示例#1
0
    def setupUI(self):
        self.setMinimumSize(self._widget_size)
        self.setMaximumSize(self._widget_size)
        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self._snapshot_frame = QtWidgets.QFrame(self)
        self._snapshot_frame.setMinimumSize(self._widget_size)
        self._snapshot_frame.setMaximumSize(self._widget_size)
        self._stackLayout = QtWidgets.QStackedLayout()
        self._stackLayout.setContentsMargins(0, 0, 0, 0)
        layout_images = QtWidgets.QHBoxLayout(self._snapshot_frame)
        layout_images.setContentsMargins(0, 0, 0, 0)
        layout_images.addLayout(self._stackLayout)

        self._viewer_view = SnapshotsView("Viewer", self._snapshot_frame)
        self._stackLayout.addWidget(self._viewer_view)

        self._dag_view = SnapshotsView("DAG", self._snapshot_frame)
        self._stackLayout.addWidget(self._dag_view)

        self._no_snapshot = QtWidgets.QFrame(self._snapshot_frame)
        self._no_snapshot.setStyleSheet(
            "QFrame{/*background: #000;*/ border:0px;}")
        layout_no_snapshot = QtWidgets.QHBoxLayout(self._no_snapshot)
        label_no_snapshot = QtWidgets.QLabel(
            "No snapshot available...", self._no_snapshot)
        label_no_snapshot.setStyleSheet("color:#855")
        label_no_snapshot.setAlignment(
            QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter)
        layout_no_snapshot.addWidget(label_no_snapshot)
        self._stackLayout.addWidget(self._no_snapshot)

        self._edit_buttons = SnapshotsEditButtons(
            False, False, self._snapshot_frame)
        self._edit_buttons.refresh_toggled.connect(self.initiate_snapshots)
        self._edit_buttons.zoom_level_toggled.connect(self.zoom_level)
        self._edit_buttons.handscroll_mode_toggled.connect(
            self.set_handscroll_mode)
        self._edit_buttons.drawing_mode_toggled.connect(self.set_drawing_mode)
        self._edit_buttons.eraser_toggled.connect(self.erase_drawing)
        self._edit_buttons.color_modified.connect(self.set_pen_color)

        self.target_button_container = QtWidgets.QWidget(self)
        self.target_button_container_layout = QtWidgets.QHBoxLayout()
        self.target_button_container.setLayout(self.target_button_container_layout)
        self._viewer_btn = QtWidgets.QPushButton("Use Active Viewer", self)
        self._viewer_btn.setObjectName("Viewer_btn")
        self._viewer_btn.clicked.connect(self.chooseSource)
        self._dag_btn = QtWidgets.QPushButton("Use Node Graph", self)
        self._dag_btn.setObjectName("DAG_btn")
        self._dag_btn.clicked.connect(self.chooseSource)
        self.target_button_container_layout.addWidget(self._viewer_btn)
        self.target_button_container_layout.addWidget(self._dag_btn)

        layout.addWidget(self._snapshot_frame)
        layout.addWidget(self.target_button_container)
    def setupUI(self):
        main_layout = QtWidgets.QVBoxLayout(self)
        main_layout.setContentsMargins(0, 0, 0, 0)
        main_layout.setSpacing(0)

        empty_task = SingleTaskWidget(parent=self)
        self._stackLayout = QtWidgets.QStackedLayout()
        self._stackLayout.addWidget(empty_task)
        main_layout.addLayout(self._stackLayout)

        self._stackLayout.setCurrentWidget(empty_task)