[supervision] Set custom icons, and change shortcut for clean. (#3049)

* [supervision] Set custom icons, and change shortcut for clean.

* [supervision] Add control panel selector.

* [supervision] remember last target built.

* [supervision] refresh AC before build.
This commit is contained in:
Fabien-B
2023-08-25 13:21:07 +02:00
committed by GitHub
parent 78f117b902
commit ee01f2720b
48 changed files with 1365 additions and 183 deletions
+5 -2
View File
@@ -9,11 +9,14 @@ OBJECTS = $(patsubst $(SOURCEDIR)/%.ui,$(BUILDDIR)/%.py,$(SOURCES))
CC = pyuic5 CC = pyuic5
all: $(BUILDDIR) $(OBJECTS) all: $(BUILDDIR) $(OBJECTS) resources
$(OBJECTS): $(BUILDDIR)/%.py : $(SOURCEDIR)/%.ui $(OBJECTS): $(BUILDDIR)/%.py : $(SOURCEDIR)/%.ui
$(CC) -o $@ $<; $(CC) --import-from=generated -o $@ $<;
resources:
pyrcc5 $(SOURCEDIR)/resources.qrc -o $(BUILDDIR)/resources_rc.py
$(BUILDDIR): $(BUILDDIR):
mkdir -p $@ mkdir -p $@
+7
View File
@@ -28,6 +28,7 @@ class FlashMode:
class BuildWidget(Ui_Build, QWidget): class BuildWidget(Ui_Build, QWidget):
spawn_program = QtCore.pyqtSignal(str, list, str, object) spawn_program = QtCore.pyqtSignal(str, list, str, object)
refresh_ac = QtCore.pyqtSignal(object)
def __init__(self, parent=None): def __init__(self, parent=None):
QWidget.__init__(self, parent=parent) QWidget.__init__(self, parent=parent)
@@ -73,6 +74,9 @@ class BuildWidget(Ui_Build, QWidget):
for target in ac.boards.keys(): for target in ac.boards.keys():
self.target_combo.addItem(target) self.target_combo.addItem(target)
last_target = utils.get_settings().value("ui/last_target", None, str)
if last_target is not None and last_target in ac.boards.keys():
self.target_combo.setCurrentText(last_target)
def update_flash_mode(self, target): def update_flash_mode(self, target):
self.device_combo.clear() self.device_combo.clear()
@@ -92,8 +96,11 @@ class BuildWidget(Ui_Build, QWidget):
if self.print_config_checkbox.isChecked(): if self.print_config_checkbox.isChecked():
cmd.append("PRINT_CONFIG=1") cmd.append("PRINT_CONFIG=1")
shortname = "Build {}".format(self.ac.name) shortname = "Build {}".format(self.ac.name)
self.refresh_ac.emit(self.ac)
self.conf.save(False) self.conf.save(False)
self.target_combo.setCurrentText(target)
self.enable_buttons(False) self.enable_buttons(False)
utils.get_settings().setValue("ui/last_target", target)
self.spawn_program.emit(shortname, cmd, None, lambda: self.enable_buttons(True)) self.spawn_program.emit(shortname, cmd, None, lambda: self.enable_buttons(True))
def clean(self): def clean(self):
File diff suppressed because it is too large Load Diff
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_app_settings.ui' # Form implementation generated from reading ui file 'ui/ui_app_settings.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.9
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -50,8 +51,8 @@ class Ui_AppSettingsDialog(object):
self.gridLayout.addWidget(self.keep_build_programs_checkbox, 3, 1, 1, 1) self.gridLayout.addWidget(self.keep_build_programs_checkbox, 3, 1, 1, 1)
self.retranslateUi(AppSettingsDialog) self.retranslateUi(AppSettingsDialog)
self.buttonBox.accepted.connect(AppSettingsDialog.accept) self.buttonBox.accepted.connect(AppSettingsDialog.accept) # type: ignore
self.buttonBox.rejected.connect(AppSettingsDialog.reject) self.buttonBox.rejected.connect(AppSettingsDialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(AppSettingsDialog) QtCore.QMetaObject.connectSlotsByName(AppSettingsDialog)
def retranslateUi(self, AppSettingsDialog): def retranslateUi(self, AppSettingsDialog):
+14 -9
View File
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_build.ui' # Form implementation generated from reading ui file 'ui/ui_build.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.6
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -13,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Build(object): class Ui_Build(object):
def setupUi(self, Build): def setupUi(self, Build):
Build.setObjectName("Build") Build.setObjectName("Build")
Build.resize(437, 87) Build.resize(464, 87)
self.horizontalLayout = QtWidgets.QHBoxLayout(Build) self.horizontalLayout = QtWidgets.QHBoxLayout(Build)
self.horizontalLayout.setObjectName("horizontalLayout") self.horizontalLayout.setObjectName("horizontalLayout")
self.groupBox = QtWidgets.QGroupBox(Build) self.groupBox = QtWidgets.QGroupBox(Build)
@@ -34,13 +35,15 @@ class Ui_Build(object):
self.target_combo.setObjectName("target_combo") self.target_combo.setObjectName("target_combo")
self.horizontalLayout_2.addWidget(self.target_combo) self.horizontalLayout_2.addWidget(self.target_combo)
self.clean_button = QtWidgets.QToolButton(self.groupBox) self.clean_button = QtWidgets.QToolButton(self.groupBox)
icon = QtGui.QIcon.fromTheme("edit-clear") icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/icons/clean.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.clean_button.setIcon(icon) self.clean_button.setIcon(icon)
self.clean_button.setObjectName("clean_button") self.clean_button.setObjectName("clean_button")
self.horizontalLayout_2.addWidget(self.clean_button) self.horizontalLayout_2.addWidget(self.clean_button)
self.build_button = QtWidgets.QToolButton(self.groupBox) self.build_button = QtWidgets.QToolButton(self.groupBox)
icon = QtGui.QIcon.fromTheme("system-run") icon1 = QtGui.QIcon()
self.build_button.setIcon(icon) icon1.addPixmap(QtGui.QPixmap(":/icons/icons/build.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.build_button.setIcon(icon1)
self.build_button.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self.build_button.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
self.build_button.setObjectName("build_button") self.build_button.setObjectName("build_button")
self.horizontalLayout_2.addWidget(self.build_button) self.horizontalLayout_2.addWidget(self.build_button)
@@ -70,8 +73,9 @@ class Ui_Build(object):
self.device_combo.setObjectName("device_combo") self.device_combo.setObjectName("device_combo")
self.horizontalLayout_3.addWidget(self.device_combo) self.horizontalLayout_3.addWidget(self.device_combo)
self.flash_button = QtWidgets.QToolButton(self.groupBox_2) self.flash_button = QtWidgets.QToolButton(self.groupBox_2)
icon = QtGui.QIcon.fromTheme("emblem-downloads") icon2 = QtGui.QIcon()
self.flash_button.setIcon(icon) icon2.addPixmap(QtGui.QPixmap(":/icons/icons/flash.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.flash_button.setIcon(icon2)
self.flash_button.setObjectName("flash_button") self.flash_button.setObjectName("flash_button")
self.horizontalLayout_3.addWidget(self.flash_button) self.horizontalLayout_3.addWidget(self.flash_button)
self.horizontalLayout.addWidget(self.groupBox_2) self.horizontalLayout.addWidget(self.groupBox_2)
@@ -86,7 +90,7 @@ class Ui_Build(object):
self.label_14.setText(_translate("Build", "Target")) self.label_14.setText(_translate("Build", "Target"))
self.clean_button.setToolTip(_translate("Build", "Clean")) self.clean_button.setToolTip(_translate("Build", "Clean"))
self.clean_button.setText(_translate("Build", "...")) self.clean_button.setText(_translate("Build", "..."))
self.clean_button.setShortcut(_translate("Build", "Ctrl+C")) self.clean_button.setShortcut(_translate("Build", "Ctrl+Shift+B"))
self.build_button.setToolTip(_translate("Build", "Build")) self.build_button.setToolTip(_translate("Build", "Build"))
self.build_button.setText(_translate("Build", "...")) self.build_button.setText(_translate("Build", "..."))
self.build_button.setShortcut(_translate("Build", "Ctrl+B")) self.build_button.setShortcut(_translate("Build", "Ctrl+B"))
@@ -96,3 +100,4 @@ class Ui_Build(object):
self.flash_button.setToolTip(_translate("Build", "Upload")) self.flash_button.setToolTip(_translate("Build", "Upload"))
self.flash_button.setText(_translate("Build", "Flash")) self.flash_button.setText(_translate("Build", "Flash"))
self.flash_button.setShortcut(_translate("Build", "Ctrl+U")) self.flash_button.setShortcut(_translate("Build", "Ctrl+U"))
from generated import resources_rc
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_conf_header.ui' # Form implementation generated from reading ui file 'ui/ui_conf_header.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.6
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -37,18 +38,21 @@ class Ui_ConfHeader(object):
self.menu_button = QtWidgets.QToolButton(ConfHeader) self.menu_button = QtWidgets.QToolButton(ConfHeader)
self.menu_button.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.menu_button.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.menu_button.setText("") self.menu_button.setText("")
icon = QtGui.QIcon.fromTheme("format-justify-fill") icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/icons/menu.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.menu_button.setIcon(icon) self.menu_button.setIcon(icon)
self.menu_button.setObjectName("menu_button") self.menu_button.setObjectName("menu_button")
self.horizontalLayout.addWidget(self.menu_button) self.horizontalLayout.addWidget(self.menu_button)
self.refresh_button = QtWidgets.QToolButton(ConfHeader) self.refresh_button = QtWidgets.QToolButton(ConfHeader)
icon = QtGui.QIcon.fromTheme("view-refresh") icon1 = QtGui.QIcon()
self.refresh_button.setIcon(icon) icon1.addPixmap(QtGui.QPixmap(":/icons/icons/refresh.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.refresh_button.setIcon(icon1)
self.refresh_button.setObjectName("refresh_button") self.refresh_button.setObjectName("refresh_button")
self.horizontalLayout.addWidget(self.refresh_button) self.horizontalLayout.addWidget(self.refresh_button)
self.save_button = QtWidgets.QToolButton(ConfHeader) self.save_button = QtWidgets.QToolButton(ConfHeader)
icon = QtGui.QIcon.fromTheme("document-save") icon2 = QtGui.QIcon()
self.save_button.setIcon(icon) icon2.addPixmap(QtGui.QPixmap(":/icons/icons/save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.save_button.setIcon(icon2)
self.save_button.setObjectName("save_button") self.save_button.setObjectName("save_button")
self.horizontalLayout.addWidget(self.save_button) self.horizontalLayout.addWidget(self.save_button)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
@@ -64,20 +68,23 @@ class Ui_ConfHeader(object):
self.new_ac_action.setIcon(icon) self.new_ac_action.setIcon(icon)
self.new_ac_action.setObjectName("new_ac_action") self.new_ac_action.setObjectName("new_ac_action")
self.remove_ac_action = QtWidgets.QAction(ConfHeader) self.remove_ac_action = QtWidgets.QAction(ConfHeader)
icon = QtGui.QIcon.fromTheme("edit-delete") icon3 = QtGui.QIcon()
self.remove_ac_action.setIcon(icon) icon3.addPixmap(QtGui.QPixmap(":/icons/icons/delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.remove_ac_action.setIcon(icon3)
self.remove_ac_action.setObjectName("remove_ac_action") self.remove_ac_action.setObjectName("remove_ac_action")
self.duplicate_action = QtWidgets.QAction(ConfHeader) self.duplicate_action = QtWidgets.QAction(ConfHeader)
icon = QtGui.QIcon.fromTheme("edit-copy") icon4 = QtGui.QIcon()
self.duplicate_action.setIcon(icon) icon4.addPixmap(QtGui.QPixmap(":/icons/icons/copy.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.duplicate_action.setIcon(icon4)
self.duplicate_action.setObjectName("duplicate_action") self.duplicate_action.setObjectName("duplicate_action")
self.rename_action = QtWidgets.QAction(ConfHeader) self.rename_action = QtWidgets.QAction(ConfHeader)
icon = QtGui.QIcon.fromTheme("format-text-italic") icon5 = QtGui.QIcon()
self.rename_action.setIcon(icon) icon5.addPixmap(QtGui.QPixmap(":/icons/icons/edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.rename_action.setIcon(icon5)
self.rename_action.setObjectName("rename_action") self.rename_action.setObjectName("rename_action")
self.retranslateUi(ConfHeader) self.retranslateUi(ConfHeader)
self.menu_button.clicked.connect(self.menu_button.showMenu) self.menu_button.clicked.connect(self.menu_button.showMenu) # type: ignore
QtCore.QMetaObject.connectSlotsByName(ConfHeader) QtCore.QMetaObject.connectSlotsByName(ConfHeader)
def retranslateUi(self, ConfHeader): def retranslateUi(self, ConfHeader):
@@ -94,3 +101,4 @@ class Ui_ConfHeader(object):
self.remove_ac_action.setText(_translate("ConfHeader", "Remove")) self.remove_ac_action.setText(_translate("ConfHeader", "Remove"))
self.duplicate_action.setText(_translate("ConfHeader", "Duplicate")) self.duplicate_action.setText(_translate("ConfHeader", "Duplicate"))
self.rename_action.setText(_translate("ConfHeader", "Rename")) self.rename_action.setText(_translate("ConfHeader", "Rename"))
from generated import resources_rc
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_conf_item.ui' # Form implementation generated from reading ui file 'ui/ui_conf_item.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.9
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_conf_settings.ui' # Form implementation generated from reading ui file 'ui/ui_conf_settings.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.6
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -23,13 +24,15 @@ class Ui_SettingsConf(object):
self.label.setObjectName("label") self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label) self.horizontalLayout.addWidget(self.label)
self.add_setting_button = QtWidgets.QToolButton(SettingsConf) self.add_setting_button = QtWidgets.QToolButton(SettingsConf)
icon = QtGui.QIcon.fromTheme("list-add") icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/icons/add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.add_setting_button.setIcon(icon) self.add_setting_button.setIcon(icon)
self.add_setting_button.setObjectName("add_setting_button") self.add_setting_button.setObjectName("add_setting_button")
self.horizontalLayout.addWidget(self.add_setting_button) self.horizontalLayout.addWidget(self.add_setting_button)
self.remove_setting_button = QtWidgets.QToolButton(SettingsConf) self.remove_setting_button = QtWidgets.QToolButton(SettingsConf)
icon = QtGui.QIcon.fromTheme("list-remove") icon1 = QtGui.QIcon()
self.remove_setting_button.setIcon(icon) icon1.addPixmap(QtGui.QPixmap(":/icons/icons/remove.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.remove_setting_button.setIcon(icon1)
self.remove_setting_button.setObjectName("remove_setting_button") self.remove_setting_button.setObjectName("remove_setting_button")
self.horizontalLayout.addWidget(self.remove_setting_button) self.horizontalLayout.addWidget(self.remove_setting_button)
self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.addLayout(self.horizontalLayout)
@@ -46,3 +49,4 @@ class Ui_SettingsConf(object):
self.label.setText(_translate("SettingsConf", "Settings")) self.label.setText(_translate("SettingsConf", "Settings"))
self.add_setting_button.setText(_translate("SettingsConf", "...")) self.add_setting_button.setText(_translate("SettingsConf", "..."))
self.remove_setting_button.setText(_translate("SettingsConf", "...")) self.remove_setting_button.setText(_translate("SettingsConf", "..."))
from generated import resources_rc
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_configuration_panel.ui' # Form implementation generated from reading ui file 'ui/ui_configuration_panel.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.9
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_console.ui' # Form implementation generated from reading ui file 'ui/ui_console.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.6
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -43,7 +44,7 @@ class Ui_Console(object):
self.scrollArea.setWidgetResizable(True) self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea") self.scrollArea.setObjectName("scrollArea")
self.programs_widget = QtWidgets.QWidget() self.programs_widget = QtWidgets.QWidget()
self.programs_widget.setGeometry(QtCore.QRect(0, 0, 382, 524)) self.programs_widget.setGeometry(QtCore.QRect(0, 0, 180, 525))
self.programs_widget.setObjectName("programs_widget") self.programs_widget.setObjectName("programs_widget")
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.programs_widget) self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.programs_widget)
self.verticalLayout_4.setObjectName("verticalLayout_4") self.verticalLayout_4.setObjectName("verticalLayout_4")
@@ -78,7 +79,8 @@ class Ui_Console(object):
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1) self.horizontalLayout_2.addItem(spacerItem1)
self.clear_button = QtWidgets.QPushButton(Console) self.clear_button = QtWidgets.QPushButton(Console)
icon = QtGui.QIcon.fromTheme("edit-clear") icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/icons/clear.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.clear_button.setIcon(icon) self.clear_button.setIcon(icon)
self.clear_button.setObjectName("clear_button") self.clear_button.setObjectName("clear_button")
self.horizontalLayout_2.addWidget(self.clear_button) self.horizontalLayout_2.addWidget(self.clear_button)
@@ -98,3 +100,4 @@ class Ui_Console(object):
self.label_3.setText(_translate("Console", "Log level:")) self.label_3.setText(_translate("Console", "Log level:"))
self.log_level_label.setText(_translate("Console", "All")) self.log_level_label.setText(_translate("Console", "All"))
self.clear_button.setText(_translate("Console", "Clear console")) self.clear_button.setText(_translate("Console", "Clear console"))
from generated import resources_rc
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_doc_viewer.ui' # Form implementation generated from reading ui file 'ui/ui_doc_viewer.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.6
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -106,7 +107,8 @@ class Ui_DocPanel(object):
self.urlLineEdit.setObjectName("urlLineEdit") self.urlLineEdit.setObjectName("urlLineEdit")
self.horizontalLayout.addWidget(self.urlLineEdit) self.horizontalLayout.addWidget(self.urlLineEdit)
self.open_browser_button = QtWidgets.QToolButton(self.layoutWidget3) self.open_browser_button = QtWidgets.QToolButton(self.layoutWidget3)
icon = QtGui.QIcon.fromTheme("applications-internet") icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/icons/browser.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.open_browser_button.setIcon(icon) self.open_browser_button.setIcon(icon)
self.open_browser_button.setObjectName("open_browser_button") self.open_browser_button.setObjectName("open_browser_button")
self.horizontalLayout.addWidget(self.open_browser_button) self.horizontalLayout.addWidget(self.open_browser_button)
@@ -140,3 +142,4 @@ class Ui_DocPanel(object):
self.doc_source_combo.setItemText(0, _translate("DocPanel", "Internet")) self.doc_source_combo.setItemText(0, _translate("DocPanel", "Internet"))
self.doc_source_combo.setItemText(1, _translate("DocPanel", "Local")) self.doc_source_combo.setItemText(1, _translate("DocPanel", "Local"))
from PyQt5 import QtWebKitWidgets from PyQt5 import QtWebKitWidgets
from generated import resources_rc
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_new_ac_dialog.ui' # Form implementation generated from reading ui file 'ui/ui_new_ac_dialog.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.9
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_operation_panel.ui' # Form implementation generated from reading ui file 'ui/ui_operation_panel.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.9
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
+10 -6
View File
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_program.ui' # Form implementation generated from reading ui file 'ui/ui_program.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.9
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -13,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Program(object): class Ui_Program(object):
def setupUi(self, Program): def setupUi(self, Program):
Program.setObjectName("Program") Program.setObjectName("Program")
Program.resize(374, 25) Program.resize(374, 32)
self.horizontalLayout = QtWidgets.QHBoxLayout(Program) self.horizontalLayout = QtWidgets.QHBoxLayout(Program)
self.horizontalLayout.setContentsMargins(-1, 0, -1, 0) self.horizontalLayout.setContentsMargins(-1, 0, -1, 0)
self.horizontalLayout.setObjectName("horizontalLayout") self.horizontalLayout.setObjectName("horizontalLayout")
@@ -29,13 +30,15 @@ class Ui_Program(object):
self.line.setObjectName("line") self.line.setObjectName("line")
self.horizontalLayout.addWidget(self.line) self.horizontalLayout.addWidget(self.line)
self.run_button = QtWidgets.QToolButton(Program) self.run_button = QtWidgets.QToolButton(Program)
icon = QtGui.QIcon.fromTheme("media-playback-stop") icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/icons/stop.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.run_button.setIcon(icon) self.run_button.setIcon(icon)
self.run_button.setObjectName("run_button") self.run_button.setObjectName("run_button")
self.horizontalLayout.addWidget(self.run_button) self.horizontalLayout.addWidget(self.run_button)
self.remove_button = QtWidgets.QToolButton(Program) self.remove_button = QtWidgets.QToolButton(Program)
icon = QtGui.QIcon.fromTheme("list-remove") icon1 = QtGui.QIcon()
self.remove_button.setIcon(icon) icon1.addPixmap(QtGui.QPixmap(":/icons/icons/remove.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.remove_button.setIcon(icon1)
self.remove_button.setObjectName("remove_button") self.remove_button.setObjectName("remove_button")
self.horizontalLayout.addWidget(self.remove_button) self.horizontalLayout.addWidget(self.remove_button)
@@ -48,3 +51,4 @@ class Ui_Program(object):
self.icon_label.setText(_translate("Program", "...")) self.icon_label.setText(_translate("Program", "..."))
self.run_button.setText(_translate("Program", "...")) self.run_button.setText(_translate("Program", "..."))
self.remove_button.setText(_translate("Program", "...")) self.remove_button.setText(_translate("Program", "..."))
from generated import resources_rc
+52 -31
View File
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_session.ui' # Form implementation generated from reading ui file 'ui/ui_session.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.6
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -16,25 +17,38 @@ class Ui_Session(object):
Session.resize(400, 300) Session.resize(400, 300)
self.verticalLayout = QtWidgets.QVBoxLayout(Session) self.verticalLayout = QtWidgets.QVBoxLayout(Session)
self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout.setObjectName("verticalLayout")
self.label_2 = QtWidgets.QLabel(Session) self.gridLayout = QtWidgets.QGridLayout()
self.label_2.setObjectName("label_2") self.gridLayout.setObjectName("gridLayout")
self.verticalLayout.addWidget(self.label_2)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.sessions_combo = QtWidgets.QComboBox(Session)
self.sessions_combo.setObjectName("sessions_combo")
self.horizontalLayout_2.addWidget(self.sessions_combo)
self.start_session_button = QtWidgets.QToolButton(Session) self.start_session_button = QtWidgets.QToolButton(Session)
icon = QtGui.QIcon.fromTheme("media-playback-start") icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/icons/play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.start_session_button.setIcon(icon) self.start_session_button.setIcon(icon)
self.start_session_button.setObjectName("start_session_button") self.start_session_button.setObjectName("start_session_button")
self.horizontalLayout_2.addWidget(self.start_session_button) self.gridLayout.addWidget(self.start_session_button, 1, 2, 1, 1)
self.menu_button = QtWidgets.QToolButton(Session) self.menu_button = QtWidgets.QToolButton(Session)
self.menu_button.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.menu_button.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
icon = QtGui.QIcon.fromTheme("format-justify-fill") icon1 = QtGui.QIcon()
self.menu_button.setIcon(icon) icon1.addPixmap(QtGui.QPixmap(":/icons/icons/menu.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.menu_button.setIcon(icon1)
self.menu_button.setObjectName("menu_button") self.menu_button.setObjectName("menu_button")
self.horizontalLayout_2.addWidget(self.menu_button) self.gridLayout.addWidget(self.menu_button, 1, 3, 1, 1)
self.control_panel_combo = QtWidgets.QComboBox(Session)
self.control_panel_combo.setObjectName("control_panel_combo")
self.gridLayout.addWidget(self.control_panel_combo, 1, 0, 1, 1)
self.label_3 = QtWidgets.QLabel(Session)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 0, 0, 1, 1)
self.label_4 = QtWidgets.QLabel(Session)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 0, 1, 1, 1)
self.sessions_combo = QtWidgets.QComboBox(Session)
self.sessions_combo.setObjectName("sessions_combo")
self.gridLayout.addWidget(self.sessions_combo, 1, 1, 1, 1)
self.gridLayout.setColumnStretch(0, 2)
self.gridLayout.setColumnStretch(1, 3)
self.verticalLayout.addLayout(self.gridLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.verticalLayout.addLayout(self.horizontalLayout_2) self.verticalLayout.addLayout(self.horizontalLayout_2)
self.favorite_tools = QtWidgets.QWidget(Session) self.favorite_tools = QtWidgets.QWidget(Session)
self.favorite_tools.setObjectName("favorite_tools") self.favorite_tools.setObjectName("favorite_tools")
@@ -47,8 +61,9 @@ class Ui_Session(object):
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem) self.horizontalLayout.addItem(spacerItem)
self.add_tool_button = QtWidgets.QToolButton(Session) self.add_tool_button = QtWidgets.QToolButton(Session)
icon = QtGui.QIcon.fromTheme("list-add") icon2 = QtGui.QIcon()
self.add_tool_button.setIcon(icon) icon2.addPixmap(QtGui.QPixmap(":/icons/icons/add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.add_tool_button.setIcon(icon2)
self.add_tool_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.add_tool_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.add_tool_button.setAutoRaise(False) self.add_tool_button.setAutoRaise(False)
self.add_tool_button.setArrowType(QtCore.Qt.NoArrow) self.add_tool_button.setArrowType(QtCore.Qt.NoArrow)
@@ -62,18 +77,19 @@ class Ui_Session(object):
self.line.setObjectName("line") self.line.setObjectName("line")
self.horizontalLayout.addWidget(self.line) self.horizontalLayout.addWidget(self.line)
self.startall_button = QtWidgets.QToolButton(Session) self.startall_button = QtWidgets.QToolButton(Session)
icon = QtGui.QIcon.fromTheme("media-playback-start")
self.startall_button.setIcon(icon) self.startall_button.setIcon(icon)
self.startall_button.setObjectName("startall_button") self.startall_button.setObjectName("startall_button")
self.horizontalLayout.addWidget(self.startall_button) self.horizontalLayout.addWidget(self.startall_button)
self.stopall_button = QtWidgets.QToolButton(Session) self.stopall_button = QtWidgets.QToolButton(Session)
icon = QtGui.QIcon.fromTheme("media-playback-stop") icon3 = QtGui.QIcon()
self.stopall_button.setIcon(icon) icon3.addPixmap(QtGui.QPixmap(":/icons/icons/stop.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.stopall_button.setIcon(icon3)
self.stopall_button.setObjectName("stopall_button") self.stopall_button.setObjectName("stopall_button")
self.horizontalLayout.addWidget(self.stopall_button) self.horizontalLayout.addWidget(self.stopall_button)
self.removeall_button = QtWidgets.QToolButton(Session) self.removeall_button = QtWidgets.QToolButton(Session)
icon = QtGui.QIcon.fromTheme("list-remove") icon4 = QtGui.QIcon()
self.removeall_button.setIcon(icon) icon4.addPixmap(QtGui.QPixmap(":/icons/icons/remove.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.removeall_button.setIcon(icon4)
self.removeall_button.setObjectName("removeall_button") self.removeall_button.setObjectName("removeall_button")
self.horizontalLayout.addWidget(self.removeall_button) self.horizontalLayout.addWidget(self.removeall_button)
self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.addLayout(self.horizontalLayout)
@@ -81,7 +97,7 @@ class Ui_Session(object):
self.scrollArea.setWidgetResizable(True) self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea") self.scrollArea.setObjectName("scrollArea")
self.programs_widget = QtWidgets.QWidget() self.programs_widget = QtWidgets.QWidget()
self.programs_widget.setGeometry(QtCore.QRect(0, 0, 380, 176)) self.programs_widget.setGeometry(QtCore.QRect(0, 0, 384, 154))
self.programs_widget.setObjectName("programs_widget") self.programs_widget.setObjectName("programs_widget")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.programs_widget) self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.programs_widget)
self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout_2.setObjectName("verticalLayout_2")
@@ -90,33 +106,37 @@ class Ui_Session(object):
self.scrollArea.setWidget(self.programs_widget) self.scrollArea.setWidget(self.programs_widget)
self.verticalLayout.addWidget(self.scrollArea) self.verticalLayout.addWidget(self.scrollArea)
self.save_session_action = QtWidgets.QAction(Session) self.save_session_action = QtWidgets.QAction(Session)
icon = QtGui.QIcon.fromTheme("document-save") icon5 = QtGui.QIcon()
self.save_session_action.setIcon(icon) icon5.addPixmap(QtGui.QPixmap(":/icons/icons/save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.save_session_action.setIcon(icon5)
self.save_session_action.setObjectName("save_session_action") self.save_session_action.setObjectName("save_session_action")
self.save_as_action = QtWidgets.QAction(Session) self.save_as_action = QtWidgets.QAction(Session)
icon = QtGui.QIcon.fromTheme("edit-copy") icon = QtGui.QIcon.fromTheme("edit-copy")
self.save_as_action.setIcon(icon) self.save_as_action.setIcon(icon)
self.save_as_action.setObjectName("save_as_action") self.save_as_action.setObjectName("save_as_action")
self.rename_session_action = QtWidgets.QAction(Session) self.rename_session_action = QtWidgets.QAction(Session)
icon = QtGui.QIcon.fromTheme("format-text-italic") icon6 = QtGui.QIcon()
self.rename_session_action.setIcon(icon) icon6.addPixmap(QtGui.QPixmap(":/icons/icons/copy.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.rename_session_action.setIcon(icon6)
self.rename_session_action.setObjectName("rename_session_action") self.rename_session_action.setObjectName("rename_session_action")
self.remove_session_action = QtWidgets.QAction(Session) self.remove_session_action = QtWidgets.QAction(Session)
icon = QtGui.QIcon.fromTheme("edit-delete") icon7 = QtGui.QIcon()
self.remove_session_action.setIcon(icon) icon7.addPixmap(QtGui.QPixmap(":/icons/icons/delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.remove_session_action.setIcon(icon7)
self.remove_session_action.setObjectName("remove_session_action") self.remove_session_action.setObjectName("remove_session_action")
self.retranslateUi(Session) self.retranslateUi(Session)
self.menu_button.clicked.connect(self.menu_button.showMenu) self.menu_button.clicked.connect(self.menu_button.showMenu) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Session) QtCore.QMetaObject.connectSlotsByName(Session)
def retranslateUi(self, Session): def retranslateUi(self, Session):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
Session.setWindowTitle(_translate("Session", "Form")) Session.setWindowTitle(_translate("Session", "Form"))
self.label_2.setText(_translate("Session", "Session"))
self.start_session_button.setToolTip(_translate("Session", "Start Session")) self.start_session_button.setToolTip(_translate("Session", "Start Session"))
self.start_session_button.setText(_translate("Session", "...")) self.start_session_button.setText(_translate("Session", "..."))
self.menu_button.setText(_translate("Session", "...")) self.menu_button.setText(_translate("Session", "..."))
self.label_3.setText(_translate("Session", "control panel"))
self.label_4.setText(_translate("Session", "Session"))
self.label.setText(_translate("Session", "Programs")) self.label.setText(_translate("Session", "Programs"))
self.add_tool_button.setToolTip(_translate("Session", "Add Tool")) self.add_tool_button.setToolTip(_translate("Session", "Add Tool"))
self.add_tool_button.setText(_translate("Session", "Add tool")) self.add_tool_button.setText(_translate("Session", "Add tool"))
@@ -131,3 +151,4 @@ class Ui_Session(object):
self.save_as_action.setToolTip(_translate("Session", "Save session as...")) self.save_as_action.setToolTip(_translate("Session", "Save session as..."))
self.rename_session_action.setText(_translate("Session", "Rename session")) self.rename_session_action.setText(_translate("Session", "Rename session"))
self.remove_session_action.setText(_translate("Session", "Remove session")) self.remove_session_action.setText(_translate("Session", "Remove session"))
from generated import resources_rc
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_supervision_window.ui' # Form implementation generated from reading ui file 'ui/ui_supervision_window.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.9
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@@ -2,9 +2,10 @@
# Form implementation generated from reading ui file 'ui/ui_tools_list.ui' # Form implementation generated from reading ui file 'ui/ui_tools_list.ui'
# #
# Created by: PyQt5 UI code generator 5.14.1 # Created by: PyQt5 UI code generator 5.15.9
# #
# WARNING! All changes made in this file will be lost! # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
-2
View File
@@ -7,8 +7,6 @@ from conf import Aircraft, Conf
import utils import utils
import os import os
import sys import sys
lib_path = os.path.normpath(os.path.join(utils.PAPARAZZI_SRC, 'sw', 'lib', 'python'))
sys.path.append(lib_path)
import paparazzi import paparazzi
from typing import List from typing import List
+11 -3
View File
@@ -3,11 +3,16 @@
# released under GNU GPLv2 or later. See COPYING file. # released under GNU GPLv2 or later. See COPYING file.
import os import os
import sys import sys
import utils
lib_path = os.path.normpath(os.path.join(utils.PAPARAZZI_SRC, 'sw', 'lib', 'python'))
sys.path.append(lib_path)
import signal import signal
import copy import copy
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
from PyQt5 import QtCore, QtGui from PyQt5 import QtCore, QtGui
import utils
from lxml import etree as ET from lxml import etree as ET
from conf import Conf, Aircraft, ConfError from conf import Conf, Aircraft, ConfError
from app_settings import AppSettings from app_settings import AppSettings
@@ -15,12 +20,13 @@ from generated.ui_supervision_window import Ui_SupervisionWindow
from generated.ui_new_ac_dialog import Ui_NewACDialog from generated.ui_new_ac_dialog import Ui_NewACDialog
from program_widget import TabProgramsState from program_widget import TabProgramsState
dirname = os.path.dirname(os.path.abspath(__file__)) dirname = os.path.dirname(os.path.abspath(__file__))
TAB_ICONS = {TabProgramsState.IDLE: QtGui.QIcon(), TAB_ICONS = {TabProgramsState.IDLE: QtGui.QIcon(),
TabProgramsState.RUNNING: QtGui.QIcon(os.path.join(dirname, "running.svg")), TabProgramsState.RUNNING: QtGui.QIcon(":/icons/icons/running.svg"),
TabProgramsState.ERROR: QtGui.QIcon(os.path.join(dirname, "error.svg"))} TabProgramsState.ERROR: QtGui.QIcon(":/icons/icons/error.svg")}
class PprzCenter(QMainWindow, Ui_SupervisionWindow): class PprzCenter(QMainWindow, Ui_SupervisionWindow):
@@ -48,6 +54,7 @@ class PprzCenter(QMainWindow, Ui_SupervisionWindow):
self.header.ac_save.connect(lambda _: self.conf.save()) self.header.ac_save.connect(lambda _: self.conf.save())
self.header.ac_new.connect(self.handle_new_ac) self.header.ac_new.connect(self.handle_new_ac)
self.configuration_panel.build_widget.refresh_ac.connect(self.handle_ac_edited)
self.configuration_panel.program_state_changed.connect(lambda state: self.programs_state_changed(state, 0)) self.configuration_panel.program_state_changed.connect(lambda state: self.programs_state_changed(state, 0))
self.operation_panel.session.program_state_changed.connect(lambda state: self.programs_state_changed(state, 1)) self.operation_panel.session.program_state_changed.connect(lambda state: self.programs_state_changed(state, 1))
@@ -259,6 +266,7 @@ class PprzCenter(QMainWindow, Ui_SupervisionWindow):
settings.setValue("ui/window_size", self.size()) settings.setValue("ui/window_size", self.size())
settings.setValue("ui/last_AC", self.currentAc.name) settings.setValue("ui/last_AC", self.currentAc.name)
settings.setValue("ui/last_session", self.operation_panel.session.get_current_session()) settings.setValue("ui/last_session", self.operation_panel.session.get_current_session())
settings.setValue("ui/last_control_panel", self.operation_panel.session.get_current_control_panel())
def update_left_pane_width(self, pos, index): def update_left_pane_width(self, pos, index):
utils.get_settings().setValue("ui/left_pane_width", pos) utils.get_settings().setValue("ui/left_pane_width", pos)
+2 -4
View File
@@ -73,15 +73,13 @@ class ProgramWidget(QWidget, Ui_Program):
self.process.terminate() self.process.terminate()
def handle_started(self): def handle_started(self):
icon = QIcon.fromTheme("media-playback-stop") self.run_button.setIcon(QIcon(":/icons/icons/stop.png"))
self.run_button.setIcon(icon)
self.program_lineedit.setReadOnly(True) self.program_lineedit.setReadOnly(True)
def handle_finished(self, exit_code: int, exit_status: QProcess.ExitStatus): def handle_finished(self, exit_code: int, exit_status: QProcess.ExitStatus):
if exit_code not in (0, 15): if exit_code not in (0, 15):
self.program_lineedit.setStyleSheet("background: #f56464") self.program_lineedit.setStyleSheet("background: #f56464")
icon = QIcon.fromTheme("media-playback-start") self.run_button.setIcon(QIcon(":/icons/icons/play.png"))
self.run_button.setIcon(icon)
self.program_lineedit.setReadOnly(False) self.program_lineedit.setReadOnly(False)
self.finished.emit(exit_code, exit_status) self.finished.emit(exit_code, exit_status)
+4 -4
View File
@@ -100,7 +100,7 @@ class Tool:
return name, Tool(name, command, icon, args, favorite) return name, Tool(name, command, icon, args, favorite)
def parse_tools() -> Dict[str, Tool]: def parse_tools(cp) -> Dict[str, Tool]:
tools = {} tools = {}
tools_dir = os.path.join(utils.CONF_DIR, "tools") tools_dir = os.path.join(utils.CONF_DIR, "tools")
for file in os.listdir(tools_dir): for file in os.listdir(tools_dir):
@@ -115,7 +115,7 @@ def parse_tools() -> Dict[str, Tool]:
# programs from control_panel.xml # programs from control_panel.xml
# override programs from conf/tools/*.xml # override programs from conf/tools/*.xml
control_panel = ET.parse(os.path.join(utils.CONF_DIR, "control_panel.xml")) control_panel = ET.parse(os.path.join(utils.CONF_DIR, cp))
for xml_section in control_panel.getroot().findall("section"): for xml_section in control_panel.getroot().findall("section"):
if xml_section.get("name") == "programs": if xml_section.get("name") == "programs":
for xml_program in xml_section.findall("program"): for xml_program in xml_section.findall("program"):
@@ -125,8 +125,8 @@ def parse_tools() -> Dict[str, Tool]:
return tools return tools
def parse_sessions() -> List[Session]: def parse_sessions(cp) -> List[Session]:
control_panel = ET.parse(os.path.join(utils.CONF_DIR, "control_panel.xml")) control_panel = ET.parse(os.path.join(utils.CONF_DIR, cp))
for xml_section in control_panel.getroot().findall("section"): for xml_section in control_panel.getroot().findall("section"):
if xml_section.get("name") == "sessions": if xml_section.get("name") == "sessions":
return [Session.parse(xml_session) for xml_session in xml_section.findall("session")] return [Session.parse(xml_session) for xml_session in xml_section.findall("session")]
+27 -7
View File
@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import *
from PyQt5 import QtCore from PyQt5 import QtCore
import utils import utils
import lxml.etree as ET import lxml.etree as ET
import paparazzi
from typing import List, Optional, Tuple, Dict from typing import List, Optional, Tuple, Dict
from program_widget import ProgramWidget, TabProgramsState from program_widget import ProgramWidget, TabProgramsState
from tools_menu import ToolMenu from tools_menu import ToolMenu
@@ -30,11 +30,10 @@ class SessionWidget(QWidget, Ui_Session):
self.console: ConsoleWidget = None self.console: ConsoleWidget = None
self.ac: Aircraft = None self.ac: Aircraft = None
self.sessions = [] self.sessions = []
self.tools = [] self.tools: Dict[str, Tool] = {}
self.tools_menu = ToolMenu() self.tools_menu = ToolMenu()
self.sessions_combo.addItems(["Simulation", "Replay"])
self.sessions_combo.insertSeparator(2)
self.programs_state: TabProgramsState = TabProgramsState.IDLE self.programs_state: TabProgramsState = TabProgramsState.IDLE
self.control_panel_combo.currentTextChanged.connect(self.on_control_panel_changed)
self.menu_button.addAction(self.save_session_action) self.menu_button.addAction(self.save_session_action)
self.menu_button.addAction(self.save_as_action) self.menu_button.addAction(self.save_as_action)
self.menu_button.addAction(self.rename_session_action) self.menu_button.addAction(self.rename_session_action)
@@ -57,14 +56,31 @@ class SessionWidget(QWidget, Ui_Session):
self.ac = ac self.ac = ac
def init(self): def init(self):
self.sessions = parse_sessions() self.update_control_panels()
self.tools = parse_tools() self.on_control_panel_changed()
def on_control_panel_changed(self):
current_cp = self.control_panel_combo.currentText()
self.sessions = parse_sessions(current_cp)
self.tools = parse_tools(current_cp)
self.init_tools_menu() self.init_tools_menu()
sessions_names = [session.name for session in self.sessions] sessions_names = [session.name for session in self.sessions]
self.sessions_combo.clear()
self.sessions_combo.addItems(["Simulation", "Replay"])
self.sessions_combo.insertSeparator(2)
self.sessions_combo.addItems(sessions_names) self.sessions_combo.addItems(sessions_names)
last_session = utils.get_settings().value("ui/last_session", None, str) last_session = utils.get_settings().value("ui/last_session", None, str)
if last_session is not None: if last_session is not None and last_session in sessions_names:
self.sessions_combo.setCurrentText(last_session) self.sessions_combo.setCurrentText(last_session)
else:
self.sessions_combo.setCurrentIndex(0)
def update_control_panels(self):
cpfs = paparazzi.get_list_of_controlpanel_files()
self.control_panel_combo.addItems(cpfs)
last_cp = utils.get_settings().value("ui/last_control_panel", None, str)
if last_cp is not None and last_cp in cpfs:
self.control_panel_combo.setCurrentText(last_cp)
def get_current_session(self) -> str: def get_current_session(self) -> str:
""" """
@@ -72,6 +88,9 @@ class SessionWidget(QWidget, Ui_Session):
""" """
return self.sessions_combo.currentText() return self.sessions_combo.currentText()
def get_current_control_panel(self) -> str:
return self.control_panel_combo.currentText()
def start_session(self): def start_session(self):
self.reset_programs_status() self.reset_programs_status()
combo_text = self.sessions_combo.currentText() combo_text = self.sessions_combo.currentText()
@@ -203,6 +222,7 @@ class SessionWidget(QWidget, Ui_Session):
self.reset_programs_status() self.reset_programs_status()
def init_tools_menu(self): def init_tools_menu(self):
self.tools_menu.clear()
for t in self.tools.values(): for t in self.tools.values():
self.tools_menu.add_tool(t) self.tools_menu.add_tool(t)
+5
View File
@@ -39,6 +39,11 @@ class ToolMenu(QWidget, Ui_ToolsList):
self.tools_buttons[t.name] = button self.tools_buttons[t.name] = button
self.content_widget.layout().addWidget(button) self.content_widget.layout().addWidget(button)
def clear(self):
for _name, widget in self.tools_buttons.items():
self.content_widget.layout().removeWidget(widget)
self.tools_buttons.clear()
def filter(self, txt: str): def filter(self, txt: str):
for name, button in self.tools_buttons.items(): for name, button in self.tools_buttons.items():
show = txt.lower() in name.lower() show = txt.lower() in name.lower()
Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

+21
View File
@@ -0,0 +1,21 @@
<RCC>
<qresource prefix="icons">
<file>icons/error.svg</file>
<file>icons/running.svg</file>
<file>icons/edit.png</file>
<file>icons/delete.png</file>
<file>icons/copy.png</file>
<file>icons/browser.png</file>
<file>icons/clear.png</file>
<file>icons/menu.png</file>
<file>icons/refresh.png</file>
<file>icons/save.png</file>
<file>icons/add.png</file>
<file>icons/remove.png</file>
<file>icons/stop.png</file>
<file>icons/play.png</file>
<file>icons/flash.png</file>
<file>icons/build.png</file>
<file>icons/clean.png</file>
</qresource>
</RCC>
+11 -9
View File
@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>437</width> <width>464</width>
<height>87</height> <height>87</height>
</rect> </rect>
</property> </property>
@@ -52,11 +52,11 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="edit-clear"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/clean.png</normaloff>:/icons/icons/clean.png</iconset>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+C</string> <string>Ctrl+Shift+B</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -69,8 +69,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="system-run"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/build.png</normaloff>:/icons/icons/build.png</iconset>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+B</string> <string>Ctrl+B</string>
@@ -130,8 +130,8 @@
<string>Flash</string> <string>Flash</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="emblem-downloads"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/flash.png</normaloff>:/icons/icons/flash.png</iconset>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+U</string> <string>Ctrl+U</string>
@@ -143,6 +143,8 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
+15 -13
View File
@@ -53,8 +53,8 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="format-justify-fill"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/menu.png</normaloff>:/icons/icons/menu.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -67,8 +67,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="view-refresh"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/refresh.png</normaloff>:/icons/icons/refresh.png</iconset>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+R</string> <string>Ctrl+R</string>
@@ -84,8 +84,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="document-save"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/save.png</normaloff>:/icons/icons/save.png</iconset>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+S</string> <string>Ctrl+S</string>
@@ -127,8 +127,8 @@
</action> </action>
<action name="remove_ac_action"> <action name="remove_ac_action">
<property name="icon"> <property name="icon">
<iconset theme="edit-delete"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/delete.png</normaloff>:/icons/icons/delete.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Remove</string> <string>Remove</string>
@@ -136,8 +136,8 @@
</action> </action>
<action name="duplicate_action"> <action name="duplicate_action">
<property name="icon"> <property name="icon">
<iconset theme="edit-copy"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/copy.png</normaloff>:/icons/icons/copy.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Duplicate</string> <string>Duplicate</string>
@@ -145,15 +145,17 @@
</action> </action>
<action name="rename_action"> <action name="rename_action">
<property name="icon"> <property name="icon">
<iconset theme="format-text-italic"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/edit.png</normaloff>:/icons/icons/edit.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Rename</string> <string>Rename</string>
</property> </property>
</action> </action>
</widget> </widget>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>menu_button</sender> <sender>menu_button</sender>
+7 -3
View File
@@ -32,7 +32,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="list-add"/> <iconset resource="resources.qrc">
<normaloff>:/icons/icons/add.png</normaloff>:/icons/icons/add.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -42,7 +43,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="list-remove"/> <iconset resource="resources.qrc">
<normaloff>:/icons/icons/remove.png</normaloff>:/icons/icons/remove.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -53,6 +55,8 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
+7 -5
View File
@@ -59,8 +59,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>382</width> <width>180</width>
<height>524</height> <height>525</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
@@ -154,8 +154,8 @@
<string>Clear console</string> <string>Clear console</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="edit-clear"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/clear.png</normaloff>:/icons/icons/clear.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -163,6 +163,8 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
+5 -3
View File
@@ -145,8 +145,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="applications-internet"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/browser.png</normaloff>:/icons/icons/browser.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -191,6 +191,8 @@
<header location="global">QtWebKitWidgets/QWebView</header> <header location="global">QtWebKitWidgets/QWebView</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
+8 -6
View File
@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>374</width> <width>374</width>
<height>25</height> <height>32</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -43,8 +43,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="media-playback-stop"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/stop.png</normaloff>:/icons/icons/stop.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -54,13 +54,15 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="list-remove"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/remove.png</normaloff>:/icons/icons/remove.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
+49 -34
View File
@@ -15,18 +15,8 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QLabel" name="label_2"> <layout class="QGridLayout" name="gridLayout" columnstretch="2,3,0,0">
<property name="text"> <item row="1" column="2">
<string>Session</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="sessions_combo"/>
</item>
<item>
<widget class="QToolButton" name="start_session_button"> <widget class="QToolButton" name="start_session_button">
<property name="toolTip"> <property name="toolTip">
<string>Start Session</string> <string>Start Session</string>
@@ -35,12 +25,12 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="media-playback-start"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/play.png</normaloff>:/icons/icons/play.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="3">
<widget class="QToolButton" name="menu_button"> <widget class="QToolButton" name="menu_button">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum> <enum>Qt::ActionsContextMenu</enum>
@@ -49,13 +39,36 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="format-justify-fill"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/menu.png</normaloff>:/icons/icons/menu.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QComboBox" name="control_panel_combo"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>control panel</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Session</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="sessions_combo"/>
</item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
</item>
<item> <item>
<widget class="QWidget" name="favorite_tools" native="true"/> <widget class="QWidget" name="favorite_tools" native="true"/>
</item> </item>
@@ -90,8 +103,8 @@
<string>Add tool</string> <string>Add tool</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="list-add"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/add.png</normaloff>:/icons/icons/add.png</iconset>
</property> </property>
<property name="toolButtonStyle"> <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum> <enum>Qt::ToolButtonTextBesideIcon</enum>
@@ -133,8 +146,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="media-playback-start"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/play.png</normaloff>:/icons/icons/play.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -147,8 +160,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="media-playback-stop"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/stop.png</normaloff>:/icons/icons/stop.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -161,8 +174,8 @@
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="list-remove"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/remove.png</normaloff>:/icons/icons/remove.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -178,8 +191,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>380</width> <width>384</width>
<height>176</height> <height>154</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@@ -203,8 +216,8 @@
</layout> </layout>
<action name="save_session_action"> <action name="save_session_action">
<property name="icon"> <property name="icon">
<iconset theme="document-save"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/save.png</normaloff>:/icons/icons/save.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Save session</string> <string>Save session</string>
@@ -224,8 +237,8 @@
</action> </action>
<action name="rename_session_action"> <action name="rename_session_action">
<property name="icon"> <property name="icon">
<iconset theme="format-text-italic"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/copy.png</normaloff>:/icons/icons/copy.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Rename session</string> <string>Rename session</string>
@@ -233,15 +246,17 @@
</action> </action>
<action name="remove_session_action"> <action name="remove_session_action">
<property name="icon"> <property name="icon">
<iconset theme="edit-delete"> <iconset resource="resources.qrc">
<normaloff>.</normaloff>.</iconset> <normaloff>:/icons/icons/delete.png</normaloff>:/icons/icons/delete.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Remove session</string> <string>Remove session</string>
</property> </property>
</action> </action>
</widget> </widget>
<resources/> <resources>
<include location="resources.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>menu_button</sender> <sender>menu_button</sender>