예제 #1
0
    def setupUI(self, parent):
        self._refresh = QtWidgets.QToolButton(parent)
        self._refresh.setMaximumSize(QtCore.QSize(45, 15))
        button_css_refresh = """
          QToolButton{background:transparent; border:none; color: rgba(255,255,255,80);}
          QToolButton:hover{color: rgba(255,255,255,200);}
          QToolButton:pressed{color: rgba(255,255,255,255);}
        """
        self._refresh.setStyleSheet(button_css_refresh)
        self._refresh.move(parent.width() - self._refresh.width() - 10, 5)
        self._refresh.setText("refresh")
        self._refresh.clicked.connect(self.refresh)

        button_css = """
          QToolButton{ background:rgba(255,255,255,50); border:none;
                       color: rgba(255,255,255,80); border-radius: 5px; }
          QToolButton:hover{ background:rgba(255,255,255,120);
                             color: rgba(255,255,255,200); }
          QToolButton:pressed{ background:rgba(255,255,255,80);
                               color: rgba(255,255,255,255); }
        """

        # Colors buttons

        left_gap = 10
        top_padding = 80
        self._color_white = QtWidgets.QToolButton(parent)
        self._color_white.setMaximumSize(QtCore.QSize(20, 20))
        self._color_white.move(left_gap, parent.height() - top_padding)
        self._color_white.clicked.connect(self._toggle_color)
        left_gap += self._color_white.width() + 10

        self._color_black = QtWidgets.QToolButton(parent)
        self._color_black.setMaximumSize(QtCore.QSize(20, 20))
        self._color_black.move(left_gap, parent.height() - top_padding)
        self._color_black.clicked.connect(self._toggle_color)
        left_gap += self._color_black.width() + 10

        self._color_red = QtWidgets.QToolButton(parent)
        self._color_red.setMaximumSize(QtCore.QSize(20, 20))
        self._color_red.move(left_gap, parent.height() - top_padding)
        self._color_red.clicked.connect(self._toggle_color)
        left_gap += self._color_red.width() + 10

        self._color_green = QtWidgets.QToolButton(parent)
        self._color_green.setMaximumSize(QtCore.QSize(20, 20))
        self._color_green.move(left_gap, parent.height() - top_padding)
        self._color_green.clicked.connect(self._toggle_color)
        left_gap += self._color_green.width() + 10

        self._color_blue = QtWidgets.QToolButton(parent)
        self._color_blue.setMaximumSize(QtCore.QSize(20, 20))
        self._color_blue.move(left_gap, parent.height() - top_padding)
        self._color_blue.clicked.connect(self._toggle_color)
        left_gap += self._color_blue.width() + 10

        self._color_yellow = QtWidgets.QToolButton(parent)
        self._color_yellow.setMaximumSize(QtCore.QSize(20, 20))
        self._color_yellow.move(left_gap, parent.height() - top_padding)
        self._color_yellow.clicked.connect(self._toggle_color)

        self._activate_color_button("white", False)
        self._activate_color_button("black", False)
        self._activate_color_button("red", True)  # default
        self._activate_color_button("green", False)
        self._activate_color_button("blue", False)
        self._activate_color_button("yellow", False)

        # Edit buttons

        left_gap = 10
        self._fit_screen = QtWidgets.QToolButton(parent)
        self._fit_screen.setMaximumSize(QtCore.QSize(20, 20))
        self._fit_screen.setStyleSheet(button_css)
        self._fit_screen.move(left_gap, 5)
        self._fit_screen.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        self._fit_screen.clicked.connect(self.fit_screen)
        self.activate_button(self._fit_screen, "fitscreen")
        left_gap += self._fit_screen.width() + 10

        self._zoom_out = QtWidgets.QToolButton(parent)
        self._zoom_out.setMaximumSize(QtCore.QSize(20, 20))
        self._zoom_out.setStyleSheet(button_css)
        self._zoom_out.move(left_gap, 5)
        self._zoom_out.setText("-")
        self._zoom_out.clicked.connect(self.zoom_out)
        left_gap += self._zoom_out.width() + 10

        self._zoom_in = QtWidgets.QToolButton(parent)
        self._zoom_in.setMaximumSize(QtCore.QSize(20, 20))
        self._zoom_in.setStyleSheet(button_css)
        self._zoom_in.move(left_gap, 5)
        self._zoom_in.setText("+")
        self._zoom_in.clicked.connect(self.zoom_in)
        left_gap += self._zoom_in.width() + 10

        self._drag = QtWidgets.QToolButton(parent)
        self._drag.setMaximumSize(QtCore.QSize(20, 20))
        self._drag.move(left_gap, 5)
        self._drag.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        self._drag.clicked.connect(self._toggle_handscroll_mode)
        self.set_handscroll_mode(self._handscroll_mode)
        left_gap += self._drag.width() + 10

        self._pencil = QtWidgets.QToolButton(parent)
        self._pencil.setMaximumSize(QtCore.QSize(20, 20))
        self._pencil.move(left_gap, 5)
        self._pencil.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        self._pencil.clicked.connect(self._toggle_drawing_mode)
        self.set_drawing_mode(self._drawing_mode)
        left_gap += self._pencil.width() + 10

        self._eraser = QtWidgets.QToolButton(parent)
        self._eraser.setMaximumSize(QtCore.QSize(20, 20))
        self._eraser.move(left_gap, 5)
        self._eraser.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        self._eraser.clicked.connect(self._toggle_eraser)
        self.activate_button(self._eraser, "eraser", hover_emphasize=True)
예제 #2
0
    def setupUI(self):
        super(GizmoPublisherDialog, self).setupUI()
        self.resize(980, 640)

        gizmo_widget = QtWidgets.QWidget()
        gizmo_layout = QtWidgets.QVBoxLayout(gizmo_widget)
        gizmo_layout.setContentsMargins(5, 0, 0, 0)

        css_asset_global = """
            QFrame { padding: 3px;
                     background: #222; color: #FFF; font-size: 13px; }
            QLabel { padding: 0px; background: none; }
            """
        css_asset_name = """
            QLineEdit { padding: 3px; border: 1px solid #444;
                        background: #333; color: #FFF; font-weight: bold; }
            """
        css_asset_version = "color: #de8888; font-weight: bold;"

        asset_main_frame = QtWidgets.QFrame(self)
        asset_main_frame.setMinimumWidth(600)
        # comment this line to remove the black background on asset.
        asset_main_frame.setStyleSheet(css_asset_global)
        asset_main_frame_layout = QtWidgets.QHBoxLayout(asset_main_frame)
        asset_main_frame_layout.setSpacing(10)
        asset_name_lbl = QtWidgets.QLabel("Asset", asset_main_frame)
        self._asset_name = QtWidgets.QLineEdit(asset_main_frame)
        self._asset_name.setText("Gizmo")
        self._asset_name.textChanged.connect(self._validate_asset_name)
        self._asset_name.setStyleSheet(css_asset_name)
        asset_version_lbl = QtWidgets.QLabel("Version", asset_main_frame)
        self._asset_version = QtWidgets.QLabel("...", asset_main_frame)
        self._asset_version.setStyleSheet(css_asset_version)
        asset_main_frame_layout.addWidget(asset_name_lbl)
        asset_main_frame_layout.addWidget(self._asset_name)
        asset_main_frame_layout.addWidget(asset_version_lbl)
        asset_main_frame_layout.addWidget(self._asset_version)
        gizmo_layout.addWidget(asset_main_frame)

        file_layout = QtWidgets.QVBoxLayout()
        file_layout.setContentsMargins(0, 0, 0, 0)
        file_layout.setSpacing(8)
        browser_layout = QtWidgets.QHBoxLayout()
        browser_layout.setContentsMargins(0, 0, 0, 0)
        browser_layout.setSpacing(8)

        browser_label = QtWidgets.QLabel("Gizmo file", gizmo_widget)
        browser_edit_css = """
            QLineEdit { border: 1px solid #666;
                        background: #555; color: #000; }
        """
        self._browser_edit = QtWidgets.QLineEdit(gizmo_widget)
        self._browser_edit.setStyleSheet(browser_edit_css)
        self._browser_edit.textChanged.connect(self.set_gizmo_file)
        completer = QtWidgets.QCompleter(gizmo_widget)
        completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        completer.setCompletionMode(QtWidgets.QCompleter.InlineCompletion)
        dir = QtWidgets.QDirModel(completer)
        dir.setFilter(
            QtCore.QDir.Dirs | QtCore.QDir.NoDot | QtCore.QDir.NoDotDot)
        completer.setModel(dir)
        self._browser_edit.setCompleter(completer)
        self._browser_btn = QtWidgets.QToolButton(gizmo_widget)
        self._browser_btn.setText("...")
        self._browser_btn.clicked.connect(self._browse_gizmo)
        browser_layout.addWidget(browser_label)
        browser_layout.addWidget(self._browser_edit)
        browser_layout.addWidget(self._browser_btn)
        file_layout.addItem(browser_layout)

        self._gizmo_file_content = ScriptEditorWidget(gizmo_widget)
        file_layout.addWidget(self._gizmo_file_content)
        self._gizmo_file_content.file_dropped.connect(
            self._initiate_dropped_file)
        gizmo_layout.addItem(file_layout)

        self._comment_widget = CommentWidget(gizmo_widget)
        self._comment_widget.setMaximumHeight(120)
        self._comment_widget.changed.connect(self._validate_gizmo)
        gizmo_layout.addWidget(self._comment_widget)

        self._save_btn.clicked.disconnect()
        self._save_btn.clicked.connect(self._publish)

        self.main_container_layout.addWidget(gizmo_widget)

        self._save_btn.setText("Publish Gizmo")
        self._save_btn.setMinimumWidth(150)
        self._save_btn.setEnabled(False)
        self.set_task(self.current_task)
예제 #3
0
    def _build(self):
        '''Build and layout widget.'''
        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        # Header
        header = ftrack_connect.ui.widget.header.Header(
            getpass.getuser(), self)
        header.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                             QtWidgets.QSizePolicy.Fixed)
        layout.addWidget(header)

        secondaryHeader = QtWidgets.QFrame()
        headerLayout = QtWidgets.QHBoxLayout()
        headerLayout.setContentsMargins(0, 0, 0, 0)
        secondaryHeader.setLayout(headerLayout)
        layout.addWidget(secondaryHeader)

        self._createButton = QtWidgets.QToolButton()
        self._createButton.setIcon(
            QtGui.QIcon.fromTheme('plus', QtGui.QIcon(':icon-plus')))
        headerLayout.addWidget(self._createButton)

        self._navigateUpButton = QtWidgets.QToolButton()
        self._navigateUpButton.setIcon(
            QtGui.QIcon.fromTheme('go-up', QtGui.QIcon(':icon-arrow-up')))
        headerLayout.addWidget(self._navigateUpButton)

        headerLayout.addStretch(1)

        # Bookmarks
        contentSplitter = QtWidgets.QSplitter()
        layout.addWidget(contentSplitter)

        self._bookmarksView = QtWidgets.QTableWidget()
        self._bookmarksView.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        self._bookmarksView.setGridStyle(QtCore.Qt.NoPen)
        self._bookmarksView.setColumnCount(1)
        self._bookmarksView.setColumnCount(1)
        self._bookmarksView.setRowCount(0)
        self._bookmarksView.horizontalHeader().setVisible(False)
        self._bookmarksView.horizontalHeader().setStretchLastSection(True)
        self._bookmarksView.verticalHeader().setVisible(False)
        self._bookmarksView.verticalHeader().setDefaultSectionSize(25)
        contentSplitter.addWidget(self._bookmarksView)

        # Navigation
        self._navigator = QtWidgets.QTableWidget()
        self._navigator.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        self._navigator.setGridStyle(QtCore.Qt.NoPen)
        self._navigator.setColumnCount(1)
        self._navigator.horizontalHeader().setStretchLastSection(True)
        self._navigator.verticalHeader().hide()
        self._navigator.setHorizontalHeaderLabels(['Name'])
        contentSplitter.addWidget(self._navigator)

        self._versionsNavigator = QtWidgets.QTableWidget()
        self._versionsNavigator.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        self._versionsNavigator.setGridStyle(QtCore.Qt.NoPen)
        self._versionsNavigator.setColumnCount(1)
        self._versionsNavigator.verticalHeader().hide()
        self._versionsNavigator.setSortingEnabled(False)
        self._versionsNavigator.setHorizontalHeaderLabels(['Version'])
        contentSplitter.addWidget(self._versionsNavigator)

        self._componentsNavigator = QtWidgets.QTableWidget()
        self._componentsNavigator.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)
        self._componentsNavigator.setColumnCount(1)
        self._componentsNavigator.horizontalHeader().setStretchLastSection(
            True)
        self._componentsNavigator.verticalHeader().hide()
        self._componentsNavigator.verticalHeader().setStretchLastSection(False)
        self._componentsNavigator.setHorizontalHeaderLabels(['Component'])
        contentSplitter.addWidget(self._componentsNavigator)

        # Details
        self._detailView = ftrack_connect_foundry.ui.detail_view.DetailView(
            self._bridge)
        contentSplitter.addWidget(self._detailView)

        # Location
        self._locationField = QtWidgets.QLineEdit()
        layout.addWidget(self._locationField)

        self._locationOptions = QtWidgets.QFrame()
        layout.addWidget(self._locationOptions)

        locationOptionsLayout = QtWidgets.QHBoxLayout()
        locationOptionsLayout.setContentsMargins(0, 0, 0, 0)
        self._locationOptions.setLayout(locationOptionsLayout)

        self._assetNameField = QtWidgets.QLineEdit()
        self._assetNameField.setEnabled(False)
        locationOptionsLayout.addWidget(self._assetNameField)

        self._overrideNameHintOption = QtWidgets.QCheckBox(
            'Specify Asset Name')
        locationOptionsLayout.addWidget(self._overrideNameHintOption)