diff --git a/src/main/python/ayab/firmware_flash.py b/src/main/python/ayab/firmware_flash.py index f3bd91c9..320fc198 100644 --- a/src/main/python/ayab/firmware_flash.py +++ b/src/main/python/ayab/firmware_flash.py @@ -19,7 +19,7 @@ from PyQt5 import QtGui, QtWidgets from PyQt5.QtCore import QSettings, QCoreApplication -from PyQt5.QtWidgets import QFrame, QListWidgetItem +from PyQt5.QtWidgets import QDialog, QListWidgetItem import serial import json @@ -33,8 +33,10 @@ from .firmware_flash_gui import Ui_Firmware from . import utils +# press Esc to Quit dialog +# press Return to Flash firmware -class FirmwareFlash(QFrame): +class FirmwareFlash(QDialog): # Arduino devices and their `avrdude` names device_dict = { "uno": "atmega328p", @@ -53,6 +55,7 @@ def __init__(self, parent): self.ui = Ui_Firmware() self.ui.setupUi(self) self.ui.flash_firmware.setEnabled(False) + self.ui.flash_firmware.setDefault(True) self.load_json() self.ui.port_combo_box.currentIndexChanged.connect(self.port_selected) @@ -67,6 +70,12 @@ def open(self): self.port_selected() self.show() + def close(self): + """Close dialog and clean firmware list.""" + #self.clean_controller_list() + self.clean_firmware_list() + self.accept() + def load_json(self): self.json_object = self.parse_json("") self.add_items_from_json_object() @@ -158,6 +167,7 @@ def execute_flash_command(self): self.__logger.info("Flashing done!") utils.display_blocking_popup( tr_("Firmware", "Flashing done!")) + self.close() return True def generate_command(self, base_dir, os_name, controller_name, diff --git a/src/main/python/ayab/firmware_flash_gui.ui b/src/main/python/ayab/firmware_flash_gui.ui index 6cfce734..2034ee37 100644 --- a/src/main/python/ayab/firmware_flash_gui.ui +++ b/src/main/python/ayab/firmware_flash_gui.ui @@ -1,7 +1,7 @@ Firmware - + 0 @@ -13,11 +13,8 @@ Firmware Flashing Utility - - QFrame::StyledPanel - - - QFrame::Raised + + True @@ -78,6 +75,9 @@ p, li { white-space: pre-wrap; } Flash + + False +