[icons] make icons available via constants.py

This commit is contained in:
2021-01-11 22:37:22 +01:00
parent c000d51276
commit 68715f4773
3 changed files with 25 additions and 8 deletions

View File

@@ -18,7 +18,7 @@ class NixView(QMainWindow):
super(NixView, self).__init__(*args, **kwargs)
self._current_item = None
self.setWindowTitle("NixView")
self.setWindowIcon(QIcon(os.path.join(cnst.ICONS_FOLDER, 'nixview.icns')))
self.setWindowIcon(cnst.get_icon('nixview'))
self._file_handler = FileHandler()
self.setStatusBar(QStatusBar(self))
@@ -43,29 +43,29 @@ class NixView(QMainWindow):
self._table_action.setEnabled(enable)
def create_actions(self):
self._file_open_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nixview_open.png")), "Open", self)
self._file_open_action = QAction(cnst.get_icon("nixview_open"), "Open", self)
self._file_open_action.setStatusTip("Open nix file")
self._file_open_action.setShortcut(QKeySequence("Ctrl+o"))
self._file_open_action.triggered.connect(self.on_file_open)
self._file_close_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nixview_close.png")), "Close", self)
self._file_close_action = QAction(cnst.get_icon("nixview_close"), "Close", self)
self._file_close_action.setStatusTip("Close current nix file")
self._file_close_action.setShortcut(QKeySequence("Ctrl+w"))
self._file_close_action.setEnabled(False)
self._file_close_action.triggered.connect(self.on_file_close)
self._quit_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_quit.png")), "Quit", self)
self._quit_action = QAction(cnst.get_icon("nixview_quit"), "Quit", self)
self._quit_action.setStatusTip("Close current file and quit")
self._quit_action.setShortcut(QKeySequence("Ctrl+q"))
self._quit_action.triggered.connect(self.on_quit)
self._plot_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_data_array.png")), "Plot", self)
self._plot_action = QAction(cnst.get_icon("nix_data_array"), "Plot", self)
self._plot_action.setStatusTip("Plot currently selected entity")
self._plot_action.setShortcut(QKeySequence("Ctrl+p"))
self._plot_action.setEnabled(False)
self._plot_action.triggered.connect(self.on_item_plot)
self._table_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_data_frame.png")), "Show table", self)
self._table_action = QAction(cnst.get_icon("nix_data_frame"), "Show table", self)
self._table_action.setStatusTip("Show data as table")
self._table_action.setShortcut(QKeySequence("Ctrl+t"))
self._table_action.setEnabled(False)
@@ -76,7 +76,7 @@ class NixView(QMainWindow):
self._about_action.setEnabled(True)
self._about_action.triggered.connect(self.on_about)
self._help_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_help.png")), "help")
self._help_action = QAction(cnst.get_icon("nixview_help"), "help")
self._help_action.setStatusTip("Show help dialog")
self._table_action.setShortcut(QKeySequence("F1"))
@@ -165,7 +165,7 @@ class NixView(QMainWindow):
def on_item_plot(self, s):
if self._current_item is not None:
self._cw.plot_item(self._current_item)
self._cw.plot_item(self._current_item.node_descriptor)
def on_about(self, e):
about = AboutDialog(self)