Example #1
0
    def _createButtons(self):
        """
        Create allowable buttons for this Block.
        This will depend on whether this is a user added block.
        """
        self.button_layout = WidgetUtils.addLayout()

        if self.block.user_added:
            self.clone_button = WidgetUtils.addButton(self.button_layout, self, "Clone Block", self._cloneBlock)
            self.clone_shortcut = WidgetUtils.addShortcut(self, "Ctrl+N", self._cloneBlock, shortcut_with_children=True)
            self.clone_button.setToolTip("Clone this block with the same parameters")

            self.remove_button = WidgetUtils.addButton(self.button_layout, self, "Remove Block", self._removeBlock)
            self.remove_button.setToolTip("Remove this block")

        self.apply_button = WidgetUtils.addButton(self.button_layout, self, "Apply", self.applyChanges)
        self.apply_button.setEnabled(False)
        self.apply_button.setToolTip("Apply changes made")

        self.reset_button = WidgetUtils.addButton(self.button_layout, self, "Reset", self.resetChanges)
        self.reset_button.setEnabled(False)
        self.reset_button.setToolTip("Reset changes to when this window was opened")

        self.new_parameter_button = WidgetUtils.addButton(self.button_layout, self, "Add parameter", self.addUserParamPressed)
        self.new_parameter_button.setToolTip("Add a non standard parameter")

        self.close_button = WidgetUtils.addButton(self.button_layout, self, "Close", self._applyAndClose)
        self.close_button.setToolTip("Apply any changes and close the window")
Example #2
0
    def _createButtons(self):
        """
        Create allowable buttons for this Block.
        This will depend on whether this is a user added block.
        """
        self.button_layout = WidgetUtils.addLayout()

        self.close_button = WidgetUtils.addButton(self.button_layout, self, "Apply && Close", self._applyAndClose)
        self.close_button.setToolTip("Apply any changes and close the window")

        self.apply_button = WidgetUtils.addButton(self.button_layout, self, "Apply", self.applyChanges)
        self.apply_button.setEnabled(False)
        self.apply_button.setToolTip("Apply changes made")

        self.reset_button = WidgetUtils.addButton(self.button_layout, self, "Reset", self.resetChanges)
        self.reset_button.setEnabled(False)
        self.reset_button.setToolTip("Reset changes to when this window was opened")

        self.new_parameter_button = WidgetUtils.addButton(self.button_layout, self, "Add parameter", self.addUserParamPressed)
        self.new_parameter_button.setToolTip("Add a non standard parameter")

        if self.block.user_added:
            self.clone_button = WidgetUtils.addButton(self.button_layout, self, "Clone Block", self._cloneBlock)
            self.clone_shortcut = WidgetUtils.addShortcut(self, "Ctrl+N", self._cloneBlock, shortcut_with_children=True)
            self.clone_button.setToolTip("Clone this block with the same parameters")

            self.remove_button = WidgetUtils.addButton(self.button_layout, self, "Remove Block", self._removeBlock)
            self.remove_button.setToolTip("Remove this block")
Example #3
0
    def __init__(self, tree, **kwds):
        """
        Input:
            tree[InputTree]: The input tree to read blocks from.
        """
        super(BlockTree, self).__init__(**kwds)

        self.tree = tree
        self.root_item = self.invisibleRootItem()
        self.header().close()
        self.setFocusPolicy(Qt.WheelFocus)
        self._item_block_map = {}
        self._path_item_map = {}

        self.setAcceptDrops(True)
        self.setDropIndicatorShown(True)
        self.setDragDropMode(QAbstractItemView.InternalMove)
        self._mime_type = "application/x-qabstractitemmodeldatalist"
        self._current_drag = None

        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self._treeContextMenu)
        self.itemClicked.connect(self.onItemClicked)
        self.itemDoubleClicked.connect(self.onItemDoubleClicked)
        self.itemChanged.connect(self.onItemChanged)
        self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
        self.setExpandsOnDoubleClick(False)
        self.setItemsExpandable(True)
        self.setMouseTracking(False)
        self.setSelectionMode(QAbstractItemView.SingleSelection)

        self.clone_shortcut = WidgetUtils.addShortcut(self, "Ctrl+N", self._newBlockShortcut, shortcut_with_children=True)
        self.populateFromTree()
        self.setup()
Example #4
0
    def __init__(self, tree, **kwds):
        """
        Input:
            tree[InputTree]: The input tree to read blocks from.
        """
        super(BlockTree, self).__init__(**kwds)

        self.tree = tree
        self.root_item = self.invisibleRootItem()
        self.header().close()
        self.setFocusPolicy(Qt.WheelFocus)
        self._item_block_map = {}
        self._path_item_map = {}

        self.setAcceptDrops(True)
        self.setDropIndicatorShown(True)
        self.setDragDropMode(QAbstractItemView.InternalMove)
        self._mime_type = "application/x-qabstractitemmodeldatalist"
        self._current_drag = None

        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self._treeContextMenu)
        self.itemClicked.connect(self.onItemClicked)
        self.itemDoubleClicked.connect(self.onItemDoubleClicked)
        self.itemChanged.connect(self.onItemChanged)
        self.setSizePolicy(QSizePolicy.MinimumExpanding,
                           QSizePolicy.MinimumExpanding)
        self.setExpandsOnDoubleClick(False)
        self.setItemsExpandable(True)
        self.setMouseTracking(False)
        self.setSelectionMode(QAbstractItemView.SingleSelection)

        self.clone_shortcut = WidgetUtils.addShortcut(
            self,
            "Ctrl+N",
            self._newBlockShortcut,
            shortcut_with_children=True)
        self.populateFromTree()
        self.setup()
        self.add_action = QAction("Add", None)
        self.remove_action = QAction("Remove", None)