Example #1
0
    def __init__(self, label, path, view):
        """Create item."""
        super(Item, self).__init__()
        self.view = view

        self.label = Q.QLineEdit(view)
        self.label.setObjectName('cataview_item_{}_title'.format(label))
        self.label.setReadOnly(True)
        self.label.setSizePolicy(Q.QSizePolicy.Minimum, Q.QSizePolicy.Fixed)

        self.path = Q.QLineEdit(view)
        self.path.setObjectName('cataview_item_{}_path'.format(label))
        self.path.setReadOnly(True)
        self.path.setMinimumWidth(150)

        self.btn = Q.QPushButton(view)
        self.btn.setObjectName('cataview_item_{}_btn'.format(label))
        self.btn.setIcon(load_icon("as_pic_delete.png"))

        gl = view.layout()
        row = gl.rowCount()
        gl.addWidget(self.label, row, 0)
        gl.addWidget(self.path, row, 1)
        gl.addWidget(self.btn, row, 2)

        self.btn.clicked.connect(self.remove)

        self.label.setText(label)
        self.label.home(False)
        self.label.setToolTip(label)
        self.path.setText(path)
        self.path.home(False)
        self.path.setToolTip(path)
Example #2
0
    def _addSelectorItem(self, parent, title, setting, items, icons, ids):
        """
        Add combo box item.

        Arguments:
            parent (QWidget): Parent widget.
            title (str): Text label.
            setting (str): Preference item's identifier.
            items (list[str]): Selector items (choices).
            icons (list[str]): Names of icons for the selector items.
            ids (list[str]): Identifiers of the selector items (to
                identify choices in the preferences file).
        """
        label = Q.QLabel(title, parent)
        _setObjName(label, "label", setting)
        editor = Q.QComboBox(parent)
        _setObjName(editor, "combo", setting)
        for index, item in enumerate(items):
            editor.addItem(item)
            if index < len(icons) and icons[index]:
                editor.setItemIcon(index, load_icon(icons[index]))
            if index < len(ids) and ids[index]:
                editor.setItemData(index, ids[index])
        row = self._layout(parent).rowCount()
        self._layout(parent).addWidget(label, row, 0)
        self._layout(parent).addWidget(editor, row, 1)
        self.widgets[setting] = editor
Example #3
0
    def __init__(self, path, panel, parent):
        """
        Create widget.

        Arguments:
            obj (Command, Parameter): Command or Parameter being edited.
            parent (Optional[QWidget]): Parent widget.
        """
        super(ParameterListWindow, self).__init__(path, panel, parent)
        view = ParameterView(panel, item_path=path,
                             parent_item=None, parent=self)
        self._setView(view)
        self._search.setVisible(False)
        self.add = QPushButton(translate("ParameterPanel", "Add item"))
        self.add.setIcon(load_icon("as_pic_add_row.png"))
        self.add.clicked.connect(self._addListItem)
        self.add.setObjectName(self.add.text())
        self.addControlWidget(self.add)
        self.addWidget(view)

        view.appendEnabled.connect(self.add.setEnabled)
Example #4
0
    def __init__(self, path, panel, parent):
        """
        Create widget.

        Arguments:
            obj (Command, Parameter): Command or Parameter being edited.
            parent (Optional[QWidget]): Parent widget.
        """
        super(ParameterTableWindow, self).__init__(path, panel, parent)
        view = ParameterTableView(panel, item_path=path,
                                  parent_item=None, parent=self)
        self._actions = {}
        self._setView(view)
        self._search.setVisible(False)
        self._plot = None

        if re.match("^.*[.]VALE$", path.path()) or \
            re.match("^.*[.](ABSCISSE|ORDONNEE)$", path.path()):
            self._plot = PlotWidget(view, self)
            self._plot.hide()

            splitter = QSplitter(self)
            splitter.setOrientation(Qt.Vertical)
            splitter.addWidget(view)
            splitter.addWidget(self._plot)
            self._scroll.setWidget(splitter)
        else:
            self._scroll.setWidget(view)

        view.selectionChanged.connect(self._updateState)

        tbar = QToolBar(self)
        tbar.setToolButtonStyle(Qt.ToolButtonIconOnly)

        tbar.addAction(\
            self._createAction(ParameterTableWindow.AppendRow,
                               load_icon("as_pic_add_row.png"),
                               translate("ParameterPanel", "Append row"),
                               translate("ParameterPanel",
                                         "Append row to the end of table"),
                               view.appendRow))

        tbar.addAction(\
            self._createAction(ParameterTableWindow.InsertRow,
                               load_icon("as_pic_insert_row.png"),
                               translate("ParameterPanel", "Insert row"),
                               translate("ParameterPanel",
                                         "Insert row at current position"),
                               view.insertRow))

        tbar.addAction(\
            self._createAction(ParameterTableWindow.RemoveRow,
                               load_icon("as_pic_remove_row.png"),
                               translate("ParameterPanel", "Remove rows"),
                               translate("ParameterPanel",
                                         "Remove selected rows"),
                               view.removeRows))

        tbar.addSeparator()

        tbar.addAction(\
            self._createAction(ParameterTableWindow.MoveRowUp,
                               load_icon("as_pic_move_up.png"),
                               translate("ParameterPanel", "Move up"),
                               translate("ParameterPanel",
                                         "Move selected rows up"),
                               view.moveRowsUp))

        tbar.addAction(\
            self._createAction(ParameterTableWindow.MoveRowDown,
                               load_icon("as_pic_move_down.png"),
                               translate("ParameterPanel", "Move down"),
                               translate("ParameterPanel",
                                         "Move selected rows down"),
                               view.moveRowsDown))

        tbar.addSeparator()

        if self._plot is not None:
            tbar.addAction(\
                self._createAction(ParameterTableWindow.FunctionPlot,
                                   load_icon("as_pic_show_plot.png"),
                                   translate("ParameterPanel",
                                             "Plot function"),
                                   translate("ParameterPanel",
                                             "Show/hide plot view"),
                                   self._plot.setVisible, True))
            tbar.addSeparator()

        tbar.addAction(\
            self._createAction(ParameterTableWindow.Import,
                               load_icon("as_pic_import_table.png"),
                               translate("ParameterPanel", "Import table"),
                               translate("ParameterPanel",
                                         "Import function data from file"),
                               view.importFile))

        self.addControlWidget(tbar)

        self._updateState()
Example #5
0
    def __init__(self, astergui, parent=None, tab_position=Q.QTabWidget.West):
        """
        Create workspace.

        Arguments:
            parent (Optional[QWidget]): Parent widget. Defaults to
                *None*.
            tab_position (Optional[QTabWidget.TabPosition]): Position
                of tab pages. Defaults to QTabWidget.West (left,
                vertical).
        """
        Q.QWidget.__init__(self, parent)

        self.astergui = astergui
        self.pages = {}
        self.panels = {}
        self.views = {}

        # Set-up main area as tab widget with two pages
        self.main = Q.QTabWidget(self)
        self.main.setSizePolicy(Q.QSizePolicy.Expanding,
                                Q.QSizePolicy.Expanding)
        self.main.setTabPosition(tab_position)
        v_layout = Q.QVBoxLayout(self)
        v_layout.setContentsMargins(0, 0, 0, 0)
        v_layout.addWidget(self.main)

        # - Add "History View" page
        self.pages[WorkingMode.HistoryMode] = Q.QWidget(self.main)
        self.main.addTab(self.pages[WorkingMode.HistoryMode],
                         load_icon("as_pic_historypanel.png"),
                         translate("Workspace", "History View"))
        # - Add "Case View" page
        self.pages[WorkingMode.CaseMode] = Q.QWidget(self.main)
        self.main.addTab(self.pages[WorkingMode.CaseMode],
                         load_icon("as_pic_casepanel.png"),
                         translate("Workspace", "Case View"))

        # Set-up "History View" page.
        self.history_hsplitter = \
            Q.QSplitter(Q.Qt.Horizontal, self.pages[WorkingMode.HistoryMode])
        self.history_hsplitter.setChildrenCollapsible(False)
        v_layout = Q.QVBoxLayout(self.pages[WorkingMode.HistoryMode])
        v_layout.addWidget(self.history_hsplitter)
        # - Add "Dashboard" view
        self.views[Context.Dashboard] = Dashboard(astergui,
                                                  self.history_hsplitter)
        # - Add "Cases" view
        self.views[Context.Cases] = CasesView(astergui, self.history_hsplitter)
        self.history_hsplitter.addWidget(self.views[Context.Cases])
        self.history_hsplitter.addWidget(self.views[Context.Dashboard])
        self.history_hsplitter.\
            setStretchFactor(self.history_hsplitter.count()-1, 1)

        # Set-up "Case View" page.
        v_layout = Q.QVBoxLayout(self.pages[WorkingMode.CaseMode])

        self.banner = Q.QLabel(self.pages[WorkingMode.CaseMode])
        self.banner.setObjectName("read_only_banner")
        self.banner.setFrameStyle(Q.QLabel.Box | Q.QLabel.Sunken)
        self.banner.setBackgroundRole(Q.QPalette.ToolTipBase)
        self.banner.setAutoFillBackground(True)
        self.banner.setAlignment(Q.Qt.AlignCenter)
        self.banner.linkActivated.connect(self.editModeActivated)
        v_layout.addWidget(self.banner)

        self.case_hsplitter = \
            Q.QSplitter(Q.Qt.Horizontal, self.pages[WorkingMode.CaseMode])
        self.case_hsplitter.setChildrenCollapsible(False)
        v_layout.addWidget(self.case_hsplitter, 10)

        self.case_vsplitter = Q.QSplitter(Q.Qt.Vertical, self.case_hsplitter)
        self.case_vsplitter.setChildrenCollapsible(False)
        self.case_hsplitter.addWidget(self.case_vsplitter)

        # - Set-up data panel
        self.panels[Panel.Data] = TabWidget(self.case_vsplitter)
        self.panels[Panel.Data].setSizePolicy(Q.QSizePolicy.Expanding,
                                              Q.QSizePolicy.Expanding)
        self.case_vsplitter.addWidget(self.panels[Panel.Data])

        # -- Add "Data Settings" view
        self.views[Context.DataSettings] = \
            DataSettings(astergui, self.panels[Panel.Data])
        self.panels[Panel.Data].addTab(self.views[Context.DataSettings],
                                       load_icon("as_pic_datasettingview.png"),
                                       view_title(Context.DataSettings))

        # -- Add "Data Files" view
        self.views[Context.DataFiles] = DataFiles(astergui,
                                                  self.panels[Panel.Data])
        self.panels[Panel.Data].addTab(self.views[Context.DataFiles],
                                       load_icon("as_pic_datafilesview.png"),
                                       view_title(Context.DataFiles))

        # -- Add "Information" view
        self.views[Context.Information] = InfoView(astergui,
                                                   self.case_vsplitter)
        self.case_vsplitter.addWidget(self.views[Context.Information])

        # - Set-up "View" panel
        self.panels[Panel.View] = astergui.createMeshView(self.case_hsplitter)
        self.case_hsplitter.addWidget(self.panels[Panel.View])
        self.case_hsplitter.setStretchFactor(self.case_hsplitter.count() - 1,
                                             1)

        # - Set-up "Edition" panel
        self.panels[Panel.Edit] = EditionPanel(self.case_hsplitter)
        self.case_hsplitter.addWidget(self.panels[Panel.Edit])

        connect(self.main.currentChanged, self.modeChanged)
        connect(self.main.currentChanged, self._updateBanner)
        connect(self.main.currentChanged, self._selectActiveCase)
        connect(self.panels[Panel.Data].currentChanged, self._viewChanged)

        for view in self.views.itervalues():
            view.setContextMenuPolicy(Q.Qt.CustomContextMenu)
            connect(view.customContextMenuRequested, self._popupMenuRequest)
            if hasattr(view, "itemSelectionChanged"):
                connect(view.itemSelectionChanged, self._selectionChanged)
            if hasattr(view, "itemDoubleClicked"):
                connect(view.itemDoubleClicked, self._itemActivated)
            if hasattr(view, "itemChanged"):
                connect(view.itemChanged, self._itemChanged)
            if hasattr(view, "entityChanged"):
                connect(view.entityChanged, self.itemChanged)

        for win in self._windows():
            win.installEventFilter(self)

        self.setFocusPolicy(Q.Qt.StrongFocus)
        self.activate(False)
Example #6
0
    def __init__(self, astergui, view):
        """
        Create searcher.

        Arguments:
            astergui (AsterGui): *AsterGui* instance.
            view (QWidget): Parent view.
        """
        super(Searcher, self).__init__(view)
        self._astergui = astergui
        self._view = view
        self._items = []
        self._auto_hide = True

        self._filter = SearchWidget(self)
        self._filter.setToolTip(translate("Searcher", "Search criteria"))

        base = Q.QGridLayout(self)
        base.setContentsMargins(5, 0, 5, 5)

        self._context = Q.QComboBox(self)
        self._context.addItem(translate("Searcher", "Command"),
                              Model.Context.Name)
        self._context.addItem(translate("Searcher", "Concept"),
                              Model.Context.Concept)
        self._context.addItem(translate("Searcher", "Keyword"),
                              Model.Context.Keyword)
        self._context.addItem(translate("Searcher", "Group"),
                              Model.Context.Group)
        self._context.setToolTip(translate("Searcher", "Type of search"))

        self._prev = Q.QToolButton(self)
        self._prev.setToolTip(translate("Searcher", "Find previous item"))
        self._prev.setIcon(load_icon("as_pic_find_prev.png"))
        self._prev.setObjectName("find_prev")

        self._next = Q.QToolButton(self)
        self._next.setToolTip(translate("Searcher", "Find next item"))
        self._next.setIcon(load_icon("as_pic_find_next.png"))
        self._next.setObjectName("find_next")

        close = Q.QToolButton(self)
        close.setToolTip(translate("Searcher", "Close search panel"))
        close.setIcon(load_icon("as_pic_find_close.png"))
        close.setObjectName("close_searcher")

        base.addWidget(self._filter, 0, 0, 1, 4)
        base.addWidget(self._context, 1, 0)
        base.addWidget(self._prev, 1, 1)
        base.addWidget(self._next, 1, 2)
        base.addWidget(close, 1, 3)

        self._timer = Q.QTimer(self)
        self._timer.setInterval(10000)
        self._timer.setSingleShot(True)

        close.clicked.connect(self._onTimeout)
        self._timer.timeout.connect(self._onTimeout)
        self._context.activated.connect(self._onContextActivated)
        self._filter.filterChanged.connect(self._onFilterChanged)

        self._prev.clicked.connect(self._onFindPrev)
        self._next.clicked.connect(self._onFindNext)

        self.setFocusProxy(self._filter)

        self.hide()
Example #7
0
    def __init__(self, astergui, parent=None):
        """
        Create panel.

        Arguments:
            astergui (AsterGui): AsterGui instance.
            parent (Optional[QWidget]): Parent widget.
        """
        super(ParameterPanel,
              self).__init__(parent=parent,
                             name=translate("ParameterPanel", "Edit command"),
                             astergui=astergui)
        self.setPixmap(load_pixmap("as_pic_edit_command.png"))

        self._files_model = astergui.study().dataFilesModel()
        self._unit_model = None

        self._command = None
        self.title = ParameterTitle(self)
        self.title.installEventFilter(self)
        self._name = QLineEdit(self)
        self.views = QStackedWidget(self)
        v_layout = QVBoxLayout(self)
        v_layout.setContentsMargins(0, 0, 0, 0)
        v_layout.setSpacing(5)
        v_layout.addWidget(self.title)
        v_layout.addWidget(HLine(self))

        n_layout = QHBoxLayout()
        v_layout.addLayout(n_layout)
        n_layout.addWidget(QLabel(translate("ParameterPanel", "Name"), self))
        n_layout.addWidget(self._name)
        # force to be a valid identifier + length <= 8
        self._name.setValidator(QRegExpValidator(QRegExp(r"[a-zA-Z]\w{1,7}")))

        # create toolbar
        tbar = QToolBar(self)
        tbar.setToolButtonStyle(Qt.ToolButtonIconOnly)
        # - Edit comment
        edit_comment = QAction(translate("AsterStudy", "Edit &Comment"), self)
        edit_comment.setToolTip(translate("AsterStudy", "Edit comment"))
        edit_comment.setStatusTip(
            translate("AsterStudy", "Edit comment for the "
                      "selected object"))
        edit_comment.setIcon(load_icon("as_pic_edit_comment.png"))
        connect(edit_comment.triggered, self._editComment)
        tbar.addAction(edit_comment)
        # - Switch on/off business-translations
        title = translate("AsterStudy", "Use Business-Oriented Translations")
        self.use_translations = QAction(title, self)
        title = translate("AsterStudy", "Use business-oriented translations")
        self.use_translations.setToolTip(title)
        self.use_translations.setStatusTip(title)
        self.use_translations.setIcon(load_icon("as_pic_use_translations.png"))
        self.use_translations.setCheckable(True)
        if behavior().forced_native_names:
            force = behavior().force_native_names
            self.use_translations.setDisabled(True)
            is_on = not force
        else:
            is_on = behavior().use_business_translations
        Options.use_translations = is_on
        self.use_translations.setChecked(is_on)
        connect(self.use_translations.toggled, self.updateTranslations)
        tbar.addAction(self.use_translations)
        # - Hide unused
        hide_unused = astergui.action(ActionType.HideUnused)
        connect(hide_unused.toggled, self._unusedVisibility)
        tbar.addAction(hide_unused)
        # - What's this
        whats_this = QWhatsThis.createAction(tbar)
        whats_this.setToolTip(translate("AsterStudy", "What's this?"))
        whats_this.setStatusTip(
            translate("AsterStudy", "Show element's description"))
        whats_this.setIcon(load_icon("as_pic_whats_this.png"))
        tbar.addAction(whats_this)
        # - Link to doc
        tbar.addAction(astergui.action(ActionType.LinkToDoc))

        n_layout.addWidget(tbar)

        v_layout.addWidget(self.views)
        self._updateState()
Example #8
0
    def load_icons(self) -> None:
        # load common icons
        self.ui.EditorTabLabel.setPixmap(QPixmap.fromImage(QImage(":/icons_common/icons_common/document-papirus.svg")))
        self.ui.GitTabLabel.setPixmap(QPixmap.fromImage(QImage(":/icons_common/icons_common/git-branch.svg")))
        self.ui.ProjectTabLabel.setPixmap(QPixmap.fromImage(QImage(":/icons_common/icons_common/project-management.svg")))
        self.ui.SettingsLabel.setPixmap(QPixmap.fromImage(QImage(":/icons_common/icons_common/settings.svg")))
        self.ui.UserAccounLabel.setPixmap(QPixmap.fromImage(QImage(":/icons_common/icons_common/account.svg")))

        # load light/dark icons
        icon_type = self.SettingsManager.get_setting_value("Colors/Icons")
        prefix = f"icons_{icon_type.lower()}"

        common.load_icon("format-text-italic.svg", prefix, self.ui.actionItalic)
        common.load_icon("format-text-bold.svg", prefix, self.ui.actionBold)
        common.load_icon("format-text-bold-italic.svg", prefix, self.ui.actionBoldItalic)
        common.load_icon("heading1.svg", prefix, self.ui.actionHeading1)
        common.load_icon("heading2.svg", prefix, self.ui.actionHeading2)
        common.load_icon("heading3.svg", prefix, self.ui.actionHeading3)
        common.load_icon("heading4.svg", prefix, self.ui.actionHeading4)
        common.load_icon("heading5.svg", prefix, self.ui.actionHeading5)
        common.load_icon("heading6.svg", prefix, self.ui.actionHeading6)
        common.load_icon("horizontal-rule.svg", prefix, self.ui.actionHorizontalRule)
        common.load_icon("format-text-blockquote.svg", prefix, self.ui.actionBlockquote)
        common.load_icon("ord-list", prefix, self.ui.actionOrdList)
        common.load_icon("unord-list.svg", prefix, self.ui.actionUnordList)
        common.load_icon("link.svg", prefix, self.ui.actionLink)
        common.load_icon("insert-image.svg", prefix, self.ui.actionImage)
        common.load_icon("format-text-code.svg", prefix, self.ui.actionCode)
        common.load_icon("format-text-strikethrough.svg", prefix, self.ui.actionStrikethrough)
        common.load_icon("format-text-superscript.svg", prefix, self.ui.actionSuperscript)
        common.load_icon("format-text-subscript.svg", prefix, self.ui.actionSubscript)
        common.load_icon("insert-footnote.svg", prefix, self.ui.actionFootnote)
        common.load_icon("table.svg", prefix, self.ui.actionAddTable)
        common.load_icon("text-frame-link.svg", prefix, self.ui.actionCrossRef)

        common.load_icon("heading1.svg", prefix, self.ui.HeadingToolButton)
Example #9
0
    def __init__(self, astergui, parent=None):
        """
        Create view.

        Arguments:
            astergui (AsterGui): *AsterGui* instance.
            parent (Optional[QWidget]): Parent widget. Defaults to
                *None*.
        """
        super(DataFiles, self).__init__(parent)
        self.astergui = astergui
        self.setObjectName("DataFilesBase")
        self.ops = {}

        # Files tree
        self.view = FilesView(self)
        self.view.setObjectName('DataFilesView')
        connect(self.view.clicked, self.updateButtonsState)
        connect(self.view.doubleClicked, self._doubleClicked)

        # Toolbar
        self.toolbar = Q.QToolBar(self)
        self.toolbar.setToolButtonStyle(Q.Qt.ToolButtonIconOnly)
        self.toolbar.setObjectName("DataFilesToolbar")

        # - add file
        action = Q.QAction(translate("AsterStudy", "&Add File"), self)
        action.setToolTip(translate("AsterStudy", "Add file"))
        action.setStatusTip(
            translate("AsterStudy", "Add a data file to the stage"))
        action.setIcon(load_icon("as_pic_new_file.png"))
        connect(action.triggered, self.add)
        self.ops[DataFiles.Add] = action

        # - edit file
        action = Q.QAction(translate("AsterStudy", "&Edit File"), self)
        action.setToolTip(translate("AsterStudy", "Edit file"))
        action.setStatusTip(
            translate("AsterStudy", "Edit properties of selected data file"))
        action.setIcon(load_icon("as_pic_edit_file.png"))
        connect(action.triggered, self.edit)
        self.ops[DataFiles.Edit] = action

        # - view file
        action = Q.QAction(translate("AsterStudy", "&View File"), self)
        action.setToolTip(translate("AsterStudy", "View file"))
        action.setStatusTip(
            translate("AsterStudy", "View properties of selected data file"))
        action.setIcon(load_icon("as_pic_view_file.png"))
        connect(action.triggered, self.edit)
        self.ops[DataFiles.View] = action

        # - remove file
        action = Q.QAction(translate("AsterStudy", "&Remove File"), self)
        action.setToolTip(translate("AsterStudy", "Remove file"))
        action.setStatusTip(
            translate("AsterStudy", "Remove selected data file "
                      "from the stage"))
        action.setIcon(load_icon("as_pic_remove_file.png"))
        connect(action.triggered, self.remove)
        self.ops[DataFiles.Remove] = action

        # - go to
        action = Q.QAction(translate("AsterStudy", "&Go To"), self)
        action.setToolTip(translate("AsterStudy", "Go to"))
        action.setStatusTip(
            translate("AsterStudy", "Go to the selected command"))
        action.setIcon(load_icon("as_pic_goto.png"))
        connect(action.triggered, self.goto)
        self.ops[DataFiles.GoTo] = action

        # - fill in toolbar
        self.toolbar.addAction(self.ops[DataFiles.Add])
        self.toolbar.addAction(self.ops[DataFiles.Edit])
        self.toolbar.addAction(self.ops[DataFiles.View])
        self.toolbar.addAction(self.ops[DataFiles.Remove])
        self.toolbar.addAction(self.ops[DataFiles.GoTo])

        # Layout widgets
        vbox_layout = Q.QVBoxLayout(self)
        vbox_layout.setContentsMargins(5, 5, 5, 5)
        vbox_layout.addWidget(self.view)
        vbox_layout.addWidget(self.toolbar)
Example #10
0
def get_icon(obj):
    """
    Get icon for the given object.

    Arguments:
        obj (Node, Category): Object.

    Returns:
        QIcon: Object's icon (*None* if icon is not specified).
    """

    if not hasattr(get_icon, "icons"):
        get_icon.icons = {}
        get_icon.icons["history"] = load_icon("as_ico_history.png")
        get_icon.icons["run_case"] = load_icon("as_ico_run_case.png")
        get_icon.icons["backup_case"] = load_icon("as_ico_backup_case.png")
        get_icon.icons["current_case"] = load_icon("as_ico_current_case.png")
        get_icon.icons["stage_graph"] = load_icon("as_ico_graphical_stage.png")
        get_icon.icons["stage_text"] = load_icon("as_ico_text_stage.png")
        get_icon.icons["category"] = load_icon("as_ico_category.png")
        get_icon.icons["command"] = load_icon("as_ico_command.png")
        get_icon.icons["variable"] = load_icon("as_ico_variable.png")
        get_icon.icons["comment"] = load_icon("as_ico_comment.png")
        get_icon.icons["macro"] = load_icon("as_ico_macro.png")
        get_icon.icons["unit"] = load_icon("as_ico_file.png")
        get_icon.icons["dir"] = load_icon("as_ico_dir.png")

    icon = None
    obj_type = get_node_type(obj)

    if obj_type == NodeType.History:
        icon = get_icon.icons["history"]
    elif obj_type == NodeType.Case:
        if obj.model:
            if obj is obj.model.current_case:
                icon = get_icon.icons["current_case"]
            elif obj in obj.model.backup_cases:
                icon = get_icon.icons["backup_case"]
            elif obj in obj.model.run_cases:
                icon = get_icon.icons["run_case"]
    elif obj_type == NodeType.Stage:
        is_graphical_stage = obj.is_graphical_mode()
        icon = get_icon.icons["stage_graph"] if is_graphical_stage \
            else get_icon.icons["stage_text"]
    elif obj_type == NodeType.Category:
        icon = get_icon.icons["category"]
    elif obj_type == NodeType.Command:
        command = obj.title.lower() + ".png"
        if command not in get_icon.icons:
            default = get_icon.icons["command"]
            get_icon.icons[command] = load_icon(command, default=default)
        icon = get_icon.icons[command]
    elif obj_type == NodeType.Variable:
        icon = get_icon.icons["variable"]
    elif obj_type == NodeType.Comment:
        icon = get_icon.icons["comment"]
    elif obj_type == NodeType.Macro:
        icon = get_icon.icons["macro"]
    elif obj_type == NodeType.Unit:
        icon = get_icon.icons["unit"]
    elif obj_type == NodeType.Dir:
        icon = get_icon.icons["dir"]

    return icon
    def load_icons(self) -> None:
        icon_type = self.SettingsManager.get_setting_value("Colors/Icons")
        prefix = f"icons_{icon_type.lower()}"

        common.load_icon("go-up-skip.svg", prefix, self.ui.actionMoveToTheTop)
        common.load_icon("go-up.svg", prefix, self.ui.actionMoveUp)
        common.load_icon("go-previous.svg", prefix, self.ui.actionMoveLeft)
        common.load_icon("go-next.svg", prefix, self.ui.actionMoveRight)
        common.load_icon("go-down.svg", prefix, self.ui.actionMoveDown)
        common.load_icon("go-down-skip.svg", prefix,
                         self.ui.actionMoveToTheBottom)