Skip to content
Snippets Groups Projects
Commit 83b90376 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Add more icons

parent 7ccb6b9e
No related branches found
No related tags found
1 merge request!320Add zoom to fit
Pipeline #95981 passed
......@@ -142,10 +142,12 @@ class SFGMainWindow(QMainWindow):
self._ui.actionShowPC.triggered.connect(self._show_precedence_graph)
self._ui.actionSimulateSFG.triggered.connect(self.simulate_sfg)
self._ui.actionSimulateSFG.setIcon(get_icon('sim'))
# About menu
self._ui.faqBASIC.triggered.connect(self.display_faq_page)
self._ui.faqBASIC.setShortcut(QKeySequence("Ctrl+?"))
self._ui.faqBASIC.setIcon(get_icon('faq'))
self._ui.aboutBASIC.triggered.connect(self.display_about_page)
self._ui.aboutBASIC.setIcon(get_icon('about'))
self._ui.keybindsBASIC.triggered.connect(self.display_keybindings_page)
......@@ -175,7 +177,9 @@ class SFGMainWindow(QMainWindow):
self._ui.exit_menu.setIcon(get_icon('quit'))
self._ui.select_all.triggered.connect(self._select_all)
self._ui.select_all.setShortcut(QKeySequence("Ctrl+A"))
self._ui.select_all.setIcon(get_icon('all'))
self._ui.unselect_all.triggered.connect(self._unselect_all)
self._ui.unselect_all.setIcon(get_icon('none'))
self._shortcut_signal = QShortcut(QKeySequence(Qt.Key_Space), self)
self._shortcut_signal.activated.connect(self._connect_callback)
self._create_recent_file_actions_and_menus()
......@@ -202,8 +206,9 @@ class SFGMainWindow(QMainWindow):
self._statusbar_visible.triggered.connect(self._toggle_statusbar)
self._ui.view_menu.addAction(self._statusbar_visible)
# Zoom to fit
self._ui.view_menu.addSeparator()
self._zoom_to_fit_action = QAction("Zoom to &fit")
self._zoom_to_fit_action = QAction(get_icon('zoom-to-fit'), "Zoom to &fit")
self._zoom_to_fit_action.triggered.connect(self._zoom_to_fit)
self._ui.view_menu.addAction(self._zoom_to_fit_action)
......@@ -416,7 +421,7 @@ class SFGMainWindow(QMainWindow):
self._update_recent_file_list()
def exit_app(self) -> None:
def exit_app(self, event=None) -> None:
"""Exit the application."""
self._logger.info("Exiting the application.")
QApplication.quit()
......
......@@ -4,6 +4,7 @@ import qtawesome
ICONS = {
'save': 'mdi6.content-save',
'save-as': 'mdi6.content-save-edit',
'undo': 'mdi6.undo',
'redo': 'mdi6.redo',
'new': 'mdi6.file-outline',
......@@ -23,9 +24,16 @@ ICONS = {
'about': 'ph.question',
'keys': 'ph.keyboard',
'add-operations': 'ph.math-operations',
'zoom-to-fit': 'mdi6.fit-to-page',
'faq': 'mdi6.frequently-asked-questions',
'sim': 'mdi6.chart-line',
'reorder': ('msc.graph-left', {'rotated': -90}),
}
def get_icon(name):
"""Return icon for given name"""
return qtawesome.icon(ICONS[name])
info = ICONS[name]
if isinstance(info, str):
return qtawesome.icon(info)
return qtawesome.icon(info[0], **info[1])
......@@ -137,16 +137,19 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow):
self.menu_save.triggered.connect(self.save)
self.menu_save.setIcon(get_icon('save'))
self.menu_save_as.triggered.connect(self.save_as)
self.menu_save_as.setIcon(get_icon('save-as'))
self.menu_quit.triggered.connect(self.close)
self.menu_quit.setIcon(get_icon('quit'))
self.menu_node_info.triggered.connect(self.show_info_table)
self.menu_node_info.setIcon(get_icon('info'))
self.menu_exit_dialog.triggered.connect(self.hide_exit_dialog)
self.actionReorder.triggered.connect(self._action_reorder)
self.actionReorder.setIcon(get_icon('reorder'))
self.actionStatus_bar.triggered.connect(self._toggle_statusbar)
self.actionPlot_schedule.triggered.connect(self._plot_schedule)
self.actionPlot_schedule.setIcon(get_icon('plot-schedule'))
self.actionZoom_to_fit.triggered.connect(self._zoom_to_fit)
self.actionZoom_to_fit.setIcon(get_icon('zoom-to-fit'))
self.actionUndo.setIcon(get_icon('undo'))
self.actionRedo.setIcon(get_icon('redo'))
self.splitter.splitterMoved.connect(self._splitter_moved)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment