Beispiel #1
0
        def __init__(self, parent, hook, items, name, **kwargs):

            super(CollectorPlugin.FieldsPropertyWidget,
                  self).__init__(parent, hook, items, name, **kwargs)

            self._fields = {}
            self._field_widgets = {}
            self._layout = QtGui.QVBoxLayout(self)

            # list of editable fields for the widget
            # the values in the list are matched using regex
            self._editable_fields = kwargs.pop("editable_fields", list())

            # Connect the value_changed signal to the property_changed slot so that
            # so this widget will broadcast the changes to the properties widget.
            self.value_changed.connect(parent.property_changed)

            # TODO: dump this in a collapsible widget
            self._fields_layout = QtGui.QFormLayout()
            self._fields_layout.setContentsMargins(0, 0, 0, 0)
            self._fields_layout.setVerticalSpacing(1)
            self._layout.addLayout(self._fields_layout)

            # Gather the fields used to resolve the template
            self.gather_fields()

            # Cache the data
            self.apply_changes()

            # Update the ui
            self.refresh_ui()
Beispiel #2
0
    def __init__(self, parent):
        QtGui.QWidget.__init__(self, parent)

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

        self.edit = WidgetHandler(layout, "Edit", QtGui.QLineEdit(self))
        self.number = WidgetHandler(layout, "Number", QtGui.QSpinBox(self))
        self.check_box = CheckboxHandler(layout, "Boolean")

        self.edit.editor.setFocus()
        self.number.editor.setMinimum(0)
        self.number.editor.setMaximum(100)
        def __init__(self, parent, hook, tasks, name, **kwargs):

            self._linked_fields = kwargs.pop("linked_fields", [])

            super(PublishPlugin.SettingWidget,
                  self).__init__(parent, hook, tasks, name, **kwargs)

            self._fields = {}
            self._field_widgets = {}
            self._resolved_value = ""

            self._layout = QtGui.QVBoxLayout(self)
            self._layout.setContentsMargins(0, 6, 0, 2)

            self._resolved_value_widget = QtGui.QLabel(self)
            self._layout.addWidget(self._resolved_value_widget)

            # Get the value_widget
            self._value_widget = self.value_widget_factory(
                self._name, self._value, self._value_type, self._editable)
            self._value_widget.setParent(self)

            # Connect the value_changed signal to the setting_changed signal so
            # all other settings will be notified about the change
            self._value_widget.value_changed.connect(parent.setting_changed)

            # Connect the setting_changed signal to the update_value slot so that
            # this widget will update whenever any setting is changed.
            parent.setting_changed.connect(self.update_value)

            # TODO: dump this in a collapsible widget
            self._fields_layout = QtGui.QFormLayout()
            self._fields_layout.setContentsMargins(0, 0, 0, 0)
            self._fields_layout.setVerticalSpacing(1)
            self._layout.addLayout(self._fields_layout)

            # Add the value to the fields layout
            self._fields_layout.addRow("Template Name", self._value_widget)

            # Gather the fields used to resolve the template
            self.gather_fields()

            # Calculate the resolved template value
            self.resolve_template_value()

            # Cache the data
            self.cache_data()

            # Update the ui
            self.refresh_ui()
        def __init__(self, parent, hook, tasks):
            QtGui.QWidget.__init__(self, parent)
            plugin = hook.plugin

            self._layout = QtGui.QFormLayout(self)

            # since tasks will be of same type it's safe to assume they will all
            # share the same list of settings
            task_settings = tasks[0].settings if tasks else {}

            # TODO: these should probably be exceptions
            for setting in plugin.settings["Settings To Display"]:
                kwargs = setting.value

                setting_name = kwargs.pop("name", None)
                if not setting_name:
                    plugin.logger.error(
                        "Entry in 'Settings To Display' is missing its 'name' attribute"
                    )
                    continue

                setting = task_settings.get(setting_name)
                if not setting:
                    plugin.logger.error(
                        "Unknown setting: {}".format(setting_name))
                    continue

                widget_type = kwargs.pop("type", None)
                if not widget_type:
                    plugin.logger.error(
                        "No defined widget type for setting: {}".format(
                            setting_name))
                    continue

                if not hasattr(hook, widget_type):
                    plugin.logger.error(
                        "Cannot find widget class: {}".format(widget_type))
                    continue

                # Instantiate the widget class
                widget_class = getattr(hook, widget_type)
                display_name = kwargs.get("display_name", setting_name)
                setting_widget = widget_class(self, hook, tasks, setting_name,
                                              **kwargs)
                setting_widget.setObjectName(setting_name)

                # Add a row entry
                self._layout.addRow(display_name, setting_widget)
Beispiel #5
0
        def __init__(self, parent):
            super(FarmWrapperWidget, self).__init__(parent)

            # Create a nice simple layout with a checkbox in it.
            layout = QtGui.QFormLayout(self)
            self.setLayout(layout)

            label = QtGui.QLabel(
                "Clicking this checkbox will submit this task to the render farm.",
                self)
            label.setWordWrap(True)
            layout.addRow(label)

            self._check_box = QtGui.QCheckBox("Submit to Farm", self)
            self._check_box.setTristate(False)
            layout.addRow(self._check_box)
Beispiel #6
0
    def populateUI(self, widget, properties=None, cut_support=False):
        """returns a tuple of added uiProperties"""
        if properties is None:
            properties = self._preset.properties()

        layout = QtGui.QFormLayout()

        collateTracksToolTip = """Enable this to include other shots which overlap the sequence time of each shot within the script. Cannot be enabled when Read Node overrides are set."""
        key = "collateTracks"
        value = False
        label = "Collate Shot Timings:"
        self._collateTimeProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=collateTracksToolTip,
        )
        layout.addRow(label, self._collateTimeProperty)

        collateShotNameToolTip = """Enable this to include other shots which have the same name in the Nuke script. Cannot be enabled when Read Node overrides are set."""
        key = "collateShotNames"
        value = False
        label = "Collate Shot Name:"
        self._collateNameProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=collateShotNameToolTip,
        )
        layout.addRow(label, self._collateNameProperty)

        if cut_support:
            cut_lbl = QtGui.QLabel(
                "NOTE: Cuts in SG are only created when collate is off.")
            color_role = QtGui.QPalette.WindowText
            palette = widget.palette()
            darker_color = palette.color(color_role).darker(150)
            palette.setColor(color_role, darker_color)
            cut_lbl.setPalette(palette)
            layout.addRow(cut_lbl)

        widget.setLayout(layout)
        return (self._collateTimeProperty, self._collateNameProperty)
Beispiel #7
0
        def __init__(self, parent, hook, items):
            QtGui.QWidget.__init__(self, parent)
            plugin = hook.plugin

            self._layout = QtGui.QFormLayout(self)

            for setting in plugin.settings["Properties To Display"]:
                kwargs = setting.value

                # TODO: this should probably be an exception
                name = kwargs.pop("name", None)
                if not name:
                    plugin.logger.error(
                        "Entry in 'Properties To Display' is missing its 'name' attribute"
                    )
                    continue

                widget_type = kwargs.pop("type", None)
                if not widget_type:
                    plugin.logger.error(
                        "No defined widget type for setting: {}".format(name))
                    continue

                if not hasattr(hook, widget_type):
                    plugin.logger.error(
                        "Cannot find widget class: {}".format(widget_type))
                    continue

                # Instantiate the widget class
                widget_class = getattr(hook, widget_type)
                display_name = kwargs.get("display_name", name)
                property_widget = widget_class(self, hook, items, name,
                                               **kwargs)
                property_widget.setObjectName(name)

                # Add a row entry
                self._layout.addRow(display_name, property_widget)
 def create_shot_processor_widget(self, parent_widget):
     widget = QtGui.QGroupBox("Custom Properties", parent_widget)
     widget.setLayout(QtGui.QFormLayout())
     return widget
 def create_nuke_shot_exporter_widget(self, parent_widget):
     widget = QtGui.QGroupBox("My Custom Properties", parent_widget)
     widget.setLayout(QtGui.QFormLayout())
     return widget
Beispiel #10
0
    def __init__(self, *args, **kwargs):

        # Get field defaults
        fields = kwargs.pop('fields', None)
        fields.setdefault('title', None)
        fields.setdefault('priority', None)
        fields.setdefault('type', None)
        fields.setdefault('description', None)
        fields.setdefault('context', None)
        fields.setdefault('error', None)
        fields.setdefault('message', None)
        fields.setdefault('assignee', None)
        self._exc_info = fields.pop('exc_info', None)

        # Initialize widget
        super(TicketsSubmitter, self).__init__(*args, **kwargs)

        # Create task manager
        self._task_manager = task_manager.BackgroundTaskManager(
            parent=self,
            start_processing=True,
            max_threads=2,
        )
        self._assignee = None
        self._context = None

        # Create widgets
        self.message = QtGui.QLabel()
        self.message.setWordWrap(True)
        self.sep0 = QtGui.QFrame()
        self.sep0.setFrameShape(self.sep0.HLine)
        self.sep0.setFrameShadow(self.sep0.Sunken)
        self.context_selector = context_selector.ContextWidget(self)
        self.context_selector.set_up(self._task_manager)
        self.context_selector.ui.label.setText('Ticket Context')
        self.context_selector.ui.label.hide()
        self.context_selector.context_changed.connect(self._on_context_changed)
        self.sep1 = QtGui.QFrame()
        self.sep1.setFrameShape(self.sep1.HLine)
        self.sep1.setFrameShadow(self.sep1.Sunken)
        self.title = QtGui.QLineEdit(self)
        self.type = QtGui.QComboBox(self)
        self.type.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Expanding,
        )
        self.priority = QtGui.QComboBox(self)
        self.priority.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Expanding,
        )
        self.assignee = shotgun_search_widget.GlobalSearchWidget(self)
        self.assignee.set_searchable_entity_types({
            'HumanUser': [['sg_status_list', 'is', 'act']],
            'Group': [],
        })
        self.assignee.set_bg_task_manager(self._task_manager)
        self.assignee.entity_activated.connect(self._on_assignee_changed)
        self.assignee.completer().entity_activated.disconnect(
            self.assignee.clear)
        self.description = QtGui.QTextEdit(self)
        policy = self.description.sizePolicy()
        policy.setVerticalStretch(1)
        self.description.setSizePolicy(policy)
        self.attachments = Attachments(self)
        self.error = QtGui.QTextEdit(self)
        self.error.setFocusPolicy(QtCore.Qt.NoFocus)
        self.error.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
        policy = self.error.sizePolicy()
        policy.setVerticalStretch(1)
        self.error.setSizePolicy(policy)
        self.submit_button = QtGui.QPushButton('Submit')
        self.submit_button.clicked.connect(self._on_submit)

        # Layout widgets
        footer_layouer = QtGui.QHBoxLayout()
        footer_layouer.addStretch(1)
        footer_layouer.addWidget(self.submit_button)
        self.footer = QtGui.QWidget()
        self.footer.setLayout(footer_layouer)

        self.layout = QtGui.QFormLayout()
        self.layout.addRow(self.message)
        self.layout.addRow(self.sep0)
        self.layout.addRow(self.context_selector)
        self.layout.addRow(self.sep1)
        self.layout.addRow('Title', self.title)
        self.layout.addRow('Type', self.type)
        self.layout.addRow('Priority', self.priority)
        self.layout.addRow('Assignee', self.assignee)
        self.layout.addRow('Attachments', self.attachments)
        self.layout.addRow('Description', self.description)
        self.layout.addRow('Error', self.error)
        self.layout.addRow(self.footer)
        self.setLayout(self.layout)
        if not fields['error']:
            self.hide_field(self.error)
        if not fields['message']:
            self.hide_field(self.message)
            self.hide_field(self.sep0)

        # Initialize field defaults
        QtCore.QTimer.singleShot(
            50,
            partial(self.set_field_defaults, fields),
        )
        self.adjustSize()
Beispiel #11
0
    def execute(self, layout, ui_object, **kwargs):
        """
        Called when building the various UI interfaces for the Hiero Exporter.
        Allows for additional properties to be added to the presets through the GUI interface.
        """
        # Customize the UI belonging to the Shotgun Shot Processor in `sg_shot_processor.py`
        if ui_object.__class__.__name__ == self._ProcessorUIName:

            processor_ui = ui_object
            properties = processor_ui._preset.properties()

            #  CBSD Customization
            # ===========================
            # For our custom ability to throttle the "Shot Updater". Non-hook changes in `sg_shot_processor.py`
            # and `shot_updater.py` related to these presets.
            shot_updater_layout = self._build_shot_updater_widget(
                processor_ui, properties)
            layout.addLayout(shot_updater_layout)
            # ===========================

            # proof of concept for further custom GUI properties
            custom_widget = QtGui.QWidget()
            layout.addWidget(custom_widget)
            custom_layout = QtGui.QHBoxLayout(custom_widget)

            additional_options_widget_01 = QtGui.QWidget()
            additional_options_layout_01 = QtGui.QFormLayout(
                additional_options_widget_01)
            additional_options_layout_01.addRow(
                QtGui.QLabel(":::: Additional Processor Options ::::"))

            custom_property = """Set a new custom property!"""
            key = "customProperty01"
            value = True
            label = "Custom Property:"
            processor_ui._custom_property_01 = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=properties,
                label=label,
                tooltip=custom_property)

            additional_options_layout_01.addRow(
                label, processor_ui._custom_property_01)

            custom_layout.addWidget(additional_options_widget_01)

        # Customize the UI for the "Shotgun Transcode Images" export type in the `version_creator.py` module.
        elif ui_object.__class__.__name__ == self._TranscodeUIName:
            transcoder_ui = ui_object

            properties = transcoder_ui._preset.properties()

            custom_widget = QtGui.QWidget()
            layout.addWidget(custom_widget)
            custom_layout = QtGui.QHBoxLayout(custom_widget)

            additional_options_widget_01 = QtGui.QWidget()
            additional_options_layout_01 = QtGui.QFormLayout(
                additional_options_widget_01)
            additional_options_layout_01.addRow(
                QtGui.QLabel(":::: Additional Transcoder Options ::::"))

            custom_property = """Set a new custom property!"""
            key = "customProperty01"
            value = True
            label = "Custom Property:"
            transcoder_ui._custom_property_01 = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=properties,
                label=label,
                tooltip=custom_property)

            additional_options_layout_01.addRow(
                label, transcoder_ui._custom_property_01)

            custom_layout.addWidget(additional_options_widget_01)

        # Customize the UI for the "Shotgun Audio Export" in the `sg_audio_export.py` module.
        elif ui_object.__class__.__name__ == self._AudioExportUIName:
            audio_exporter_ui = ui_object

            properties = audio_exporter_ui._preset.properties()

            custom_widget = QtGui.QWidget()
            layout.addWidget(custom_widget)
            custom_layout = QtGui.QHBoxLayout(custom_widget)

            additional_options_widget_01 = QtGui.QWidget()
            additional_options_layout_01 = QtGui.QFormLayout(
                additional_options_widget_01)
            additional_options_layout_01.addRow(
                QtGui.QLabel(":::: Additional Audio Export Options ::::"))

            custom_property = """Set a new custom property!"""
            key = "customProperty01"
            value = True
            label = "Custom Property:"
            audio_exporter_ui._custom_property_01 = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=properties,
                label=label,
                tooltip=custom_property)

            additional_options_layout_01.addRow(
                label, audio_exporter_ui._custom_property_01)

            custom_layout.addWidget(additional_options_widget_01)

        # Customize the UI for the "Shotgun Nuke Shot Export" in the `sg_nuke_shot_export.py` module.
        elif ui_object.__class__.__name__ == self._NukeShotExportUIName:

            nuke_exporter_ui = ui_object

            properties = nuke_exporter_ui._preset.properties()

            custom_widget = QtGui.QWidget()
            layout.addWidget(custom_widget)
            custom_layout = QtGui.QHBoxLayout(custom_widget)

            additional_options_widget_01 = QtGui.QWidget()
            additional_options_layout_01 = QtGui.QFormLayout(
                additional_options_widget_01)
            additional_options_layout_01.addRow(
                QtGui.QLabel(":::: Additional Nuke Shot Export Options ::::"))

            custom_property = """Set a new custom property!"""
            key = "customProperty01"
            value = True
            label = "Custom Property:"
            nuke_exporter_ui._custom_property_01 = UIPropertyFactory.create(
                type(value),
                key=key,
                value=value,
                dictionary=properties,
                label=label,
                tooltip=custom_property)

            additional_options_layout_01.addRow(
                label, nuke_exporter_ui._custom_property_01)

            custom_layout.addWidget(additional_options_widget_01)
Beispiel #12
0
    def _build_shot_updater_widget(self, processor_ui, properties):
        """This was written following the pattern in the CollatingExportUI object."""
        shot_updater_layout = QtGui.QFormLayout()

        sgCreateCut = """Create a Cut and CutItems in Shotgun..."""
        key = "sgCreateCut"
        value = True
        label = "Create Cut:"
        processor_ui._sgCreateCut = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgCreateCut)
        shot_updater_layout.addRow(label, processor_ui._sgCreateCut)

        shot_updater_layout.addRow(QtGui.QLabel("--- Frame Ranges ---"))

        sgHeadIn = """Update 'sg_head_in' on the Shot entity."""
        key = "updateSgHeadIn"
        value = True
        label = "Head In:"
        processor_ui._sgHeadInProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgHeadIn)
        shot_updater_layout.addRow(label, processor_ui._sgHeadInProperty)

        sgCutIn = """Update 'sg_cut_in' on the Shot entity."""
        key = "updateSgCutIn"
        value = True
        label = "Cut In:"
        processor_ui._sgCutInProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgCutIn)
        shot_updater_layout.addRow(label, processor_ui._sgCutInProperty)

        sgCutOut = """Update 'sg_cut_out' on the Shot entity."""
        key = "updateSgCutOut"
        value = True
        label = "Cut Out:"
        processor_ui._sgCutOutProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgCutOut)
        shot_updater_layout.addRow(label, processor_ui._sgCutOutProperty)

        sgTailOut = """Update 'sg_tail_out' on the Shot entity."""
        key = "updateSgTailOut"
        value = True
        label = "Tail Out:"
        processor_ui._sgTailOutProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgTailOut)
        shot_updater_layout.addRow(label, processor_ui._sgTailOutProperty)

        sgCutDuration = """Update 'sg_cut_duration' on the Shot entity."""
        key = "updateSgCutDuration"
        value = True
        label = "Cut Duration:"
        processor_ui._sgCutDurationProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgCutDuration)
        shot_updater_layout.addRow(label, processor_ui._sgCutDurationProperty)

        sgWorkingDuration = """Update 'sg_working_duration' on the Shot entity."""
        key = "updateSgWorkingDuration"
        value = True
        label = "Working Duration:"
        processor_ui._sgWorkingDurationProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=sgWorkingDuration)
        shot_updater_layout.addRow(label,
                                   processor_ui._sgWorkingDurationProperty)

        shot_updater_layout.addRow(QtGui.QLabel("--- File System ---"))

        tkCreateFilesystemStructure = """Run the Toolkit 'Create Folders' command for the Shot entity."""
        key = "tkCreateFilesystemStructure"
        value = True
        label = "Create Folders:"
        processor_ui._tkCreateFilesystemStructureProperty = UIPropertyFactory.create(
            type(value),
            key=key,
            value=value,
            dictionary=properties,
            label=label,
            tooltip=tkCreateFilesystemStructure)
        shot_updater_layout.addRow(
            label, processor_ui._tkCreateFilesystemStructureProperty)

        return shot_updater_layout