diff --git a/nixview/central_widget.py b/nixview/central_widget.py index ba947c5..23fab8d 100644 --- a/nixview/central_widget.py +++ b/nixview/central_widget.py @@ -196,7 +196,7 @@ class SplashScreen(QWidget): self.setLayout(layout) label = QLabel() - label.setPixmap(QPixmap("./icons/nixview_transparent.png")) + label.setPixmap(QPixmap(os.path.join(cnst.ICONS_FOLDER, "nixview_transparent.png"))) label.setMaximumWidth(300) label.setAlignment(Qt.AlignCenter) layout.addWidget(label, 1, 1, 1, 3, Qt.AlignCenter) diff --git a/nixview/main_window.py b/nixview/main_window.py index 2b06c5c..2633405 100644 --- a/nixview/main_window.py +++ b/nixview/main_window.py @@ -1,3 +1,4 @@ +import os import sys from PyQt5.QtWidgets import QWidget, QFileDialog, QMainWindow, QMenuBar, QToolBar, QAction, QStatusBar, QSizePolicy from PyQt5.QtGui import QIcon, QKeySequence @@ -15,7 +16,7 @@ class NixView(QMainWindow): super(NixView, self).__init__(*args, **kwargs) self._current_item = None self.setWindowTitle("NixView") - self.setWindowIcon(QIcon('./icons/nixview.icns')) + self.setWindowIcon(QIcon(os.path.join(cnst.ICONS_FOLDER, 'nixview.icns'))) self._file_handler = FileHandler() self.setStatusBar(QStatusBar(self)) @@ -40,29 +41,29 @@ class NixView(QMainWindow): self._table_action.setEnabled(enable) def create_actions(self): - self._file_open_action = QAction(QIcon("./icons/nix_open.png"), "Open", self) + self._file_open_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_open.png")), "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("./icons/nix_close.png"), "Close", self) + self._file_close_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_close.png")), "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("./icons/quit.png"), "Quit", self) + self._quit_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "quit.png")), "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("./icons/nix_plot.png"), "Plot", self) + self._plot_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_plot.png")), "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("./icons/nix_table.png"), "Show table", self) + self._table_action = QAction(QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_table.png")), "Show table", self) self._table_action.setStatusTip("Show data as table") self._table_action.setShortcut(QKeySequence("Ctrl+t")) self._table_action.setEnabled(False) diff --git a/nixview/tree_model.py b/nixview/tree_model.py index c48be8c..540e351 100644 --- a/nixview/tree_model.py +++ b/nixview/tree_model.py @@ -1,3 +1,5 @@ +import os +import nixview.constants as cnst from PyQt5.QtCore import QAbstractItemModel, QModelIndex, Qt, QSize from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QTreeView, QTreeWidgetItem, QAbstractItemView, QHeaderView @@ -261,17 +263,17 @@ class TreeModel(QAbstractItemModel): def __init__(self, file_handler, tree_type=TreeType.Full, parent=None, root_section_id=None): super(TreeModel, self).__init__(parent) nd = ItemDescriptor(file_handler.filename, type="Root item") - self.type_icons = {NodeType.Block: QIcon("./icons/nix_block_1d.png"), - NodeType.Source: QIcon("./icons/nix_source.png"), - NodeType.DataArray: QIcon("./icons/nix_data_array.png"), - NodeType.Dimension: QIcon("./icons/nix_dimension.png"), - NodeType.DataFrame: QIcon("./icons/nix_data_frame.png"), - NodeType.Section: QIcon("./icons/nix_section.png"), - NodeType.Property: QIcon("./icons/nix_property.png"), - NodeType.Tag: QIcon("./icons/nix_tag.png"), - NodeType.MultiTag: QIcon("./icons/nix_tag.png"), - NodeType.Group: QIcon("./icons/nix_group.png"), - NodeType.Feature: QIcon("./icons/nix_feature.png")} + self.type_icons = {NodeType.Block: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_block_1d.png")), + NodeType.Source: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_source.png")), + NodeType.DataArray: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_data_array.png")), + NodeType.Dimension: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_dimension.png")), + NodeType.DataFrame: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_data_frame.png")), + NodeType.Section: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_section.png")), + NodeType.Property: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_property.png")), + NodeType.Tag: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_tag.png")), + NodeType.MultiTag: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_tag.png")), + NodeType.Group: QIcon(os.path.join(cnst.ICONS_FOLDER, "icons/nix_group.png")), + NodeType.Feature: QIcon(os.path.join(cnst.ICONS_FOLDER, "nix_feature.png"))} if tree_type == TreeType.Full: self.root_item = FileTreeItem(nd, file_handler, parent=None)