def __init__(self,parent_layout=None,parent=None): QtWidgets.QWidget.__init__(self, parent) # super(ComboWidget, self).__init__(parent) self.setHidden(True) self._parent_layout = parent_layout # UI self.setMaximumHeight(60) self.setMinimumHeight(60) self.layout = QtWidgets.QVBoxLayout(self) self.layout.setAlignment(QtCore.Qt.AlignLeft) self.label = QtWidgets.QLabel() self.comboBox = QtWidgets.QComboBox(parent) self.comboBox.setIconSize(QtCore.QSize(24, 24)) self.comboBox.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) # self.comboBox.setStyleSheet(cfg.stylesheet) self.layout.addWidget(self.label) self.layout.addWidget(self.comboBox) self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) self._parent_layout.addWidget(self) self.setStyleSheet(''' QComboBox::down-arrow { image:url(''' + cfg.light_down_arrow + '''); margin-right: 10px; } ''')
def massage(icon, title, message, parent=None): reply = QtWidgets.QMessageBox( parent) if parent else QtWidgets.QMessageBox() if icon == "critical": reply.setIconPixmap(cfg.warning_icon) elif icon == "warning": reply.setIconPixmap(cfg.simple_warning_icon) elif icon == "massage": reply.setIconPixmap(cfg.massage_icon) else: reply.setIconPixmap(icon) css = loadCSS.loadCSS( os.path.join(os.path.dirname(pipeline.CSS.__file__), 'mainWindow.css')) reply.setStyleSheet(css) reply.setText(message) reply.setWindowTitle(title) reply.setStandardButtons(QtWidgets.QMessageBox.Close) result = reply.exec_()
def contextMenuEvent(self, event): handled = True index = self.indexAt(event.pos()) menu = QtWidgets.QMenu() node = None if index.isValid(): node = self.model().getNode(index) # top_actions = list() def_actions = list() if node: def_actions.append(QtWidgets.QAction("Remove branch...", menu, triggered=functools.partial(self.remove, node, index))) else: def_actions.append(QtWidgets.QAction("Add branch...", menu, triggered=functools.partial(self.add, node))) menu.addActions(def_actions) menu.exec_(event.globalPos()) event.accept() return
def __init__(self, parent=None, settings=None): super(Library, self).__init__(parent) self.setMinimumHeight(100) self.parent = parent self.layout = QtWidgets.QVBoxLayout(self) self.layout.setContentsMargins(0, 5, 0, 0) self.library_view = views.Library_View(self, settings=settings) self.layout.addWidget(self.library_view) self.progressBar = QtWidgets.QProgressBar(self) self.progressBar.setMaximum(100) self.progressBar.setMinimum(0) self.progressBar.setValue(0) self.progressBar.setMaximumHeight(5) self.progressBar.setTextVisible(False) self.progressBar.setStyleSheet(''' QProgressBar { border: 1px solid ''' + cfg.colors.DARK_GRAY_MINUS + '''; } QProgressBar::chunk { background-color: ''' + cfg.colors.DARK_PURPLE + '''; }''') self.layout.addWidget(self.progressBar) self.address_widget = QtWidgets.QWidget(self) self.address_widget_layout = QtWidgets.QHBoxLayout(self.address_widget) self.address_widget_layout.setAlignment(QtCore.Qt.AlignLeft) self.address_widget_layout.setContentsMargins(0, 3, 0, 0) self.layout.addWidget(self.address_widget) self.search_line = inputs.SuggestionSearchBar( self, label="Search public components...") self.search_line.setMinimumHeight(30) self.address_widget_layout.addWidget(self.search_line) # self.comps = list() self.comp_hints = list() self.comps_model = None self.project = None self.scan = None # # self.search_line.set_suggestions_model(None) # self.library_view.setModel_(None) # self.populate() self.search_line.textChanged.connect(self.search_changed)
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)
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)
def __init__(self, parent=None, preset_file=None, **kwargs): super(Preset_generation_dialog, self).__init__(parent, **kwargs) self.setWindowTitle("Preset generation") self.hierarchy_label.setMaximumHeight(30) self.components_label.setMaximumHeight(30) self.hierarchy_help_label.setHidden(True) self.components_help_label.setHidden(True) self.save_preset_btn.setHidden(True) self.load_preset_btn.setHidden(True) self.generate_preset_btn = QtWidgets.QPushButton("Generate tree") self.generate_preset_btn.setIcon(QtGui.QIcon(cfg.creation_icon)) self.generate_preset_btn.setIconSize(QtCore.QSize(20, 20)) self.actions_widget_layout.addWidget(self.generate_preset_btn) self.generate_preset_btn.clicked.connect(self.generate_preset) if preset_file: self.set_preset(preset_file) self.show() else: if self.load_preset(): self.show() else: pass
def warning(icon, title, message): if icon == "critical": dlg_icon = cfg.warning_icon elif icon == "warning": dlg_icon = cfg.simple_warning_icon else: dlg_icon = cfg.warning_icon reply = QtWidgets.QMessageBox() reply.setIconPixmap(dlg_icon) reply.setText(message) reply.setWindowTitle(title) css = loadCSS.loadCSS( os.path.join(os.path.dirname(pipeline.CSS.__file__), 'mainWindow.css')) reply.setStyleSheet(css) reply.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) result = reply.exec_() if result == QtWidgets.QMessageBox.Yes: return True else: return False
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)
def __init__(self, parent, height, buttons = dict()): super(Toolbar, self).__init__(parent) self.layout = QtWidgets.QHBoxLayout(self) self.layout.setContentsMargins(1, 1, 1, 1) self.layout.setSpacing(2) self.layout.setAlignment(QtCore.Qt.AlignLeft) _buttons = dict() for k in buttons: button = QtWidgets.QPushButton(buttons[k]['label']) button.setIconSize(QtCore.QSize(height-2, height-2)) button.setIcon(QtGui.QIcon(buttons[k]['icon'])) self.layout.addWidget(button) _buttons[k] = button
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)
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)
def __init__(self, parent=None, string="", parent_name=None, name_label_sting="Name", title="Create new stage", stages=[], ancestors=None, project=None): super(newStageDialog, self).__init__(parent, string, name_label_sting, title) self.project = project self.name_widget.setParent(None) self.name_widget.deleteLater() # self.create_stages_title = gui.Title(self, label = "Add stages:") # self.input_layout.addWidget(self.create_stages_title) 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_names = [] [ ancestors_names.append("<{}>".format(node.name)) for node in ancestors ] self.name_format_widget = NameFormatWidget(self, parent_name=parent_name, ancestors=ancestors_names, project=self.project) self.input_layout.addWidget(self.name_format_widget)
def __init__(self, parent, label = "", suggestions_model = None): super(SuggestionSearchBar, self).__init__(parent, label) self.completer = QtWidgets.QCompleter(suggestions_model, self) self.completer.setPopup(Completer_list_view(self)) self.completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.completer.setCompletionMode(QtWidgets.QCompleter.UnfilteredPopupCompletion) # self.completer.setCompletionMode(QtWidgets.QCompleter.PopupCompletion) self.setCompleter(self.completer) if suggestions_model: self.completer.setModel(suggestions_model)
def set_preset_menu(self): self.menu = None self.menu = QtWidgets.QMenu(self.load_preset_btn) self.menu.addAction( QtWidgets.QAction("Load from file...", self.menu, triggered=self.load_preset)) self.menu.addSeparator() for p in self.list_saved_presets(): self.menu.addAction( QtWidgets.QAction(p[1], self.menu, triggered=functools.partial( self.set_preset, p[0]))) self.menu.addSeparator() self.menu.addAction( QtWidgets.QAction("Clear", self.menu, triggered=self.clear_preset)) self.load_preset_btn.setMenu(self.menu)
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)
def __init__(self, parent=None, title=None): super(Create_from_selection, self).__init__(parent) self.setStyleSheet(cfg.stylesheet) self.setMaximumWidth(200) self.setMinimumWidth(200) self.setMaximumHeight(50) self.label = QtWidgets.QLabel() self.label.setPixmap(cfg.new_icon) # layout = QtWidgets.QVBoxLayout(self) self.item_name = QtWidgets.QLabel(title) # self.text_input = QtWidgets.QLineEdit() self.include_radio = QtWidgets.QRadioButton("Include all connections") self.include_radio.setChecked(True) self.exclude_radio = QtWidgets.QRadioButton("Include only textures") layout.addWidget(self.item_name) # layout.addWidget(self.text_input) layout.addWidget(self.include_radio) layout.addWidget(self.exclude_radio) 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)
def __init__(self, parent, label=None, ic=None): super(RangeInput, self).__init__(parent) self.layout = QtWidgets.QHBoxLayout(self) self.layout.setContentsMargins(5, 5, 5, 5) self.layout.setAlignment(QtCore.Qt.AlignLeft) if ic: self.icon = QtWidgets.QLabel() self.icon.setPixmap(ic) self.icon.setMinimumSize(QtCore.QSize(24, 24)) self.layout.addWidget(self.icon) if label: self.label = QtWidgets.QLabel(label) self.label.setMinimumSize(QtCore.QSize(100, 30)) self.layout.addWidget(self.label) self.from_label = QtWidgets.QLabel("From") # self.from_label.setMinimumSize(QtCore.QSize(100, 30)) self.layout.addWidget(self.from_label) self.start_input = QtWidgets.QSpinBox(self) self.start_input.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.start_input.setMinimumSize(QtCore.QSize(0, 30)) self.layout.addWidget(self.start_input) self.to_label = QtWidgets.QLabel("To") # self.to_label.setMinimumSize(QtCore.QSize(100, 30)) self.layout.addWidget(self.to_label) self.end_input = QtWidgets.QSpinBox(self) self.end_input.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.end_input.setMinimumSize(QtCore.QSize(0, 30)) self.layout.addWidget(self.end_input) self.step_label = QtWidgets.QLabel("Step") # self.to_label.setMinimumSize(QtCore.QSize(100, 30)) self.layout.addWidget(self.to_label) self.step_input = QtWidgets.QSpinBox(self) self.step_input.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.step_input.setMinimumSize(QtCore.QSize(0, 30)) self.layout.addWidget(self.step_input)
def __init__(self, parent, label=None, inputWidget=None, ic=None): super(GroupInput, self).__init__(parent) self.layout = QtWidgets.QHBoxLayout(self) self.layout.setContentsMargins(2,2,2,2) self.layout.setSpacing(2) self.layout.setAlignment(QtCore.Qt.AlignLeft) if isinstance(inputWidget, QtWidgets.QCheckBox): self.input = inputWidget self.input.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.input.setMinimumSize(QtCore.QSize(20, 0)) self.layout.addWidget(self.input) ic = None if label: self.label = QtWidgets.QLabel(label) self.label.setMinimumSize(QtCore.QSize(100, 24)) self.layout.addWidget(self.label) return else: if ic: self.icon = QtWidgets.QLabel() self.icon.setPixmap(ic) self.icon.setMaximumSize(QtCore.QSize(24, 24)) self.icon.setMinimumSize(QtCore.QSize(24, 24)) self.layout.addWidget(self.icon) if label: self.label = QtWidgets.QLabel(label) self.label.setMinimumSize(QtCore.QSize(100, 24)) self.layout.addWidget(self.label) if inputWidget: self.input = inputWidget self.input.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.input.setMinimumSize(QtCore.QSize(0, 24)) self.layout.addWidget(self.input)
def __init__(self, parent=None): super(LoginWindow, self).__init__(parent) self.setStyleSheet(cfg.stylesheet) self.setMaximumWidth(200) self.setMinimumWidth(200) self.setMaximumHeight(50) self.label = QtWidgets.QLabel() self.label.setPixmap(cfg.users_icon) self.label_user = QtWidgets.QLabel("Username:"******"Password:"******"Login") log.setDefault(True) canc = QtWidgets.QPushButton("Cancel") buttons = QtWidgets.QDialogButtonBox(QtCore.Qt.Horizontal) buttons.addButton(log, QtWidgets.QDialogButtonBox.AcceptRole) buttons.addButton(canc, QtWidgets.QDialogButtonBox.RejectRole) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons)
def __init__(self, parent=None, caption = "", plainText=None): super(MultilineInput, self).__init__(parent) css = loadCSS.loadCSS(os.path.join(os.path.dirname(pipeline.CSS.__file__), 'mainWindow.css')) self.setStyleSheet(css) # self.setMaximumWidth(800) # self.setMinimumWidth(800) # self.setMaximumHeight(200) # # self.label = QtWidgets.QLabel() # self.label.setPixmap(cfg.edit_icon) # # self.label_Note = QtWidgets.QLabel(caption) # self.textNote = QtWidgets.QTextEdit(self) self.setMaximumWidth(800) self.setMinimumWidth(800) self.setMinimumHeight(400) self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) # self.setMaximumHeight(200) self.label = QtWidgets.QLabel() self.label.setPixmap(cfg.edit_icon) self.label_Note = QtWidgets.QLabel(caption) self.textNote = QtWidgets.QTextEdit(self) self.textNote.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) layout = QtWidgets.QVBoxLayout(self) layout.addWidget(self.label) layout.addWidget(gui.HLine()) layout.addWidget(self.label_Note) layout.addWidget(self.textNote) ok = QtWidgets.QPushButton("Save") 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) layout.addWidget(buttons) self.textNote.setPlainText(plainText)
def __init__(self, parent=None, string="", name_label_sting="", current_name="", title="", alert=None): super(Rename_dialog, self).__init__(parent, string, name_label_sting, title) self.name_input.setText(current_name) self.name_input.textChanged.connect(self.name_changed) if alert: self.alert_label = QtWidgets.QLabel() self.alert_label.setMargin(10) self.alert_label.setText(alert) font = QtGui.QFont() font.setBold(True) font.setPointSize(13) self.alert_label.setStyleSheet(''' QLabel { color: ''' + cfg.colors.WARNING_RED + ''' ;} ''') self.alert_label.setFont(font) self.input_layout.addWidget(self.alert_label)
def __init__(self, parent, label=None, options=None, ic=None): super(GroupRadioInput, self).__init__(parent) self.options = [option for option in options] self.option = self.options[0] self.layout = QtWidgets.QHBoxLayout(self) self.layout.setContentsMargins(5, 5, 5, 5) self.layout.setAlignment(QtCore.Qt.AlignLeft) if ic: self.icon = QtWidgets.QLabel() self.icon.setPixmap(ic) self.icon.setMinimumSize(QtCore.QSize(24, 24)) self.layout.addWidget(self.icon) self.icon.setAlignment(QtCore.Qt.AlignTop) if label: self.label = QtWidgets.QLabel(label) self.label.setMinimumSize(QtCore.QSize(100, 30)) self.layout.addWidget(self.label) self.label.setAlignment(QtCore.Qt.AlignTop) self.options_widget = QtWidgets.QWidget() self.layout.addWidget(self.options_widget) self.options_widget_layout = QtWidgets.QVBoxLayout(self.options_widget) self.options_radio_widgets = [] for option in self.options: option_widget = QtWidgets.QRadioButton(option) self.options_radio_widgets.append( option_widget ) self.options_widget_layout.addWidget(option_widget) option_widget.clicked.connect(self.selection) self.options_radio_widgets[0].setChecked(True)
def __init__(self, parent=None, alert_string=""): super(Prompt_alert, self).__init__(parent) css = loadCSS.loadCSS( os.path.join(os.path.dirname(pipeline.CSS.__file__), 'mainWindow.css')) self.setStyleSheet(css) # self.setMaximumWidth(450) # self.setMinimumWidth(450) self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) # self.setMinimumHeight(150) # self.setMaximumHeight(150) self.layout = QtWidgets.QVBoxLayout(self) self.layout.setContentsMargins(20, 5, 20, 10) self.massage_widget = QtWidgets.QWidget(self) self.massage_layout = QtWidgets.QHBoxLayout(self.massage_widget) self.massage_layout.setContentsMargins(5, 5, 5, 5) self.prompt_icon = QtWidgets.QLabel(self) self.prompt_icon.setPixmap(cfg.warning_icon) self.massage_layout.addWidget(self.prompt_icon) self.alert_label = QtWidgets.QLabel() self.alert_label.setMargin(10) self.alert_label.setText(alert_string) font = QtGui.QFont() font.setBold(True) font.setPointSize(13) self.alert_label.setStyleSheet(''' QLabel { color: ''' + cfg.colors.WARNING_RED + ''' ;} ''') self.alert_label.setFont(font) self.massage_layout.addWidget(self.alert_label) self.layout.addWidget(self.massage_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.layout.addWidget(buttons)
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)
def __init__(self, parent=None): super(About, 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.setMaximumWidth(460) self.setMinimumWidth(460) self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.setMinimumHeight(260) self.setMaximumHeight(260) self.layout = QtWidgets.QVBoxLayout(self) self.layout.setContentsMargins(20, 20, 20, 20) self.massage_widget = QtWidgets.QWidget(self) self.massage_layout = QtWidgets.QVBoxLayout(self.massage_widget) self.massage_layout.setContentsMargins(5, 5, 5, 5) self.logo_label = QtWidgets.QLabel(self) self.logo_label.setPixmap(cfg.logo_text_icon) self.massage_layout.addWidget(self.logo_label) self.spacer_label = QtWidgets.QLabel() self.spacer_label.setMinimumHeight(20) self.version_label = QtWidgets.QLabel() version = "Version {}".format(misc.version_string( pipeline.__version__)) self.version_label.setText(version) self.owner_label = QtWidgets.QLabel() # import pipeline2_sb.libs.lic as lic license = lic.License_node.check_lic(pipeline.__version__) if license: owner = "Licensed to {}".format( lic.License_node(version=pipeline.__version__, encrypted=True).license_file["email"]) else: owner = "Trial version" self.owner_label.setText(owner) self.link_label = Click_label() link = '''<a href='http://pipeline.nnl.tv'><font color=''' + cfg.colors.LIGHT_BLUE + '''>pipeline.nnl.tv</font></a>''' self.link_label.setText(link) font = QtGui.QFont() font.setBold(True) # font.setPointSize(13) self.link_label.setStyleSheet(''' QLabel { color: ''' + cfg.colors.LIGHT_BLUE + ''' ;} ''') self.link_label.setFont(font) self.massage_layout.addWidget(self.spacer_label) self.massage_layout.addWidget(self.version_label) self.massage_layout.addWidget(self.owner_label) self.massage_layout.addWidget(self.link_label) self.layout.addWidget(self.massage_widget) buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok, QtCore.Qt.Horizontal, self) buttons.accepted.connect(self.accept) # buttons.rejected.connect(self.reject) self.layout.addWidget(buttons) self.link_label.clicked.connect(self.launch_link)
def create(self, preset=None, parent=None, project=None): self.progress_bar_dialog = QtWidgets.QProgressDialog( "", "Abort operation", 0, 100, parent) self.progress_bar_dialog.setWindowModality(QtCore.Qt.WindowModal) self.progress_bar_dialog.show() global proceed global counter global total_items proceed = True counter = 0 total_items = 0 def rec_total(catagories, branch): global total_items _from = int(catagories[0]['from']) _to = int(catagories[0]['to']) total = _to - _from for i in range(total + 1): if len(catagories) == 1: # add folder total_items += 1 for component in branch: # add component total_items += 1 else: # add folder total_items += 1 if len(catagories) > 1: l = list(catagories[1:]) rec_total(l, branch) else: pass def rec(catagories, p, branch, project): global proceed global counter global total_items if self.progress_bar_dialog.wasCanceled(): proceed = False return """ recursive function for generating a tree out of the instructions list called items the function creates nodes by instruction in the first item in the list, then while the list is longer then 1, it sends the list againg but without the current item the parent is the currently created node""" _from = int(catagories[0]['from']) _to = int(catagories[0]['to']) name = catagories[0]['name'] padding = int(catagories[0]['padding']) trailing = int(catagories[0]['trailing']) step = int(catagories[0]['step']) total = _to - _from for i in range(total + 1): if (total > 0) and (padding == 0): padding += 1 count = misc.set_padding( (i + _from) * step, padding) if padding > 0 else '' trailing_ = '_{}'.format(misc.set_padding( 0, trailing)) if trailing > 0 else '' folder_name = "{}{}{}".format(name, count, trailing_) path = os.path.join(p, folder_name) if len(catagories) == 1: counter += 1 if not self.progress_bar_dialog.wasCanceled(): self.progress_bar_dialog.setValue( misc.remap_value(counter, 0, total_items, 0, 100)) QtWidgets.QApplication.processEvents() if not os.path.isdir(path): self.create_catagory(name=folder_name, path=path, project=project) # logger.info("-") # logger.info("creating folder with components {}".format(path)) for component in branch: counter += 1 if not self.progress_bar_dialog.wasCanceled(): self.progress_bar_dialog.setValue( misc.remap_value(counter, 0, total_items, 0, 100)) QtWidgets.QApplication.processEvents() dir = os.path.join(path, component) # logger.info("createing component {}".format(dir)) if not os.path.isdir(dir): self.create_component( name=component, path=dir, format=branch[component]['format'], project=project, master_file_type=branch[component] ['master_file_type'], version_file_type=branch[component] ['version_file_type']) else: # pass counter += 1 if not self.progress_bar_dialog.wasCanceled(): self.progress_bar_dialog.setValue( misc.remap_value(counter, 0, total_items, 0, 100)) QtWidgets.QApplication.processEvents() # logger.info("-") # logger.info("creating folder {}".format(path)) if not os.path.isdir(path): self.create_catagory(name=folder_name, path=path, project=project) if len(catagories) > 1: l = list(catagories[1:]) rec(l, path, branch, project) else: pass def remove_catagory(name, _from, _to, padding, step): total = _to - _from for i in range(total + 1): if (total > 0) and (padding == 0): padding += 1 count = misc.set_padding( (i + _from) * step, padding) if padding > 0 else '' folder_name = "{}{}".format(name, count) logger.info('removing {}'.format(folder_name)) catagories = preset['categories'] branches = preset['branches'] for branch in branches: rec_total(catagories, branches[branch]) logger.info(total_items) new_branches = list() for branch in branches: parent_dir = os.path.join(project.path, branch) if not os.path.isdir(parent_dir): self.create_branch(name=branch, path=parent_dir, project=project) new_branches.append(parent_dir) rec(catagories, parent_dir, branches[branch], project) if not proceed: remove_catagory(catagories[0]['name'], int(catagories[0]['from']), int(catagories[0]['to']), int(catagories[0]['padding']), int(catagories[0]['step'])) for folder in new_branches: files.delete(folder) return False self.progress_bar_dialog.hide() return True # # @staticmethod # def xx_create(self, preset): # catagories = preset['categories'] # branches = preset['branches'] # # for branch in branches: # logger.info("createing branch {}".format(branch)) # # parent_dir = os.path.join(branch) # # for catagory in catagories: # _from = catagory['from'] # _to = catagory['to'] # if _from !=0: # for i in range(_from, _to+1): # dir = os.path.join(parent_dir, "{}{}".format(catagory['name'],i)) # logger.info("createing catagory {}".format(dir)) # parent_dir = dir # else: # dir = os.path.join(parent_dir, catagory['name']) # logger.info("createing catagory {}".format(dir)) # parent_dir = dir # # for component in branches[branch]: # dir = os.path.join(parent_dir, component) # logger.info("createing component {}".format(dir)) # # # # # while i < len(catagories): # # logger.info("createing catagory {}/{}".format(branch, catagory['name'])) # # # # for catagory in catagories: # # # # logger.info("createing catagory {}/{}".format(branch, catagory['name'])) # # # # logger.info() # # # def create_catagory(self, node, index = None): # # # # folderDlg = outliner.newFolderDialog(string="") # # result = folderDlg.exec_() # # res = folderDlg.result() # # if result == QtWidgets.QDialog.Accepted: # # logger.info(res) # # # # base_folder_name = res["name"] # # # # for i in range(0, res["quantity"]): # # # # number = files.set_padding(res["from"] + i, res["padding"]) # # # # if base_folder_name != "": # # # # folder_name = "{0}{1}".format(base_folder_name, number) if res["quantity"] > 1 else "{0}".format(base_folder_name) # # # # else: # # folder_name = "{0}".format(number) if res["quantity"] > 1 else "unnamed_folder" # # # # if node: # # target_directory = node.path # # else: # # target_directory = self.parent()._path # # # # skip = False # # if folder_name in files.list_dir_folders(target_directory): # # skip = True # # if skip: # # logger.info("Folder named {0} exsits at {1}. skipping...".format(folder_name, target_directory)) # # continue # # # # path = os.path.join(target_directory, folder_name) # # new_node = elements.CatagoryNode(folder_name, path=path, project=self.parent().parent.parent.project).create(path=path) # # # # if not node: # # # # if self.model(): # # self.model().sourceModel().insertRows(0, 1, node=new_node) # # self._proxyModel.invalidate() # # # # else: # # model = models.List_Model([new_node]) # # logger.info(model) # # self.setModel_(model) # # # # if node and index: # # self.parent().update(index) # # # # class Progress_window(QtWidgets.QDialog): # # def __init__(self, parent=None, title = '', caption = '', min = 0, max = 100): # # super(Progress_window, self).__init__(parent) # # self.setStyleSheet(cfg.stylesheet) # # self.setMaximumWidth(300) # # self.setMinimumWidth(300) # # self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) # # # # self.setMinimumHeight(80) # # self.setMaximumHeight(80) # # # # self.layout = QtWidgets.QVBoxLayout(self) # # self.layout.setContentsMargins(10, 10, 10, 10) # # # # self.title = gui.Title(self, label=caption, seperator=False) # # self.title.setMaximumHeight(30) # # self.layout.addWidget(self.title) # # # # self.progress_bar = QtWidgets.QProgressBar() # # self.progress_bar.setMinimum(min) # # self.progress_bar.setMaximum(max) # # self.progress_bar.setValue(0) # # self.layout.addWidget(self.progress_bar) # # # # def setValue(self, value): # # self.progress_bar.setValue(value)
def __init__(self, parent, **kwargs): super(Preset_dialog, self).__init__(parent) self.setWindowFlags(QtCore.Qt.Tool) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.pipeline_window = None if 'pipeline_window' in kwargs: self.pipeline_window = kwargs['pipeline_window'] self.setMinimumHeight(650) self.setMinimumWidth(800) self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.center_to_maya_window() self.main_widget = QtWidgets.QWidget(self) self.setCentralWidget(self.main_widget) # 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.main_widget) self.layout.setContentsMargins(5, 5, 5, 5) # self.setLayout(self.layout) self.setWindowTitle("Preset editor") self.header = gui.Title(self, label="Tree construction preset") self.header.setMaximumHeight(40) self.layout.addWidget(self.header) self.editor_tables_widget = QtWidgets.QWidget(self) self.editor_tables_widget_layout = QtWidgets.QVBoxLayout( self.editor_tables_widget) self.editor_tables_widget_layout.setContentsMargins(5, 5, 5, 5) self.editor_tables_widget_layout.setSpacing(10) self.layout.addWidget(self.editor_tables_widget) self.hierarchy_table_view = views.Hierarcy_catagories_view( parent=self, parentWidget=self.editor_tables_widget) self.hierarchy_table_view.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) branches = [ os.path.split(p)[1] for p in self.pipeline_window.project.branches ] if self.pipeline_window else list() self.components_table_view = views.Hierarcy_components_view( parent=self, parentWidget=self.editor_tables_widget, branches=branches) self.components_table_view.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.hierarchy_label = gui.Title(self, label="Tree hierarchy", seperator=False) # self.hierarchy_label.setMaximumHeight(30) self.components_label = gui.Title(self, label="Child omponents", seperator=False) # self.components_label.setMaximumHeight(30) self.hierarchy_help_label = QtWidgets.QLabel() self.hierarchy_help_label.setText( "Use right click for options.\n" "Each category will be generated under it's parent category.\n\n" "{} = during creation the user will be prompt to enter a value.". format(cfg.Hierarcy_options.ASK_USER)) italic = QtGui.QFont() italic.setItalic(True) self.hierarchy_help_label.setFont(italic) self.components_help_label = QtWidgets.QLabel() self.components_help_label.setText( "Components and categories will be generated for the defined branch,\n" "under the lower category.\n\n" "Branches will be created if they are not exists in the project.") italic = QtGui.QFont() italic.setItalic(True) self.components_help_label.setFont(italic) self.editor_tables_widget_layout.addWidget(self.hierarchy_label) self.editor_tables_widget_layout.addWidget(self.hierarchy_help_label) self.editor_tables_widget_layout.addWidget(self.hierarchy_table_view) self.editor_tables_widget_layout.addWidget(self.components_label) self.editor_tables_widget_layout.addWidget(self.components_help_label) self.editor_tables_widget_layout.addWidget(self.components_table_view) self.actions_widget = QtWidgets.QWidget(self) self.actions_widget_layout = QtWidgets.QHBoxLayout(self.actions_widget) self.actions_widget_layout.setContentsMargins(5, 5, 5, 5) self.layout.addWidget(self.actions_widget) self.save_preset_btn = QtWidgets.QPushButton("Save preset") self.save_preset_btn.setIcon(QtGui.QIcon(cfg.save_icon)) self.save_preset_btn.setIconSize(QtCore.QSize(20, 20)) self.load_preset_btn = QtWidgets.QPushButton("Load preset") self.load_preset_btn.setIcon(QtGui.QIcon(cfg.folder_open_icon)) self.load_preset_btn.setIconSize(QtCore.QSize(20, 20)) self.load_preset_btn.setStyleSheet(''' QPushButton::menu-indicator{ image: url(none.jpg); } ''') self.set_preset_menu() # self.menu = QtWidgets.QMenu(self.load_preset_btn) # self.menu.addAction(QtWidgets.QAction("Load from file...", self.menu, triggered=self.load_preset)) # self.menu.addSeparator() # # for p in self.list_saved_presets(): # self.menu.addAction(QtWidgets.QAction(p[1], self.menu, triggered=functools.partial(self.set_preset, p[0]))) # # self.menu.addSeparator() # self.menu.addAction(QtWidgets.QAction("Clear", self.menu, triggered=self.clear_preset)) # self.load_preset_btn.setMenu(self.menu) # self.actions_widget_layout.addWidget(self.save_preset_btn) self.actions_widget_layout.addWidget(self.load_preset_btn) self.save_preset_btn.clicked.connect(self.save_preset)
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
def __init__(self, parent, title='oops!', prompt=None, override_yes_text=None, override_no_label=None, override_cancel_label="Cancel", cancel_button=False, color=None, override_yes_icon=None, override_no_icon=None, cancel_icon=None): super(PromptUser, self).__init__(parent) if not color: color = '#fff' css = loadCSS.loadCSS( os.path.join(os.path.dirname(pipeline.CSS.__file__), 'mainWindow.css')) self.setStyleSheet(css) self.setObjectName('prompt_massage') self.setStyleSheet(self.styleSheet() + ''' QLabel { color: ''' + color + ''' ;} ''') self.setWindowTitle(title) self.setText(prompt) self.setIconPixmap(cfg.simple_warning_icon) if override_yes_icon: self.yes_btn = QtWidgets.QPushButton(self) self.yes_btn.setText(override_yes_text) self.yes_btn.setMinimumHeight(30) self.yes_btn.setIconSize(QtCore.QSize(24, 24)) self.yes_btn.setIcon(QtGui.QIcon(override_yes_icon)) self.addButton(self.yes_btn, QtWidgets.QMessageBox.YesRole) else: self.addButton(override_yes_text, QtWidgets.QMessageBox.YesRole) if override_yes_icon: self.no_btn = QtWidgets.QPushButton(self) self.no_btn.setText(override_no_label) self.no_btn.setIcon(QtGui.QIcon(override_no_icon)) self.addButton(self.no_btn, QtWidgets.QMessageBox.NoRole) self.no_btn.setMinimumHeight(30) self.no_btn.setIconSize(QtCore.QSize(24, 24)) else: self.addButton(override_no_label, QtWidgets.QMessageBox.NoRole) # self.addButton(override_no_label, QtWidgets.QMessageBox.NoRole) if cancel_button: if cancel_icon: self.canc_btn = QtWidgets.QPushButton(self) self.canc_btn.setText(override_cancel_label) self.canc_btn.setIcon(QtGui.QIcon(cancel_icon)) self.addButton(self.canc_btn, QtWidgets.QMessageBox.RejectRole) self.canc_btn.setMinimumHeight(30) self.canc_btn.setIconSize(QtCore.QSize(24, 24)) else: self.addButton(override_cancel_label, QtWidgets.QMessageBox.RejectRole)