diff --git a/b_asic/scheduler-gui/main_window.py b/b_asic/scheduler-gui/main_window.py index eee0b3593a9e5c8490321fd06589bd06e2ceb66c..6eed4aad716b237d8a84d15a79b9359a315a5565 100644 --- a/b_asic/scheduler-gui/main_window.py +++ b/b_asic/scheduler-gui/main_window.py @@ -138,6 +138,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.menu_save_as .triggered .connect(self.save_as) self.menu_quit .triggered .connect(self.close) self.menu_node_info .triggered .connect(self.toggle_component_info) + self.menu_exit_dialog .triggered .connect(self.toggle_exit_dialog) self.splitter_center .splitterMoved .connect(self._splitter_center_moved) # Setup event member functions @@ -226,6 +227,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): #TODO: self.open(schedule_obj_list[ret_tuple[0]) self._schedules[self._schedule_id] = schedule self._schedule_id += 1 + print(self._schedule_id) pprint(self._schedules) self.printButtonPressed('load_sfg()') @@ -258,6 +260,12 @@ class MainWindow(QMainWindow, Ui_MainWindow): else: settings.setValue("mainwindow/splitter_center/last_state", self.splitter_center.saveState()) self.splitter_center.moveSplitter(range[1], 1) + + @Slot(bool) + def toggle_exit_dialog(self, checked: bool): + s = QSettings() + s.setValue("mainwindow/hide_exit_dialog", checked) + @Slot(int, int) def _splitter_center_moved(self, pos: int, index: int) -> None: @@ -344,11 +352,12 @@ class MainWindow(QMainWindow, Ui_MainWindow): if s.value('mainwindow/maximized', defaultValue=False, type=bool): self.showMaximized() else: - self.move( s.value('mainwindow/pos', defaultValue=self.pos())) - self.resize( s.value('mainwindow/size', defaultValue=self.size())) - self.restoreState( s.value('mainwindow/state', defaultValue=QByteArray())) - self.menu_node_info.setChecked( s.value('mainwindow/menu/node_info', defaultValue=True, type=bool)) - self.splitter_center.restoreState( s.value('mainwindow/splitter/state', defaultValue=QByteArray())) + self.move( s.value('mainwindow/pos', self.pos())) + self.resize( s.value('mainwindow/size', self.size())) + self.restoreState( s.value('mainwindow/state', QByteArray())) + self.menu_node_info.setChecked( s.value('mainwindow/menu/node_info', True, bool)) + self.splitter_center.restoreState( s.value('mainwindow/splitter/state', QByteArray())) + self.menu_exit_dialog.setChecked(s.value('mainwindow/hide_exit_dialog', False, bool)) log.debug('Settings read from \'{}\'.'.format(s.fileName())) diff --git a/b_asic/scheduler-gui/main_window.ui b/b_asic/scheduler-gui/main_window.ui index c075d4093409159fa3fb0763514083b8580003fd..6738e16a2de30c7390b1e4d0be0a289359c8ad83 100644 --- a/b_asic/scheduler-gui/main_window.ui +++ b/b_asic/scheduler-gui/main_window.ui @@ -100,9 +100,16 @@ <string>&Edit</string> </property> </widget> + <widget class="QMenu" name="menuWindow"> + <property name="title"> + <string>&Window</string> + </property> + <addaction name="menu_exit_dialog"/> + </widget> <addaction name="menuFile"/> <addaction name="menu_Edit"/> <addaction name="menuView"/> + <addaction name="menuWindow"/> </widget> <widget class="QStatusBar" name="statusbar"/> <widget class="QDockWidget" name="dockWidget_2"> @@ -166,8 +173,7 @@ </widget> <action name="menu_load_from_file"> <property name="icon"> - <iconset theme="document-open-folder"> - <normaloff>.</normaloff>.</iconset> + <iconset theme="document-open-folder"/> </property> <property name="text"> <string>&Load Schedule From File...</string> @@ -184,8 +190,7 @@ </action> <action name="menu_save"> <property name="icon"> - <iconset theme="document-save"> - <normaloff>.</normaloff>.</iconset> + <iconset theme="document-save"/> </property> <property name="text"> <string>&Save</string> @@ -204,6 +209,9 @@ <property name="checked"> <bool>true</bool> </property> + <property name="icon"> + <iconset theme="application-menu"/> + </property> <property name="text"> <string>&Node Info</string> </property> @@ -213,6 +221,9 @@ <property name="shortcut"> <string>Ctrl+I</string> </property> + <property name="iconVisibleInMenu"> + <bool>false</bool> + </property> </action> <action name="menu_quit"> <property name="icon"> @@ -228,13 +239,23 @@ </action> <action name="menu_save_as"> <property name="icon"> - <iconset theme="document-save-as"> - <normaloff>.</normaloff>.</iconset> + <iconset theme="document-save-as"/> </property> <property name="text"> <string>Save &As...</string> </property> </action> + <action name="menu_exit_dialog"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>&Hide exit dialog</string> + </property> + <property name="toolTip"> + <string>Hide exit dialog</string> + </property> + </action> </widget> <resources> <include location="resources.qrc"/>