Esempio n. 1
0
def main():

    global host

    # Connect to the executor, and start the listener.
    fd = int(os.environ.get('UIFUTURES_HOST_FD') or sys.argv[1])
    conn = _multiprocessing.Connection(fd)
    conn.send(dict(
        type='handshake',
        pid=os.getpid(),
    ))

    host = Host(conn)

    app = QtGui.QApplication([])
    app.setApplicationName('Futures Host')
    app.setWindowIcon(QtGui.QIcon(utils.icon('fatcow/road_sign')))

    dialog = Dialog(host)

    host.start()

    dialog.show()

    exit(app.exec_())
Esempio n. 2
0
    def _setup_ui(self):

        title = re.sub(r'([A-z][^A-Z])', ' \1', self.exporter_class.__name__)
        self.setWindowTitle(title.strip())

        self.setLayout(QtGui.QVBoxLayout())
        self.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)

        self._exporter = self.exporter_class()
        self._exporter_widget = sgpublish.exporter.ui.tabwidget.Widget()
        self.layout().addWidget(self._exporter_widget)

        # Work area.
        tab = sgpublish.exporter.ui.workarea.Widget(self._exporter,
                                                    self.workarea_kwargs)
        self._exporter_widget.addTab(tab, "Export to Work Area")

        # SGPublishes.
        tab = sgpublish.exporter.ui.publish.Widget(self._exporter)
        tab.beforeScreenshot.connect(lambda *args: self.hide())
        tab.afterScreenshot.connect(lambda *args: self.show())
        self._exporter_widget.addTab(tab, "Publish to Shotgun")

        button_row = QtGui.QHBoxLayout()
        button_row.addStretch()
        self.layout().addLayout(button_row)

        self._button = button = QtGui.QPushButton("Export")
        button.clicked.connect(self._on_export)
        button_row.addWidget(button)
Esempio n. 3
0
 def _setup_ui(self):
     self._enabled_checkbox = QtGui.QCheckBox()
     self._enabled_checkbox.setChecked(True)
     self._enabled_checkbox.stateChanged.connect(self._on_enabled_change)
     self._cache_name_field = QtGui.QLineEdit(self._cache_name)
     self._cache_name_field.textChanged.connect(self._on_name_change)
     self._on_enabled_change()
Esempio n. 4
0
    def _setup_ui(self):
        self.setWindowTitle('Set FPS')
        layout = QtGui.QVBoxLayout()
        self.setLayout(layout)

        self.set_fps = QtGui.QComboBox(self)
        layout.addWidget(self.set_fps)

        for name, fps in unit_to_fps.iteritems():
            if fps == units.core.get_fps():
                self.set_fps.addItem(name)

        for item in sorted(unit_to_fps, key=unit_to_fps.get):
            self.set_fps.addItem(item)

        self._ok_button = QtGui.QPushButton('Set')
        self._ok_button.clicked.connect(self._on_ok_clicked)

        self._cancel_button = QtGui.QPushButton('Cancel')
        self._cancel_button.clicked.connect(self._on_cancel_clicked)

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self._cancel_button)
        hbox.addStretch()
        hbox.addWidget(self._ok_button)

        self.layout().addLayout(hbox)
Esempio n. 5
0
    def _setup_ui(self):
        
        self.setWindowTitle("Select Task to Copy To")

        self.setMinimumWidth(400)
        self.setMinimumHeight(400)
        self.setLayout(QtGui.QVBoxLayout())

        self._model, self._picker = picker_presets.any_task(entity=self._publish['sg_link'])
        self._picker.setMaximumHeight(400)
        self._picker.setPreviewVisible(False)
        self._picker.nodeChanged.connect(self._on_node_changed)
        self.layout().addWidget(self._picker)

        workspace = self._sgfs.path_for_entity(self._publish)
        self._namer = SceneNameWidget(dict(workspace=workspace))
        self.layout().addWidget(self._namer)

        button_layout = QtGui.QHBoxLayout()
        button_layout.addStretch()
        self.layout().addLayout(button_layout)
        
        self._cancel_button = QtGui.QPushButton("Cancel")
        self._cancel_button.clicked.connect(self._on_cancel)
        button_layout.addWidget(self._cancel_button)
        
        self._copy_button = QtGui.QPushButton("Copy")
        self._copy_button.setDefault(True)
        self._copy_button.clicked.connect(self._on_copy)
        button_layout.addWidget(self._copy_button)
        
        # Trigger a UI update.
        self._on_node_changed(self._picker.currentNode())
Esempio n. 6
0
    def _setupGui(self):

        self.setMinimumWidth(1000)
        self.setMinimumHeight(400)

        self.setLayout(QtGui.QVBoxLayout())

        self._model, self._picker = self._buildPicker()

        self._picker.setMaximumHeight(400)
        self._picker.setPreviewVisible(False)
        self._picker.nodeChanged.connect(self._onNodeChanged)

        self.layout().addWidget(self._picker)

        button_layout = QtGui.QHBoxLayout()
        self.layout().addLayout(button_layout)

        self._cancelButton = QtGui.QPushButton("Cancel")
        self._cancelButton.clicked.connect(self._onCancel)
        button_layout.addWidget(self._cancelButton)

        button_layout.addStretch()

        self._button = QtGui.QPushButton("Select")
        self._button.setEnabled(False)
        self._button.clicked.connect(self._onSelect)
        button_layout.addWidget(self._button)

        # Trigger a button update.
        self._onNodeChanged(self._picker.currentNode())
Esempio n. 7
0
    def _setupGui(self):

        self.setWindowTitle('Save Script to Work Area')
        self.setLayout(QtGui.QVBoxLayout())

        self._pickerModel, self._pickerView = any_task(
            path=os.path.dirname(nuke.root().name()),
            extra_node_types=[
                functools.partial(
                    DirectoryPicker,
                    entity_types=['Task'],
                    template='nuke_scripts_dir',
                ),
            ],
        )

        self._pickerView.setFixedSize(600, 250)
        self._pickerView.setPreviewVisible(False)
        self._pickerView.nodeChanged.connect(self._pickerNodeChanged)

        self.layout().addWidget(self._pickerView)

        # The main widget.
        self._sceneName = SceneNameWidget(self._kwargs)
        self.layout().addWidget(self._sceneName)

        # Save button.
        self._button = button = QtGui.QPushButton('Save',
                                                  clicked=self._onSaveClicked)

        self.layout().addWidget(button)

        self._pickerNodeChanged(self._pickerView.currentNode())
Esempio n. 8
0
        def button_row(channel=None):
            row = QtGui.QWidget()
            row.setLayout(QtGui.QHBoxLayout())
            row.layout().setContentsMargins(0, 0, 0, 0)
            row.layout().setSpacing(1)

            label = '"%s"' % channel if channel else 'All'
            button = QtGui.QPushButton(silk_icon('arrow_refresh', 12), 'Fuzz')
            button.setFixedSize(button.sizeHint().boundedTo(
                QtCore.QSize(1000, 20)))
            button.setToolTip('Fuzzy Match %s' % label)
            channels = [channel] if channel else None
            button.clicked.connect(
                lambda *args: self._on_fuzzy_match(channels=channels))
            row.layout().addWidget(button)

            button = QtGui.QPushButton(silk_icon('cross', 12), 'Unlink')
            button.setFixedSize(button.sizeHint().boundedTo(
                QtCore.QSize(1000, 20)))
            button.setToolTip('Unlink %s' % label)
            button.clicked.connect(
                lambda *args: self._on_unlink(channels=channels))
            row.layout().addWidget(button)

            return row
Esempio n. 9
0
    def _setupGui(self):

        self.setWindowTitle('Open Script from Work Area')
        self.setLayout(QtGui.QVBoxLayout())

        self._pickerModel, self._pickerView = any_task(
            path=nuke.root().name(),
            extra_node_types=[
                functools.partial(
                    TemplateGlobPicker,
                    entity_types=['Task'],
                    template='nuke_scripts_dir',
                    glob='*.nk',
                ),
            ],
        )

        self._pickerView.setFixedSize(600, 250)
        self._pickerView.setPreviewVisible(False)
        self._pickerView.nodeChanged.connect(self._pickerNodeChanged)

        self.layout().addWidget(self._pickerView)

        self._button = button = QtGui.QPushButton('Open',
                                                  clicked=self._onOpenClicked)

        self.layout().addWidget(button)

        self._pickerNodeChanged(self._pickerView.currentNode())
Esempio n. 10
0
def silk_widget(name, size=16, tooltip=None):
    icon = QtGui.QIcon(silk(name))
    label = QtGui.QLabel()
    label.setPixmap(icon.pixmap(size, size))
    label.setFixedSize(QtCore.QSize(size, size))
    if tooltip:
        label.setToolTip(tooltip)
    return label
Esempio n. 11
0
    def _setupGui(self):

        self._enabledCheckbox = QtGui.QCheckBox(checked=True)
        self._enabledCheckbox.stateChanged.connect(self._onEnabledChanged)

        self._nameField = QtGui.QLineEdit(self._export_name)
        self._nameField.textChanged.connect(self._onNameChanged)

        self._onEnabledChanged()
Esempio n. 12
0
 def _setup_ui(self):
     self._viewport = QtGui.QWidget()
     self.setViewport(self._viewport)
     self._layout = QtGui.QHBoxLayout()
     self._viewport.setLayout(self._layout)
     
     self.setFrameShape(QtGui.QFrame.NoFrame)
     
     self.setContentsMargins(0, 0, 0, 0)
     self.setViewportMargins(0, 0, 0, 0)
     self._viewport.setContentsMargins(0, 0, 0, 0)
     self._layout.setContentsMargins(0, 0, 0, 0)
Esempio n. 13
0
    def _setup_pre_ui(self):

        self.setLayout(QtGui.QVBoxLayout())

        self._main_layout = QtGui.QHBoxLayout()
        self.layout().addLayout(self._main_layout)

        # self._main_layout.addWidget(silk_widget('tick', tooltip='OK'))

        self._mapping_box = QtGui.QGroupBox("Channel Mapping")
        self._mapping_box.hide()
        self.layout().addWidget(self._mapping_box)
Esempio n. 14
0
    def _setup_ui(self):

        self.setWindowTitle("Job Queue")
        self.setMinimumWidth(400)

        self._widget = QtGui.QWidget()
        self.setCentralWidget(self._widget)
        self._layout = QtGui.QVBoxLayout()
        self._widget.setLayout(self._layout)

        self._layout.setSpacing(0)
        self._layout.setContentsMargins(0, 0, 0, 0)
Esempio n. 15
0
def run(*args, **kwargs):

    global dialog

    if dialog:
        dialog.close()

    dialog = QtGui.QDialog()
    dialog.setLayout(QtGui.QVBoxLayout())
    dialog.layout().addWidget(SetPicker(*args, **kwargs))

    dialog.show()
Esempio n. 16
0
    def _setup_ui(self):
        
        window_title = re.sub(r'(?<!^)([A-Z])(?![A-Z])', r' \1', self.importer_class.__name__)
        self.setWindowTitle(window_title)

        self.setLayout(QtGui.QVBoxLayout())
        
        self._tabs = ImportTabs()
        self.layout().addWidget(self._tabs)
        
        button = QtGui.QPushButton("Import")
        button.clicked.connect(self._on_import)
        self.layout().addWidget(button)
Esempio n. 17
0
    def _setup_ui(self):

        self._field = QtGui.QLineEdit()
        self._field.editingFinished.connect(self._on_field_changed)
        self._main_layout.addWidget(self._field)

        button = QtGui.QPushButton(silk_icon("arrow_refresh", 12), "Update")
        button.clicked.connect(self._on_update)
        button.setFixedSize(button.sizeHint().boundedTo(QtCore.QSize(1000,
                                                                     20)))
        self._main_layout.addWidget(button)

        super(Selection, self)._setup_ui()
Esempio n. 18
0
    def _do_thumbnail(self, path):

        return

        if self._thumbnail is None:
            self._icon.setPixmap(self._icon.pixmap().scaled(
                16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation))
            self._icon.setFixedSize(self._icon.pixmap().size())
            self._name_layout.insertWidget(0, self._icon)
            self._thumbnail = QtGui.QLabel()
            self.layout().insertWidget(0, self._thumbnail)

        pixmap = QtGui.QPixmap(path)
        pixmap = pixmap.scaled(120, 80, Qt.KeepAspectRatio)
        self._thumbnail.setPixmap(pixmap)
Esempio n. 19
0
    def _setup_ui(self):
        self.setLayout(QtGui.QHBoxLayout())

        self._path_field = QtGui.QLineEdit("NOT YET IMPLEMENTED")

        self._browse_button = QtGui.QPushButton("Browse")

        self.layout().addLayout(
            vbox("Export Path",
                 hbox(self._path_field, self._browse_button, spacing=2)))

        self._browse_button.setFixedHeight(
            self._path_field.sizeHint().height())
        self._browse_button.setFixedWidth(
            self._browse_button.sizeHint().width())
Esempio n. 20
0
    def add_playblasts(self, playblasts):
        for playblast in sorted(playblasts, key = lambda pb: (' None' if pb.user_category == 'none' else pb.user_category, pb.name)):
            row = self.rowCount()
            self.setRowCount(row + 1)
            self.setRowHeight(row, 57)

            thumb = PlayblastThumbnail(playblast.first_frame)
            thumb.playblast = playblast
            self.setCellWidget(row, 0, thumb)

            name = QtGui.QTableWidgetItem(playblast.name)
            self.setItem(row, 1, name)

            date = QtGui.QTableWidgetItem(playblast.created_at.isoformat(' '))
            self.setItem(row, 2, date)
Esempio n. 21
0
def _open_entity(entity):

    main_window = [x 
        for x in QtGui.QApplication.instance().topLevelWidgets()
        if isinstance(x, QtGui.QMainWindow)
    ][0]

    msgbox = QtGui.QMessageBox(main_window)
    msgbox.setText('Where would you like to go?')

    shotgun = msgbox.addButton(
        "Shotgun",
        msgbox.AcceptRole,
    )
    finder = msgbox.addButton(
        "Finder" if sys.platform == 'darwin' else 'File Browser',
        msgbox.AcceptRole,
    )
    
    msgbox.addButton(msgbox.Cancel)

    msgbox.setDefaultButton(shotgun)
    msgbox.exec_()

    if msgbox.clickedButton() is shotgun:
        dest = entity.url
    elif msgbox.clickedButton() is finder:
        dest = _sgfs.path_for_entity(entity)
    else:
        dest = None

    if dest:
        call(['open' if sys.platform == 'darwin' else 'xdg-open', dest])
Esempio n. 22
0
 def __init__(self, path):
     self._path = path
     self._loaded = False
     super(PlayblastThumbnail, self).__init__()
     self.setAlignment(Qt.AlignCenter)
     self.setPixmap(QtGui.QPixmap(self._path).scaled(100, 57, Qt.KeepAspectRatio, Qt.SmoothTransformation))
     self._loaded = True
Esempio n. 23
0
 def _empty_buttons(self):
     for x in self._buttons:
         x.hide()
         x.destroy()
     self._main_layout.removeItem(self._button_layout)
     self._button_layout = QtGui.QHBoxLayout()
     self._main_layout.addLayout(self._button_layout)
     self._buttons = []
Esempio n. 24
0
    def _setup_ui(self):

        self.setWindowTitle("Job Queue")
        self.setMinimumWidth(400)

        self.setLayout(QtGui.QVBoxLayout())
        self.layout().setSpacing(0)
        self.layout().setContentsMargins(0, 0, 0, 0)
Esempio n. 25
0
    def __init__(self, importer, selector=None):
        super(WorkAreaImporter, self).__init__()

        self._importer = importer
        self._selector = selector or product_select.Layout(self)

        self.setLayout(QtGui.QVBoxLayout())
        self.layout().addLayout(self._selector)
Esempio n. 26
0
    def _do_exception(self, exception_name, exception_message, **msg):
        self._set_failure('%s: %s' % (exception_name, exception_message))

        self._empty_buttons()

        button = QtGui.QToolButton()
        button.setText("Try Again")
        button.setStyleSheet('font-size: 9px;')
        button.clicked.connect(self._retry)
        self._add_button(button)

        button = QtGui.QToolButton()
        button.setText("Report Bug")
        button.setStyleSheet('font-size: 9px;')
        # self._add_button(button)
        button.setEnabled(False)

        self._button_layout.addStretch()
Esempio n. 27
0
    def _reload(self):

        self._groups = {}

        pattern = str(self._pattern_field.text())
        patterns = [x.strip() for x in pattern.split(',')]
        for set_ in sorted(
                set(cmds.ls(*patterns, sets=True, recursive=True, long=True))):

            if ':' in set_:
                reference, name = set_.rsplit(':', 1)
            else:
                reference = None
                name = set_

            group = self._groups.get(reference)
            if group is None:
                group = GroupItem(reference)
                self._groups[reference] = group
            child = SetItem(name, set_, self._namesEnabled)
            group._addChild(child)

        tree = self._tree
        tree.clear()

        if not self._groups:
            item = QtGui.QTreeWidgetItem(["No sets match pattern!"])
            tree.addTopLevelItem(item)
            spacer = QtGui.QLabel('')
            spacer.setFixedHeight(22)
            tree.setItemWidget(item, 0, spacer)

        for reference, group in sorted(self._groups.iteritems(),
                                       key=lambda x: (x[0] is not None, x[0])):
            tree.addTopLevelItem(group)
            tree.expandItem(group)
            for child in group._children:
                child._setupTree()
            group._setupTree()

        tree.resizeColumnToContents(0)
        tree.setColumnWidth(0, tree.columnWidth(0) + 10)
        tree.setColumnWidth(1, 16)
        tree.resizeColumnToContents(2)
Esempio n. 28
0
    def _setup_post_ui(self):

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

        button = QtGui.QPushButton(silk_icon('arrow_switch', 12), "Edit")
        button.clicked.connect(self._on_mapping_clicked)
        button.setFixedSize(button.sizeHint().boundedTo(QtCore.QSize(1000,
                                                                     22)))
        self._main_layout.addWidget(button)

        button = QtGui.QPushButton(silk_icon('delete', 12), "Delete")
        button.clicked.connect(self._on_delete)
        button.setFixedSize(button.sizeHint().boundedTo(QtCore.QSize(1000,
                                                                     22)))
        self._main_layout.addWidget(button)

        # Finally setup the mapping UI. This requires self.meshes() to work.
        self._cache_changed()
Esempio n. 29
0
File: utils.py Progetto: vfxetc/sgfs
def icon(name, as_icon=False):

    try:
        icon = _icons_by_name[name]
    except KeyError:

        path = os.path.abspath(
            os.path.join(__file__, '..', '..', '..', 'art', 'icons',
                         name + '.png'))
        if os.path.exists(path):
            icon = QtGui.QPixmap(path)
        else:
            icon = None

        _icons_by_name[name] = icon

    if as_icon:
        icon = QtGui.QIcon(icon)

    return icon
Esempio n. 30
0
 def contextMenuEvent(self, event):
     menu = QtGui.QMenu(self)
     flipbook_action = menu.addAction("Flipbook")
     flipbook_action.triggered.connect(self.flipbook_playblast)
     qt_action = menu.addAction("Make Quicktime")
     qt_action.triggered.connect(self.make_quicktime)
     refresh_action = menu.addAction("Refresh")
     refresh_action.triggered.connect(self.refresh.emit)
     delete_action = menu.addAction("Delete")
     delete_action.triggered.connect(self.delete_playblasts)
     action = menu.exec_(event.globalPos())