Ejemplo n.º 1
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)
    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)
Ejemplo n.º 3
0
    def _fillColor(self, pixmap):
        # force icon color
        painter = QtGui.QPainter(pixmap)
        painter.setCompositionMode(QtGui.QPainter.CompositionMode_SourceIn)

        painter.fillRect(pixmap.rect(), QtGui.QColor(140, 84, 184))
        painter.end()
Ejemplo n.º 4
0
    def paintEvent(self, event):
        '''Paint widget.'''
        painter = QtGui.QPainter()
        painter.begin(self)

        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            area = QtCore.QRect(0, 0,
                                painter.device().width(),
                                painter.device().height())
            center = QtCore.QPointF(area.width() / 2.0, area.height() / 2.0)

            # Draw in a normalised centered box.
            normalisedEdge = 100.0
            normalisedArea = QtCore.QRectF(-(normalisedEdge / 2.0),
                                           -(normalisedEdge / 2.0),
                                           normalisedEdge, normalisedEdge)

            shortestSide = min(area.width(), area.height())
            painter.translate(center)
            painter.scale(shortestSide / normalisedEdge,
                          shortestSide / normalisedEdge)

            # Draw logo.
            svgRenderer = QtSvg.QSvgRenderer()
            svgRenderer.load(self._logo)
            logoMargin = 30.0
            logoArea = normalisedArea.adjusted(logoMargin, logoMargin,
                                               -logoMargin, -logoMargin)
            svgRenderer.render(painter, logoArea)

            # Draw spinner at current spin angle.
            pen = QtGui.QPen()
            penWidth = 5.0
            pen.setWidth(penWidth)

            gradient = QtGui.QConicalGradient(QtCore.QPoint(0, 0),
                                              -self._spinnerAngle)

            gradient.setColorAt(0.95, QtCore.Qt.transparent)
            gradient.setColorAt(0, self._spinnerColor)

            brush = QtGui.QBrush(gradient)
            pen.setBrush(brush)
            painter.setPen(pen)

            spinnerArea = QtCore.QRectF(
                normalisedArea.top() + (penWidth / 2.0),
                normalisedArea.left() + (penWidth / 2.0),
                normalisedArea.width() - penWidth,
                normalisedArea.height() - penWidth)

            painter.drawArc(
                spinnerArea,
                0,  # Start angle.
                360 * 16  # Span angle.
            )

        finally:
            painter.end()
Ejemplo n.º 5
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.º 6
0
    def paintEvent(self, event):
        '''Paint *event* with the configured elideMode.'''
        painter = QtGui.QPainter(self)

        metrics = QtGui.QFontMetrics(self.font())
        elided = metrics.elidedText(self.text(), self.elideMode, self.width())

        painter.drawText(self.rect(), self.alignment(), elided)
Ejemplo n.º 7
0
    def updateView(self, ftrackEntity):
        '''Update view with the provided *ftrackEntity*'''
        try:
            self.currentTask = ftrackEntity
            project = self.currentTask.getProject()
            taskid = '11c137c0-ee7e-4f9c-91c5-8c77cec22b2c'
            # Populate statuses based on task if it is a task.
            if self.currentTask.get('object_typeid') == taskid:
                self.ui.ListStatusComboBox.show()
                self.ui.assetTaskLabel_2.show()
                self.ui.ListStatusComboBox.clear()
                statuses = project.getTaskStatuses(
                    self.currentTask.get('typeid'))
                for index, status, in enumerate(statuses):
                    self.ui.ListStatusComboBox.addItem(status.getName())
                    if status.get('statusid') == self.currentTask.get(
                            'statusid'):
                        self.ui.ListStatusComboBox.setCurrentIndex(index)
            else:
                self.ui.ListStatusComboBox.hide()
                self.ui.assetTaskLabel_2.hide()

            if self.browseMode == 'Task':
                task = self.currentTask.getParent()

            assets = task.getAssets(assetTypes=self.assetTypesStr)
            assets = sorted(assets, key=lambda a: a.getName().lower())
            self.ui.ListAssetsViewModel.clear()

            item = QtGui.QStandardItem('New')
            item.id = ''
            curAssetType = self.currentAssetType
            if curAssetType:
                itemType = QtGui.QStandardItem(curAssetType)
            else:
                itemType = QtGui.QStandardItem('')
            self.ui.ListAssetsViewModel.setItem(0, 0, item)
            self.ui.ListAssetsViewModel.setItem(0, 1, itemType)
            self.ui.ListAssetNamesComboBox.setCurrentIndex(0)

            blankRows = 0
            for i in range(0, len(assets)):
                assetName = assets[i].getName()
                if assetName != '':
                    item = QtGui.QStandardItem(assetName)
                    item.id = assets[i].getId()
                    itemType = QtGui.QStandardItem(
                        assets[i].getType().getShort())

                    j = i - blankRows + 1
                    self.ui.ListAssetsViewModel.setItem(j, 0, item)
                    self.ui.ListAssetsViewModel.setItem(j, 1, itemType)
                else:
                    blankRows += 1
        except:
            import traceback
            import sys
            traceback.print_exc(file=sys.stdout)
Ejemplo n.º 8
0
    def paintEvent(self, event):
        '''Override paint event to make round thumbnails.'''
        painter = QtGui.QPainter(self)
        painter.setRenderHints(QtGui.QPainter.Antialiasing, True)

        brush = QtGui.QBrush(self.pixmap())

        painter.setBrush(brush)

        painter.setPen(QtGui.QPen(QtGui.QColor(0, 0, 0, 0)))

        painter.drawEllipse(QtCore.QRectF(0, 0, self.width(), self.height()))
Ejemplo n.º 9
0
    def __init__(self, name, url=None, plugin=None, parent=None):
        '''Initialise web view with *name* and *url*.

        *name* will be used as the title of the widget and also will be
        converted to a lowercase dotted name which the panel can be referenced
        with. For example, "My Panel" -> "my.panel".

        *url* should be the initial url to display.

        *plugin* should be an instance of
        *:py:class:`ftrack_connect_hieroplayer.plugin.Plugin` which will be
        *injected into the JavaScript window object of any loaded page.

        *parent* is the optional parent of this widget.

        '''
        super(WebView, self).__init__(parent=parent)

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

        self.setObjectName(name.lower().replace(' ', '.'))
        self.setWindowTitle(name)

        self.plugin = plugin

        self.webView = QtWebKit.QWebView()
        self.webView.urlChanged.connect(self.changedLocation)

        # Use plugin network access manager if available.
        if self.plugin:
            self.webView.page().setNetworkAccessManager(
                self.plugin.networkAccessManager)

        self.frame = self.webView.page().mainFrame()

        # Enable developer tools for debugging loaded page.
        self.webView.settings().setAttribute(
            QtWebKit.QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        self.inspector = QtWebKit.QWebInspector(self)
        self.inspector.setPage(self.webView.page())
        self.inspector.hide()

        self.splitter = QtGui.QSplitter(self)
        self.splitter.addWidget(self.webView)
        self.splitter.addWidget(self.inspector)

        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.splitter)

        # Load the passed url.
        self.setUrl(url)
    def __init__(self, parent=None):
        super(AssetPreferencesDialog, self).__init__(parent=parent)

        self.setWindowTitle("Asset Management Preferences")

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

        self.settingsWidget = SessionSettingsWidget()
        layout.addWidget(self.settingsWidget)

        self.applyButton = QtGui.QPushButton("Apply")
        layout.addWidget(self.applyButton)
        self.applyButton.clicked.connect(self.apply)
Ejemplo n.º 11
0
    def loadResource(self, resource):
        '''Update current pixmap using *resource*.'''
        svg_renderer = QtSvg.QSvgRenderer(resource)

        image = QtGui.QImage(self.size, self.size, QtGui.QImage.Format_ARGB32)
        # Set the ARGB to 0 to prevent rendering artifacts.
        image.fill(0x00000000)
        svg_renderer.render(QtGui.QPainter(image),
                            QtCore.QRectF(0, 0, self.size, self.size))

        pixmap = QtGui.QPixmap.fromImage(image)

        self._fillColor(pixmap)
        self._scaleAndSetPixmap(pixmap)
Ejemplo n.º 12
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
        })
    def __init__(self,
                 specification,
                 context,
                 parent=None,
                 embedBrowser=False,
                 embedDetails=True,
                 session=None):
        super(ItemCreateWidget, self).__init__(parent=parent)

        l = FnAssetAPI.l

        self._embedBrowser = embedBrowser
        self._embedDetails = embedDetails

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

        if not session:
            session = FnAssetAPI.ui.UISessionManager.currentSession()

        if embedBrowser:
            widgetIdentifier = FnAssetAPI.ui.constants.kBrowserWidgetId
        else:
            widgetIdentifier = FnAssetAPI.ui.constants.kInlinePickerWidgetId

        pickerCls = session.getManagerWidget(widgetIdentifier,
                                             instantiate=False)
        self.parentPicker = pickerCls(specification, context)

        if embedDetails:
            destGbox = QtGui.QGroupBox(l("{publish} To"))
            layout.addWidget(destGbox)
            destLayout = QtGui.QVBoxLayout()
            destGbox.setLayout(destLayout)
            destLayout.addWidget(self.parentPicker)
        else:
            layout.addWidget(self.parentPicker)

        self.itemSpreadsheet = None

        if embedDetails:
            self.itemSpreadsheet = ItemSpreadsheetWidget()
            self.itemsGbox = QtGui.QGroupBox("Items")
            itemsLayout = QtGui.QVBoxLayout()
            self.itemsGbox.setLayout(itemsLayout)
            itemsLayout.addWidget(self.itemSpreadsheet)
            layout.addWidget(self.itemsGbox)

        self.__items = []
    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)
Ejemplo n.º 15
0
    def __init__(self, parent, browseMode='Shot'):
        QtWidgets.QWidget.__init__(self, parent)
        self.ui = Ui_ExportAssetOptions()
        self.ui.setupUi(self)
        self.currentAssetType = None
        self.currentTask = None
        self.browseMode = browseMode
        self.ui.ListAssetsViewModel = QtGui.QStandardItemModel()

        self.ui.ListAssetsSortModel = QtCore.QSortFilterProxyModel()

        self.ui.ListAssetsSortModel.setDynamicSortFilter(True)
        self.ui.ListAssetsSortModel.setFilterKeyColumn(1)
        self.ui.ListAssetsSortModel.setSourceModel(self.ui.ListAssetsViewModel)

        self.ui.ListAssetNamesComboBox.setModel(self.ui.ListAssetsSortModel)

        self.ui.ListAssetsComboBoxModel = QtGui.QStandardItemModel()

        assetTypeItem = QtGui.QStandardItem('Select AssetType')
        self.assetTypes = []
        self.assetTypes.append('')
        self.ui.ListAssetsComboBoxModel.appendRow(assetTypeItem)

        assetHandler = FTAssetHandlerInstance.instance()
        self.assetTypesStr = sorted(assetHandler.getAssetTypes())

        for assetTypeStr in self.assetTypesStr:
            try:
                assetType = ftrack.AssetType(assetTypeStr)
            except:
                log.warning('{0} not available in ftrack'.format(assetTypeStr))
                continue
            assetTypeItem = QtGui.QStandardItem(assetType.getName())
            assetTypeItem.type = assetType.getShort()
            self.assetTypes.append(assetTypeItem.type)
            self.ui.ListAssetsComboBoxModel.appendRow(assetTypeItem)

        self.ui.ListAssetsComboBox.setModel(self.ui.ListAssetsComboBoxModel)

        self.ui.AssetTaskComboBoxModel = QtGui.QStandardItemModel()
        self.ui.AssetTaskComboBox.setModel(self.ui.AssetTaskComboBoxModel)

        self.ui.ListAssetNamesComboBox.currentIndexChanged[str].connect(
            self.onAssetChanged)

        if browseMode == 'Task':
            self.ui.AssetTaskComboBox.hide()
            self.ui.assetTaskLabel.hide()
Ejemplo n.º 16
0
def customise_menu(event):
    ''' Set ftrack icon looking in menu from given *event*. '''
    actions = event.menu.actions()
    for action in actions:
        if action.text() in ['Version', 'Export...']:
            action.setIcon(
                QtGui.QPixmap(':ftrack/image/default/ftrackLogoLight'))
Ejemplo n.º 17
0
    def getTextDocument(self, option, item_data):
        '''Return QTextDocument based on *option* and *item_data*.'''
        document = QtGui.QTextDocument()
        document.setHtml(self.format(item_data))
        document.setTextWidth(option.rect.width())

        return document
 def setThumbnail(self, filePath):
     '''Set thumbnail to *filePath* and display a preview.'''
     self._filePath = filePath
     pixmap = QtGui.QPixmap(self._filePath).scaled(
         self._imageWidth, self._imageHeight, QtCore.Qt.KeepAspectRatio)
     self.imageLabel.setPixmap(pixmap)
     self.removeButton.setVisible(True)
Ejemplo n.º 19
0
    def updateTasks(self, ftrackEntity):
        '''Update task with the provided *ftrackEntity*'''
        self.currentTask = ftrackEntity
        try:
            shotpath = self.currentTask.getName()
            taskParents = self.currentTask.getParents()

            for parent in taskParents:
                shotpath = '{0}.{1}'.format(parent.getName(), shotpath)

            self.ui.AssetTaskComboBox.clear()
            tasks = self.currentTask.getTasks()
            curIndex = 0
            ftrackuser = ftrack.User(getpass.getuser())
            taskids = [x.getId() for x in ftrackuser.getTasks()]

            for i in range(len(tasks)):
                assetTaskItem = QtGui.QStandardItem(tasks[i].getName())
                assetTaskItem.id = tasks[i].getId()
                self.ui.AssetTaskComboBoxModel.appendRow(assetTaskItem)

                if (os.environ.get('FTRACK_TASKID') == assetTaskItem.id):
                    curIndex = i
                else:
                    if assetTaskItem.id in taskids:
                        curIndex = i

            self.ui.AssetTaskComboBox.setCurrentIndex(curIndex)

        except:
            print 'Not a task'
def processAndWriteThumbnailQImage(qImage, options):
    """

  Takes a Qimage processes it, and writes it to a file based on the supplied
  options (from Manager.thumbnailSpecification), returns the path or an empty
  string if the write failed.

  """

    ## @todo This isn't a good method as it won't work in batch (when we have it)

    from QtExt import QtGui, QtWidgets, QtCore

    path = getTmpThumbnailPath(options)

    width = options.get(FnAssetAPI.constants.kField_PixelWidth,
                        FnAssetAPI.constants.kThumbnail_DefaultPixelWidth)

    height = options.get(FnAssetAPI.constants.kField_PixelHeight,
                         FnAssetAPI.constants.kThumbnail_DefaultPixelHeight)

    qImage = qImage.scaled(width, height, QtCore.Qt.KeepAspectRatioByExpanding,
                           QtCore.Qt.SmoothTransformation)

    writer = QtGui.QImageWriter()
    writer.setFormat("jpeg")
    writer.setFileName(path)

    if writer.write(qImage):
        return path

    return ''
Ejemplo n.º 21
0
def buildStaticUI():

    global __actions

    menu = QtGui.QMenu("Asset Management")
    __actions['assetMenu'] = menu
    _addAssetMenuItems(menu)

    helpmenu = hiero.ui.findMenuAction("Help")
    hiero.ui.menuBar().insertMenu(helpmenu, menu)

    filemenuaction = hiero.ui.findMenuAction("File")
    if filemenuaction:
        filemenu = filemenuaction.menu()
        __extendFileMenu(filemenu)

    clipmenuaction = hiero.ui.findMenuAction("Clip")
    if clipmenuaction:
        clipmenu = clipmenuaction.menu()
        __extendClipMenu(clipmenu)

    timelinemenuaction = hiero.ui.findMenuAction("Timeline")
    if timelinemenuaction:
        timelinemenu = timelinemenuaction.menu()
        if timelinemenu:
            __extendTimelineMenu(timelinemenu)
def _getProjectOpenOptions(parent=None):

    l = FnAssetAPI.l

    if parent is None:
        parent = hiero.ui.mainWindow()

    msgBox = QtGui.QMessageBox(parent=parent)
    msgBox.setText(l("{published} Projects can't be opened directly."))
    msgBox.setInformativeText(
        "This is to avoid changing the asset itself by " +
        "saving. Would you like to Save a Copy or open read-only?")

    saveAs = msgBox.addButton("Save As...", msgBox.AcceptRole)
    readOnly = msgBox.addButton("Read Only", msgBox.NoRole)

    # Had some issues with StandardButton .vs. AbstractButton
    msgBox.addButton("Cancel", msgBox.RejectRole)

    msgBox.exec_()
    button = msgBox.clickedButton()

    if button == saveAs:
        return 'saveas'
    elif button == readOnly:
        return 'readonly'
    else:
        return ''
    def _drawOptions(self, layout):

        l = FnAssetAPI.l

        optionsLayout = super(ClipPublishDialog, self)._drawOptions(layout)

        self._replaceMediaSource = QtGui.QCheckBox(
            l("Link Clips with {published} {assets}"))
        self._replaceMediaSource.setChecked(True)
        optionsLayout.addWidget(self._replaceMediaSource)

        self._ignorePublished = QtGui.QCheckBox(
            l("Ignore Clips that are already {published}"))
        self._ignorePublished.setChecked(True)
        optionsLayout.addWidget(self._ignorePublished)
        self._ignorePublished.toggled.connect(self._optionsChanged)
Ejemplo n.º 24
0
def populate_ftrack(event):
    '''Populate the ftrack menu with items.'''
    import hiero.ui
    from QtExt import QtGui

    menu_bar = hiero.ui.menuBar()
    ftrack_menu = menu_bar.addMenu(
        QtGui.QPixmap(':ftrack/image/default/ftrackLogoLight'), 'ftrack')
    def __init__(self, text=None, pixmap=None, resize=None, parent=None):
        super(IconLabelWidget, self).__init__(parent=parent)

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

        self.pixmapLabel = QtGui.QLabel()
        self.label = QtGui.QLabel()

        layout.addWidget(self.pixmapLabel)
        layout.addWidget(self.label)

        if pixmap and not pixmap.isNull():
            self.setPixmap(pixmap, resize)

        if text:
            self.label.setText(text)
    def __init__(self,
                 specification,
                 context,
                 embedBrowser=False,
                 session=None,
                 parent=None,
                 embedDetails=True):
        super(ItemCreateDialog, self).__init__(parent=parent)

        l = FnAssetAPI.l

        self._specification = specification
        self._context = context

        if not session:
            session = FnAssetAPI.SessionManager.currentSession()
        self._session = session

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

        self.itemCreateWidget = ItemCreateWidget(specification,
                                                 context,
                                                 embedBrowser=embedBrowser,
                                                 embedDetails=embedDetails,
                                                 session=session)
        layout.addWidget(self.itemCreateWidget)

        self._managerOptions = None
        self._drawOptions(layout)

        buttons = QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel
        self._buttons = QtGui.QDialogButtonBox(buttons)

        if not embedDetails:
            detailsButton = self._buttons.addButton(
                "Details...", QtGui.QDialogButtonBox.HelpRole)
            detailsButton.clicked.connect(self.showDetails)

        self._buttons.button(QtGui.QDialogButtonBox.Ok).setText(l('{publish}'))

        self.connect(self._buttons, QtCore.SIGNAL('accepted()'), self.accept)
        self.connect(self._buttons, QtCore.SIGNAL('rejected()'), self.reject)

        layout.addWidget(self._buttons)
Ejemplo n.º 27
0
    def __init__(self):
        ''' Initialise action. '''
        super(FtrackReBuildServerTrackAction,
              self).__init__('Build track from ftrack')
        self.trackFinder = FtrackTrackFinderByNameWithDialog(self)
        self.setIcon(QtGui.QPixmap(':ftrack/image/default/ftrackLogoLight'))

        self.logger = logging.getLogger(__name__ + '.' +
                                        self.__class__.__name__)
    def __init__(self, *args, **kwargs):
        super(AdvancedHieroItemSpreadsheet, self).__init__(*args, **kwargs)

        self._columnTitle = 'Status'

        self._disabledText = ''
        self._enabledText = ''
        self._textCallback = None

        self._enabledIcon = QtGui.QIcon("icons:status/TagFinal.png")
        self._disabledIcon = QtGui.QIcon("icons:status/TagOmitted.png")
        self._iconCallback = None

        self._disabledCallback = None
        self._disableItems = True

        self._statusIndex = -1
        self._iconIndex = -1
Ejemplo n.º 29
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.º 30
0
    def __init__(self, *args, **kwargs):
        '''Instantiate the time tracker.'''
        super(TimeTracker, self).__init__(*args, **kwargs)
        self.setObjectName('timeTracker')

        self._activeEntity = None

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

        self.activeLabel = QtWidgets.QLabel('Currently running')
        self.activeLabel.setProperty('title', True)
        layout.addWidget(self.activeLabel)

        self._timerEnabled = False
        self.timer = ftrack_connect.ui.widget.timer.Timer()
        layout.addWidget(self.timer)

        self.timerPlaceholder = TimerOverlay(self.timer)

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

        assignedTimeLogUpdateButton = QtWidgets.QPushButton(reloadIcon, '')
        assignedTimeLogUpdateButton.setFlat(True)
        assignedTimeLogUpdateButton.setToolTip('Refresh list')
        assignedTimeLogUpdateButton.clicked.connect(self._updateAssignedList)

        self.assignedTimeLogList = _TimeLogList(
            title='Assigned', headerWidgets=[assignedTimeLogUpdateButton])
        layout.addWidget(self.assignedTimeLogList, stretch=1)

        # Connect events.
        self.timer.stopped.connect(self._onCommitTime)
        self.timer.timeEdited.connect(self._onCommitTime)

        self.assignedTimeLogList.itemSelected.connect(self._onSelectTimeLog)

        self.blockingOverlay = TimeTrackerBlockingOverlay(
            self, 'Time tracker is currently disabled during beta.')
        self.blockingOverlay.show()

        self._updateAssignedList()