def __init__(self, *args, **kwargs):
        '''Instantiate the entity selector widget.'''
        super(EntitySelector, self).__init__(*args, **kwargs)
        self._entity = None

        # Create widget used to select an entity.
        selectionWidget = QtWidgets.QFrame()
        selectionWidget.setLayout(QtWidgets.QHBoxLayout())
        selectionWidget.layout().setContentsMargins(0, 0, 0, 0)
        self.insertWidget(0, selectionWidget)

        self.entityBrowser = _entity_browser.EntityBrowser(parent=self)
        self.entityBrowser.setMinimumSize(600, 400)
        self.entityBrowser.selectionChanged.connect(
            self._onEntityBrowserSelectionChanged)

        self.entityBrowseButton = QtWidgets.QPushButton('Browse')

        # TODO: Once the link is available through the API change this to a
        # combo with assigned tasks.
        self.assignedContextSelector = QtWidgets.QLineEdit()
        self.assignedContextSelector.setReadOnly(True)

        selectionWidget.layout().addWidget(self.assignedContextSelector)
        selectionWidget.layout().addWidget(self.entityBrowseButton)

        # Create widget used to present current selection.
        presentationWidget = QtWidgets.QFrame()
        presentationWidget.setLayout(QtWidgets.QHBoxLayout())
        presentationWidget.layout().setContentsMargins(0, 0, 0, 0)
        self.insertWidget(1, presentationWidget)

        self.entityPath = _entity_path.EntityPath()
        presentationWidget.layout().addWidget(self.entityPath)

        self.discardEntityButton = QtWidgets.QPushButton()
        removeIcon = QtGui.QIcon(QtGui.QPixmap(':/ftrack/image/light/remove'))
        self.discardEntityButton.setIconSize(QtCore.QSize(20, 20))
        self.discardEntityButton.setIcon(removeIcon)
        self.discardEntityButton.setFixedWidth(20)
        self.discardEntityButton.clicked.connect(
            self._onDiscardEntityButtonClicked)

        presentationWidget.layout().addWidget(self.discardEntityButton)

        self.entityChanged.connect(self.entityPath.setEntity)
        self.entityChanged.connect(self._updateIndex)
        self.entityBrowseButton.clicked.connect(
            self._onEntityBrowseButtonClicked)
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 4
0
    def __init__(self,
                 label,
                 description,
                 publish_asset,
                 session,
                 settings_provider=None,
                 parent=None):
        '''Display instances that can be published.'''
        super(Workflow, self).__init__()
        self.setObjectName('ftrack-workflow-widget')
        self.session = session
        self._label_text = label
        self.publish_asset = publish_asset

        plugin = ftrack_connect_pipeline.get_plugin()
        plugin_information = plugin.get_plugin_information()
        event_metadata = {
            'workflow_label': self._label_text,
        }
        if isinstance(plugin_information, dict):
            event_metadata.update(plugin_information)

        send_usage('USED-FTRACK-CONNECT-PIPELINE-PUBLISH', event_metadata)

        self.publish_asset.prepare_publish()

        self.item_options_store = {}
        self.general_options_store = {}

        self.settings_provider = settings_provider
        if self.settings_provider is None:
            self.settings_provider = BaseSettingsProvider()

        self.settings_map = {}
        list_instances_widget = QtWidgets.QFrame()
        list_instances_widget.setObjectName('ftrack-instances-widget')

        self._list_instances_layout = QtWidgets.QVBoxLayout()

        list_instances_widget.setLayout(self._list_instances_layout)
        self._list_instances_layout.setContentsMargins(5, 5, 5, 5)

        list_instance_settings_widget = QtWidgets.QFrame()
        list_instance_settings_widget.setObjectName(
            'ftrack-instances-settings-widget')

        self._list_items_settings_layout = QtWidgets.QVBoxLayout()
        self._list_items_settings_layout.addStretch(1)
        list_instance_settings_widget.setLayout(
            self._list_items_settings_layout)
        self._list_items_settings_layout.setContentsMargins(5, 5, 5, 5)

        configuration_layout = QtWidgets.QHBoxLayout()
        configuration_layout.addWidget(list_instances_widget, stretch=1)
        configuration_layout.addWidget(list_instance_settings_widget,
                                       stretch=1)
        configuration = QtWidgets.QFrame()
        configuration.setObjectName('ftrack-configuration-widget')
        configuration.setLayout(configuration_layout)
        configuration_layout.setContentsMargins(0, 0, 0, 0)

        information_layout = QtWidgets.QHBoxLayout()
        information_layout.addWidget(
            QtWidgets.QLabel('<h3>{0}</h3>'.format(self._label_text)))
        information_layout.addWidget(QtWidgets.QLabel(
            '<i>{0}</i>'.format(description)),
                                     stretch=1)
        information = QtWidgets.QFrame()
        information.setObjectName('ftrack-information-widget')
        information.setLayout(information_layout)
        information_layout.setContentsMargins(0, 0, 0, 0)

        publish_button = QtWidgets.QPushButton('Publish')
        publish_button.clicked.connect(self.on_publish_clicked)

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

        scroll = QtWidgets.QScrollArea(self)

        scroll.setWidgetResizable(True)
        scroll.setLineWidth(0)
        scroll.setFrameShape(QtWidgets.QFrame.NoFrame)
        scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)

        scroll.setWidget(configuration)

        self._list_instances_layout.addWidget(information)

        main_layout.addWidget(scroll, stretch=1)
        self._list_items_settings_layout.addWidget(publish_button)

        self._publish_overlay = BusyOverlay(self,
                                            message='Publishing Assets...')
        self._publish_overlay.setStyleSheet(OVERLAY_DARK_STYLE)
        self._publish_overlay.setVisible(False)

        self.result_win = PublishResult(self.session, self)
        self.result_win.setStyleSheet(OVERLAY_DARK_STYLE)
        self.result_win.setVisible(False)

        self.refresh()
Esempio n. 5
0
    def __init__(self, session, parent):
        '''Instantiate with *session*.'''
        super(CreateAssetTypeOverlay, self).__init__(parent=parent)
        self.session = session

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

        icon = QtGui.QPixmap(':ftrack/image/default/ftrackLogoColor')
        icon = icon.scaled(QtCore.QSize(85, 85), QtCore.Qt.KeepAspectRatio,
                           QtCore.Qt.SmoothTransformation)
        self.ftrack_icon = QtWidgets.QLabel()
        self.ftrack_icon.setPixmap(icon)

        self.main_layout.addStretch(1)
        self.main_layout.insertWidget(1,
                                      self.ftrack_icon,
                                      alignment=QtCore.Qt.AlignCenter)
        self.main_layout.addStretch(1)
        self.main_layout.setContentsMargins(20, 20, 20, 20)

        # create asset type widget
        self.create_asset_widget = QtWidgets.QFrame()
        self.create_asset_widget.setVisible(False)

        create_asset_layout = QtWidgets.QVBoxLayout()
        create_asset_layout.setContentsMargins(20, 20, 20, 20)
        create_asset_layout.addStretch(1)
        buttons_layout = QtWidgets.QHBoxLayout()
        self.create_asset_widget.setLayout(create_asset_layout)

        self.create_asset_label_top = QtWidgets.QLabel()

        self.create_asset_label_bottom = QtWidgets.QLabel(
            '<h4>Do you want to create one ?</h4>')

        create_asset_layout.insertWidget(1,
                                         self.create_asset_label_top,
                                         alignment=QtCore.Qt.AlignCenter)
        create_asset_layout.insertWidget(2,
                                         self.create_asset_label_bottom,
                                         alignment=QtCore.Qt.AlignCenter)
        self.create_asset_button = QtWidgets.QPushButton('Create')
        self.cancel_asset_button = QtWidgets.QPushButton('Cancel')
        create_asset_layout.addLayout(buttons_layout)
        buttons_layout.addWidget(self.create_asset_button)
        buttons_layout.addWidget(self.cancel_asset_button)

        # result create asset type
        self.create_asset_widget_result = QtWidgets.QFrame()
        self.create_asset_widget_result.setVisible(False)

        create_asset_layout_result = QtWidgets.QVBoxLayout()
        create_asset_layout_result.setContentsMargins(20, 20, 20, 20)
        create_asset_layout_result.addStretch(1)

        self.create_asset_widget_result.setLayout(create_asset_layout_result)
        self.create_asset_label_result = QtWidgets.QLabel()
        self.continue_button = QtWidgets.QPushButton('Continue')

        create_asset_layout_result.insertWidget(
            1, self.create_asset_label_result, alignment=QtCore.Qt.AlignCenter)

        create_asset_layout_result.insertWidget(
            2, self.continue_button, alignment=QtCore.Qt.AlignCenter)

        # error on create asset
        self.create_asset_widget_error = QtWidgets.QFrame()
        self.create_asset_widget_error.setVisible(False)

        create_asset_layout_error = QtWidgets.QVBoxLayout()
        create_asset_layout_error.setContentsMargins(20, 20, 20, 20)
        create_asset_layout_error.addStretch(1)

        self.create_asset_widget_error.setLayout(create_asset_layout_error)
        self.create_asset_label_error = QtWidgets.QLabel()
        self.close_button = QtWidgets.QPushButton('Close')

        create_asset_layout_error.insertWidget(1,
                                               self.create_asset_label_error,
                                               alignment=QtCore.Qt.AlignCenter)

        create_asset_layout_error.insertWidget(2,
                                               self.close_button,
                                               alignment=QtCore.Qt.AlignCenter)

        # parent all.
        self.main_layout.addWidget(self.create_asset_widget)
        self.main_layout.addWidget(self.create_asset_widget_result)
        self.main_layout.addWidget(self.create_asset_widget_error)

        self.main_layout.addStretch(1)

        # signals
        self.create_asset_button.clicked.connect(self.on_create_asset)
        self.continue_button.clicked.connect(self.on_continue)
        self.close_button.clicked.connect(self.on_fail)
        self.cancel_asset_button.clicked.connect(self.on_fail)
Esempio n. 6
0
    def __init__(self, groups, user, hub, classifier=None, parent=None):
        '''Instantiate widget with and *groups* and *userId*.

        If *hub* is configured the Crew widget will connect listeners for::

            *onEnter*: enter event.
            *onHeartbeat*: hearbeat event.
            *onExit*: exit event.

        '''
        super(Crew, self).__init__(parent)

        self.setObjectName('crew')
        self.setContentsMargins(0, 0, 0, 0)

        self.user = user
        self._currentConversationUserId = None
        self._currentConversationId = None

        self.hub = hub

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

        # If not classifier is specified return default `other` group.
        if not classifier:
            classifier = defaultClassifier

        self._classifier = classifier

        self.hub.onEnter.connect(self.onEnter)
        self.hub.onHeartbeat.connect(self.onHeartbeat)
        self.hub.onExit.connect(self.onExit)
        self.hub.onConversationMessagesLoaded.connect(
            self.onConversationLoaded)
        self.hub.onConversationUpdated.connect(self.onConversationUpdated)
        self.hub.onConversationSeen.connect(self.onConversationSeen)

        groups = [group.lower() for group in groups]

        if 'others' not in groups:
            groups.append('others')

        if 'offline' not in groups:
            groups.append('offline')

        self._groups = groups

        self.userList = ftrack_connect.ui.widget.user_list.UserList(
            groups=self._groups)

        self.userContainer = QtWidgets.QFrame()
        self.userContainer.setObjectName('user-container')
        self.userContainer.setLayout(QtWidgets.QVBoxLayout())
        self.userContainer.layout().setContentsMargins(0, 0, 0, 0)

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

        self._extendedUser = None
        self.chat = ftrack_connect.ui.widget.chat.Chat()
        self.chat.chatMessageSubmitted.connect(self.onChatMessageSubmitClicked)

        self.userContainer.layout().addWidget(self.chat, stretch=1)

        self.layout().addWidget(self.userList, stretch=1)
        self.layout().addWidget(self.userContainer, stretch=3)

        self.userContainer.hide()

        self.userList.setMinimumWidth(180)
        self.userList.itemClicked.connect(self.onConversationSelected)
    def __init__(self, parent=None, connector=None):
        '''Instantiate widget with *connector*.'''
        if not connector:
            raise ValueError(
                'Please provide a connector object for {0}'.format(
                    self.__class__.__name__))

        super(FtrackImportAssetDialog, self).__init__(parent=parent)
        applyTheme(self, 'integration')

        #---------------------------------------------------------------------------#
        # Add for proper hou colors
        try:
            import hou
            self.stylesheet = '%s; background-color: #3a3a3a; color: #FFFFFF;' % hou.qt.styleSheet(
            )
            self.setStyleSheet(self.stylesheet)
        except:
            pass
#---------------------------------------------------------------------------#

        self.connector = connector
        self.currentEntity = ftrack.Task(
            os.getenv('FTRACK_TASKID', os.getenv('FTRACK_SHOTID')))

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

        self.setMinimumWidth(600)

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

        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)

        self.scrollArea = QtWidgets.QScrollArea(self)
        self.mainLayout.addWidget(self.scrollArea)

        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollArea.setLineWidth(0)
        self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.scrollArea.setHorizontalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff)

        self.mainWidget = QtWidgets.QWidget(self)
        self.scrollArea.setWidget(self.mainWidget)

        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.mainWidget.setLayout(self.verticalLayout)

        self.headerWidget = header.Header(getpass.getuser(), self)
        self.verticalLayout.addWidget(self.headerWidget, stretch=0)

        self.browseTasksWidget = ContextSelector(
            currentEntity=self.currentEntity, parent=self)

        self.verticalLayout.addWidget(self.browseTasksWidget, stretch=0)

        self.listAssetsTableWidget = ListAssetsTableWidget(self)

        self.verticalLayout.addWidget(self.listAssetsTableWidget, stretch=4)

        # Horizontal line
        self.divider = QtWidgets.QFrame()
        self.divider.setFrameShape(QtWidgets.QFrame.HLine)
        self.divider.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.divider.setLineWidth(2)

        self.verticalLayout.addWidget(self.divider)

        self.assetVersionDetailsWidget = AssetVersionDetailsWidget(
            self, connector=self.connector)

        self.verticalLayout.addWidget(self.assetVersionDetailsWidget,
                                      stretch=0)

        self.componentTableWidget = ComponentTableWidget(
            self, connector=self.connector)

        self.verticalLayout.addWidget(self.componentTableWidget, stretch=3)

        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.importAllButton = QtWidgets.QPushButton("Import All")
        self.importAllButton.setFixedWidth(120)
        self.importAllButton.setObjectName('ftrack-import-btn')

        self.importSelectedButton = QtWidgets.QPushButton("Import Selected")
        self.importSelectedButton.setFixedWidth(120)
        self.importAllButton.setObjectName('ftrack-import-btn')

        self.horizontalLayout.addWidget(self.importSelectedButton)
        self.horizontalLayout.addWidget(self.importAllButton)

        self.horizontalLayout.setAlignment(QtCore.Qt.AlignRight)

        self.importOptionsWidget = ImportOptionsWidget(
            parent=self, connector=self.connector)

        self.verticalLayout.addWidget(self.importOptionsWidget, stretch=0)

        self.messageLabel = QtWidgets.QLabel(self)
        self.messageLabel.setText(' \n ')
        self.verticalLayout.addWidget(self.messageLabel, stretch=0)

        self.setObjectName('ftrackImportAsset')
        self.setWindowTitle("ftrackImportAsset")

        panelComInstance = PanelComInstance.instance()
        panelComInstance.addSwitchedShotListener(self.reset_context_browser)

        self.browseTasksWidget.entityChanged.connect(self.clickedIdSignal)

        self.importAllButton.clicked.connect(self.importAllComponents)
        self.importSelectedButton.clicked.connect(
            self.importSelectedComponents)
        self.listAssetsTableWidget.assetVersionSelectedSignal[str].connect(
            self.clickedAssetVSignal)
        self.listAssetsTableWidget.assetTypeSelectedSignal[str].connect(
            self.importOptionsWidget.setStackedWidget)
        self.importSignal.connect(panelComInstance.refreshListeners)

        self.componentTableWidget.importComponentSignal.connect(
            self.onImportComponent)

        self.browseTasksWidget.reset()