Ejemplo n.º 1
0
    def __init__(self, wizard):
        """ Preset Wizard Session Management Menu

        :param modules.gui.wizard.PresetWizard wizard:
        """
        super(WizardSessionMenu, self).__init__(parent=wizard.ui)
        self.wizard = wizard
        self.ui = wizard.ui

        load = QAction(IconRsc.get_icon('folder'), _('Öffnen'), self)
        save = QAction(IconRsc.get_icon('disk'), _('Speichern unter ...'),
                       self)
        restore = QAction(IconRsc.get_icon('undo'),
                          _('Letzte Sitzung wiederherstellen'), self)
        reset = QAction(IconRsc.get_icon('reset'), _('Zurücksetzen'), self)

        load.setStatusTip(_('Wizard Sitzung aus Datei laden'))
        save.setStatusTip(_('Wizard Sitzung in Datei sichern'))
        restore.setStatusTip(
            _('Letzte automatisch gesicherte Sitzung wiederherstellen'))
        reset.setStatusTip(
            _('Preset Wizard neustarten und vorhandene Daten verwerfen'))

        load.triggered.connect(self._load_session)
        save.triggered.connect(self._save_session)
        restore.triggered.connect(self._restore_session)
        reset.triggered.connect(self._reset_session)

        self.addActions((load, save, restore, reset))
Ejemplo n.º 2
0
    def __init__(self, wizard):
        """ Wizard DeltaGenResult Page

        :param modules.gui.wizard.wizard.PresetWizard wizard: The parent wizard
        """
        super(ResultWizardPage, self).__init__()
        self.wizard = wizard
        self.session = wizard.session

        SetupWidget.from_ui_file(self, Resource.ui_paths['wizard_result'])

        self.setTitle(_('Wizard Ergebnis'))
        self.setSubTitle(
            _('Überblick über nicht verwendete Optionen und Pakete'))

        # -- Tabs --
        self.tabWidget: QTabWidget
        self.tabWidget.setTabText(0, _('Ergebnis'))
        self.tabWidget.setTabIcon(0, IconRsc.get_icon('options'))
        self.tabWidget.setTabText(1, _('Nicht verwendete Optionen'))
        self.tabWidget.setTabIcon(1, IconRsc.get_icon('delete_list'))

        # --- Tree Views ---
        self.unused_tree = self._init_tree_view(self.unused_tree)
        self.result_tree = self._init_tree_view(self.result_tree)
        self.unused_tree.view_refreshed.connect(self.completeChanged)
        self.result_tree.view_refreshed.connect(self.completeChanged)

        self.check_complete_timer = QTimer()
        self.check_complete_timer.setInterval(1000)
        self.check_complete_timer.timeout.connect(self.completeChanged)
Ejemplo n.º 3
0
    def __init__(self, ui, menu_edit):
        """

        :param modules.gui.main_ui.KnechtWindow ui:
        :param modules.widgets.menu_edit.EditMenu menu_edit:
        """
        super(DocHistoryWidget, self).__init__(ui)
        SetupWidget.from_ui_file(self, Resource.ui_paths['knecht_history'])

        self.setWindowFlags(Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint)
        self.setWindowIcon(IconRsc.get_icon('later'))

        # --- Setup Fields ---
        self.ui = ui
        self.menu_edit = menu_edit

        self.view_mgr: UiViewManager = None
        self.viewList: QListWidget = self.viewList
        self.tab: QTabWidget = self.ui.srcTabWidget
        self.undo_grp: QUndoGroup = ui.app.undo_grp
        self.time_machine = None

        # --- Buttons ---
        self.jumpBtn: QPushButton = self.jumpBtn
        self.jumpBtn.setIcon(IconRsc.get_icon('history'))
        self.jumpBtn.setText(_('Zum gewählten Schritt springen'))
        self.jumpBtn.pressed.connect(self.time_jump)

        self.redoBtn: QPushButton = self.redoBtn
        self.undoBtn: QPushButton = self.undoBtn
        self.redoBtn.setEnabled(False)
        self.undoBtn.setEnabled(False)
        self.redoBtn.setIcon(IconRsc.get_icon('redo'))
        self.redoBtn.setText(_('Schritt Vorwärts'))
        self.undoBtn.setIcon(IconRsc.get_icon('undo'))
        self.undoBtn.setText(_('Schritt Zurück'))
        # Create undo/redo actions from undo_grp
        self.redo = self.undo_grp.createRedoAction(self, 'Redo')
        self.redo.changed.connect(self.undo_action_changed)
        self.undo = self.undo_grp.createUndoAction(self, 'Undo')
        self.undo.changed.connect(self.undo_action_changed)

        self.redoBtn.released.connect(self.redo.trigger)
        self.undoBtn.released.connect(self.undo.trigger)
        self.addActions([self.redo, self.undo])

        # --- Update delay ---
        self.update_view_timer.timeout.connect(self._update_view)

        # --- Connect viewList ---
        self.viewList.itemDoubleClicked.connect(self.time_jump_item_click)

        self.active_stack: QUndoStack = self.undo_grp.activeStack()
        QTimer.singleShot(1, self.delayed_setup)
Ejemplo n.º 4
0
    def __init__(self, parent_widget, ui, menu_name: str = _('Baum')):
        """
        :param modules.gui.main_ui.KnechtWindow ui: The main ui class
        :param str menu_name: Edit Menu display name
        """
        super(TreeMenu, self).__init__(menu_name, parent_widget)

        self.parent_widget = parent_widget
        self.ui = ui
        self.view: KnechtTreeView = None

        sort_view = QAction(IconRsc.get_icon('sort'),
                            _('Breite der Kopfspalten an Bauminhalt anpassen'),
                            self)
        sort_view.triggered.connect(self.sort_current_tree)
        quick_view = QAction(IconRsc.get_icon('eye'),
                             _('Schnellansicht ein-/ausschalten'), self)
        quick_view.triggered.connect(self.ui.pushButton_Dest_show.animateClick)
        self.clear_view = QAction(IconRsc.get_icon('delete_list'),
                                  _('Bauminhalt vollständig verwerfen'), self)
        self.clear_view.triggered.connect(self.clear_current_tree)
        self.addActions([sort_view, quick_view, self.clear_view])

        self.addSeparator()

        reset_filter = QAction(IconRsc.get_icon('reset'),
                               _('Filter zurücksetzen\tEsc'), self)
        reset_filter.triggered.connect(self.clear_view_filter)
        collapse_all = QAction(IconRsc.get_icon('options'),
                               _('Bauminhalte vollständig einklappen\t2x Esc'),
                               self)
        collapse_all.triggered.connect(self.collapse_tree)
        self.addActions([reset_filter, collapse_all])

        self.addSeparator()

        self.move_grp = QActionGroup(self)
        self.m_up = QAction(
            IconRsc.get_icon('arrow_up'),
            _('Selektierte Elemente aufwärts verschieben\tPfeil auf'),
            self.move_grp)
        self.m_dn = QAction(
            IconRsc.get_icon('arrow'),
            _('Selektierte Elemente abwärts verschieben\tPfeil ab'),
            self.move_grp)
        self.j_up = QAction(
            IconRsc.get_icon('arrow_up'),
            _('Selektierte Elemente 10 Schritte aufwärts verschieben\tBild auf'
              ), self.move_grp)
        self.j_dn = QAction(
            IconRsc.get_icon('arrow'),
            _('Selektierte Elemente 10 Schritte abwärts verschieben\tBild ab'),
            self.move_grp)
        self.move_grp.triggered.connect(self.move)
        self.addActions([self.m_up, self.m_dn, self.j_up, self.j_dn])

        self.aboutToShow.connect(self.update_current_view)
Ejemplo n.º 5
0
 def create_editor(self, parent, option, index):
     editor = QPushButton(parent)
     editor.setIcon(IconRsc.get_icon('folder'))
     editor.index = index
     editor.output_dir = ''
     editor.pressed.connect(self.set_file_path)
     return editor
Ejemplo n.º 6
0
    def add_source_path_object(self):
        src_path = QObject(self)
        h_layout = QHBoxLayout(self.srcGrp)
        label = QLabel(f'Source_{len(self.src_path_objects)}')
        h_layout.addWidget(label)
        line_edit = QLineEdit(self.srcGrp)
        h_layout.addWidget(line_edit)
        tool_btn = QToolButton(self.srcGrp)
        tool_btn.setText('...')
        h_layout.addWidget(tool_btn)
        del_btn = QPushButton(self.srcGrp)
        del_btn.setIcon(IconRsc.get_icon('delete'))
        h_layout.addWidget(del_btn)
        del_btn.src_path = src_path
        del_btn.released.connect(self.remove_source_path_object)
        path_widget = SetDirectoryPath(self,
                                       line_edit=line_edit,
                                       tool_button=tool_btn)

        src_path.layout = h_layout
        src_path.path_widget = path_widget

        # Save widget in path objects list and add widget to source path layout
        self.src_path_objects.append(src_path)
        self.srcLayout.addLayout(h_layout)
Ejemplo n.º 7
0
    def create_scene_action(self, scene_name: str, is_active: bool):
        s = QAction(IconRsc.get_icon('document'), scene_name, self.action_grp)
        s.setCheckable(True)
        s.setChecked(is_active)
        s.triggered.connect(self._toggle_scene)

        self.addAction(s)
Ejemplo n.º 8
0
    def populate_result_tree(self, src_idx_selection_ls):
        self.result_tree.clear()

        # -- Populate Selection TreeWidget ---
        trim_items = dict()
        for model_code in self.wizard.session.data.fakom_selection.keys():
            trim = [t for t in self.wizard.session.data.import_data.models if t.model == model_code][0]
            trim_item_name = f'{trim.model_text} {model_code}'
            trim_item = QTreeWidgetItem([trim_item_name])
            trim_item.setIcon(0, IconRsc.get_icon('car'))
            trim_items[trim_item_name] = trim_item

        for src_index in src_idx_selection_ls:
            trim_idx = self.get_index_group_parent(src_index)
            model = trim_idx.siblingAtColumn(Kg.VALUE).data(Qt.DisplayRole)
            trim_item_name = f'{trim_idx.siblingAtColumn(Kg.NAME).data(Qt.DisplayRole)} {model}'

            trim_item = trim_items.get(trim_item_name)
            trim_item.setData(0, Qt.UserRole, trim_idx)

            name = src_index.siblingAtColumn(Kg.NAME).data(Qt.DisplayRole)
            icon = src_index.siblingAtColumn(Kg.style_column).data(Qt.DecorationRole) or QIcon()
            item = QTreeWidgetItem(trim_item, [name])
            item.setData(0, Qt.UserRole, src_index)
            item.setIcon(0, icon)

        # -- Expand DeltaGenResult Tree --
        for trim_item in trim_items.values():
            self.result_tree.addTopLevelItem(trim_item)
            self.result_tree.expandItem(trim_item)
Ejemplo n.º 9
0
    def ask(self, save_call):
        self.button(QMessageBox.Save).setText(self.save_txt)
        self.button(QMessageBox.Save).setIcon(IconRsc.get_icon('disk'))
        self.button(QMessageBox.Save).setStyleSheet('padding: 4px 6px;')
        self.button(QMessageBox.Ok).setText(self.ok_txt)
        self.button(QMessageBox.Ok).setIcon(IconRsc.get_icon('play'))
        self.button(QMessageBox.Ok).setStyleSheet('padding: 4px 6px;')
        self.button(QMessageBox.Abort).setText(self.abort_txt)
        self.button(QMessageBox.Abort).setIcon(IconRsc.get_icon('stop'))
        self.button(QMessageBox.Abort).setStyleSheet('padding: 4px 6px;')

        result = self.exec_()
        if result == QMessageBox.Ok:
            return True
        elif result == QMessageBox.Save:
            save_call()
        return False
Ejemplo n.º 10
0
    def __init__(self, view: KnechtTreeViewCheckable):
        super(CheckableViewContext, self).__init__('Tree_Context', view)

        self.select_all = QAction(IconRsc.get_icon('check_box'),
                                  _('Alle Einträge auswählen'))
        self.select_all.triggered.connect(self.select_all_items)
        self.select_selected = QAction(IconRsc.get_icon('navicon'),
                                       _('Selektierte Einträge auswählen'))
        self.select_selected.triggered.connect(self.select_selected_items)
        self.select_none = QAction(IconRsc.get_icon('check_box_empty'),
                                   _('Alle Einträge abwählen'))
        self.select_none.triggered.connect(self.select_no_items)

        self.addActions(
            [self.select_all, self.select_selected, self.select_none])

        self.view = view
        self.view.installEventFilter(self)
Ejemplo n.º 11
0
    def ask(self, title: str='', txt: str='', ok_btn_txt: str='', abort_btn_txt: str=''):
        if title:
            self.setWindowTitle(title)
        if txt:
            self.setText(txt)

        ok_btn_txt = ok_btn_txt or self.continue_txt
        abort_btn_txt = abort_btn_txt or self.abort_txt

        self.button(QMessageBox.Ok).setText(ok_btn_txt)
        self.button(QMessageBox.Ok).setIcon(IconRsc.get_icon('play'))
        self.button(QMessageBox.Ok).setStyleSheet('padding: 4px 6px;')
        self.button(QMessageBox.Abort).setText(abort_btn_txt)
        self.button(QMessageBox.Abort).setIcon(IconRsc.get_icon('stop'))
        self.button(QMessageBox.Abort).setStyleSheet('padding: 4px 6px;')

        if self.exec_() == QMessageBox.Ok:
            return True
        return False
Ejemplo n.º 12
0
 def create_current_item(self, flags):
     if self.active_stack.index() == 0:
         txt = _('  0: Geladener Zustand des Dokuments')
     else:
         txt = _('  0: Aktueller Zustand des Dokuments')
     current_item = QListWidgetItem(txt)
     current_item.setForeground(self.fg_black)
     current_item.setBackground(self.bg_grey)
     current_item.setFlags(flags)
     current_item.setIcon(IconRsc.get_icon('options'))
     return current_item
Ejemplo n.º 13
0
    def __init__(self, view, wizard):
        """

        :param modules.itemview.treeview.KnechtTreeView view: the view to manipulate
        :param modules.gui.wizard.wizard.PresetWizard wizard: The parent wizard
        """
        super(PresetTreeContextMenu, self).__init__(parent=view)
        self.view = view
        self.view.installEventFilter(self)
        self.wizard = wizard

        clear = QAction(IconRsc.get_icon('delete_list'),
                        _('Alle Optionen entfernen'), self)
        clear.triggered.connect(self.view.clear_tree)

        rem = QAction(IconRsc.get_icon('trash-a'),
                      _('Selektierte Zeilen entfernen\tEntf'), self)
        rem.triggered.connect(self.remove_rows)

        self.addActions((clear, rem))
Ejemplo n.º 14
0
    def update_recent_files_menu(self):
        self.recent_menu.clear()

        if not len(KnechtSettings.app['recent_files']):
            no_entries_dummy = QAction(_("Keine Einträge vorhanden"),
                                       self.recent_menu)
            no_entries_dummy.setEnabled(False)
            self.recent_menu.addAction(no_entries_dummy)

        for idx, entry in enumerate(KnechtSettings.app['recent_files']):
            if idx >= 20:
                break

            file, file_type = entry
            file_name = Path(file).stem

            if not path_exists(file):
                # Skip and remove non existing files
                KnechtSettings.app['recent_files'].pop(idx)
                continue

            recent_action = QAction(f'{file_name} - {file_type}',
                                    self.recent_menu)
            recent_action.file = Path(file)

            if file_type == 'xml':
                recent_action.setText(f'{file_name} - Xml Presets')
                recent_action.setIcon(IconRsc.get_icon('document'))
                recent_action.triggered.connect(self._open_recent_xml_file)
            elif file_type == 'xlsx':
                recent_action.setText(f'{file_name} - Excel Import')
                recent_action.setIcon(IconRsc.get_icon('excel'))
                recent_action.triggered.connect(self._open_recent_xlsx_file)
            elif file_type == 'rksession':
                recent_action.setText(f'{file_name} - Preset Wizard Session')
                recent_action.setIcon(IconRsc.get_icon('qub_button'))
                recent_action.triggered.connect(self._open_recent_rksession)

            self.recent_menu.addAction(recent_action)

        self.recent_files_changed.emit()
Ejemplo n.º 15
0
    def __init__(self, widget, ui):
        super(JobManagerContextMenu, self).__init__(widget)
        self.widget, self.ui = widget, ui

        add_context_action(self,
                           self.cancel_job_item,
                           IconRsc.get_icon('close'),
                           desc=_('Job abbrechen'))
        add_context_action(self,
                           self.force_psd_creation,
                           IconRsc.get_icon('reset_state'),
                           desc=_('PSD Erstellung erzwingen.'))
        add_context_action(self,
                           self.open_output_dir,
                           IconRsc.get_icon('folder'),
                           desc=_('Ausgabe Verzeichnis öffnen'))
        add_context_action(self,
                           self.remove_render_file,
                           IconRsc.get_icon('trash'),
                           desc=_('Maya Rendering Szene löschen'))
        add_context_action(self,
                           self.move_job_top,
                           IconRsc.get_icon('options'),
                           desc=_('An den Anfang der Warteschlange'))
        add_context_action(self,
                           self.move_job_back,
                           IconRsc.get_icon('options'),
                           desc=_('An das Ende der Warteschlange'))

        self.widget.installEventFilter(self)
Ejemplo n.º 16
0
    def __init__(self, ui, menu_name: str = _('Baum Kontextmenü')):
        """ Context menu of document tabs

        :param modules.gui.main_ui.KnechtWindow ui: main window ui class
        :param str menu_name: name of the menu
        """
        super(TabContextMenu, self).__init__(menu_name, ui)
        self.ui, self.status_bar = ui, ui.statusBar()

        self.context_tab_index = -1

        grp = QActionGroup(self)
        self.copy_action = QAction(
            IconRsc.get_icon('options'),
            _('Dokumenten Pfad in Zwischenablage kopieren'), grp)
        self.open_action = QAction(IconRsc.get_icon('folder'),
                                   _('Dokumenten Pfad öffnen'), grp)
        grp.triggered.connect(self.doc_action)
        self.addActions([self.copy_action, self.open_action])

        self.tab_bar = self.ui.srcTabWidget.tabBar()
        self.tab_bar.installEventFilter(self)
Ejemplo n.º 17
0
    def create_preset_page_entries(self):
        self.clear()
        num_pages = len(self.wizard.session.data.preset_page_ids)

        if not num_pages:
            empty_entry = QAction(IconRsc.get_icon('close'),
                                  _('Keine Einträge vorhanden'), self)
            empty_entry.setDisabled(True)
            self.button.setEnabled(False)
            return

        for page_id in self.wizard.session.data.preset_page_ids:
            current_num = page_id - 3
            page = self.wizard.page(page_id)
            title = f'{current_num:02d}/{num_pages:02d} - {page.model} {page.fakom}'

            entry = QAction(IconRsc.get_icon('preset'), title, self)
            entry.target_id = page_id
            entry.triggered.connect(self.navigate_to_page)
            self.addAction(entry)

        self.button.setEnabled(True)
Ejemplo n.º 18
0
    def populate_list_view(self):
        stack = self.active_stack
        ls = self.viewList
        ls.clear()

        undo_idx = max(0, stack.index() - 1)
        redo_idx = stack.index()

        for c in range(0, stack.count()):
            txt = stack.text(c)
            icon = IconRsc.get_icon('history')

            if c == undo_idx:
                icon = IconRsc.get_icon('undo')

            if c == redo_idx:
                icon = IconRsc.get_icon('forward')

            self.create_history_item(c, txt, icon, redo_idx)

        current_item = self.create_current_item(self.disabled_flags)
        self.viewList.insertItem(redo_idx, current_item)
Ejemplo n.º 19
0
    def __init__(self, ui):
        """ Menu to import data

        :param modules.gui.main_ui.KnechtWindow ui:
        """
        super(ImportMenu, self).__init__(_("Import"), ui)
        self.ui = ui

        xl_action = QAction(IconRsc.get_icon('excel'), _('V-Plus Browser'),
                            self)
        xl_action.triggered.connect(self.open_xlsx)
        fa_action = QAction(IconRsc.get_icon('fakom'), _('FaKom Lutscher'),
                            self)
        fa_action.triggered.connect(self.open_fakom)
        pw_action = QAction(IconRsc.get_icon('qub_button'),
                            _('Preset Assistent'), self)
        pw_action.triggered.connect(self.open_wizard)
        dp_action = QAction(IconRsc.get_icon('storage'),
                            _('Datapool Einträge'), self)
        dp_action.triggered.connect(self.open_db)

        self.addActions([xl_action, fa_action, pw_action, dp_action])
Ejemplo n.º 20
0
    def setup_deltagen_menu(self):
        # ---- Reset On/Off ----
        self.reset = self._setup_checkable_action(_('Reset senden'), True,
                                                  self.toggle_reset)

        # ---- Freeze Viewer On/Off ----
        self.freeze = self._setup_checkable_action(_('Freeze Viewer'), True,
                                                   self.toggle_freeze_viewer)

        # ---- Variants State Check On/Off ----
        self.check = self._setup_checkable_action(
            _('Varianten State Check'), True, self.toggle_variants_state_check)

        # ---- Send Camera Data On/Off ----
        self.send_camera = self._setup_checkable_action(
            _('Kamera Daten übertragen'), True, self.toggle_camera_send)

        # ---- Display State Check On/Off ----
        self.display = self._setup_checkable_action(
            _('State Check im Baum anzeigen'), False,
            self.toggle_state_check_display)

        # ---- Display Overlay after Preset Send operation finished ----
        self.display_overlay = self._setup_checkable_action(
            _('Zuletzt gesendetes Preset als Overlay anzeigen'), False,
            self.toggle_display_finished_overlay)

        # ---- Assign Dummy Material before applying PlmXml Materials
        self.enable_material_dummy = self._setup_checkable_action(
            _('Dummy Material auf PlmXml Konfiguration anwenden'), False,
            self.toggle_plmxml_material_dummy)

        # ---- Validate DeltaGen Scene vs PlmXml before switching configurations
        self.validate_plmxml = self._setup_checkable_action(
            _('DeltaGen Szene vor dem konfigurieren mit PlmXml abgleichen.'),
            True, self.toggle_validate_plmxml, self.hidden_actions)

        # --- As Connector choose active scene menu ---
        self.as_scene_menu.deleteLater()
        self.as_scene_menu = AsSceneMenu(self.ui,
                                         _('AsConnector aktive Szene:'))
        self.addMenu(self.as_scene_menu)

        # --- Change DeltaGen Command Port
        self.change_port = QAction(IconRsc.get_icon('paperplane'),
                                   _('DeltaGen Port ändern'), self)
        self.change_port.triggered.connect(self.change_deltagen_port)
        self.addAction(self.change_port)

        self._apply_settings()
Ejemplo n.º 21
0
    def __init__(self, view, preset_page):
        """

        :param modules.itemview.treeview.KnechtTreeView view: the view to manipulate
        :param PresetWizardPage preset_page: The parent wizard
        """
        super(OptionTreeContextMenu, self).__init__(parent=view)
        self.view = view
        self.view.installEventFilter(self)

        self.preset_page = preset_page

        add = QAction(IconRsc.get_icon('lock'),
                      _('Selektierte Optionen sperren'), self)
        add.triggered.connect(self.preset_page.user_lock_options)
        add.view = self.view

        rem = QAction(IconRsc.get_icon('lock_open'),
                      _('Selektierte Optionen entsperren'), self)
        rem.triggered.connect(self.preset_page.user_unlock_options)
        rem.view = self.view

        self.addActions((add, rem))
Ejemplo n.º 22
0
    def _setup_checkable_action(self,
                                name: str,
                                checked: bool,
                                target: object,
                                action_grp: QActionGroup = None):
        check_icon = IconRsc.get_icon('check_box_empty')
        check_icon.addPixmap(IconRsc.get_pixmap('check_box'), QIcon.Normal,
                             QIcon.On)

        if action_grp:
            action = QAction(check_icon, name, action_grp)
        else:
            action = QAction(check_icon, name, self)
        action.setCheckable(True)
        action.setChecked(checked)
        action.triggered.connect(target)
        self.addAction(action)

        return action
Ejemplo n.º 23
0
    def style_column(cls,
                     item: KnechtItem,
                     item_type_key: str = None,
                     column: int = 0) -> None:
        item_type_key = item_type_key or item.data(Kg.TYPE)

        if not column:
            column = Kg.style_column

        if item_type_key not in cls.ICON_MAP.keys():
            return

        if item.data(column, Qt.DecorationRole):
            return

        icon_key = cls.ICON_MAP[item_type_key]
        icon = IconRsc.get_icon(icon_key)

        item.itemData[Qt.DecorationRole][column] = icon
Ejemplo n.º 24
0
    def _next_entry(self, called_from_timer: bool = True):
        """ Display the next entry in the queue """
        if self.btn_list:
            return

        if self.queue:
            message, duration, buttons = self.queue.pop(0)
            LOGGER.debug('Displaying: %s (%s)', message[:30], len(self.queue))
        else:
            self.display_exit()
            LOGGER.debug('Overlay stopping.')
            return

        if buttons:
            self.anchors = dict()
            self.btn_list = [self.create_button(btn) for btn in buttons]
            self.btn_box.show()
        else:
            self.btn_box.hide()

        if not self.use_msg_browser:
            self.text_label.setText(message)
            self.show_all()
            self.restore_visibility()
        else:
            message = f'<b>{self.parent.objectName()} {datetime.now().strftime("(%H:%M:%S)")}:</b><br />{message}'
            self.msg_browser.append(message)
            self.tab_widget_anim.blink()
            if self.msg_tab.currentIndex() != self.msg_tab_idx:
                self.msg_tab.setTabIcon(self.msg_tab_idx,
                                        IconRsc.get_icon('assignment_msg_new'))

        # Animate if not called from the queue timer
        if not called_from_timer and not self.message_active:
            self.overlay_grp.setUpdatesEnabled(False)
            self._init_fade_anim(True)
            QTimer.singleShot(150, self._enable_updates)

        QTimer.singleShot(1, self._adapt_size)
        self.message_active = True
        self.msg_timer.start(duration)
Ejemplo n.º 25
0
    def __init__(self, ui, menu_name: str = _('DeltaGen')):
        """ Setup AsConnector Scene Selection menu

        :param modules.gui.main_ui.KnechtWindow ui:
        :param menu_name: name of the menu that will be displayed
        """
        super(AsSceneMenu, self).__init__(menu_name, ui)
        self.ui = ui

        self.addAction(self._no_conn_action())

        self.action_grp = QActionGroup(self)
        self.action_grp.setExclusive(True)

        self.setIcon(IconRsc.get_icon('paperplane'))

        self._awaiting_result = False

        self.aboutToShow.connect(self._about_to_show)

        QTimer.singleShot(500, self._delayed_setup)
Ejemplo n.º 26
0
 def update_ready(self):
     update_icon = IconRsc.get_icon('update-ready')
     self.menu.setIcon(update_icon)
     self.ui.actionVersionCheck.setIcon(update_icon)
Ejemplo n.º 27
0
    def __init__(self, wizard, model: str, fakom: str):
        """ Page for one Preset with available PR-Options and Packages tree's

        :param modules.gui.wizard.wizard.PresetWizard wizard: The parent wizard
        :param str model: model code
        :param str fakom: fakom code
        """
        super(PresetWizardPage, self).__init__()
        self.wizard = wizard
        self.model = model
        self.fakom = fakom

        trim = [
            x for x in wizard.session.data.import_data.models
            if x.model == model
        ][0]
        self.model_text = trim.model_text

        SetupWidget.from_ui_file(self, Resource.ui_paths['wizard_preset'])

        # -- Title --
        self.page_num = 1 + len(self.wizard.session.data.preset_page_ids)

        # -- Sub Title Update Timer --
        self.update_title_timer = QTimer()
        self.update_title_timer.setInterval(25)
        self.update_title_timer.setSingleShot(True)
        self.update_title_timer.timeout.connect(self.update_page_title)

        # -- Trigger filter update for all views ---
        self.update_filter_timer = QTimer()
        self.update_filter_timer.setInterval(5)
        self.update_filter_timer.setSingleShot(True)
        self.update_filter_timer.timeout.connect(self.update_filter_all_views)

        self.line_edit_preset: QLineEdit
        self.line_edit_preset.textChanged.connect(
            self.update_filter_timer.start)

        # -- Setup Page Ui --
        self.option_auto_btn: QPushButton
        self.option_auto_btn.setText(_('Preset auto&magisch befüllen'))
        self.option_auto_btn.setIcon(IconRsc.get_icon('qub_button'))
        self.option_auto_btn.setStatusTip(
            _('Aktuelles Preset automagisch mit nicht verwendeten Optionen befüllen. '
              'Bezugs-, Sitz-, Leder oder Fahrwerksoptionen werden ignoriert.')
        )
        self.option_auto_btn.released.connect(self.fill_automagically)

        self.option_hide_btn: QPushButton
        eye_icon = IconRsc.get_icon('eye')
        eye_icon.addPixmap(IconRsc.get_pixmap('eye-disabled'), QIcon.Normal,
                           QIcon.On)
        self.option_hide_btn.setIcon(eye_icon)
        self.option_hide_btn.setStatusTip(
            _('Bereits verwendete Optionen ein- oder ausblenden'))
        self.option_hide_btn.toggled.connect(self.update_available_options)

        self.option_lock_btn: QPushButton
        lock_icon = IconRsc.get_icon('lock_open')
        lock_icon.addPixmap(IconRsc.get_pixmap('lock'), QIcon.Normal, QIcon.On)
        self.option_lock_btn.setIcon(lock_icon)
        self.option_lock_btn.setStatusTip(
            _('Bereits verwendete Optionen für die Bearbeitung sperren'))
        self.option_lock_btn.toggled.connect(self.update_available_options)

        self.option_tree_btn: QPushButton
        opt_icon = QIcon(IconRsc.get_pixmap('options'))
        opt_icon.addPixmap(IconRsc.get_pixmap('options-neg'), QIcon.Normal,
                           QIcon.On)
        self.option_tree_btn.setIcon(opt_icon)
        self.option_tree_btn.setStatusTip(
            _('Spalte Beschreibung ein- oder ausblenden'))
        self.option_tree_btn.toggled.connect(self.update_view_headers)

        # -- Replace Placeholder TreeViews --
        self.pkg_tree = self._init_tree_view(
            self.pkg_tree, self.wizard.session.pkg_models.get(model))
        self.pkg_tree.permanent_type_filter_column = Kg.VALUE
        self.pkg_tree.context = OptionTreeContextMenu(self.pkg_tree, self)
        self.option_tree = self._init_tree_view(
            self.option_tree, self.wizard.session.opt_models.get(model))
        self.option_tree.permanent_type_filter_column = Kg.NAME
        self.option_tree.context = OptionTreeContextMenu(
            self.option_tree, self)

        # -- Setup Preset Tree --
        self.preset_tree = self._init_tree_view(self.preset_tree,
                                                KnechtModel())
        self.preset_tree.supports_drop = True
        self.preset_tree.supports_drag_move = True
        self.preset_tree.is_wizard_preset_view = True
        self.preset_tree.context = PresetTreeContextMenu(
            self.preset_tree, self.wizard)
        self.preset_tree.shortcut_override = PresetTreeViewShortcutOverrides(
            self.preset_tree)
        self.preset_tree.view_refreshed.connect(self.update_available_options)

        # Initial Tree sort
        QTimer.singleShot(50, self.update_view_headers)
Ejemplo n.º 28
0
    def setup_file_menu(self):
        insert_before = 0
        if self.ui.actionBeenden in self.menu.actions():
            insert_before = self.ui.actionBeenden
            self.ui.actionBeenden.setIcon(IconRsc.get_icon('sad'))
            self.ui.actionBeenden.setShortcut(QKeySequence('Ctrl+Q'))

        # ---- New file ----
        new_action = QAction(IconRsc.get_icon('document'), _('Neu\tStrg+N'),
                             self.menu)
        new_action.setShortcut(QKeySequence('Ctrl+N'))
        new_action.triggered.connect(self.new_document)
        self.menu.insertAction(insert_before, new_action)

        # ---- Open ----
        open_xml_action = QAction(_('Öffnen\tStrg+O'), self.menu)
        open_xml_action.setShortcut(QKeySequence('Ctrl+O'))
        open_xml_action.triggered.connect(self.open_xml)
        open_xml_action.setIcon(IconRsc.get_icon('folder'))
        self.menu.insertAction(insert_before, open_xml_action)

        # ---- Import Menu ----
        self.menu.insertMenu(insert_before, self.import_menu)

        # ---- Save ----
        save_xml_action = QAction(_('Speichern\tStrg+S'), self.menu)
        save_xml_action.setShortcut(QKeySequence('Ctrl+S'))
        save_xml_action.triggered.connect(self.save_xml)
        save_xml_action.setIcon(IconRsc.get_icon('disk'))
        self.menu.insertAction(insert_before, save_xml_action)

        save_as_action = QAction(_('Speichern unter ...\tStrg+Shift+S'),
                                 self.menu)
        save_as_action.setShortcut(QKeySequence('Ctrl+Shift+S'))
        save_as_action.triggered.connect(self.save_as_xml)
        save_as_action.setIcon(IconRsc.get_icon('save_alt'))
        self.menu.insertAction(insert_before, save_as_action)

        self.menu.insertSeparator(insert_before)

        # ---- Apps ----
        start_knecht_viewer = QAction(_('KnechtViewer starten'), self.menu)
        start_knecht_viewer.triggered.connect(self.start_knecht_viewer)
        start_knecht_viewer.setIcon(IconRsc.get_icon('img'))
        self.menu.insertAction(insert_before, start_knecht_viewer)
        if not path_exists(self.viewer_app):
            LOGGER.info('KnechtViewer executable could not be found: %s',
                        self.viewer_app.as_posix())
            start_knecht_viewer.setEnabled(False)

        start_schnuffi_app = QAction(_('POS Schnuffi starten'), self.menu)
        start_schnuffi_app.triggered.connect(self.start_schnuffi_app)
        start_schnuffi_app.setIcon(IconRsc.get_icon('dog'))
        self.menu.insertAction(insert_before, start_schnuffi_app)
        if not path_exists(self.schnuffi_app):
            LOGGER.info('KnechtViewer executable could not be found: %s',
                        self.schnuffi_app.as_posix())
            start_schnuffi_app.setEnabled(False)

        img_conv = QAction(_('Bilddaten konvertieren ...'))
        img_conv.triggered.connect(self.convert_image_directory)
        img_conv.setIcon(IconRsc.get_icon('render'))
        self.menu.insertAction(insert_before, img_conv)

        material_merger = QAction('AViT Material Merger')
        material_merger.triggered.connect(self.start_material_merger)
        material_merger.setIcon(IconRsc.get_icon('options'))
        self.menu.insertAction(insert_before, material_merger)

        self.menu.insertSeparator(insert_before)

        # ---- Recent files menu ----
        self.recent_menu.aboutToShow.connect(self.update_recent_files_menu)
        self.menu.insertMenu(insert_before, self.recent_menu)

        self.menu.insertSeparator(insert_before)
Ejemplo n.º 29
0
    def clean_view(self):
        self.viewList.clear()

        origin = QListWidgetItem(_('Keine Historie Einträge'), self.viewList)
        origin.setIcon(IconRsc.get_icon('history'))
Ejemplo n.º 30
0
 def _style_index_checked(self, src_idx: QModelIndex):
     self.fakom_tree.model().sourceModel().setData(src_idx, IconRsc.get_icon('checkmark'), Qt.DecorationRole)