예제 #1
0
def initialize_post_publish_dialog():
    """
    A frameless, staysOnTop dialog to be initialized during post publish process
    for locking its application and actually show user that post publishes are in progress.
    """
    try:
        _fromUtf8 = QtCore.QString.fromUtf8
    except AttributeError:

        def direct_drive(s):
            return s

        _fromUtf8 = direct_drive

    dialog = QtWidgets.QDialog()
    dialog.vertical_layout = QtWidgets.QVBoxLayout(dialog)
    dialog.label = QtWidgets.QLabel(dialog.vertical_layout.widget())
    dialog.label.setText('POST PUBLISH IN PROGRESS')
    dialog.label.setStyleSheet(
        _fromUtf8("color: rgb(20, 255, 20);\n"
                  "font: 16pt;"))
    dialog.vertical_layout.addWidget(dialog.label)
    dialog.label1 = QtWidgets.QLabel(dialog.vertical_layout.widget())
    dialog.label1.setText('PLEASE WAIT...')
    dialog.label1.setAlignment(QtCore.Qt.AlignCenter)
    dialog.vertical_layout.addWidget(dialog.label1)
    dialog.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
    dialog.setWindowFlags(QtCore.Qt.FramelessWindowHint)
    dialog.setWindowModality(QtCore.Qt.ApplicationModal)

    return dialog
예제 #2
0
파일: base.py 프로젝트: cgmafia/anima
def ui_caller(app_in, executor, ui_class, **kwargs):
    global app
    global ui_instance
    self_quit = False
    app = QtWidgets.QApplication.instance()
    if app is None:
        if not app_in:
            try:
                app = QtWidgets.QApplication(sys.argv)
            except AttributeError:  # sys.argv gives argv.error
                app = QtWidgets.QApplication([])
        else:
            app = app_in
        self_quit = True

    ui_instance = ui_class(**kwargs)
    ui_instance.show()
    if executor is None:
        app.exec_()
        if self_quit:
            app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app,
                        QtCore.SLOT("quit()"))
    else:
        executor.exec_(app, ui_instance)
    return ui_instance
예제 #3
0
    def _setup_ui(self):
        self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.setModal(True)
        self.resize(300, 300)
        size_policy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred,
            QtWidgets.QSizePolicy.Preferred
        )

        size_policy.setHorizontalStretch(1)
        size_policy.setVerticalStretch(1)
        size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(size_policy)
        self.setSizeGripEnabled(True)

        self.horizontal_layout = QtWidgets.QHBoxLayout(self)
        self.toolbox_widget = QtWidgets.QWidget(self)
        self.horizontal_layout.addWidget(self.toolbox_widget)

        self.toolbox_layout = ToolboxLayout(self.toolbox_widget)
        self.toolbox_layout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
        self.toolbox_layout.setContentsMargins(0, 0, 0, 0)

        # setup icon
        global __here__
        icon_path = os.path.abspath(
            os.path.join(__here__, "../../../ui/images/fusion9.png")
        )
        icon = QtGui.QIcon(icon_path)

        self.setWindowIcon(icon)
예제 #4
0
    def setup_ui(self):
        """create the UI widgets
        """
        self.vertical_layout = QtWidgets.QVBoxLayout(self)

        self.header_horizontal_layout = QtWidgets.QHBoxLayout()

        self.responsible_label = QtWidgets.QLabel(self)
        self.responsible_label.setText('Resource')
        self.responsible_label.setStyleSheet("""
            background-color: gray;
            font-weight: bold;
            color: white;
            padding: 0.5em;
        """)

        self.add_resource_button = QtWidgets.QPushButton(self)
        self.add_resource_button.setText('+')
        self.add_resource_button.setStyleSheet("""
            background-color: gray;
            color: white;
            padding: 0.5em;
        """)

        self.header_horizontal_layout.addWidget(self.responsible_label)
        self.header_horizontal_layout.addStretch(1)
        self.header_horizontal_layout.addWidget(self.add_resource_button)
        self.header_horizontal_layout.setStretch(0, 1)
        self.header_horizontal_layout.setStretch(1, 0)
        self.vertical_layout.addLayout(self.header_horizontal_layout)

        self.responsible_grid_layout = QtWidgets.QGridLayout()
        self.vertical_layout.addLayout(self.responsible_grid_layout)
예제 #5
0
    def create_layouts(self):
        """
        Creates layouts
        """

        form_layout = QtWidgets.QFormLayout()
        form_layout.addRow("Name", self.name_line_edit)
        form_layout.addRow("Login", self.login_line_edit)
        form_layout.addRow("Email", self.email_line_edit)
        form_layout.addRow("Password", self.password_line_edit)

        button_layout = QtWidgets.QHBoxLayout()
        button_layout.addStretch()
        button_layout.addWidget(self.ok_button)
        button_layout.addWidget(self.cancel_button)

        label_layout = QtWidgets.QVBoxLayout()
        label_layout.addWidget(self.dialog_label)
        label_layout.addWidget(self.line)
        label_layout.addStretch()

        main_layout = QtWidgets.QVBoxLayout(self)
        main_layout.addLayout(label_layout)
        main_layout.addLayout(form_layout)
        main_layout.addLayout(button_layout)

        self.resize(328, 184)
예제 #6
0
    def setup_ui(self):
        """add tools
        """
        # create the main tab layout
        main_tab_widget = QtWidgets.QTabWidget(self.widget())
        self.addWidget(main_tab_widget)

        # add the General Tab
        general_tab_widget = QtWidgets.QWidget(self.widget())
        general_tab_vertical_layout = QtWidgets.QVBoxLayout()
        general_tab_vertical_layout.setSizeConstraint(
            QtWidgets.QLayout.SetMaximumSize)
        general_tab_widget.setLayout(general_tab_vertical_layout)

        main_tab_widget.addTab(general_tab_widget, 'Generic')

        # Create tools for general tab

        # -------------------------------------------------------------------
        # Version Creator
        add_button('Version Creator',
                   general_tab_vertical_layout,
                   GenericTools.version_creator,
                   callback_kwargs={"parent": self.parent()})

        # Loader Report
        add_button('Loader Report', general_tab_vertical_layout,
                   GenericTools.loader_report)

        # -------------------------------------------------------------------
        # Add the stretcher
        general_tab_vertical_layout.addStretch()
예제 #7
0
    def setup_ui(self):
        """create the UI widgets
        """
        self.vertical_layout = QtWidgets.QVBoxLayout(self)
        self.setLayout(self.vertical_layout)

        # the widget should consist of a QGraphic
        self.thumbnail_graphics_view = QtWidgets.QGraphicsView(self)

        # set size policy
        size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                            QtWidgets.QSizePolicy.Fixed)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            self.thumbnail_graphics_view.sizePolicy().hasHeightForWidth())
        self.thumbnail_graphics_view.setSizePolicy(size_policy)

        # set size
        default_size = QtCore.QSize(*self.default_thumbnail_size)

        self.thumbnail_graphics_view.setMinimumSize(default_size)
        self.thumbnail_graphics_view.setMaximumSize(default_size)

        self.thumbnail_graphics_view.setAutoFillBackground(False)
        self.thumbnail_graphics_view.setVerticalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff)
        self.thumbnail_graphics_view.setHorizontalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        self.thumbnail_graphics_view.setBackgroundBrush(brush)
        self.thumbnail_graphics_view.setInteractive(False)
        self.thumbnail_graphics_view.setRenderHints(
            QtGui.QPainter.Antialiasing
            | QtGui.QPainter.HighQualityAntialiasing
            | QtGui.QPainter.SmoothPixmapTransform
            | QtGui.QPainter.TextAntialiasing)
        self.vertical_layout.addWidget(self.thumbnail_graphics_view)

        self.upload_thumbnail_button = QtWidgets.QPushButton(self)
        self.upload_thumbnail_button.setText("Upload...")
        self.upload_thumbnail_button.setGeometry(
            self.thumbnail_graphics_view.geometry())
        self.upload_thumbnail_button.setVisible(True)

        self.vertical_layout.addWidget(self.upload_thumbnail_button)

        # create signals
        # QtCore.QObject.connect(
        #     self.thumbnail_graphics_view,
        #     QtCore.SIGNAL("clicked()"),
        #     self.thumbnail_graphics_view_clicked
        # )

        QtCore.QObject.connect(self.upload_thumbnail_button,
                               QtCore.SIGNAL("clicked()"),
                               self.upload_thumbnail_button_clicked)
예제 #8
0
    def __init__(self, parent=None, *args, **kwargs):
        QtWidgets.QTableWidget.__init__(self, parent, *args, **kwargs)

        self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.setAlternatingRowColors(True)
        self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
        self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
        self.setShowGrid(False)
        self.setColumnCount(5)
        self.setObjectName("previous_versions_table_widget")
        self.setColumnCount(5)
        self.setRowCount(0)
        self.setHorizontalHeaderItem(0, QtWidgets.QTableWidgetItem())
        self.setHorizontalHeaderItem(1, QtWidgets.QTableWidgetItem())
        self.setHorizontalHeaderItem(2, QtWidgets.QTableWidgetItem())
        self.setHorizontalHeaderItem(3, QtWidgets.QTableWidgetItem())
        self.setHorizontalHeaderItem(4, QtWidgets.QTableWidgetItem())
        self.horizontalHeader().setStretchLastSection(True)
        self.verticalHeader().setStretchLastSection(False)

        tool_tip_html = \
            "<html><head/><body><p>Right click to:</p><ul style=\"" \
            "margin-top: 0px; margin-bottom: 0px; margin-left: 0px; " \
            "margin-right: 0px; -qt-list-indent: 1;\"><li><span style=\" " \
            "font-weight:600;\">Copy Path</span></li><li><span style=\" " \
            "font-weight:600;\">Browse Path</span></li><li><span style=\" " \
            "font-weight:600;\">Change Description</span></li></ul>" \
            "<p>Double click to:</p><ul style=\"margin-top: 0px; " \
            "margin-bottom: 0px; margin-left: 0px; margin-right: 0px; " \
            "-qt-list-indent: 1;\"><li style=\" margin-top:12px; " \
            "margin-bottom:12px; margin-left:0px; margin-right:0px; " \
            "-qt-block-indent:0; text-indent:0px;\"><span style=\" " \
            "font-weight:600;\">Open</span></li></ul></body></html>"

        try:
            self.setToolTip(
                QtWidgets.QApplication.translate(
                    "Dialog", tool_tip_html, None,
                    QtWidgets.QApplication.UnicodeUTF8))
        except AttributeError:
            self.setToolTip(
                QtWidgets.QApplication.translate("Dialog", tool_tip_html,
                                                 None))

        self.versions = []
        self.labels = [
            '#',
            'App',
            'Created By',
            'Updated By',
            'Size',
            'Date',
            'Description',
        ]
        self.setColumnCount(len(self.labels))
예제 #9
0
    def create_widgets(self):
        """
        Creates widgets
        """

        self.dialog_label = QtWidgets.QLabel()
        self.dialog_label.setStyleSheet("color: rgb(71, 143, 202);\n"
                                        "font: 18pt;")
        self.dialog_label.setText("Create User")

        self.line = QtWidgets.QFrame()
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)

        self.name_line_edit = QtWidgets.QLineEdit()
        self.name_line_edit.setPlaceholderText("Enter Name")

        self.login_line_edit = QtWidgets.QLineEdit()
        self.login_line_edit.setPlaceholderText("stalker")

        self.email_line_edit = QtWidgets.QLineEdit()
        self.email_line_edit.setPlaceholderText("*****@*****.**")

        self.password_line_edit = QtWidgets.QLineEdit()
        self.password_line_edit.setPlaceholderText("******")

        self.ok_button = QtWidgets.QPushButton("OK")
        self.cancel_button = QtWidgets.QPushButton("Cancel")
예제 #10
0
    def _setup_ui(self):
        self.resize(629, 567)
        self.verticalLayout = QtWidgets.QVBoxLayout(self)
        self.buttonBox = QtWidgets.QDialogButtonBox(self)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                          | QtWidgets.QDialogButtonBox.Ok)
        self.verticalLayout.addWidget(self.buttonBox)

        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"),
                               self.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"),
                               self.reject)
        QtCore.QMetaObject.connectSlotsByName(self)
예제 #11
0
파일: task.py 프로젝트: ktSevindik/anima
    def _setup_dialog(self):
        """create the UI elements
        """
        # set window title
        self.setWindowTitle("Duplicate Task Hierarchy")

        # set window size
        self.resize(285, 118)

        # create the main layout
        self.main_layout = QtWidgets.QVBoxLayout(self)
        self.setLayout(self.main_layout)

        # the label
        self.label = QtWidgets.QLabel(self)
        self.label.setText('Duplicated Task Name:')
        self.main_layout.addWidget(self.label)

        # the line edit
        self.line_edit = QtWidgets.QLineEdit(self)
        self.line_edit.setText(self.duplicated_task_name)
        self.main_layout.addWidget(self.line_edit)

        # the check box
        self.check_box = QtWidgets.QCheckBox(self)
        self.check_box.setText('Keep resources')
        self.check_box.setChecked(True)
        self.main_layout.addWidget(self.check_box)

        # the button box
        self.button_box = QtWidgets.QDialogButtonBox(self)
        self.button_box.setOrientation(QtCore.Qt.Horizontal)
        self.button_box.setStandardButtons(
            QtWidgets.QDialogButtonBox.Cancel |
            QtWidgets.QDialogButtonBox.Ok
        )
        self.main_layout.addWidget(self.button_box)

        # setup signals
        QtCore.QObject.connect(
            self.button_box,
            QtCore.SIGNAL("accepted()"),
            self.accept
        )
        QtCore.QObject.connect(
            self.button_box,
            QtCore.SIGNAL("rejected()"),
            self.reject
        )
예제 #12
0
    def setup_ui(self):
        """add tools
        """
        # create the main tab layout
        main_tab_widget = QtWidgets.QTabWidget(self.widget())
        self.addWidget(main_tab_widget)

        # add the General Tab
        general_tab_widget = QtWidgets.QWidget(self.widget())
        general_tab_vertical_layout = QtWidgets.QVBoxLayout()
        general_tab_widget.setLayout(general_tab_vertical_layout)

        main_tab_widget.addTab(general_tab_widget, 'Generic')

        # Create tools for general tab

        # -------------------------------------------------------------------
        # Version Creator
        add_button('Version Creator', general_tab_vertical_layout,
                   GenericTools.version_creator,
                   GenericTools.version_creator.__doc__)

        add_button('Browse $HIP', general_tab_vertical_layout,
                   GenericTools.browse_hip, GenericTools.browse_hip.__doc__)

        # Copy Path
        add_button('Copy Node Path', general_tab_vertical_layout,
                   GenericTools.copy_node_path,
                   GenericTools.copy_node_path.__doc__)

        # Range from shot
        add_button('Range From Shot', general_tab_vertical_layout,
                   GenericTools.range_from_shot,
                   GenericTools.range_from_shot.__doc__)

        # Update render settings
        add_button('Update Render Settings', general_tab_vertical_layout,
                   GenericTools.update_render_settings,
                   GenericTools.update_render_settings.__doc__)

        # Export RSProxy Data As JSON
        add_button('Export RSProxy Data As JSON', general_tab_vertical_layout,
                   GenericTools.export_rsproxy_data_as_json,
                   GenericTools.export_rsproxy_data_as_json.__doc__)

        # -------------------------------------------------------------------
        # Add the stretcher
        general_tab_vertical_layout.addStretch()
예제 #13
0
    def create_dock_widgets(self):
        """creates the dock widgets
        """
        # ----------------------------------------
        # create the Project Dock Widget
        self.project_dock_widget = QtWidgets.QDockWidget('Projects', self)
        self.project_dock_widget.setObjectName('project_dock_widget')
        # create the TaskTreeView as the main widget
        from anima.ui.views.task import TaskTreeView
        self.tasks_tree_view = TaskTreeView(parent=self)
        self.tasks_tree_view.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)

        self.tasks_tree_view.show_completed_projects = True
        self.tasks_tree_view.fill()

        # also setup the signal
        QtCore.QObject.connect(
            self.tasks_tree_view.selectionModel(),
            QtCore.SIGNAL('selectionChanged(const QItemSelection &, '
                          'const QItemSelection &)'),
            self.tasks_tree_view_changed)

        self.project_dock_widget.setWidget(self.tasks_tree_view)

        # and set the left dock widget
        self.addDockWidget(QtCore.Qt.LeftDockWidgetArea,
                           self.project_dock_widget)

        # ----------------------------------------
        # create the Central Widget
        from anima.ui.widgets.task_dashboard import TaskDashboardWidget
        self.task_dashboard_widget = TaskDashboardWidget(parent=self)
        self.setCentralWidget(self.task_dashboard_widget)
예제 #14
0
def add_button(label, layout, callback, tooltip=''):
    """A wrapper for button creation

    :param label: The label of the button
    :param layout: The layout that the button is going to be placed under.
    :param callback: The callable that will be called when the button is
      clicked.
    :param str tooltip: Optional tooltip for the button
    :return:
    """
    # button
    button = QtWidgets.QPushButton()
    button.setText(label)
    layout.addWidget(button)

    button.setToolTip(tooltip)

    # Signal
    QtCore.QObject.connect(
        button,
        QtCore.SIGNAL("clicked()"),
        callback
    )

    return button
예제 #15
0
    def run_fix_definition(self):
        """runs fix definitions for publishers
        """
        m = QtWidgets.QMessageBox()
        m.setWindowTitle('Continue?')
        m.setText('This command will try to fix<br/>'
                  '[ <b>%s</b> ] issue<br/>'
                  'automatically.<br/><br/>'
                  'Confirm ? <b>(BETA)</b>' %
                  self.publisher.__doc__.split('\n')[0].strip())
        m.setStandardButtons(QtWidgets.QMessageBox.Yes
                             | QtWidgets.QMessageBox.No)
        m.setDefaultButton(QtWidgets.QMessageBox.Yes)
        m.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        m.exec_()

        if m.clickedButton() == m.defaultButton():
            fix_def_name = '%s%s' % (self.publisher.__name__,
                                     self.fix_identifier)
            try:
                from anima.env.mayaEnv import publish
                fix_func = publish.__dict__[fix_def_name]
                fix_func()
            except KeyError:
                pass
            self.check_push_button.click()
예제 #16
0
def ui():
    """returns the widget to Houdini
    """
    root_widget = QtWidgets.QWidget()
    tlb = ToolboxLayout()
    root_widget.setLayout(tlb)
    return root_widget
예제 #17
0
파일: utils.py 프로젝트: ktSevindik/anima
def add_button(label, layout, callback, tooltip='', callback_kwargs=None):
    """A wrapper for button creation

    :param label: The label of the button
    :param layout: The layout that the button is going to be placed under.
    :param callback: The callable that will be called when the button is
      clicked.
    :param str tooltip: Optional tooltip for the button
    :param callback_kwargs: Callback arguments
    :return:
    """
    if tooltip == '':
        tooltip = callback.__doc__

    # button
    button = QtWidgets.QPushButton(layout.parentWidget())
    button.setText(label)
    layout.addWidget(button)

    button.setToolTip(tooltip)

    # Signal
    if callback_kwargs:
        import functools
        callback = functools.partial(callback, **callback_kwargs)

    QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), callback)

    return button
예제 #18
0
파일: general.py 프로젝트: MehmetErer/anima
def unknown_plugin_cleaner_ui():
    """UI for Unknown plugin cleaner which cleans unknown plugin entries from
    the selected *.ma files
    """
    from anima.ui.lib import QtWidgets
    from anima.env.mayaEnv import get_maya_main_window
    maya_main_window = get_maya_main_window()

    dialog = QtWidgets.QFileDialog(maya_main_window, "Choose file")
    dialog.setNameFilter("Maya Files (*.ma)")
    dialog.setFileMode(QtWidgets.QFileDialog.AnyFile)
    if dialog.exec_():
        file_path = dialog.selectedFiles()[0]
        if file_path:
            from anima.ui import progress_dialog

            pc = UnknownPluginCleaner(path=file_path, show_progress=True)
            result = pc.clean()
            if result:
                QtWidgets.QMessageBox.information(
                    maya_main_window,
                    'Cleaned',
                    'Cleaned:<br><br>%s' % os.path.basename(file_path),
                )
            else:
                QtWidgets.QMessageBox.information(
                    maya_main_window,
                    'Clean',
                    'The file was clean:<br><br>%s' %
                    os.path.basename(file_path),
                )
예제 #19
0
    def setup_ui(self):
        """create the UI widgets
        """
        self.vertical_layout = QtWidgets.QVBoxLayout(self)

        from anima.ui.lib import QtCore, QtGui
        # the widget should consist of a QGraphic
        self.thumbnail_graphics_view = QtWidgets.QGraphicsView(self)

        # set size policy
        size_policy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Fixed
        )
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            self.thumbnail_graphics_view.sizePolicy().hasHeightForWidth())
        self.thumbnail_graphics_view.setSizePolicy(size_policy)

        # set size
        default_size = QtCore.QSize(
            self.default_thumbnail_size,
            self.default_thumbnail_size
        )

        self.thumbnail_graphics_view.setMinimumSize(default_size)
        self.thumbnail_graphics_view.setMaximumSize(default_size)

        self.thumbnail_graphics_view.setAutoFillBackground(False)
        self.thumbnail_graphics_view.setVerticalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff
        )
        self.thumbnail_graphics_view.setHorizontalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff
        )
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        self.thumbnail_graphics_view.setBackgroundBrush(brush)
        self.thumbnail_graphics_view.setInteractive(False)
        self.thumbnail_graphics_view.setRenderHints(
            QtGui.QPainter.Antialiasing |
            QtGui.QPainter.HighQualityAntialiasing |
            QtGui.QPainter.SmoothPixmapTransform |
            QtGui.QPainter.TextAntialiasing
        )
        self.vertical_layout.addWidget(self.thumbnail_graphics_view)
예제 #20
0
    def create_render_jobs(self):
        """creates render jobs
        """
        # first check duplicate shots
        if not self.check_duplicate_shots():
            return

        if not self.validate_shot_codes():
            return

        project = self.project_combo_box.get_current_project()
        sequence = self.sequence_combo_box.get_current_sequence()
        im = ShotManager(project, sequence)

        message_box = QtWidgets.QMessageBox(self)
        # message_box.setTitle("Which Shots?")
        message_box.setText("Which Shots?")

        current_shot = QtWidgets.QPushButton("Current")
        all_shots = QtWidgets.QPushButton("All")

        message_box.addButton(current_shot, QtWidgets.QMessageBox.YesRole)
        message_box.addButton(all_shots, QtWidgets.QMessageBox.NoRole)

        message_box.exec_()

        try:
            clicked_button = message_box.clickedButton()
            message_box.deleteLater()
            if clicked_button == all_shots:
                for shot in im.get_shots():
                    shot.create_render_job()
            else:
                im.get_current_shot().create_render_job()
        except BaseException as e:
            QtWidgets.QMessageBox.critical(
                self,
                "Error",
                str(e)
            )
            raise e
        finally:
            QtWidgets.QMessageBox.information(
                self,
                "Created Shots and Render Jobs 👍",
                "Created Shots and Render Jobs 👍"
            )
예제 #21
0
    def _setup_ui(self):
        """create the UI elements
        """
        # Create the main layout
        self.resize(850, 650)

        # Main Layout
        self.main_layout = QtWidgets.QVBoxLayout(self)

        # Dialog Label
        self.dialog_label = QtWidgets.QLabel(self)

        self.dialog_label.setText("Clip Manager")
        self.dialog_label.setStyleSheet("color: rgb(71, 143, 202);font: 18pt;")

        self.main_layout.addWidget(self.dialog_label)

        # Title Line
        line = QtWidgets.QFrame(self)
        line.setFrameShape(QtWidgets.QFrame.HLine)
        line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.main_layout.addWidget(line)

        # Add Clip Field Button
        self.add_clip_field_push_button = QtWidgets.QPushButton(self)
        self.add_clip_field_push_button.setText("Add Clip")
        self.main_layout.addWidget(self.add_clip_field_push_button)

        # Clip Fields Layout
        self.scroll_area_widget = QtWidgets.QWidget(self)
        self.clip_vertical_layout = QtWidgets.QVBoxLayout(self)
        self.scroll_area_widget.setLayout(self.clip_vertical_layout)

        self.scroll_area = QtWidgets.QScrollArea(self)
        self.scroll_area.setVerticalScrollBarPolicy(
            QtCore.Qt.ScrollBarAsNeeded)
        self.scroll_area.setHorizontalScrollBarPolicy(
            QtCore.Qt.ScrollBarAsNeeded)
        self.scroll_area.setWidgetResizable(True)
        self.scroll_area.setWidget(self.scroll_area_widget)

        self.main_layout.addWidget(self.scroll_area)

        # Create Shots Push Button
        self.create_shots_push_button = QtWidgets.QPushButton(self)
        self.create_shots_push_button.setText("Create")
        self.main_layout.addWidget(self.create_shots_push_button)

        # setup signals
        # Add Clip Push Button
        QtCore.QObject.connect(self.add_clip_field_push_button,
                               QtCore.SIGNAL("clicked()"), self.add_clip_field)

        # Create Push Button
        QtCore.QObject.connect(self.create_shots_push_button,
                               QtCore.SIGNAL("clicked()"), self.create_shots)
예제 #22
0
 def video_choose_button_clicked(self):
     """runs when the Video push button is clicked
     """
     dialog = QtWidgets.QFileDialog(self.parent, "Choose Video File")
     result = dialog.getOpenFileName()
     file_path = result[0]
     if file_path:
         self.video_file_field.setText(file_path)
예제 #23
0
    def setup_ui(self):
        """create the UI widgets
        """
        self.vertical_layout = QtWidgets.QVBoxLayout(self)

        self.header_horizontal_layout = QtWidgets.QHBoxLayout()

        self.versions_use_in_label = QtWidgets.QLabel(self)
        self.versions_use_in_label.setText('Versions are used in')
        self.versions_use_in_label.setStyleSheet("""
            background-color: gray;
            color: white;
            font-weight: bold;
            padding: 0.5em;
        """)

        self.header_horizontal_layout.addWidget(self.versions_use_in_label)
        self.vertical_layout.addLayout(self.header_horizontal_layout)
예제 #24
0
 def fill_table_widget(self):
     """fills the table widget with data
     """
     task_data = self.get_filtered_entities()
     self.data_table_widget.clear()
     self.data_table_widget.setRowCount(len(task_data))
     for i, t_data in enumerate(task_data):
         item = QtWidgets.QTableWidgetItem(t_data.name)
         self.data_table_widget.setItem(i, 0, item)
예제 #25
0
    def _setup(self):
        """create UI elements
        """
        self.setWindowTitle("Create Shot Dialog")
        self.resize(550, 790)
        self.vertical_layout = QtWidgets.QVBoxLayout(self)

        # ----------------------------------------------
        # Dilog Label
        self.dialog_label = QtWidgets.QLabel(self)
        self.dialog_label.setText('Create Shot')
        self.dialog_label.setStyleSheet("color: rgb(71, 143, 202);font: 18pt;")
        self.vertical_layout.addWidget(self.dialog_label)

        # ----------------------------------------------
        # Title Line
        line = QtWidgets.QFrame(self)
        line.setFrameShape(QtWidgets.QFrame.HLine)
        line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.vertical_layout.addWidget(line)

        # ----------------------------------------------
        # Button Box
        self.buttonBox = QtWidgets.QDialogButtonBox(self)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(
            QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok
        )
        self.vertical_layout.addWidget(self.buttonBox)

        # ----------------------------------------------
        # SIGNALS

        # button box
        QtCore.QObject.connect(
            self.buttonBox,
            QtCore.SIGNAL("accepted()"),
            self.accept
        )
        QtCore.QObject.connect(
            self.buttonBox,
            QtCore.SIGNAL("rejected()"),
            self.reject
        )
예제 #26
0
def add_line(layout):
    """Adds a horizontal line

    :param layout:
    :return:
    """

    line = QtWidgets.QFrame(layout.parent())
    line.setFrameShape(QtWidgets.QFrame.HLine)
    line.setFrameShadow(QtWidgets.QFrame.Sunken)
    layout.addWidget(line)
예제 #27
0
    def _setup_ui(self):
        self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.setModal(True)
        self.resize(300, 800)
        size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Preferred)

        size_policy.setHorizontalStretch(1)
        size_policy.setVerticalStretch(1)
        size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(size_policy)
        self.setSizeGripEnabled(True)

        self.horizontal_layout = QtWidgets.QHBoxLayout(self)
        self.toolbox_widget = QtWidgets.QWidget(self)
        self.horizontal_layout.addWidget(self.toolbox_widget)

        self.toolbox_layout = ToolboxLayout(self.toolbox_widget)
        self.toolbox_layout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
        self.toolbox_layout.setContentsMargins(0, 0, 0, 0)
예제 #28
0
    def _show_versions_treeView_context_menu(self, position):
        """the custom context menu for the versions_treeView
        """
        # convert the position to global screen position
        global_position = \
            self.versions_treeView.mapToGlobal(position)

        index = self.versions_treeView.indexAt(position)
        model = self.versions_treeView.model()

        # get the column 0 item which holds the Version instance
        # index = self.versions_treeView.model().index(index.row(), 0)
        item = model.itemFromIndex(index)
        logger.debug('itemAt(position) : %s' % item)

        if not item:
            return

        if not hasattr(item, 'version'):
            return

        version = item.version
        latest_published_version = None
        if version:
            latest_published_version = version.latest_published_version

        item_action = item.action

        # if item_action != 'create':
        #    return

        from stalker import Version
        if not isinstance(version, Version):
            return

        # create the menu
        menu = QtWidgets.QMenu()

        # Add "Open..." action
        # Always open the latest published version
        absolute_full_path = version.absolute_full_path
        if absolute_full_path:
            action = menu.addAction('Open...')
            if latest_published_version:
                action.version = latest_published_version
            else:
                action.version = version

        selected_action = menu.exec_(global_position)

        if selected_action:
            choice = selected_action.text()
            if choice == 'Open...':
                self.open_version(selected_action.version)
예제 #29
0
 def _setup_ui(self):
     """creates the ui elements
     """
     self.label = QtWidgets.QLabel(self.parent)
     self.parent_form_layout.setWidget(self.parent_form_layout_index,
                                       QtWidgets.QFormLayout.LabelRole,
                                       self.label)
     self.horizontal_layout = QtWidgets.QHBoxLayout()
     self.combo_box = QtWidgets.QComboBox(self.parent)
     self.horizontal_layout.addWidget(self.combo_box)
     self.update_push_button = QtWidgets.QPushButton(self.parent)
     self.horizontal_layout.addWidget(self.update_push_button)
     self.create_push_button = QtWidgets.QPushButton(self.parent)
     self.horizontal_layout.addWidget(self.create_push_button)
     self.horizontal_layout.setStretch(0, 1)
     self.parent_form_layout.setLayout(self.parent_form_layout_index,
                                       QtWidgets.QFormLayout.FieldRole,
                                       self.horizontal_layout)
     self.label.setText("Image Format")
     self.update_push_button.setText("Update...")
     self.create_push_button.setText("New...")
예제 #30
0
 def tde4_lens_distort_node_creator(cls, parent):
     """creates lens distort nodes from the given 3de4 lens file
     """
     # show a file browser
     dialog = QtWidgets.QFileDialog(parent, "Choose file")
     dialog.setNameFilter("3DE4 Lens Files (*.txt)")
     dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile)
     if dialog.exec_():
         file_path = dialog.selectedFiles()[0]
         if not file_path:
             return
         from anima.env.fusion.utils import TDE4LensDistortionImporter
         lens_importer = TDE4LensDistortionImporter()
         lens_importer.import_(file_path)