From 83b9037642aa95d0b711c8f2222598c6018c4875 Mon Sep 17 00:00:00 2001
From: Oscar Gustafsson <oscar.gustafsson@gmail.com>
Date: Sat, 29 Apr 2023 23:00:12 +0200
Subject: [PATCH] Add more icons

---
 b_asic/GUI/main_window.py           |  9 +++++++--
 b_asic/gui_utils/icons.py           | 10 +++++++++-
 b_asic/scheduler_gui/main_window.py |  3 +++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/b_asic/GUI/main_window.py b/b_asic/GUI/main_window.py
index 5f75ae09..5daf997f 100644
--- a/b_asic/GUI/main_window.py
+++ b/b_asic/GUI/main_window.py
@@ -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()
diff --git a/b_asic/gui_utils/icons.py b/b_asic/gui_utils/icons.py
index f302345b..54f02db1 100644
--- a/b_asic/gui_utils/icons.py
+++ b/b_asic/gui_utils/icons.py
@@ -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])
diff --git a/b_asic/scheduler_gui/main_window.py b/b_asic/scheduler_gui/main_window.py
index bc57fdbe..21f2b211 100644
--- a/b_asic/scheduler_gui/main_window.py
+++ b/b_asic/scheduler_gui/main_window.py
@@ -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)
-- 
GitLab