예제 #1
0
 def inline_icons_count(self):
     """The number of icons on the right - hand side."""
     if self.width() < common.WIDTH() * 0.5:
         return 0
     if self.buttons_hidden():
         return 0
     return 4
예제 #2
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])
예제 #3
0
 def __init__(self, parent=None):
     super(RectanglesWidget, self).__init__(parent=parent)
     self._width = 0.0
     self._height = 0.0
     self._fps = 0.0
     self._prefix = u''
     self._start = 0.0
     self._duration = 0.0
     self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
     self.setAttribute(QtCore.Qt.WA_NoSystemBackground)
     self.setMinimumHeight(common.HEIGHT() * 0.30)
     self.setMinimumWidth(common.WIDTH() * 0.15)
예제 #4
0
 def text(self):
     if not self.stacked_widget():
         return self.default_label
     index = self.active_index(self.index)
     if index.isValid():
         text = index.data(QtCore.Qt.DisplayRole).split(u'/').pop().upper()
         if self.parent().parent().width() < common.WIDTH():
             if len(text) > 20:
                 text = u'{}...{}'.format(text[0:8], text[-9:])
     else:
         text = self.default_label
     return text
예제 #5
0
def get_group(parent=None):
    """Utility method for creating a group widget.

    Returns:
        QGroupBox: group widget.

    """
    grp = QtWidgets.QGroupBox(parent=parent)
    grp.setMinimumWidth(common.WIDTH() * 0.3)
    grp.setMaximumWidth(common.WIDTH() * 2.0)

    QtWidgets.QVBoxLayout(grp)
    grp.setSizePolicy(
        QtWidgets.QSizePolicy.Minimum,
        QtWidgets.QSizePolicy.Maximum,
    )

    o = common.INDICATOR_WIDTH()
    grp.layout().setContentsMargins(o, o, o, o)
    grp.layout().setSpacing(o)
    parent.layout().addWidget(grp, 1)
    return grp
예제 #6
0
    def __init__(self, pixmap, text, parent=None):
        super(DragPixmap, self).__init__(parent=parent)
        self._pixmap = pixmap
        self._text = text

        font, metrics = common.font_db.primary_font(common.MEDIUM_FONT_SIZE())
        self._text_width = metrics.width(text)

        width = self._text_width + common.MARGIN()
        width = common.WIDTH() + common.MARGIN() if width > common.WIDTH(
        ) else width

        self.setFixedHeight(pixmap.height())
        self.setFixedWidth(pixmap.width() + common.INDICATOR_WIDTH() + width +
                           common.INDICATOR_WIDTH())

        self.setAttribute(QtCore.Qt.WA_NoSystemBackground)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Window)
        self.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
        self.adjustSize()
예제 #7
0
 def sizeHint(self):
     """The widget's default size."""
     return QtCore.QSize(common.WIDTH(), common.HEIGHT())
예제 #8
0
 def sizeHint(self):
     return QtCore.QSize(common.WIDTH() * 0.8, common.HEIGHT() * 1.2)
예제 #9
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)
예제 #10
0
 def sizeHint(self):
     """Custom size hint"""
     return QtCore.QSize(common.WIDTH(), common.HEIGHT())
예제 #11
0
 def sizeHint(self):
     """The default size of the widget."""
     if self.parent():
         return QtCore.QSize(self.parent().width(), self.parent().height())
     else:
         return QtCore.QSize(common.WIDTH() * 0.6, common.HEIGHT() * 0.6)