Skip to content

Commit

Permalink
change Firmware Flash dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mpr1c3 authored and dl1com committed Oct 17, 2023
1 parent 46fe4b2 commit 9f111f8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
14 changes: 12 additions & 2 deletions src/main/python/ayab/firmware_flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions src/main/python/ayab/firmware_flash_gui.ui
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Firmware</class>
<widget class="QFrame" name="FirmwareFlashFrame">
<widget class="QDialog" name="FirmwareFlashFrame">
<property name="geometry">
<rect>
<x>0</x>
Expand All @@ -13,11 +13,8 @@
<property name="windowTitle">
<string>Firmware Flashing Utility</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="modal">
<bool>True</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down Expand Up @@ -78,6 +75,9 @@ p, li { white-space: pre-wrap; }
<property name="text">
<string>Flash</string>
</property>
<property name="flat">
<bool>False</bool>
</property>
</widget>
</item>
<item>
Expand Down

0 comments on commit 9f111f8

Please sign in to comment.