예제 #1
0
        def add_section(label, description, data):
            """Utility method for creating the layout needed to edit default paths."""
            height = common.ROW_HEIGHT() * 0.8
            o = common.MARGIN()

            grp = common_ui.get_group(parent=self)
            grp.layout().setContentsMargins(o, o, o, o)
            grp.layout().setSpacing(0)

            label = common_ui.PaintedLabel(label,
                                           size=common.LARGE_FONT_SIZE(),
                                           parent=self)
            grp.layout().addWidget(label)
            grp.layout().addSpacing(o)

            if description:
                common_ui.add_description(description, label=None, parent=grp)
                grp.layout().addSpacing(o)

            scroll_area = QtWidgets.QScrollArea(parent=self)
            scroll_area.setWidgetResizable(True)
            scroll_area.setMaximumHeight(common.HEIGHT() * 0.66)
            scroll_area.setAttribute(QtCore.Qt.WA_NoBackground)
            scroll_area.setAttribute(QtCore.Qt.WA_TranslucentBackground)
            grp.layout().addWidget(scroll_area)

            _row = common_ui.add_row(None,
                                     vertical=True,
                                     padding=None,
                                     height=None,
                                     parent=grp)
            _row.layout().setContentsMargins(0, 0, 0, 0)
            _row.layout().setSpacing(0)
            scroll_area.setWidget(_row)

            for k, v in sorted(data.items()):
                label = u'<span style="color:rgba({ADD});">{k}</span> - {v}:'.format(
                    ADD=common.rgb(common.ADD),
                    k=k.upper(),
                    v=v[u'description'])
                row = common_ui.add_row(None,
                                        padding=None,
                                        height=height,
                                        parent=_row)
                common_ui.add_description(label, label=u'', parent=row)
                row = common_ui.add_row(None,
                                        padding=None,
                                        height=height,
                                        parent=_row)
                line_edit = common_ui.add_line_edit(v[u'default'], parent=row)
                line_edit.setAlignment(QtCore.Qt.AlignLeft)
                line_edit.setText(v[u'value'])
                line_edit.textChanged.connect(
                    functools.partial(text_changed, data, k))
예제 #2
0
    def _create_UI(self):
        QtWidgets.QVBoxLayout(self)
        o = common.MARGIN()
        self.layout().setSpacing(o)
        self.layout().setContentsMargins(o, o, o, o)
        self.layout().setAlignment(QtCore.Qt.AlignCenter)

        row = common_ui.add_row(None, parent=self)
        label = common_ui.PaintedLabel(self.path, parent=row)
        row.layout().addWidget(label)

        row = common_ui.add_row(None, height=None, parent=self)
        row.layout().addStretch(1)
        row.layout().addWidget(self.view, 1)
        row.layout().addStretch(1)
예제 #3
0
        def add_name_template():
            height = common.ROW_HEIGHT() * 0.8
            o = common.MARGIN()

            grp = common_ui.get_group(parent=self)
            grp.layout().setContentsMargins(o, o, o, o)
            grp.layout().setSpacing(0)

            label = common_ui.PaintedLabel(u'Name template',
                                           size=common.LARGE_FONT_SIZE(),
                                           parent=grp)
            grp.layout().addWidget(label)
            grp.layout().addSpacing(o)

            label = u'<span style="color:rgba({ADD});">File name pattern</span> - {v}:'.format(
                ADD=common.rgb(common.ADD),
                v=u'The template used to generate new file names')
            row = common_ui.add_row(None,
                                    padding=None,
                                    height=height,
                                    parent=grp)
            common_ui.add_description(label, label=u'', parent=row)
            row = common_ui.add_row(None,
                                    padding=None,
                                    height=height,
                                    parent=grp)
            line_edit = common_ui.add_line_edit(defaultpaths.FILE_NAME_PATTERN,
                                                parent=row)
            line_edit.textChanged.connect(
                functools.partial(text_changed, defaultpaths.FILE_NAME_PATTERN,
                                  u'defaultpaths/filenamepattern'))
            line_edit.setAlignment(QtCore.Qt.AlignLeft)
            line_edit.setText(defaultpaths.FILE_NAME_PATTERN)

            s = \
                u'Available tokens<br><br>\
<span style="color:rgba({ADD});">{{folder}}</span>  -  The destination folder<br>\
<span style="color:rgba({ADD});">{{prefix}}</span>  -  Prefix defined by the bookmark<br>\
<span style="color:rgba({ADD});">{{asset}}</span>   -  Asset name<br>\
<span style="color:rgba({ADD});">{{mode}}</span>    -  Selected mode (see below)<br>\
<span style="color:rgba({ADD});">{{user}}</span>    -  Name of the current user<br>\
<span style="color:rgba({ADD});">{{version}}</span> -  Version number<br>\
<span style="color:rgba({ADD});">{{ext}}</span>     -  File extension'                                                                      .format(
                    ADD=common.rgb(common.ADD),
                    v=u'The template used to generate new file names'
                )
            grp.layout().addSpacing(o)
            common_ui.add_description(s, label='', parent=grp)
예제 #4
0
    def _create_UI(self):
        QtWidgets.QVBoxLayout(self)
        o = common.MARGIN()
        self.layout().setContentsMargins(o, o * 0.5, o, o)
        self.layout().setSpacing(0)

        row = common_ui.add_row(None, padding=None, parent=self)
        self.hide_button = common_ui.ClickableIconButton(
            u'close', (common.REMOVE, common.REMOVE),
            common.ROW_HEIGHT() * 0.6)
        label = common_ui.PaintedLabel(u'Preferences',
                                       size=common.LARGE_FONT_SIZE())
        row.layout().addWidget(label, 0)
        row.layout().addStretch(1)
        row.layout().addWidget(self.hide_button, 0)
        self.hide_button.clicked.connect(
            lambda: self.done(QtWidgets.QDialog.Rejected))

        splitter = QtWidgets.QSplitter(parent=self)
        self.layout().addWidget(splitter)

        self.sections_list_widget = SectionSwitcherWidget(parent=self)
        splitter.addWidget(self.sections_list_widget)

        scroll_area = QtWidgets.QScrollArea(parent=self)
        scroll_area.setWidgetResizable(True)
        splitter.addWidget(scroll_area)

        self.sections_stack_widget = SectionsStackWidget(parent=self)
        scroll_area.setWidget(self.sections_stack_widget)
예제 #5
0
    def _create_UI(self):
        QtWidgets.QVBoxLayout(self)
        o = common.MARGIN()
        self.layout().setContentsMargins(o, o, o, o)
        self.layout().setSpacing(common.INDICATOR_WIDTH())

        height = common.ROW_HEIGHT() * 0.7
        row = common_ui.add_row(None, height=height, padding=None, parent=self)

        self.channel_button = common_ui.ClickableIconButton(
            u'slack',
            (common.TEXT, common.TEXT),
            height,
        )
        label = common_ui.PaintedLabel(u'Send Message',
                                       size=common.LARGE_FONT_SIZE(),
                                       parent=row)
        label.setFixedHeight(height)
        self.hide_button = common_ui.ClickableIconButton(
            u'close', (common.REMOVE, common.REMOVE), height, parent=row)

        row.layout().addWidget(label, 0)
        row.layout().addStretch(1)
        row.layout().addWidget(self.channel_button, 0)
        row.layout().addWidget(self.hide_button, 0)

        self.message_widget = MessageWidget(self.token, parent=self)
        self.layout().addSpacing(o * 0.5)
        self.layout().addWidget(self.message_widget)

        self.send_button = common_ui.PaintedButton(u'Send', parent=self)
        self.layout().addSpacing(o)
        self.layout().addWidget(self.send_button)
        self.layout().addSpacing(o * 0.5)
예제 #6
0
    def _create_UI(self):
        o = 0
        top_widget = QtWidgets.QWidget(parent=self)
        QtWidgets.QVBoxLayout(top_widget)
        top_widget.layout().setContentsMargins(o, o, o, o)
        top_widget.layout().setSpacing(0)
        self.addWidget(top_widget)

        self.message_widget = QtWidgets.QTextEdit(parent=self)
        _o = common.MARGIN()
        self.message_widget.document().setDocumentMargin(_o)
        self.message_widget.setPlaceholderText(u'Enter a message to send...')
        self.message_widget.setAcceptRichText(False)
        self.message_widget.moveCursor(QtGui.QTextCursor.End)

        top_widget.layout().addWidget(self.message_widget, 0)

        bottom_widget = QtWidgets.QWidget(parent=self)
        o = common.MARGIN() * 0.5
        height = common.ROW_HEIGHT()
        QtWidgets.QVBoxLayout(bottom_widget)
        bottom_widget.layout().setContentsMargins(o, 0, o, 0)
        bottom_widget.layout().setSpacing(0)

        row = common_ui.add_row(u'', height=height, parent=bottom_widget)
        row.layout().setAlignment(QtCore.Qt.AlignBottom)
        label = common_ui.PaintedLabel(u'Channels & Direct Messages',
                                       parent=self)
        row.layout().addWidget(label, 0)

        row = common_ui.add_row(u'', height=height, parent=bottom_widget)
        row.layout().setAlignment(QtCore.Qt.AlignBottom)

        self.user_filter = common_ui.LineEdit(parent=self)
        self.user_filter.setAlignment(QtCore.Qt.AlignVCenter
                                      | QtCore.Qt.AlignRight)
        self.user_filter.setPlaceholderText(u'Search...')
        row.layout().addWidget(self.user_filter, 1)

        self.users_widget = UsersWidget(self.token, parent=self)

        bottom_widget.layout().addWidget(self.users_widget)

        self.addWidget(bottom_widget)
        self.addWidget(top_widget)

        self.setSizes([common.WIDTH() * 0.08, common.WIDTH() * 0.2])
예제 #7
0
    def _create_UI(self):
        if self._frameless is True:
            o = common.INDICATOR_WIDTH()  # offset around the widget
        else:
            o = 0

        QtWidgets.QVBoxLayout(self)
        self.layout().setContentsMargins(o, o, o, o)
        self.layout().setSpacing(0)
        self.setContextMenuPolicy(QtCore.Qt.NoContextMenu)

        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum,
                           QtWidgets.QSizePolicy.Minimum)

        self.headerwidget = HeaderWidget(parent=self)
        self.stackedwidget = StackedWidget(parent=self)
        self.bookmarkswidget = BookmarksWidget(parent=self)
        self.assetswidget = AssetsWidget(parent=self)
        self.fileswidget = FilesWidget(parent=self)
        self.favouriteswidget = FavouritesWidget(parent=self)

        self.stackedwidget.addWidget(self.bookmarkswidget)
        self.stackedwidget.addWidget(self.assetswidget)
        self.stackedwidget.addWidget(self.fileswidget)
        self.stackedwidget.addWidget(self.favouriteswidget)

        # Setting the tab now before we do any more initialisation
        idx = settings.local_settings.value(u'widget/mode')
        idx = 0 if idx is None or False else idx
        idx = 0 if idx < 0 else idx
        idx = 3 if idx > 3 else idx
        self.stackedwidget._setCurrentIndex(idx)

        self.listcontrolwidget = ListControlWidget(parent=self)

        if self._frameless:
            self.layout().addWidget(self.headerwidget)
        self.layout().addWidget(self.listcontrolwidget)
        self.layout().addWidget(self.stackedwidget)

        height = common.MARGIN() + (common.INDICATOR_WIDTH() * 2)
        row = common_ui.add_row(None, padding=0, height=height, parent=self)
        row.layout().setSpacing(0)
        row.layout().setContentsMargins(0, 0, 0, 0)

        self.statusbar = StatusBar(height, parent=self)
        self.solo_button = ToggleModeButton(height, parent=self)
        self.solo_button.message.connect(
            lambda s: self.statusbar.showMessage(s, 4000))

        self.thread_monitor = threads.ThreadMonitor(parent=self)

        row.layout().addWidget(self.thread_monitor, 0)
        row.layout().addWidget(self.statusbar, 1)
        row.layout().addWidget(self.solo_button, 0)
예제 #8
0
    def _create_UI(self):
        QtWidgets.QVBoxLayout(self)
        o = common.MARGIN()
        self.layout().setContentsMargins(o, o, o, o)
        self.layout().setSpacing(o)

        row = common_ui.add_row(u'', parent=self)
        self.hide_button = common_ui.ClickableIconButton(
            u'close', (common.REMOVE, common.REMOVE),
            common.MARGIN(),
            description=u'Hide',
            parent=row)

        bookmark = u'{}/{}/{}'.format(self.server, self.job, self.root)
        source = images.get_thumbnail_path(self.server, self.job, self.root,
                                           bookmark)

        pixmap = images.ImageCache.get_pixmap(source, row.height())
        if not pixmap:
            source = images.get_placeholder_path(
                bookmark, fallback=u'thumb_bookmark_gray')
            pixmap = images.ImageCache.get_pixmap(source, row.height())

        if pixmap:
            thumbnail = QtWidgets.QLabel(parent=self)
            thumbnail.setPixmap(pixmap)
            row.layout().addWidget(thumbnail, 0)
            row.layout().addSpacing(o * 0.5)

        text = u'{}  |  {}'.format(self.job.upper(), self.root.upper())
        label = common_ui.PaintedLabel(text, size=common.LARGE_FONT_SIZE())

        row.layout().addWidget(label)
        row.layout().addStretch(1)
        row.layout().addWidget(self.hide_button, 0)

        # *****************************************

        self.templates_widget = managebookmarks.TemplatesWidget(u'asset',
                                                                parent=self)
        self.layout().addWidget(self.templates_widget, 1)

        s = u'Independent of the template, basic <span style="color:rgba({ADD});">mode</span> and \
<span style="color:rgba({ADD});">task</span> are defined in \
<span style="color:rgba({H});">Preferences -> Default Paths</span>. \
Ideally, both the template and the preferences should define the same folders.'.format(
            ADD=common.rgb(common.ADD),
            H=common.rgb(common.TEXT_SELECTED),
        )
        common_ui.add_description(s, label='hint', parent=self)
        self.layout().addStretch(1)
예제 #9
0
    def _create_UI(self):
        QtWidgets.QVBoxLayout(self)
        o = common.MARGIN()
        self.layout().setContentsMargins(o, o, o, o)
        self.layout().setSpacing(0)

        height = common.ROW_HEIGHT() * 0.8
        # ********************************************
        row = common_ui.add_row(None, padding=None, parent=self)
        self.save_button = common_ui.ClickableIconButton(
            u'check', (common.ADD, common.ADD), height)

        bookmark = u'{}/{}/{}'.format(self.server, self.job, self.root)
        source = images.get_thumbnail_path(self.server, self.job, self.root,
                                           bookmark)

        pixmap = images.ImageCache.get_pixmap(source, row.height())
        if not pixmap:
            source = images.get_placeholder_path(
                bookmark, fallback=u'thumb_bookmark_gray')
            pixmap = images.ImageCache.get_pixmap(source, row.height())

        if pixmap:
            thumbnail = QtWidgets.QLabel(parent=self)
            thumbnail.setPixmap(pixmap)
            row.layout().addWidget(thumbnail, 0)
            row.layout().addSpacing(o * 0.5)

        text = u'{}  |  {}'.format(self.job.upper(), self.root.upper())
        label = common_ui.PaintedLabel(text, size=common.LARGE_FONT_SIZE())

        row.layout().addWidget(label)
        row.layout().addStretch(1)
        row.layout().addWidget(self.save_button, 0)

        self.scrollarea = ScrollArea(parent=self)
        self.layout().addSpacing(o * 0.5)
        self.layout().addWidget(self.scrollarea)

        self.save_button.clicked.connect(
            lambda: self.done(QtWidgets.QDialog.Accepted))
예제 #10
0
    def _create_UI(self):
        import bookmarks.common_ui as common_ui

        QtWidgets.QVBoxLayout(self)
        o = common.MARGIN() * 0.5
        self.layout().setContentsMargins(o, o, o, o)
        self.layout().setSpacing(o)

        row = common_ui.add_row(None, parent=self)
        label = common_ui.PaintedLabel(
            u'Console', size=common.LARGE_FONT_SIZE(), parent=self)

        self.reset_button = common_ui.PaintedButton(u'Clear log', parent=self)
        self.enable_debug = QtWidgets.QCheckBox(
            'Log debug messages', parent=self)
        self.enable_debug.toggled.connect(self.toggle_debug)

        row.layout().addWidget(label)
        row.layout().addStretch(1)
        row.layout().addWidget(self.enable_debug)
        row.layout().addWidget(self.reset_button)

        self.logview = LogView(parent=self)
        self.layout().addWidget(self.logview, 1)
예제 #11
0
    def _create_UI(self):
        o = common.INDICATOR_WIDTH()
        self.setMinimumWidth(common.WIDTH() * 0.5)
        height = common.ROW_HEIGHT() * 0.8

        widget = QtWidgets.QWidget(parent=self)
        QtWidgets.QVBoxLayout(widget)
        widget.layout().setAlignment(QtCore.Qt.AlignCenter)
        widget.layout().setContentsMargins(0, 0, 0, 0)
        widget.layout().setSpacing(o * 2)
        self.setWidget(widget)

        # Main group
        grpA = common_ui.get_group(parent=widget)

        # GROUP
        grp = common_ui.get_group(parent=grpA)

        numvalidator = QtGui.QRegExpValidator(parent=self)
        numvalidator.setRegExp(QtCore.QRegExp(ur'[0-9]+[\.]?[0-9]*'))
        textvalidator = QtGui.QRegExpValidator(parent=self)
        textvalidator.setRegExp(QtCore.QRegExp(ur'[a-zA-Z0-9]+'))

        #   ROW1
        self.rectangles_widget = RectanglesWidget(parent=self)
        grp.layout().addWidget(self.rectangles_widget, 1)

        #   ROW
        row = common_ui.add_row(u'Resolution', parent=grp, height=height)
        self.width_editor = common_ui.LineEdit(parent=self)
        self.width_editor.setPlaceholderText(u'Width...')
        self.width_editor.setValidator(numvalidator)
        row.layout().addWidget(self.width_editor, 0)
        self.height_editor = common_ui.LineEdit(parent=self)
        self.height_editor.setPlaceholderText(u'Height...')
        self.height_editor.setValidator(numvalidator)
        row.layout().addWidget(self.height_editor, 0)

        #   ROW
        row = common_ui.add_row(u'Frame rate', parent=grp, height=height)
        self.framerate_editor = common_ui.LineEdit(parent=self)
        self.framerate_editor.setPlaceholderText(u'Frame rate...')
        self.framerate_editor.setValidator(numvalidator)
        row.layout().addWidget(self.framerate_editor, 0)

        # ********************************************
        grp = common_ui.get_group(parent=grpA)
        row = common_ui.add_row(u'Bookmark Prefix', parent=grp, height=height)
        self.prefix_editor = common_ui.LineEdit(parent=self)
        self.prefix_editor.setPlaceholderText(u'Prefix (eg. \'MYJOB\')...')
        self.prefix_editor.setValidator(textvalidator)

        self.suggest_prefix_button = common_ui.PaintedButton(u'Suggest')
        self.suggest_prefix_button.setFixedHeight(height * 0.7)
        row.layout().addWidget(self.prefix_editor, 0)
        row.layout().addWidget(self.suggest_prefix_button, 0)

        # ********************************************
        grp = common_ui.get_group(parent=grpA)

        row = common_ui.add_row(u'Start Frame', parent=grp, height=height)
        self.startframe_editor = common_ui.LineEdit(parent=self)
        self.startframe_editor.setPlaceholderText(u'Start Frame...')
        self.startframe_editor.setValidator(numvalidator)
        row.layout().addWidget(self.startframe_editor, 0)

        row = common_ui.add_row(u'Duration', parent=grp, height=height)
        self.duration_editor = common_ui.LineEdit(parent=self)
        self.duration_editor.setPlaceholderText(u'Duration...')
        self.duration_editor.setValidator(numvalidator)
        row.layout().addWidget(self.duration_editor, 0)
        # ********************************************
        grp = common_ui.get_group(parent=widget)
        row = common_ui.add_row(u'Asset Identifier', parent=grp)
        self.identifier_editor = common_ui.LineEdit(parent=row)
        self.identifier_editor.setPlaceholderText(
            u'Asset identifier, eg. \'workspace.mel\'')
        row.layout().addWidget(self.identifier_editor, 0)

        text = u'Only folders containing this file will be treated as assets.<br>\
Using the default Maya Workspace the identifier normally is \
<span style="text-decoration: underline;">workspace.mel</span>, but \
any other file can be used as long it is present in the root of \
the asset.<br>If not set, all folders inside the Bookmark \
will be read as assets.'.format(common.PRODUCT)
        common_ui.add_description(text, label='Hint', parent=grp)
        # ********************************************
        grpA = common_ui.get_group(parent=widget)

        # Slack API token
        label = common_ui.PaintedLabel(u'Slack Settings',
                                       size=common.MEDIUM_FONT_SIZE() * 1.2)
        grpA.layout().addWidget(label, 0)
        grpA.layout().addSpacing(o * 2)

        grp = common_ui.get_group(parent=grpA)

        row = common_ui.add_row(u'Slack API Token', parent=grp, height=height)
        self.slacktoken_editor = common_ui.LineEdit(parent=self)
        self.slacktoken_editor.setPlaceholderText(
            u'xoxb-01234567890-0123456...')
        button = common_ui.PaintedButton(u'Test Token')
        button.setFixedHeight(height * 0.7)
        button.clicked.connect(self.test_slack_token)
        row.layout().addWidget(self.slacktoken_editor, 0)
        row.layout().addWidget(button)
        text = u'{p} can send messages to team-members using Slack.<br><br>\
To get started, create a new app and install it for your workspace. \
Paste the generated <span style="{h}">OAuth</span> token, usually starting with "xoxb-0123..." above.<br> \
See <a href="http://api.slack.com/apps">http://api.slack.com/apps</a> for more information.<br><br> \
The Slack app needs to have the <span style="{h}">users:read</span> and \
<span style="{h}">chat:write</span> scopes enabled. To send messages to channels \
the bot is not part of, add <span style="{h}">chat:write.public</span>. \
Scopes <span style="{h}">channels:read</span> and <span style="{h}">groups:read</span> are needed to list available \
Slack Channels.<br><br>'.format(p=common.PRODUCT,
                                h='color: rgba({});'.format(
                                    common.rgb(common.ADD)))
        common_ui.add_description(text, label=u'Slack API Hint', parent=grp)
        # ********************************************
        self.widget().layout().addStretch(1)
예제 #12
0
    def _create_UI(self):
        label = common_ui.PaintedLabel(
            u'Maya Plugin Preferences',
            size=common.LARGE_FONT_SIZE(),
            parent=self,
        )
        self.layout().addWidget(label)

        grp = common_ui.get_group(parent=self)
        row = common_ui.add_row(u'Sync instances', parent=grp)
        self.sync_active_button = QtWidgets.QCheckBox(
            u'Disable instance syncing', parent=self)
        row.layout().addStretch(1)
        row.layout().addWidget(self.sync_active_button)
        label = u'{} instances are syncronised by default. \
For example, when an asset is activated, other instances \
with will also activate the same asset. \
You can turn this behaviour off above.'.format(common.PRODUCT)
        common_ui.add_description(label, label=u'Help', parent=grp)
        ######################################################
        grp = common_ui.get_group(parent=self)
        row = common_ui.add_row(u'Alembic Export Path', parent=grp)
        label = u'Edit the Alembic cache export path below. \
Make sure to include the following tokens:\n\n\
{workspace}: The path to the current workspace.\n\
{exports}: The name of the exports folder ("exports" by default).\n\
{set}: The name of the geometry group (eg. "character_rig_geo")\n\n\
There must be a version number present as well (this will be automatically \
incremented when exporting). Eg. v01, v001 or v0001, etc.'

        common_ui.add_description(label, parent=grp)

        self.alembic_export_path = common_ui.add_line_edit(
            u'eg. {workspace}/{exports}/abc/{set}/{set}_v001.abc', parent=row)
        row.layout().addWidget(self.alembic_export_path, 1)

        row = common_ui.add_row(u'Playblast Path', parent=grp)
        self.capture_path = common_ui.add_line_edit(u'eg. viewport_captures',
                                                    parent=row)
        label = u'Edit the relative path of the playblasts (relative to the current project root)'
        common_ui.add_description(label, parent=grp)
        row.layout().addWidget(self.capture_path, 1)

        ######################################################
        grp = common_ui.get_group(parent=self)
        row = common_ui.add_row(u'Workspace warning', parent=grp)
        self.workspace_warning_button = QtWidgets.QCheckBox(
            u'Disable workspace change warnings', parent=grp)
        row.layout().addStretch(1)
        row.layout().addWidget(self.workspace_warning_button)
        label = u'Disable the pop-up warning when the current Workspace is \
changed by {}'.format(common.PRODUCT)
        common_ui.add_description(label, parent=grp)

        row = common_ui.add_row(u'Save warning', parent=grp)
        self.save_warning_button = QtWidgets.QCheckBox(
            u'Don\'t show save warning', parent=grp)
        row.layout().addStretch(1)
        row.layout().addWidget(self.save_warning_button)
        label = u'Saving files outside the current workspace will show a \
warning dialog. Tick to disable (default is "off"):'

        common_ui.add_description(label, parent=grp)
        ######################################################
        grp = common_ui.get_group(parent=self)
        row = common_ui.add_row(u'Sync workspace', parent=grp)
        self.sync_maya_project_button = QtWidgets.QCheckBox(
            u'Disable workspace syncing', parent=self)
        row.layout().addStretch(1)
        row.layout().addWidget(self.sync_maya_project_button)
        label = u'{} sets the current Workspace to the active asset \
        (overriding any Workspace set manually by Maya\'s Set Project). \
        Tick above if you want to disable Maya Workspace Syncing \
        (default is "off"):'.format(common.PRODUCT)
        common_ui.add_description(label, parent=grp)

        self.layout().addStretch(1)
예제 #13
0
        def add_extensions():
            height = common.ROW_HEIGHT() * 0.8
            o = common.MARGIN()

            grp = common_ui.get_group(parent=self)
            grp.layout().setContentsMargins(o, o, o, o)
            grp.layout().setSpacing(0)

            description = \
                u'Edit the list of valid extensions. Use \
    <span style="color:rgba({ADD});">*</span> to allow all files.'                                                                  .format(
                    p=common.PRODUCT,
                    ADD=common.rgb(common.ADD))

            label = common_ui.PaintedLabel(u'Default extension filters',
                                           size=common.LARGE_FONT_SIZE(),
                                           parent=self)
            grp.layout().addWidget(label)
            grp.layout().addSpacing(o)

            if description:
                common_ui.add_description(description, label=None, parent=grp)
                grp.layout().addSpacing(o)

            scroll_area = QtWidgets.QScrollArea(parent=self)
            scroll_area.setWidgetResizable(True)
            scroll_area.setMaximumHeight(common.HEIGHT() * 0.66)
            scroll_area.setAttribute(QtCore.Qt.WA_NoBackground)
            scroll_area.setAttribute(QtCore.Qt.WA_TranslucentBackground)
            grp.layout().addWidget(scroll_area)

            _row = common_ui.add_row(None,
                                     vertical=True,
                                     padding=None,
                                     height=None,
                                     parent=grp)
            _row.layout().setContentsMargins(0, 0, 0, 0)
            _row.layout().setSpacing(0)
            scroll_area.setWidget(_row)

            for k, v in sorted(defaultpaths.FORMAT_FILTERS.items(),
                               key=lambda x: x[0]):
                label = u'<span style="color:rgba({ADD});">{k}</span> - {v}:'.format(
                    ADD=common.rgb(common.ADD),
                    k=v[u'name'],
                    v=v[u'description'])
                row = common_ui.add_row(None,
                                        padding=None,
                                        height=height,
                                        parent=_row)
                common_ui.add_description(label, label=u'', parent=row)
                row = common_ui.add_row(None,
                                        padding=None,
                                        height=height,
                                        parent=_row)
                line_edit = common_ui.add_line_edit(v[u'default'], parent=row)
                line_edit.textChanged.connect(
                    functools.partial(text_changed,
                                      defaultpaths.FORMAT_FILTERS, k))
                line_edit.setAlignment(QtCore.Qt.AlignLeft)
                line_edit.setText(v[u'value'])
예제 #14
0
    def _create_UI(self):
        import bookmarks

        label = common_ui.PaintedLabel(u'General Preferences',
                                       size=common.LARGE_FONT_SIZE(),
                                       parent=self)
        self.layout().addWidget(label)
        grp = common_ui.get_group(parent=self)

        row = common_ui.add_row(u'Frameless window', parent=grp)
        self.frameless_window = QtWidgets.QCheckBox(u'Use frameless window',
                                                    parent=self)
        row.layout().addStretch(1)
        row.layout().addWidget(self.frameless_window)
        label = common_ui.PaintedLabel(u'(Restart required)',
                                       size=common.SMALL_FONT_SIZE(),
                                       color=common.TEXT_DISABLED)
        row.layout().addWidget(label, 0)

        if common.STANDALONE:
            row = common_ui.add_row(u'Scale interface', parent=grp)
            self.ui_scale = QtWidgets.QComboBox(parent=self)
            self.ui_scale.setFixedHeight(common.ROW_HEIGHT() * 0.66)

            for s in (u'100%', u'125%', u'150%', u'175%', u'200%'):
                self.ui_scale.addItem(s)
                idx = self.ui_scale.count() - 1
                data = int(s.strip(u'%')) * 0.01
                self.ui_scale.setItemData(idx, data, role=QtCore.Qt.UserRole)
                data = QtCore.QSize(1, common.ROW_HEIGHT() * 0.66)
                self.ui_scale.setItemData(idx,
                                          data,
                                          role=QtCore.Qt.SizeHintRole)

            row.layout().addWidget(self.ui_scale, 1)
            label = common_ui.PaintedLabel(u'(Restart required)',
                                           size=common.SMALL_FONT_SIZE(),
                                           color=common.TEXT_DISABLED)
            row.layout().addWidget(label, 0)

        ##############################
        row = common_ui.add_row(u'Update', parent=grp)
        self.check_updates = common_ui.PaintedButton(u'Check for Updates',
                                                     parent=row)
        self.show_help = common_ui.PaintedButton(u'Help', parent=row)
        row.layout().addWidget(self.check_updates)
        row.layout().addWidget(self.show_help)
        row.layout().addStretch(1.0)
        #######################################################
        row = common_ui.add_row(None, parent=self)

        label = common_ui.PaintedLabel(u'Shotgun RV',
                                       size=common.LARGE_FONT_SIZE(),
                                       parent=row)
        row.layout().addWidget(label)
        row.layout().addStretch(1)

        grp = common_ui.get_group(parent=self)

        row = common_ui.add_row(u'Path to RV', parent=grp)
        self.rv_path = common_ui.add_line_edit(u'eg. c:/rv/bin/rv.exe',
                                               parent=row)
        row.layout().addWidget(self.rv_path, 1)

        button = common_ui.PaintedButton(u'Pick')
        button.clicked.connect(self.pick_rv)
        row.layout().addWidget(button)
        button = common_ui.PaintedButton(u'Reveal')
        button.clicked.connect(lambda: common.reveal(self.rv_path.text()))
        row.layout().addWidget(button)

        text = \
            u'You can use {} to push footage to Shotgun RV \
(<span style="color:rgba({});">CTRL+P)</span>. Select the RV executable for this to work.'                                                                                          .format(
                common.PRODUCT, common.rgb(common.ADD))
        common_ui.add_description(text, label=u'Hint', parent=grp)

        #######################################################

        label = common_ui.PaintedLabel(u'Shortcuts',
                                       size=common.LARGE_FONT_SIZE(),
                                       parent=self)
        self.layout().addWidget(label)

        grp = common_ui.get_group(parent=self)

        label = QtWidgets.QLabel(parent=self)
        s = u'<table width="100%">'

        def r():
            return unicode('<tr>\
    <td align="center" style="background-color:rgba(0,0,0,80);padding:{pad}px;">\
        <span style="color:rgba({ADD});">{shortcut}</span>\
    </td>\
    <td align="left" style="background-color:rgba(0,0,0,30);padding:{pad}px;">\
        <span style="color:rgba({TEXT});">{description}</span>\
    </td>\
</tr>')

        for shortcut, description in (
            (u'Ctrl+N', u'Open new {} instance'.format(common.PRODUCT)),
            (u'Enter', u'Activate item'),
            (u'Space', u'Preview thumbnail'),
            (u'Arrow Up/Down', u'Navigate list'),
            (u'Ctrl+R', u'Reload'),
            (u'Ctrl+F', u'Edit filter'),
            (u'Ctrl+O', u'Reveal in file manager'),
            (u'Ctrl+C', u'Copy path'),
            (u'Ctrl+Shift+C', u'Copy path (alt)'),
            (u'Ctrl+S', u'Save/remove favourite'),
            (u'Ctrl+A', u'Archive/enable'),
            (u'Ctrl+T', u'Show Notes & Todos'),
            (u'Ctrl+H', u'Hide buttons'),
            (u'Ctrl+M', u'Toggle thumbnail loading'),
            (u'Ctrl+Shift+A', u'Show/Hide archived items'),
            (u'Ctrl+Shift+F', u'Show favourites only/Show all'),
            (u'Tab', u'Edit item description'),
            (u'Shift+Tab', u'Edit item description'),
            (u'Alt+Left', u'Show previous tab'),
            (u'Alt+Right', u'Show next tab'),
            (u'Ctrl+1', u'Show bookmarks'),
            (u'Ctrl+2', u'Show assets'),
            (u'Ctrl+3', u'Show files'),
            (u'Ctrl+4', u'Show favourites'),
            (u'Ctrl+Plus', u'Increase row height'),
            (u'Ctrl+Minus', u'Decrease row height'),
            (u'Ctrl+0', u'Reset row height'),
        ):
            s += r().format(
                shortcut=shortcut,
                description=description,
                pad=int(common.INDICATOR_WIDTH() * 1.5),
                ADD=common.rgb(common.ADD),
                TEXT=common.rgb(common.SECONDARY_TEXT),
            )
        s += u'</table>'
        label.setText(s)
        label.setWordWrap(True)
        grp.layout().addWidget(label)

        label = common_ui.PaintedLabel(u'About {}'.format(common.PRODUCT),
                                       size=common.LARGE_FONT_SIZE(),
                                       parent=grp)
        self.layout().addWidget(label)
        grp = common_ui.get_group(parent=self)
        o = common.MARGIN()
        grp.layout().setContentsMargins(o, o, o, o)
        # row = common_ui.add_row(u'Version', parent=grp, height=None)
        s = u'\n'.join(bookmarks.get_info())
        common_ui.add_description(s, label=None, parent=grp)

        self.layout().addStretch(1)
예제 #15
0
    def _create_UI(self):
        """Creates the ui layout."""
        QtWidgets.QVBoxLayout(self)
        o = common.MARGIN()
        self.layout().setSpacing(common.INDICATOR_WIDTH())
        self.layout().setContentsMargins(o, o, o, o)

        # Top row
        height = common.ROW_HEIGHT() * 0.6666
        row = common_ui.add_row(None, height=height, parent=self)
        row.layout().addSpacing(height * 0.33)

        def paintEvent(event):
            painter = QtGui.QPainter()
            painter.begin(row)
            painter.setPen(QtCore.Qt.NoPen)
            painter.setBrush(QtGui.QColor(0, 0, 0, 255))
            rect = row.rect()
            rect.setTop(rect.bottom())
            painter.drawRect(rect)
            painter.end()

        # row.paintEvent = paintEvent
        # Thumbnail
        self.add_button = common_ui.ClickableIconButton(
            u'add', (common.ADD, common.ADD),
            height,
            description=u'Click to add a new Todo item...',
            parent=self)

        # Name label
        text = u'Notes and Tasks'
        label = common_ui.PaintedLabel(text,
                                       color=common.SEPARATOR,
                                       size=common.LARGE_FONT_SIZE(),
                                       parent=self)
        row.layout().addWidget(label, 1)
        row.layout().addStretch(1)

        self.refresh_button = common_ui.ClickableIconButton(
            u'refresh',
            (QtGui.QColor(0, 0, 0, 255), QtGui.QColor(0, 0, 0, 255)),
            height,
            description=u'Refresh...',
            parent=self)
        self.refresh_button.clicked.connect(self.refresh)
        row.layout().addWidget(self.refresh_button, 0)

        self.remove_button = common_ui.ClickableIconButton(
            u'close', (QtGui.QColor(0, 0, 0, 255), QtGui.QColor(0, 0, 0, 255)),
            height,
            description=u'Refresh...',
            parent=self)
        self.remove_button.clicked.connect(self.close)
        row.layout().addWidget(self.remove_button, 0)

        row = common_ui.add_row(None, height=height, parent=self)
        text = u'Add new note'
        label = common_ui.PaintedLabel(text,
                                       color=common.SECONDARY_TEXT,
                                       size=common.SMALL_FONT_SIZE(),
                                       parent=self)

        row.layout().addWidget(self.add_button, 0)
        row.layout().addWidget(label, 0)

        row.layout().addStretch(1)

        self.add_button.clicked.connect(lambda: self.add_item(idx=0))

        self.todoeditors_widget = TodoEditors(parent=self)
        self.setMinimumHeight(common.ROW_HEIGHT() * 3.0)

        self.scrollarea = QtWidgets.QScrollArea(parent=self)
        self.scrollarea.setWidgetResizable(True)
        self.scrollarea.setWidget(self.todoeditors_widget)

        self.scrollarea.setAttribute(QtCore.Qt.WA_NoSystemBackground)
        self.scrollarea.setAttribute(QtCore.Qt.WA_TranslucentBackground)

        self.layout().addWidget(self.scrollarea)