Ejemplo n.º 1
0
    def paintEvent(self, event):
        '''Handle paint *event*.'''
        itemData = self.itemData(self.currentIndex())

        if itemData:
            # Draw main control.
            painter = QtWidgets.QStylePainter(self)
            painter.setPen(self.palette().color(QtGui.QPalette.Text))

            option = QtWidgets.QStyleOptionComboBox()
            self.initStyleOption(option)
            painter.drawComplexControl(QtWidgets.QStyle.CC_ComboBox, option)

            # Get QTextDocument from delegate to use for painting HTML text.
            delegate = self.itemDelegate()
            document = delegate.getTextDocument(
                option, self.itemData(self.currentIndex()))

            style = painter.style()  # QtWidgets.QApplication.style()
            paint_context = QtGui.QAbstractTextDocumentLayout.PaintContext()

            text_rectangle = style.subElementRect(
                QtWidgets.QStyle.SE_ComboBoxFocusRect, option, self)

            painter.save()
            painter.translate(text_rectangle.topLeft())
            painter.setClipRect(
                text_rectangle.translated(-text_rectangle.topLeft()))
            document.documentLayout().draw(painter, paint_context)
            painter.restore()

        else:
            super(HtmlComboBox, self).paintEvent(event)
    def __init__(self, *args, **kwargs):
        '''Initialise widget.'''
        super(ThumbnailDropZone, self).__init__(*args, **kwargs)

        self.setObjectName('ftrack-connect-thumbnail-drop-zone')

        layout = QtWidgets.QHBoxLayout()
        layout.addSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        self.setAcceptDrops(True)
        self.setProperty('ftrackDropZone', True)

        self._filePath = None
        self._imageWidth = 200
        self._imageHeight = 50

        self.imageLabel = QtWidgets.QLabel()
        self.setDropZoneText()
        layout.addWidget(self.imageLabel, alignment=QtCore.Qt.AlignLeft)

        # TODO: Add theme support.
        removeIcon = QtGui.QIcon(QtGui.QPixmap(':/ftrack/image/light/trash'))
        self.removeButton = QtWidgets.QPushButton()
        self.removeButton.setVisible(False)
        self.removeButton.setFlat(True)
        self.removeButton.setIcon(removeIcon)
        self.removeButton.clicked.connect(self.removeThumbnail)
        layout.addWidget(self.removeButton, alignment=QtCore.Qt.AlignRight)
    def __init__(self, *args, **kwargs):
        '''Initialise DataDropZone widget.'''
        super(DataDropZone, self).__init__(*args, **kwargs)

        self.log = logging.getLogger(__name__ + '.' + self.__class__.__name__)
        self.setAcceptDrops(True)
        self.setObjectName('ftrack-connect-publisher-browse-button')
        self.setProperty('ftrackDropZone', True)

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        bottomCenterAlignment = QtCore.Qt.AlignBottom | QtCore.Qt.AlignHCenter
        topCenterAlignment = QtCore.Qt.AlignTop | QtCore.Qt.AlignHCenter

        self._label = QtWidgets.QLabel('Drop files here or')
        layout.addWidget(self._label, alignment=bottomCenterAlignment)

        self._browseButton = QtWidgets.QPushButton('Browse')
        self._browseButton.setToolTip('Browse for file(s).')
        layout.addWidget(self._browseButton, alignment=topCenterAlignment)

        self._setupConnections()

        homeFolder = os.path.expanduser('~')
        if os.path.isdir(homeFolder):
            self._currentLocation = homeFolder
Ejemplo n.º 4
0
    def __init__(self, parent=None, connector=None):
        ''''Initialize dialog with *parent* and *connector* instance.'''
        if not connector:
            raise ValueError(
                'Please provide a connector object for {0}'.format(
                    self.__class__.__name__))
        self.connector = connector
        if not parent:
            self.parent = self.connector.getMainWindow()
        super(FtrackTasksDialog, self).__init__(self.parent)
        applyTheme(self, 'integration')
        self.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding))
        self.setMinimumWidth(500)
        self.centralwidget = QtWidgets.QWidget(self)
        self.verticalMainLayout = QtWidgets.QVBoxLayout(self)
        self.horizontalLayout = QtWidgets.QHBoxLayout()

        self.headerWidget = Header(getpass.getuser(), self)
        self.headerWidget.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Fixed)
        self.verticalMainLayout.addWidget(self.headerWidget)

        self.tasksWidget = WebViewWidget(self)

        url = ftrack.getWebWidgetUrl('tasks', theme='tf')

        self.tasksWidget.setUrl(url)
        self.horizontalLayout.addWidget(self.tasksWidget)
        self.verticalMainLayout.addLayout(self.horizontalLayout)

        self.setObjectName('ftrackTasks')
        self.setWindowTitle("ftrackTasks")
Ejemplo n.º 5
0
    def __init__(self, text, name, me=False, parent=None):
        '''Initialise widget with *text* and *name*.'''
        super(Message, self).__init__(parent)

        self.setLayout(QtWidgets.QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(0)

        if me:
            name = 'You'

        self.sender = QtWidgets.QLabel(name)
        self.layout().addWidget(self.sender, stretch=0)

        self.text = QtWidgets.QLabel(text)
        self.text.setWordWrap(True)
        self.text.setObjectName('message-text')

        self.layout().addWidget(self.text, stretch=1)

        if me:
            self.sender.setStyleSheet('''
                    QLabel {
                        color: #1CBC90;
                    }
                ''')
            self.sender.setAlignment(QtCore.Qt.AlignRight)
            self.text.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignRight)
        else:
            self.sender.setStyleSheet('''
                    QLabel {
                        color: rgba(52, 152, 219, 255);
                    }
                ''')
    def __init__(self, parent=None, title=None, headerWidgets=None):
        '''Instantiate widget with optional *parent* and *title*.

        *headerWidgets* is an optional list of widgets to append to the header
        of the time log widget.

        '''
        super(TimeLogList,
              self).__init__(widgetFactory=self._createWidget,
                             widgetItem=lambda widget: widget.value(),
                             parent=parent)
        self.setObjectName('time-log-list')
        self.list.setShowGrid(False)

        # Disable selection on internal list.
        self.list.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)

        headerLayout = QtWidgets.QHBoxLayout()
        self.titleLabel = QtWidgets.QLabel(title)
        self.titleLabel.setProperty('title', True)

        headerLayout.addWidget(self.titleLabel, stretch=1)

        # TODO: Refacor and make use of QToolBar and QAction.
        # Also consider adding 'addAction'/'removeAction'.
        if headerWidgets:
            for widget in headerWidgets:
                headerLayout.addWidget(widget, stretch=0)

        self.layout().insertLayout(0, headerLayout)
Ejemplo n.º 7
0
    def __init__(self, currentEntity, parent=None):
        '''Initialise with the *currentEntity* and *parent* widget.'''
        super(ContextSelector, self).__init__(parent=parent)
        self.setObjectName('context-selector-widget')
        self._entity = currentEntity
        self.entityBrowser = EntityBrowser()
        self.entityBrowser.setMinimumWidth(600)
        self.entityPath = EntityPath()

        self.entityBrowseButton = QtWidgets.QPushButton('Change')
        self.entityBrowseButton.setFixedWidth(110)
        self.entityBrowseButton.setFixedHeight(35)

        layout = QtWidgets.QHBoxLayout()
        layout.setContentsMargins(10, 0, 10, 0)
        self.setMinimumHeight(50)
        self.setLayout(layout)

        layout.addWidget(self.entityPath)
        layout.addWidget(self.entityBrowseButton)

        self.entityBrowseButton.clicked.connect(
            self._onEntityBrowseButtonClicked
        )
        self.entityChanged.connect(self.entityPath.setEntity)
        self.entityBrowser.selectionChanged.connect(
            self._onEntityBrowserSelectionChanged
        )
        self.setEntity(self._entity)
Ejemplo n.º 8
0
    def parseRow(self, rowElement, connectorName, mainLayout, assetTypeName):
        '''Parse xml *rowElement*.'''
        accepts = rowElement.attribute('accepts')
        acceptsSplit = accepts.split(',')
        if accepts == '' or connectorName in acceptsSplit:
            rowLayout = QtWidgets.QHBoxLayout()
            rowName = rowElement.attribute('name')
            rowEnabled = rowElement.attribute('enabled')

            optionLabel = QtWidgets.QLabel(rowName)
            optionLabel.setFixedWidth(160)
            rowLayout.addWidget(optionLabel)

            if rowEnabled == 'False':
                enabled = False
                optionLabel.setEnabled(False)
            else:
                enabled = True

            optionElements = rowElement.elementsByTagName('option')
            optionsCount = self.parseOptions(rowLayout, optionElements,
                                             assetTypeName, enabled)

            return rowLayout, optionsCount
        else:
            return None, 0
Ejemplo n.º 9
0
    def __init__(self, parent=None):
        '''Initialise widget with *parent*'''
        super(Notification, self).__init__(parent=parent)

        self._context = defaultdict(list)

        layout = QtWidgets.QVBoxLayout()

        toolbar = QtWidgets.QHBoxLayout()

        self.setLayout(layout)

        reloadIcon = QtGui.QIcon(QtGui.QPixmap(':/ftrack/image/dark/reload'))

        self.reloadButton = QtWidgets.QPushButton(reloadIcon, '')
        self.reloadButton.clicked.connect(self.reload)

        toolbar.addWidget(QtWidgets.QWidget(), stretch=1)
        toolbar.addWidget(self.reloadButton, stretch=0)

        layout.addLayout(toolbar)

        self._list = NotificationList(self)
        self._list.setObjectName('notification-list')
        layout.addWidget(self._list, stretch=1)

        self.overlay = ftrack_connect.ui.widget.overlay.BusyOverlay(
            self, message='Loading')

        self.overlay.hide()

        self.loadStarted.connect(self._onLoadStarted)
        self.loadEnded.connect(self._onLoadEnded)
Ejemplo n.º 10
0
    def __init__(self, username, session, parent=None):
        '''Instantiate user name and logo widget using *username*.'''

        super(User, self).__init__(parent=parent)
        self.setObjectName('ftrack-userid-widget')
        self.main_layout = QtWidgets.QHBoxLayout()
        self.main_layout.setContentsMargins(0, 0, 0, 0)
        self.main_layout.setAlignment(QtCore.Qt.AlignRight)
        self.setLayout(self.main_layout)

        self.session = session

        self.label = QtWidgets.QLabel(self)
        self.image = thumbnail.User(self)
        self.image.setFixedSize(30, 30)

        self.main_layout.addWidget(self.label)
        self.main_layout.addWidget(self.image)

        self.username = username
        self.image.load(username)

        if username in NAME_CACHE:
            self.set_user_fullname()
        else:
            self.load_user_fullname()
Ejemplo n.º 11
0
    def __init__(self, *args, **kwargs):
        '''Instantiate the asset options.'''
        super(AssetOptions, self).__init__(*args, **kwargs)

        self.logger = logging.getLogger(
            __name__ + '.' + self.__class__.__name__
        )

        self._entity = None
        self._hasEditedName = False

        self.radioButtonFrame = QtWidgets.QFrame()
        self.radioButtonFrame.setLayout(QtWidgets.QHBoxLayout())
        self.radioButtonFrame.layout().setContentsMargins(5, 5, 5, 5)

        self.newAssetButton = QtWidgets.QRadioButton('Create new')
        self.newAssetButton.toggled.connect(self._onNewAssetToggled)
        self.radioButtonFrame.layout().addWidget(self.newAssetButton)

        self.existingAssetButton = QtWidgets.QRadioButton('Version up existing')
        self.existingAssetButton.toggled.connect(self._onExistingAssetToggled)
        self.radioButtonFrame.layout().addWidget(self.existingAssetButton)

        self.existingAssetSelector = _asset_selector.AssetSelector()
        self.assetTypeSelector = _asset_type_selector.AssetTypeSelector()
        self.assetNameLineEdit = _asset_name_edit.AssetNameEdit(
            self.existingAssetSelector, self.assetTypeSelector
        )

        self.assetTypeSelector.currentIndexChanged.connect(self._onAssetTypeChanged)
        self.assetNameLineEdit.textEdited.connect(self._onAssetNameEdited)
Ejemplo n.º 12
0
    def __init__(self, parent=None):
        '''Initiate chat widget with *chatHub*.'''
        super(Chat, self).__init__(parent)

        self.setLayout(QtWidgets.QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(0)
        self.setObjectName('chat-widget')

        self._chatFeed = Feed(parent)
        self.layout().addWidget(self._chatFeed, stretch=1)

        self._messageArea = ChatTextEdit(self)
        self._messageArea.setMinimumHeight(30)
        self._messageArea.setMaximumHeight(75)
        self._messageArea.returnPressed.connect(self.onReturnPressed)
        self.layout().addWidget(self._messageArea, stretch=0)

        self._sendMessageButton = QtWidgets.QPushButton('Submit')
        self.layout().addWidget(self._sendMessageButton, stretch=0)

        self._sendMessageButton.clicked.connect(self.onReturnPressed)

        self.busyOverlay = ftrack_connect.ui.widget.overlay.BusyOverlay(
            self, message='Loading')
        self.hideOverlay()
Ejemplo n.º 13
0
    def __init__(self, componentName=None, resourceIdentifier=None,
                 parent=None):
        '''Initialise widget with initial component *value* and *parent*.'''
        super(Component, self).__init__(parent=parent)
        self.setLayout(QtWidgets.QVBoxLayout())

        self.componentNameEdit = ftrack_connect.ui.widget.line_edit.LineEdit()
        self.componentNameEdit.setPlaceholderText('Enter component name')
        self.componentNameEdit.textChanged.connect(self.nameChanged)

        self.layout().addWidget(self.componentNameEdit)

        # TODO: Add theme support.
        removeIcon = QtGui.QIcon(
            QtGui.QPixmap(':/ftrack/image/light/trash')
        )

        self.removeAction = QtWidgets.QAction(
            QtGui.QIcon(removeIcon), 'Remove', self.componentNameEdit
        )
        self.removeAction.setStatusTip('Remove component.')
        self.componentNameEdit.addAction(
            self.removeAction
        )

        self.resourceInformation = ftrack_connect.ui.widget.label.Label()
        self.layout().addWidget(self.resourceInformation)

        # Set initial values.
        self.setId(str(uuid.uuid4()))
        self.setComponentName(componentName)
        self.setResourceIdentifier(resourceIdentifier)
Ejemplo n.º 14
0
 def createVersionWidget(self):
     ''' Override to disable version widget.
     Return an empty QWidget.
     '''
     widget = QtWidgets.QWidget()
     layout = QtWidgets.QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     widget.setLayout(layout)
     return widget
Ejemplo n.º 15
0
    def __init__(
        self, parent, message='Processing',
        icon=':ftrack/image/default/ftrackLogoColor'
    ):
        '''Initialise with *parent*.

         *message* is the message to display on the overlay.

         '''
        super(BlockingOverlay, self).__init__(parent)
        layout = QtWidgets.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        self.content = QtWidgets.QFrame()
        self.content.setObjectName('content')
        layout.addWidget(
            self.content, alignment=QtCore.Qt.AlignCenter
        )

        self.contentLayout = QtWidgets.QVBoxLayout()
        self.contentLayout.setContentsMargins(0, 0, 0, 0)
        self.content.setLayout(self.contentLayout)

        self.icon = QtWidgets.QLabel()
        pixmap = QtGui.QPixmap(icon)
        self.icon.setPixmap(
            pixmap.scaledToHeight(36, mode=QtCore.Qt.SmoothTransformation)
        )
        self.icon.setAlignment(QtCore.Qt.AlignCenter)
        self.contentLayout.addWidget(self.icon)

        self.messageLabel = QtWidgets.QLabel()
        self.messageLabel.setWordWrap(True)
        self.messageLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.contentLayout.addWidget(self.messageLabel)

        self.setStyleSheet('''
            BlockingOverlay {
                background-color: rgba(250, 250, 250, 200);
                border: none;
            }

            BlockingOverlay QFrame#content {
                padding: 0px;
                border: 80px solid transparent;
                background-color: transparent;
                border-image: url(:ftrack/image/default/boxShadow) 140 stretch;
            }

            BlockingOverlay QLabel {
                background: transparent;
            }
        ''')

        self.setMessage(message)
Ejemplo n.º 16
0
 def __init__(self, parent=None):
     super(ScrollingFlowWidget, self).__init__(parent)
     grid = QtWidgets.QGridLayout(self)
     scroll = ResizeScrollArea(parent)
     self._wrapper = QtWidgets.QWidget(scroll)
     self.flowLayout = FlowLayout(self._wrapper)
     self._wrapper.setLayout(self.flowLayout)
     scroll.setWidget(self._wrapper)
     scroll.setWidgetResizable(True)
     grid.addWidget(scroll)
Ejemplo n.º 17
0
    def __init__(self,
                 session,
                 all_section_text=None,
                 overlay=None,
                 parent=None):
        '''Initiate a actions view.'''
        super(Actions, self).__init__(parent)

        self.logger = logging.getLogger(__name__ + '.' +
                                        self.__class__.__name__)
        self._session = session

        self._action_label_text = all_section_text

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)
        self.layout().setContentsMargins(0, 0, 0, 0)

        self._currentUserId = None
        self._recentActions = []
        self._actions = []

        self._recentLabel = QtWidgets.QLabel('Recent')
        layout.addWidget(self._recentLabel)
        self._recentSection = ActionSection(self)
        # self._recentSection.setFixedHeight(100)
        self._recentSection.beforeActionLaunch.connect(
            self._onBeforeActionLaunched)
        self._recentSection.actionLaunched.connect(self._onActionLaunched)
        # layout.addWidget(self._recentSection)

        self._allLabel = QtWidgets.QLabel()
        self._allLabel.setAlignment(QtCore.Qt.AlignCenter)
        layout.addWidget(self._allLabel)
        self._allSection = ActionSection(self)
        self._allSection.beforeActionLaunch.connect(
            self._onBeforeActionLaunched)
        self._allSection.actionLaunched.connect(self._onActionLaunched)
        layout.addWidget(self._allSection)

        if overlay is None:
            self._overlay = overlay_.BusyOverlay(self, message='Launching...')
        else:
            self._overlay = overlay

        self._overlay.setStyleSheet(OVERLAY_DARK_STYLE)
        self._overlay.setVisible(False)

        self.recentActionsChanged.connect(self._updateRecentSection)

        self._loadActionsForContext([])
        self._updateRecentActions()
Ejemplo n.º 18
0
    def __init__(
        self, name, userId, group=None, applications=None, parent=None
    ):
        '''Initialise widget with initial component *value* and *parent*.'''
        super(User, self).__init__(parent)
        if applications is None:
            applications = {}

        self._userId = userId
        self._applications = applications
        self._group = group

        self.setObjectName('user')

        self.setLayout(QtWidgets.QHBoxLayout())

        self.thumbnail = ftrack_connect.ui.widget.thumbnail.User()
        self.thumbnail.setFixedWidth(30)
        self.thumbnail.setFixedHeight(30)
        self.thumbnail.load(userId)
        self.layout().addWidget(self.thumbnail)

        self.layout().setContentsMargins(0, 0, 0, 0)

        nameAndActivity = QtWidgets.QWidget()
        nameAndActivity.setLayout(QtWidgets.QVBoxLayout())
        nameAndActivity.layout().setContentsMargins(0, 0, 0, 0)

        self.countLabel = QtWidgets.QLabel()
        self.countLabel.setObjectName('user-conversation-count')
        self.countLabel.hide()

        self.nameLabel = ftrack_connect.ui.widget.label.Label()
        self.nameLabel.setText(name)
        self.nameLabel.setObjectName('name')
        nameAndActivity.layout().addWidget(self.nameLabel)

        self.activityLabel = ftrack_connect.ui.widget.label.Label()
        self.activityLabel.setObjectName('user-activity')

        self.nameAndCountLayout = QtWidgets.QHBoxLayout()
        self.nameAndCountLayout.addWidget(self.nameLabel, stretch=1)
        self.nameAndCountLayout.addWidget(self.countLabel, stretch=0)
        self.nameAndCountLayout.addSpacing(5)

        nameAndActivity.layout().addLayout(self.nameAndCountLayout)
        nameAndActivity.layout().addWidget(self.activityLabel)

        self.layout().addWidget(nameAndActivity)

        self._refreshStyles()
        self._updateActivity()
Ejemplo n.º 19
0
    def __init__(self, ftrack_entity, hint=None):
        '''Instantiate asset selector with *ftrack_entity*.'''
        super(AssetSelector, self).__init__()

        self.assets = ftrack_entity.session.query(
            'select name, id, type_id from Asset where context_id '
            'is "{0}"'.format(
                ftrack_entity['id']
            )
        ).all()

        main_layout = QtWidgets.QVBoxLayout(self)
        self.setLayout(main_layout)
        main_layout.setContentsMargins(0, 0, 0, 0)

        self.asset_selector = QtWidgets.QComboBox(self)
        main_layout.addWidget(self.asset_selector)

        self.asset_selector.addItem('Create new asset')
        for asset in self.assets:
            self.asset_selector.addItem(asset['name'])

        self.asset_name = QtWidgets.QLineEdit(self)
        self.asset_name.setPlaceholderText('Asset name...')
        main_layout.addWidget(self.asset_name)

        self.asset_type_selector = QtWidgets.QComboBox(self)

        self.asset_types = ftrack_entity.session.query(
            'select name, short, id from AssetType'
        ).all()

        for asset_type in self.asset_types:
            self.asset_type_selector.addItem(asset_type['name'])

        # automatically set the correct asset type
        if hint:
            for index, asset_type in enumerate(self.asset_types):
                if asset_type['short'] == hint:
                    self.asset_type_selector.setCurrentIndex(index)
                    break

        main_layout.addWidget(self.asset_type_selector)

        self.asset_selector.currentIndexChanged.connect(
            self._on_asset_selection_changed
        )
        self.asset_type_selector.currentIndexChanged.connect(
            self.notify_changed
        )
        self.asset_name.textChanged.connect(self.notify_changed)
Ejemplo n.º 20
0
    def __init__(self, title=None, description=None, data=None, parent=None):
        '''Initialise time log.

        *title* should be the title entry to display for the time log whilst
        *description* can provide an optional longer description.

        *data* is optional data that can be stored for future reference (for
        example a link to an ftrack task that the time log represents).

        *parent* should be the optional parent of this widget.

        '''
        super(TimeLog, self).__init__(parent=parent)
        self.setObjectName('time-log')
        self._data = None

        layout = QtWidgets.QHBoxLayout()
        self.setLayout(layout)

        self.labelLayout = QtWidgets.QVBoxLayout()
        layout.addLayout(self.labelLayout, stretch=1)

        self.titleLabel = ftrack_connect.ui.widget.label.Label()
        self.titleLabel.setProperty('title', True)
        self.labelLayout.addWidget(self.titleLabel)

        self.descriptionLabel = ftrack_connect.ui.widget.label.Label()
        self.labelLayout.addWidget(self.descriptionLabel)

        # TODO: Add theme support.
        playIcon = QtGui.QIcon(
            QtGui.QPixmap(':/ftrack/image/light/play')
        )

        self.playButton = QtWidgets.QPushButton(playIcon, '')
        self.playButton.setFlat(True)
        self.playButton.clicked.connect(self._onPlayButtonClicked)
        layout.addWidget(self.playButton)

        self.setSizePolicy(
            QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed
        )

        # Set initial values.
        self.setValue({
            'title': title,
            'description': description,
            'data': data
        })
Ejemplo n.º 21
0
    def location_configuration_finished(self, reconfigure_session=True):
        '''Continue connect setup after location configuration is done.'''
        if reconfigure_session:
            ftrack_connect.session.destroy_shared_session()
            self._session = self._setup_session()

        try:
            self.configureConnectAndDiscoverPlugins()
        except Exception as error:
            self.logger.exception(u'Error during location configuration.:')
            self._report_session_setup_error(error)
        else:
            self.focus()

        # Send verify startup event to verify that storage scenario is
        # working correctly.
        event = ftrack_api.event.base.Event(
            topic='ftrack.connect.verify-startup',
            data={
                'storage_scenario': self._session.server_information.get(
                    'storage_scenario'
                )
            }
        )
        results = self._session.event_hub.publish(event, synchronous=True)
        problems = [
            problem for problem in results if isinstance(problem, basestring)
        ]
        if problems:
            msgBox = QtWidgets.QMessageBox(parent=self)
            msgBox.setIcon(QtWidgets.QMessageBox.Warning)
            msgBox.setText('\n\n'.join(problems))
            msgBox.exec_()
Ejemplo n.º 22
0
    def refresh(self):
        '''Refresh content.'''
        layout = self._list_instances_layout

        general_options = self.publish_asset.get_options()
        if general_options:
            settings_widget = self.settings_provider(
                label=None,
                options=general_options,
                store=self.general_options_store)
            self._list_items_settings_layout.insertWidget(0, settings_widget)

        items = self.publish_asset.get_publish_items()

        self.list_items_view = ListItemsWidget(items)
        self.list_items_view.itemChanged.connect(self.on_selection_changed)

        scene_select_button = QtWidgets.QPushButton('Scene selection')

        scene_select_button.clicked.connect(self._on_sync_scene_selection)
        layout.addWidget(scene_select_button)

        layout.addWidget(self.list_items_view, stretch=0)

        for item in items:
            if item.get('value') is True:
                self.add_instance_settings(item)

        self.list_items_view.setFocus()
Ejemplo n.º 23
0
    def __init__(
        self, idField='id', labelField='label', defaultLabel='Unnamed Item',
        emptyLabel='Select an item', *args, **kwargs
    ):
        '''Initialise item selector widget.

        *idField* and *labelField* are the keys used to get the unique
        identifier and label for each item. *defaultLabel* is used if
        *labelField* is not found in an item and *emptyLabel* is used as
        the placholder label.

        '''
        super(ItemSelector, self).__init__(*args, **kwargs)

        # Set style delegate to allow styling of combobox menu via Qt Stylesheet
        itemDelegate = QtWidgets.QStyledItemDelegate()
        self.setItemDelegate(itemDelegate)

        self._idField = idField
        self._labelField = labelField
        self._defaultLabel = defaultLabel
        self._emptyLabel = emptyLabel

        self.currentIndexChanged.connect(self._onCurrentIndexChanged)
        self.setItems()
    def setupUi(self, ImportOptions):
        '''Setup UI for *ImportOptions*.'''
        ImportOptions.setObjectName("ImportOptions")
        ImportOptions.resize(451, 16)
        self.verticalLayout = QtWidgets.QVBoxLayout(ImportOptions)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.optionsPlaceHolderLayout = QtWidgets.QHBoxLayout()
        self.optionsPlaceHolderLayout.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize
        )
        self.optionsPlaceHolderLayout.setObjectName("optionsPlaceHolderLayout")
        self.verticalLayout.addLayout(self.optionsPlaceHolderLayout)

        self.retranslateUi(ImportOptions)
        QtCore.QMetaObject.connectSlotsByName(ImportOptions)
Ejemplo n.º 25
0
    def __init__(self, *args, **kwargs):
        '''Instantiate the actions widget.'''
        super(Actions, self).__init__(*args, **kwargs)
        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        self.actionsView = ftrack_connect.ui.widget.actions.Actions()
        layout.addWidget(self.actionsView)
Ejemplo n.º 26
0
    def __init__(self, parent=None):
        '''Initiate a actions view.'''
        super(Actions, self).__init__(parent)

        self.logger = logging.getLogger(__name__ + '.' +
                                        self.__class__.__name__)
        self._session = ftrack_connect.session.get_session()

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        self._currentUserId = None
        self._recentActions = []
        self._actions = []

        self._entitySelector = entity_selector.EntitySelector()
        self._entitySelector.setFixedHeight(50)
        self._entitySelector.entityChanged.connect(self._onEntityChanged)
        layout.addWidget(QtWidgets.QLabel('Select action context'))
        layout.addWidget(self._entitySelector)

        self._recentLabel = QtWidgets.QLabel('Recent')
        layout.addWidget(self._recentLabel)
        self._recentSection = ActionSection(self)
        self._recentSection.setFixedHeight(100)
        self._recentSection.beforeActionLaunch.connect(
            self._onBeforeActionLaunched)
        self._recentSection.actionLaunched.connect(self._onActionLaunched)
        layout.addWidget(self._recentSection)

        self._allLabel = QtWidgets.QLabel('Discovering actions..')
        self._allLabel.setAlignment(QtCore.Qt.AlignCenter)
        layout.addWidget(self._allLabel)
        self._allSection = ActionSection(self)
        self._allSection.beforeActionLaunch.connect(
            self._onBeforeActionLaunched)
        self._allSection.actionLaunched.connect(self._onActionLaunched)
        layout.addWidget(self._allSection)

        self._overlay = overlay.BusyOverlay(self, message='Launching...')
        self._overlay.setVisible(False)

        self.recentActionsChanged.connect(self._updateRecentSection)

        self._loadActionsForContext([])
        self._updateRecentActions()
Ejemplo n.º 27
0
 def __init__(self):
     '''Initialize widget'''
     super(ThumbnailField, self).__init__()
     layout = QtWidgets.QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(layout)
     self.thumbnail = thumbnail_drop_zone.ThumbnailDropZone()
     self.layout().addWidget(self.thumbnail)
     self.thumbnail.updated.connect(self.notify_changed)
Ejemplo n.º 28
0
 def __init__(self, placeholder):
     '''Initialize widget.'''
     super(TextAreaField, self).__init__()
     layout = QtWidgets.QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(layout)
     self.textarea = textarea.TextArea(placeholder)
     self.layout().addWidget(self.textarea)
     self.textarea.textChanged.connect(self.notify_changed)
Ejemplo n.º 29
0
    def __init__(self, parent):
        '''Initialise.'''
        super(TimerOverlay, self).__init__(parent)
        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        message = QtWidgets.QLabel('Select a task to activate timer.')
        message.setWordWrap(True)
        message.setAlignment(QtCore.Qt.AlignVCenter)
        layout.addWidget(message)

        # TODO: See if there is a way to stop Sass converting the rgba string
        # to the wrong value.
        self.setStyleSheet('''
            #ftrack-connect-window TimerOverlay {
                background-color: rgba(255, 255, 255, 200);
            }
        ''')
Ejemplo n.º 30
0
    def sizeHint(self, option, index):
        '''Return preferred size hint.'''
        options = QtWidgets.QStyleOptionViewItem(option)
        self.initStyleOption(options, index)

        data = index.data(role=QtCore.Qt.UserRole)
        document = self.getTextDocument(option, data)

        return QtCore.QSize(document.idealWidth(), document.size().height())