Example #1
0
    def __init__(self,
                 parent=None,
                 parent_name=None,
                 name_input=None,
                 multi_inputs=None,
                 ancestors=None,
                 project=None):
        super(NameFormatWidget, self).__init__(parent)

        self.project = project

        self.name_input = name_input
        self.multi_inputs = multi_inputs
        self.ancestors = ancestors
        self.parent_name = parent_name

        self.ancestors_names = ancestors

        if not multi_inputs:
            self.ancestors_names.reverse()
            self.ancestors_names.pop(0)

        self.max_depth = len(self.ancestors_names)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.setContentsMargins(5, 2, 5, 2)
        self.layout.setAlignment(QtCore.Qt.AlignLeft)

        self.file_name_title = gui.Title(self, label="File name format:")
        self.layout.addWidget(self.file_name_title)

        self.input_format_widget = inputs.GroupInput(
            self,
            label="Format Depth",
            inputWidget=QtWidgets.QSpinBox(self),
            ic=cfg.counter_icon)

        self.depth_slider = self.input_format_widget.input
        self.depth_slider.setMinimum(0)
        self.depth_slider.setMaximum(self.max_depth)
        self.depth_slider.setValue(self.max_depth)

        self.format_preview_widget = inputs.GroupInput(
            self, inputWidget=QtWidgets.QLineEdit(self))
        self.format_preview = self.format_preview_widget.input
        self.format_preview.setEnabled(False)
        self.preview_format()

        self.layout.addWidget(self.input_format_widget)
        self.layout.addWidget(self.format_preview_widget)

        self.depth_slider.valueChanged.connect(self.preview_format)
Example #2
0
    def __init__(self,
                 parent=None,
                 string="",
                 name_label_sting="Name",
                 title="Create new Category"):
        super(newFolderDialog, self).__init__(parent, string, name_label_sting,
                                              title)

        self.input_range_widget = inputs.RangeInput(self,
                                                    label="Range",
                                                    ic=cfg.buffer_icon)

        self.range_start_slider = self.input_range_widget.start_input
        self.range_end_slider = self.input_range_widget.end_input
        self.range_step_slider = self.input_range_widget.step_input
        self.range_start_slider.setMinimum(1)
        self.range_start_slider.setMaximum(10000)
        self.range_start_slider.setValue(1)
        self.range_end_slider.setMinimum(1)
        self.range_end_slider.setMaximum(10000)
        self.range_end_slider.setValue(1)
        self.range_step_slider.setMinimum(1)
        self.range_step_slider.setMaximum(10000)
        self.range_step_slider.setValue(1)
        self.input_layout.addWidget(self.input_range_widget)

        self.range_start_slider.valueChanged.connect(self.editEndSliderMin)

        # self.input_quantity_widget = inputs.groupInput(self, label="Quantity", inputWidget=QtWidgets.QSpinBox(self),
        #                                         ic=cfg.buffer_icon)
        #
        # self.quantity_slider = self.input_quantity_widget.input
        # self.quantity_slider.setMinimum(1)
        # self.quantity_slider.setMaximum(1000)
        # self.quantity_slider.setValue(1)
        #
        # self.input_from_widget = inputs.groupInput(self, label="From", inputWidget=QtWidgets.QSpinBox(self),
        #                                     ic=cfg.tab_icon)
        #
        # self.from_slider = self.input_from_widget.input
        # self.from_slider.setMinimum(1)
        # self.from_slider.setMaximum(1000)
        # self.from_slider.setValue(1)

        self.input_padding_widget = inputs.GroupInput(
            self,
            label="Padding",
            inputWidget=QtWidgets.QSpinBox(self),
            ic=cfg.counter_icon)

        self.padding_slider = self.input_padding_widget.input
        self.padding_slider.setMinimum(0)
        self.padding_slider.setMaximum(6)
        self.padding_slider.setValue(3)

        # self.input_layout.addWidget(self.input_quantity_widget)
        # self.input_layout.addWidget(self.input_from_widget)

        self.input_layout.addWidget(self.input_padding_widget)
        self.name_input.textChanged.connect(self.name_changed)
Example #3
0
    def __init__(self, parent=None, name_input=None, ancestors=[]):
        super(FormatWidget, self).__init__(parent)

        # self.project = project

        self.name_input = name_input
        self.ancestors = ancestors
        # self.ancestors_names = []
        # [self.ancestors_names.append("<{}>".format(a)) for a in ancestors]

        self.max_depth = len(self.ancestors)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.setContentsMargins(5, 2, 5, 2)
        self.layout.setAlignment(QtCore.Qt.AlignLeft)

        self.file_name_title = gui.Title(self,
                                         label="File name format: (Advanced) ")
        self.layout.addWidget(self.file_name_title)

        self.input_format_widget = inputs.GroupInput(
            self,
            label="Include categories",
            inputWidget=QtWidgets.QSpinBox(self),
            ic=cfg.counter_icon)

        self.depth_slider = self.input_format_widget.input
        self.depth_slider.setMinimum(0)
        self.depth_slider.setMaximum(self.max_depth)

        if self.max_depth >= 1:
            self.depth_slider.setValue(1)
        else:
            self.depth_slider.setValue(self.max_depth)

        self.format_preview_widget = inputs.GroupInput(
            self, inputWidget=QtWidgets.QLineEdit(self))
        self.format_preview = self.format_preview_widget.input
        self.format_preview.setEnabled(False)
        self.preview_format()

        self.layout.addWidget(self.input_format_widget)
        self.layout.addWidget(self.format_preview_widget)

        self.depth_slider.valueChanged.connect(self.preview_format)
Example #4
0
    def __init__(self, parent=None):

        super(License_dialog, self).__init__(parent)
        self.setStyleSheet(cfg.stylesheet)
        self.layout = QtWidgets.QVBoxLayout(self)

        self.pipelineUI = self.parent()
        self.version = pipeline.__version__

        self.input_widget = QtWidgets.QWidget(self)
        self.input_layout = QtWidgets.QVBoxLayout(self.input_widget)
        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Fixed)

        self.input_layout.setContentsMargins(5, 5, 5, 5)
        self.layout.setContentsMargins(10, 10, 10, 10)

        self.title = gui.Title(
            self,
            label="Please enter your Pipeline {} license key:".format(
                self.version[0]),
            seperator=False)
        self.title.layout.setContentsMargins(5, 0, 5, 0)
        self.input_layout.addWidget(self.title)
        self.note = gui.Title(self,
                              label="Activation requires internet connection.")
        font = QtGui.QFont()
        font.setItalic(True)
        self.note.label.setFont(font)
        self.input_layout.addWidget(self.note)

        self.key_widget = inputs.GroupInput(
            self,
            label="Key",
            inputWidget=QtWidgets.QLineEdit(self),
            ic=cfg.lock_icon)
        self.key_input = self.key_widget.input
        self.key_widget.label.setMinimumSize(QtCore.QSize(10, 30))
        self.key_widget.label.setText("")
        self.key_input.setMinimumSize(QtCore.QSize(300, 30))
        self.input_layout.addWidget(self.key_widget)
        self.layout.addWidget(self.input_widget)

        ok = QtWidgets.QPushButton("Activate")
        ok.setDefault(True)

        canc = QtWidgets.QPushButton("Cancel")

        buttons = QtWidgets.QDialogButtonBox(QtCore.Qt.Horizontal)
        buttons.addButton(ok, QtWidgets.QDialogButtonBox.AcceptRole)
        buttons.addButton(canc, QtWidgets.QDialogButtonBox.RejectRole)

        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        self.layout.addWidget(buttons)
Example #5
0
    def __init__(self, parent=None):
        super(Update_window, self).__init__(parent)

        # self.pipelineUI = self.parent()
        self.setWindowFlags(QtCore.Qt.Tool)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        self.main_widget = QtWidgets.QWidget(self)
        self.setCentralWidget(self.main_widget)

        self.setStyleSheet(cfg.stylesheet)
        self.layout = QtWidgets.QVBoxLayout(self.main_widget)
        self.layout.setContentsMargins(10, 5, 10, 10)

        self.setMinimumHeight(120)
        self.setMaximumHeight(120)
        self.setMinimumWidth(600)
        self.setMaximumWidth(600)
        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Expanding)

        # self.center_to_maya_window()

        # self.current_version = current_version
        self.caption = gui.Title(self, label="", seperator=False)

        self.link_label = Click_label()
        self.link_label.setHidden(True)
        self.layout.addWidget(self.link_label)
        self.layout.addWidget(self.caption)

        self.startup_switch = inputs.GroupInput(
            self,
            label="Check for updates on startup",
            inputWidget=QtWidgets.QCheckBox())
        self.startup_switch_input = self.startup_switch.input

        if settings.settings_node().check_for_updates:
            self.startup_switch_input.setCheckState(QtCore.Qt.Checked)

        self.startup_switch_input.stateChanged.connect(
            self.start_updates_toggle)
        self.layout.addWidget(self.startup_switch)

        self.ok = QtWidgets.QPushButton("Abort")
        self.ok.setIconSize(QtCore.QSize(20, 20))

        self.ok.setIcon(QtGui.QIcon(cfg.no_icon))
        self.ok.clicked.connect(self.close)
        self.layout.addWidget(self.ok)
Example #6
0
    def __init__(self, parent=None, string="", name_label_string="", title=""):
        super(newNodeDialog, self).__init__(parent)
        # self.setStyleSheet(cfg.stylesheet)
        self.setMaximumWidth(400)
        self.setMinimumWidth(400)
        self.setMaximumHeight(50)

        css = loadCSS.loadCSS(
            os.path.join(os.path.dirname(pipeline.CSS.__file__),
                         'mainWindow.css'))
        self.setStyleSheet(css)

        self.layout = QtWidgets.QVBoxLayout(self)

        self.input_widget = QtWidgets.QWidget(self)
        self.input_layout = QtWidgets.QVBoxLayout(self.input_widget)

        self.name_widget = inputs.GroupInput(
            self,
            label=name_label_string,
            inputWidget=QtWidgets.QLineEdit(self),
            ic=cfg.text_icon)

        self.name_input = self.name_widget.input
        self.name_input.setText(string)

        self.create_title = gui.Title(self, label=title)
        self.input_layout.addWidget(self.create_title)

        self.input_layout.addWidget(self.name_widget)

        self.layout.addWidget(self.input_widget)

        self.input_layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setContentsMargins(5, 5, 5, 10)

        buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        self.layout.addWidget(buttons)
Example #7
0
    def __init__(self, parent=None, **kwargs):
        super(ProjectDialog, self).__init__(parent)
        # self.setStyleSheet(cfg.stylesheet)

        css = loadCSS.loadCSS(
            os.path.join(os.path.dirname(pipeline.CSS.__file__),
                         'mainWindow.css'))
        self.setStyleSheet(css)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.setContentsMargins(5, 5, 5, 10)
        # self.setMaximumHeight(150)
        self.setWindowTitle('Create new project')
        self.input_widget = QtWidgets.QWidget(self)
        self.input_layout = QtWidgets.QVBoxLayout(self.input_widget)

        self.title = gui.Title(self, label="New project")
        self.input_layout.addWidget(self.title)

        self.name_widget = inputs.GroupInput(
            self,
            label="Project name",
            inputWidget=QtWidgets.QLineEdit(self),
            ic=cfg.text_icon)
        self.name_input = self.name_widget.input
        self.input_layout.addWidget(self.name_widget)

        self.nice_name_widget = inputs.GroupInput(
            self,
            label="Nice name",
            inputWidget=QtWidgets.QLineEdit(self),
            ic=cfg.text_icon)
        self.nice_name_input = self.nice_name_widget.input
        self.input_layout.addWidget(self.nice_name_widget)

        self.path_widget = inputs.GroupInput(
            self,
            label="Project path",
            inputWidget=QtWidgets.QLineEdit(self),
            ic=cfg.text_icon)
        self.path_input = self.path_widget.input
        self.path_input.setEnabled(False)
        self.path_set_btn = QtWidgets.QPushButton()
        self.path_widget.layout.addWidget(self.path_set_btn)
        self.path_set_btn.setIcon(QtGui.QIcon(cfg.search_icon))
        self.path_set_btn.setIconSize(QtCore.QSize(20, 20))

        self.path_set_btn.clicked.connect(self.set_project_path)
        self.input_layout.addWidget(self.path_widget)

        self.input_padding_widget = inputs.GroupInput(
            self,
            label="Padding",
            inputWidget=QtWidgets.QSpinBox(self),
            ic=cfg.counter_icon)

        self.padding_slider = self.input_padding_widget.input
        self.padding_slider.setMinimum(0)
        self.padding_slider.setMaximum(6)
        self.padding_slider.setValue(3)
        self.input_layout.addWidget(self.input_padding_widget)

        self.input_fps_widget = inputs.GroupInput(
            self,
            label="Default fps",
            inputWidget=QtWidgets.QComboBox(self),
            ic=cfg.time_icon)
        self.fps_input = self.input_fps_widget.input
        self.fps_input.setEditable(False)
        rates = ["PAL (25fps)", "Film (24fps)", "NTSC (30fps)"]
        self.fps_input.addItems(rates)
        self.input_layout.addWidget(self.input_fps_widget)
        i = self.fps_input.findText(rates[0], QtCore.Qt.MatchFixedString)
        if i >= 0:
            self.fps_input.setCurrentIndex(i)

        self.input_playblasts_switch_widget = inputs.GroupInput(
            self,
            label="Save playblast at",
            inputWidget=QtWidgets.QComboBox(self),
            ic=cfg.icons.HDD)

        self.playblasts_switch_input = self.input_playblasts_switch_widget.input
        self.playblasts_switch_input.setEditable(False)
        rates = [
            cfg.playblast_save_options.PROJECT_ROOT,
            cfg.playblast_save_options.PROJECT_SISTER,
            cfg.playblast_save_options.COMPONENT
        ]  # "Projects root (Recommended)", "Project sister folder", "Component root"]
        self.playblasts_switch_input.addItems(rates)
        self.input_layout.addWidget(self.input_playblasts_switch_widget)
        i = self.playblasts_switch_input.findText(rates[0],
                                                  QtCore.Qt.MatchFixedString)
        if i >= 0:
            self.playblasts_switch_input.setCurrentIndex(i)

        # self.prefix_widget = inputs.GroupInput(self, label="Project prefix", inputWidget=QtWidgets.QLineEdit(self),
        #                                        ic=cfg.text_icon)
        # self.prefix_input = self.prefix_widget.input
        # self.input_layout.addWidget(self.prefix_widget)
        # self.playblasts_switch = inputs.GroupInput(self,label="Save playblasts to root folder",inputWidget= QtWidgets.QCheckBox(),ic = cfg.camrea_icon)
        # self.playblasts_switch_input = self.playblasts_switch.input
        # self.input_layout.addWidget(self.playblasts_switch)
        # self.playblasts_switch_input.stateChanged.connect(self.playblasts_switch_toggle)

        self.var_title = gui.Title(self, label="Project variables")
        self.input_layout.addWidget(self.var_title)

        self.layout.addWidget(self.input_widget)
        self.input_layout.setContentsMargins(0, 0, 0, 0)
        self.input_widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Fixed)

        self.tab_widgets = QtWidgets.QWidget(self)
        self.tab_widgets_layout = QtWidgets.QVBoxLayout(self.tab_widgets)
        self.tab_widgets_layout.setContentsMargins(0, 0, 0, 0)
        self.tab_widgets.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Expanding)
        self.layout.addWidget(self.tab_widgets)

        self.variable_tabs = gui.Tabs(self)
        self.tab_widgets_layout.addWidget(self.variable_tabs)

        self.branches_widget = QtWidgets.QWidget()

        self.branches_layout = QtWidgets.QVBoxLayout(self.branches_widget)
        # self.branches_widget.setMinimumHeight(600)
        self.branches_widget.setMinimumWidth(450)
        self.variable_tabs.tab_widget.addTab(self.branches_widget, "Branches")

        self.branches_view = branch_view.Branch_list_view(self)

        self.branches_layout.addWidget(self.branches_view)
        # self.branches_view.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)

        self.users_widget = QtWidgets.QWidget()
        self.users_layout = QtWidgets.QVBoxLayout(self.users_widget)
        self.users_widget.setMinimumHeight(400)
        self.users_widget.setMinimumWidth(450)
        self.variable_tabs.tab_widget.addTab(self.users_widget, "Users")

        self.users_switch = inputs.GroupInput(
            self,
            label="Enable users",
            inputWidget=QtWidgets.QCheckBox(),
            ic=cfg.users_icon)
        self.users_swith_input = self.users_switch.input
        self.users_layout.addWidget(self.users_switch)
        self.users_swith_input.stateChanged.connect(self.users_table_toggle)
        self.users_tree = views.Project_Users_View(self.users_widget)
        self.users_layout.addWidget(self.users_tree)
        # self.users_tree.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)

        # self.list_view.setModel_(self.list_model)

        # self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)

        self.actions_widget = QtWidgets.QWidget(self)
        self.actions_widget_layout = QtWidgets.QVBoxLayout(self.actions_widget)
        self.actions_widget_layout.setContentsMargins(0, 0, 0, 0)
        self.actions_widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                          QtWidgets.QSizePolicy.Fixed)
        self.layout.addWidget(self.actions_widget)

        buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal, self)

        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        self.actions_widget_layout.addWidget(buttons)

        self.populate_brnaches()
        self.populated_users()

        # self.name_input.setText(cfg.preset["project_name"])
        self.padding_slider.setValue(3)
        # self.prefix_input.setText(cfg.preset["prefix"])

        self.name_input.textChanged.connect(self.name_changed)
        self.path_input.textChanged.connect(self.path_changed)

        self.users_swith_input.setCheckState(QtCore.Qt.Checked)
        self.users_table_toggle(QtCore.Qt.Checked)
        # self.playblasts_switch_input.setCheckState(QtCore.Qt.Checked)
        # self.playblasts_switch_toggle(QtCore.Qt.Checked)

        self.users_mode = True
        self.playblast_on_root = True
Example #8
0
    def __init__(
        self,
        parent=None
    ):  #, title = None, hud = True, offscreen = True, formats = None, format = "movie", compressions = None, compression = "H.264", scale = 50):
        super(Playblast_options, self).__init__(parent)

        self.setStyleSheet(cfg.stylesheet)

        title = "Playblast options"

        settings_node = settings.settings_node()

        hud = settings_node.playblast_hud
        offscreen = settings_node.playblast_offscreen
        format = settings_node.playblast_format
        compression = settings_node.playblast_compression
        scale = settings_node.playblast_scale
        # camera = settings_node.playblast_camera

        self.setMaximumWidth(400)
        self.setMinimumWidth(400)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
        # self.setMaximumHeight(50)

        layout = QtWidgets.QVBoxLayout(self)
        self.item_name = QtWidgets.QLabel(title)

        self.include_hud = QtWidgets.QCheckBox("Record HUD")
        self.include_hud.setChecked(hud)

        self.render_offscreen = QtWidgets.QCheckBox("Record Offscreen")
        self.render_offscreen.setChecked(offscreen)

        self.scaleLayout = QtWidgets.QHBoxLayout(self)

        self.scale_label = QtWidgets.QLabel("Scale:")

        self.scaleSlider = QtWidgets.QSlider()
        self.scaleSlider.setOrientation(QtCore.Qt.Horizontal)
        self.scaleSlider.setMinimum(10)
        self.scaleSlider.setMaximum(100)
        self.scaleSlider.setValue(scale)

        self.scaleSpinbox = QtWidgets.QSpinBox()
        self.scaleSpinbox.setMinimum(10)
        self.scaleSpinbox.setMaximum(100)
        self.scaleSpinbox.setValue(scale)

        self.scaleSlider.valueChanged.connect(self.sacle_spinbox_value)
        self.scaleSpinbox.valueChanged.connect(self.sacle_slider_value)

        self.scaleLayout.addWidget(self.scaleSpinbox)
        self.scaleLayout.addWidget(self.scaleSlider)

        self.input_ftm_widget = inputs.GroupInput(
            self,
            label="Format",
            inputWidget=QtWidgets.QComboBox(self),
            ic=cfg.time_icon)

        self.ftm_input = self.input_ftm_widget.input
        self.ftm_input.setEditable(False)
        fmts = maya.getPlayblastFormat()  #maya.getPlayblastOptions()["format"]
        self.ftm_input.addItems(fmts)
        # layout.addWidget(self.input_ftm_widget)
        i = self.ftm_input.findText(format, QtCore.Qt.MatchFixedString)
        if i >= 0:
            self.ftm_input.setCurrentIndex(i)

        self.input_c_widget = inputs.GroupInput(
            self,
            label="Compression",
            inputWidget=QtWidgets.QComboBox(self),
            ic=cfg.time_icon)

        self.c_input = self.input_c_widget.input
        self.c_input.setEditable(False)

        self.ftm_input.activated.connect(self.on_format_changed)
        self.on_format_changed()
        # cs = maya.getPlayblastOptions()["compression"]
        # self.c_input.addItems(cs)
        #
        i = self.c_input.findText(compression, QtCore.Qt.MatchFixedString)
        if i >= 0:
            self.c_input.setCurrentIndex(i)

        #
        # self.input_cam_widget = inputs.GroupInput(self, label="Camera", inputWidget=QtWidgets.QComboBox(self),
        #                                           ic=cfg.camrea_icon)
        #
        # self.cam_input = self.input_cam_widget.input
        # self.cam_input.setEditable(False)
        # # fmts = maya.getPlayblastFormat()#maya.getPlayblastOptions()["format"]
        # self.cam_input.addItems(['Active camera', 'Render camera'])
        # # layout.addWidget(self.input_ftm_widget)
        # i = self.cam_input.findText(camera, QtCore.Qt.MatchFixedString)
        # if i >= 0:
        #     self.cam_input.setCurrentIndex(i)

        layout.addWidget(self.item_name)

        layout.addWidget(gui.HLine())
        layout.addWidget(self.include_hud)
        layout.addWidget(self.render_offscreen)
        layout.addWidget(self.scale_label)
        layout.addLayout(self.scaleLayout)
        layout.addWidget(self.input_ftm_widget)
        layout.addWidget(self.input_c_widget)
        # layout.addWidget(self.input_cam_widget)

        buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        layout.addWidget(buttons)
Example #9
0
    def __init__(self,
                 parent=None,
                 string="",
                 name_label_sting="Name",
                 title="Create new tree",
                 stages=[],
                 project=None,
                 section=None):
        super(newTreeDialog, self).__init__(parent, string, name_label_sting,
                                            title)
        self.project = project
        self.levels_names = self.project.levels[section]
        self.levels = []
        self.name_widget.label.setText("{} name".format(self.levels_names[0]))
        self.name_input.setText(self.levels_names[0])
        self.levels.append([
            self.levels_names[0], self.name_input, self.range_start_slider,
            self.range_end_slider, self.padding_slider
        ])
        names = []
        for i in range(1, len(self.levels_names) - 1):
            names.append(self.levels_names[i])

        for level in names:
            name_widget = inputs.GroupInput(
                self,
                label=level,
                inputWidget=QtWidgets.QLineEdit(self),
                ic=cfg.text_icon)
            name_widget.label.setText("{} name".format(level))
            create_title = gui.Title(self, label=level)
            name_input = name_widget.input
            name_input.setText(level)
            self.input_layout.addWidget(create_title)
            self.input_layout.addWidget(name_widget)

            input_quantity_widget = inputs.GroupInput(
                self,
                label="Quantity",
                inputWidget=QtWidgets.QSpinBox(self),
                ic=cfg.buffer_icon)

            quantity_slider = input_quantity_widget.input
            quantity_slider.setMinimum(1)
            quantity_slider.setMaximum(1000)
            quantity_slider.setValue(1)
            self.input_layout.addWidget(input_quantity_widget)

            # input_from_widget = inputs.groupInput(self, label="From", inputWidget=QtWidgets.QSpinBox(self),
            #                                ic=cfg.tab_icon)
            #
            # from_slider = input_from_widget.input
            # from_slider.setMinimum(1)
            # from_slider.setMaximum(1000)
            # from_slider.setValue(1)
            # self.input_layout.addWidget(input_from_widget)

            input_padding_widget = inputs.GroupInput(
                self,
                label="Padding",
                inputWidget=QtWidgets.QSpinBox(self),
                ic=cfg.counter_icon)

            padding_slider = input_padding_widget.input
            padding_slider.setMinimum(0)
            padding_slider.setMaximum(6)
            padding_slider.setValue(3)
            self.input_layout.addWidget(input_padding_widget)
            self.levels.append(
                [level, name_input, quantity_slider, padding_slider])

        self.create_stages_title = gui.Title(self, label="Add stages:")
        self.input_layout.addWidget(self.create_stages_title)
        self.project = project
        stages = self.project.stages[section]

        self.stages_options = {}
        for stage in stages:
            widget = QtWidgets.QWidget(self)
            layout = QtWidgets.QVBoxLayout(widget)
            layout.setContentsMargins(5, 2, 5, 2)
            layout.setAlignment(QtCore.Qt.AlignLeft)
            checkbox = QtWidgets.QCheckBox(stage)
            self.stages_options[stage] = checkbox
            layout.addWidget(checkbox)
            self.input_layout.addWidget(widget)

        ancestors = list(self.project.levels[section])
        ancestors = ancestors[:-1]

        self.name_format_widget = NameFormatWidget(self,
                                                   multi_inputs=self.levels,
                                                   ancestors=ancestors,
                                                   project=self.project)
        self.input_layout.addWidget(self.name_format_widget)

        for l in self.levels:
            l[1].textChanged.connect(self.name_format_widget.preview_format)
            l[3].valueChanged.connect(self.name_format_widget.preview_format)
Example #10
0
    def __init__(self, parent=None, origin='', settings={}, **kwargs):
        super(Publish_Dialog, self).__init__(parent)

        css = loadCSS.loadCSS(
            os.path.join(os.path.dirname(pipeline.CSS.__file__),
                         'mainWindow.css'))
        self.setStyleSheet(css)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.setSpacing(5)
        self.layout.setContentsMargins(5, 5, 5, 5)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)

        self.setMinimumWidth(400)
        self.setWindowTitle('Save master')
        # self.title = gui.Title(self, label="Save master")
        # self.layout.addWidget(self.title)
        self.center_to_maya_window()

        self.main_widget = QtWidgets.QWidget(self)
        self.main_widget_layout = QtWidgets.QVBoxLayout(self.main_widget)
        self.main_widget_layout.setSpacing(2)
        self.main_widget_layout.setContentsMargins(5, 5, 5, 5)
        self.layout.addWidget(self.main_widget)

        self.options_widget = QtWidgets.QWidget()

        self.options_widget_layout = QtWidgets.QVBoxLayout(self.options_widget)
        self.options_widget_layout.setSpacing(2)
        self.options_widget_layout.setContentsMargins(2, 2, 2, 2)
        self.options_widget_layout.setAlignment(QtCore.Qt.AlignTop)

        self.scripts_table_label = QtWidgets.QLabel('Execute scripts')
        self.scripts_table_view = views.Run_scripts_View(parent=self)
        self.scripts_table_view.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                              QtWidgets.QSizePolicy.Expanding)

        self.scripts_table_toolbar = QtWidgets.QToolBar(self.main_widget)
        self.scripts_table_toolbar.setIconSize(QtCore.QSize(20, 20))

        add = self.scripts_table_toolbar.addAction(
            QtGui.QIcon(cfg.simple_add_icon), '', self.add_script)
        add.setToolTip('Add script')
        rm = self.scripts_table_toolbar.addAction(
            QtGui.QIcon(cfg.simple_rm_icon), '', self.remove_script)
        rm.setToolTip('Remove script')

        self.scripts_table_toolbar.addAction(QtGui.QIcon(cfg.simple_up_icon),
                                             '', self.move_up)
        self.scripts_table_toolbar.addAction(QtGui.QIcon(cfg.simple_dn_icon),
                                             '', self.move_down)

        self.scripts_table_toolbar.setStyleSheet('''
        QToolButton{
        border: none;
        }
        QToolButton::hover {
        background-color: ''' + cfg.colors.LIGHT_GRAY_plus + ''';
        border none;
        }

        ''')

        self.label_Note = QtWidgets.QLabel('Note')
        self.textNote = QtWidgets.QTextEdit(self)
        self.textNote.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                    QtWidgets.QSizePolicy.Fixed)
        self.textNote.setMaximumHeight(100)

        self.remember = inputs.GroupInput(
            self.options_widget,
            "Remember these settings for {}".format(origin),
            QtWidgets.QCheckBox(),
            ic=cfg.save_icon)
        self.remember_input = self.remember.input
        self.remember_input.setCheckState(QtCore.Qt.Checked)

        self.open_after = inputs.GroupInput(self.options_widget,
                                            "Open master after save",
                                            QtWidgets.QCheckBox(),
                                            ic=cfg.save_icon)
        self.open_after_input = self.open_after.input
        self.open_after_input.setCheckState(QtCore.Qt.Checked)

        self.main_widget_layout.addWidget(self.options_widget)

        space1 = gui.HLine()
        space1.setMinimumHeight(20)
        self.main_widget_layout.addWidget(space1)

        self.main_widget_layout.addWidget(self.scripts_table_label)
        self.main_widget_layout.addWidget(self.scripts_table_toolbar)
        self.main_widget_layout.addWidget(self.scripts_table_view)

        space2 = gui.HLine()
        space2.setMinimumHeight(20)
        self.main_widget_layout.addWidget(space2)

        self.main_widget_layout.addWidget(self.label_Note)
        self.main_widget_layout.addWidget(self.textNote)
        self.main_widget_layout.addWidget(self.remember)
        self.main_widget_layout.addWidget(self.open_after)

        self.import_references = inputs.GroupInput(self.options_widget,
                                                   "Import references",
                                                   QtWidgets.QCheckBox(),
                                                   ic=cfg.creation_icon)
        self.import_references_input = self.import_references.input
        self.import_references_input.setCheckState(QtCore.Qt.Checked)
        self.options_widget_layout.addWidget(self.import_references)

        self.delete_namespaces = inputs.GroupInput(self.options_widget,
                                                   "Delete namespaces",
                                                   QtWidgets.QCheckBox(),
                                                   ic=cfg.creation_icon)
        self.delete_namespaces_input = self.delete_namespaces.input
        self.delete_namespaces_input.setCheckState(QtCore.Qt.Checked)
        self.options_widget_layout.addWidget(self.delete_namespaces)

        self.clean_up = inputs.GroupInput(self.options_widget,
                                          "Optimize scene",
                                          QtWidgets.QCheckBox(),
                                          ic=cfg.creation_icon)
        self.clean_up_input = self.clean_up.input
        self.clean_up_input.setCheckState(QtCore.Qt.Checked)
        self.options_widget_layout.addWidget(self.clean_up)

        self.delete_ng = inputs.GroupInput(self.options_widget,
                                           "Delete ngSkinTools nodes",
                                           QtWidgets.QCheckBox(),
                                           ic=cfg.creation_icon)
        self.delete_ng_input = self.delete_ng.input
        self.delete_ng_input.setCheckState(QtCore.Qt.Checked)
        self.options_widget_layout.addWidget(self.delete_ng)

        # buttons = QtWidgets.QDialogButtonBox(
        #     QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
        #     QtCore.Qt.Horizontal, self)
        #
        # buttons.accepted.setText('Save')
        # buttons.accepted.connect(self.accept)
        # buttons.rejected.connect(self.reject)

        save = QtWidgets.QPushButton("Save")

        canc = QtWidgets.QPushButton("Cancel")
        canc.setDefault(True)

        buttons = QtWidgets.QDialogButtonBox(QtCore.Qt.Horizontal)
        buttons.addButton(save, QtWidgets.QDialogButtonBox.AcceptRole)
        buttons.addButton(canc, QtWidgets.QDialogButtonBox.RejectRole)

        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        self.main_widget_layout.addWidget(buttons)

        model = models.Script_files_Model(list())
        self.scripts_table_view.setModel(model)

        # logger.info(settings)
        stat = QtCore.Qt.Checked if settings[
            'import_ref'] else QtCore.Qt.Unchecked
        self.import_references_input.setCheckState(stat)

        stat = QtCore.Qt.Checked if settings[
            'delete_ns'] else QtCore.Qt.Unchecked
        self.delete_namespaces_input.setCheckState(stat)

        stat = QtCore.Qt.Checked if settings[
            'optimize'] else QtCore.Qt.Unchecked
        self.clean_up_input.setCheckState(stat)

        if settings['scripts']:
            items = list()
            for s in settings['scripts']:
                items.append(dt.ScriptFileNode(name='script', path=s))

            model = models.Script_files_Model(items)
        else:
            model = models.Script_files_Model(list())

        self.scripts_table_view.setModel(model)

        stat = QtCore.Qt.Checked if settings[
            'remember_settings'] else QtCore.Qt.Unchecked
        self.remember_input.setCheckState(stat)

        stat = QtCore.Qt.Checked if settings[
            'open_after'] else QtCore.Qt.Unchecked
        self.open_after_input.setCheckState(stat)