Exemple #1
0
    def _init_tree_view(self, tree_view: QTreeView) -> KnechtTreeView:
        """ Replace the UI Designer placeholder tree views """
        parent = tree_view.parent()
        new_view = KnechtTreeView(parent, None)
        replace_widget(tree_view, new_view)

        # DeltaGenResult wizard specific
        new_view.setEditTriggers(QTreeView.NoEditTriggers)
        new_view.setDragDropMode(QTreeView.NoDragDrop)
        new_view.supports_drag_move = False
        new_view.supports_drop = False

        # Setup filter widget
        new_view.filter_text_widget = self.filter_edit
        # Setup keyboard shortcuts
        new_view.shortcuts = KnechtTreeViewShortcuts(new_view)
        # Override Edit Shotcuts
        new_view.shortcut_overrides = PresetTreeViewShortcutOverrides(new_view)

        # Update with placeholder Model to avoid access to unset attributes
        UpdateModel(new_view).update(KnechtModel())

        for column in (Kg.VALUE, Kg.TYPE, Kg.REF, Kg.ID):
            new_view.hideColumn(column)

        return new_view
Exemple #2
0
    def replace_tree_view(self, tree_view: QTreeView) -> KnechtTreeView:
        """ Replace the UI Designer placeholder tree views """
        parent = tree_view.parent()
        new_view = KnechtTreeView(parent, self.undo_grp)
        replace_widget(tree_view, new_view)

        return new_view
    def replace_view(self, old_view):
        """ Replace an existing placeholder view """
        replace_widget(old_view, self)

        # Update with placeholder Model to avoid access to unset attributes
        UpdateModel(self).update(KnechtModel())

        # most Dialogs do not require a column description
        self.setHeaderHidden(True)
    def _init_tree_view(self, tree_view: QTreeView) -> KnechtTreeView:
        """ Replace the UI Designer placeholder tree views """
        parent = tree_view.parent()
        new_view = KnechtTreeView(parent, None)
        replace_widget(tree_view, new_view)

        new_view.pressed.connect(self._view_item_pressed)

        return new_view
Exemple #5
0
    def _init_tree_view(self, tree_view: QTreeView,
                        item_model: KnechtModel) -> KnechtTreeView:
        """ Replace the UI Designer placeholder tree views """
        parent = tree_view.parent()
        new_view = KnechtTreeView(parent, self.wizard.ui.app.undo_grp)
        replace_widget(tree_view, new_view)

        # Preset wizard specific
        new_view.setEditTriggers(QTreeView.NoEditTriggers)
        new_view.supports_drag_move = False
        new_view.supports_drop = False

        # Setup filter widget
        new_view.filter_text_widget = self.line_edit_preset
        # Setup keyboard shortcuts
        new_view.shortcuts = KnechtTreeViewShortcuts(new_view)

        # Update with placeholder Model to avoid access to unset attributes
        UpdateModel(new_view).update(item_model or KnechtModel())

        for column in self.hidden_columns_a:
            new_view.hideColumn(column)

        return new_view
Exemple #6
0
    def _init_tree_view(self, tree_view: QTreeView) -> KnechtTreeView:
        """ Replace the UI Designer placeholder tree views """
        parent = tree_view.parent()
        new_view = KnechtTreeView(parent, None)
        replace_widget(tree_view, new_view)

        # Fakom wizard specific
        new_view.setSelectionMode(QTreeView.NoSelection)
        new_view.setSelectionBehavior(QTreeView.SelectRows)
        new_view.setEditTriggers(QTreeView.NoEditTriggers)
        new_view.setDragDropMode(QTreeView.NoDragDrop)
        new_view.supports_drag_move = False
        new_view.setIndentation(15)

        # Setup filter widget
        new_view.filter_text_widget = self.filter_edit
        # Setup keyboard shortcuts
        new_view.shortcuts = KnechtTreeViewShortcuts(new_view)

        # Update with placeholder Model to avoid access to unset attributes
        UpdateModel(new_view).update(KnechtModel())
        new_view.clicked.connect(self._fakom_item_pressed)

        return new_view
Exemple #7
0
    def replace_resolution_edit(default_widget: QWidget):
        parent = default_widget.parent()
        new_widget = ResolutionLineEdit(parent)
        replace_widget(default_widget, new_widget)

        return new_widget
Exemple #8
0
    def __init__(self, ui, plmxml_file: Path, variants: KnechtVariantList):
        """ Generic welcome page

        :param modules.gui.main_ui.KnechtWindow ui: Knecht main window
        """
        super(KnechtPlmXmlScene, self).__init__(ui)
        SetupWidget.from_ui_file(self,
                                 Resource.ui_paths['knecht_plmxml_scene'])
        self.ui = ui
        self.setWindowTitle(_('PlmXml Schnuffi'))
        self.plmxml: Optional[PlmXml] = None

        # -- Prepare UI
        self.searchScene: QLineEdit = self.searchScene
        self.searchMaterials: QLineEdit = self.searchMaterials

        # -- File name label
        self.fileLabel: QLabel = self.fileLabel
        self.fileLabel.setText(plmxml_file.name)

        # -- Config Label
        self.configLabel: QLabel = self.configLabel
        self.configLabel.setText(variants.preset_name)

        # -- Config Button
        self.configBtn: QPushButton = self.configBtn
        self.configBtn.toggled.connect(self.toggle_config)
        if not len(variants):
            self.configBtn.setEnabled(False)

        self.config = PlmXmlBaseConfigurator(
            None, create_pr_string_from_variants(variants))

        # -- Open file dir button
        self.fileButton: QPushButton = self.fileButton
        self.fileButton.pressed.connect(self.open_desktop_directory)

        # -- Prepare PlmXml Scene View
        self.scene_tree = KnechtTreeView(self, None)
        self.scene_tree.filter_text_widget = self.searchScene
        self.scene_tree.setIndentation(18)
        # Setup keyboard shortcuts
        shortcuts = KnechtTreeViewShortcuts(self.scene_tree)
        self.scene_tree.shortcuts = shortcuts

        # -- Prepare PlmXml Material View
        self.material_tree = KnechtTreeView(self, None)
        self.material_tree.filter_text_widget = self.searchMaterials
        # Setup keyboard shortcuts
        shortcuts = KnechtTreeViewShortcuts(self.material_tree)
        self.material_tree.shortcuts = shortcuts

        # -- Replace Trees
        replace_widget(self.sceneTree, self.scene_tree)
        replace_widget(self.materialTree, self.material_tree)

        # -- Delete UI Template Trees
        self.sceneTree.deleteLater()
        self.materialTree.deleteLater()

        # -- Workaround PySide2 bug
        self.scene_tree.show()
        self.material_tree.show()

        self.q = Queue()
        t = Thread(target=self.read_plmxml, args=(plmxml_file, self.q))
        t.start()
        self.timer = QTimer()
        self.timer.setSingleShot(False)
        self.timer.setInterval(250)
        self.timer.timeout.connect(self.check_q)
        self.timer.start()