def __init__(self, parent, title, scope): QtWidgets.QWidget.__init__(self, parent) v_layout = QtWidgets.QVBoxLayout(self) h_layout = QtWidgets.QHBoxLayout(self) if scope == 'assets': self.category_row = LabelComboRow('%s Category' % scope.title(), button=False, bold=False) self.name_row = LabelComboRow('%s Name(s)' % scope.title(), button=False, bold=False) if scope == 'shots': self.category_row = LabelComboRow('Sequence', button=False, bold=False) self.name_row = LabelComboRow('Shot Name(s)', button=False, bold=False) self.label = title self.project_label = QtWidgets.QLabel( "<b>Create %s tasks For: %s</b>" % (scope.title(), title)) self.message = QtWidgets.QLabel("") h_layout.addWidget(self.project_label) h_layout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) v_layout.addLayout(h_layout) v_layout.addItem( QtWidgets.QSpacerItem(0, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)) v_layout.addLayout(self.category_row) v_layout.addLayout(self.name_row) v_layout.addWidget(self.message) self.message.hide()
def __init__(self, parent=None, path_dict=None, task_mode=False): LJDialog.__init__(self, parent) self.task_mode = task_mode self.resize(300, 60) self.red_palette, self.green_palette, self.black_palette = define_palettes( ) if not path_dict: return self.path_object = PathObject(path_dict) self.scope = self.path_object.scope if task_mode: self.setWindowTitle('Create %s' % 'Task(s)') else: self.setWindowTitle('Create %s' % self.scope.title()) self.asset = None self.asset_message_string = '' self.asset_list = [] self.full_root = None self.regex = '' self.valid_categories_string = '' self.seq = None self.valid_categories = [] self.get_valid_categories() # Environment Stuff self.root = CONFIG['paths']['root'] self.project_management = CONFIG['account_info']['project_management'] self.schema = CONFIG['project_management'][ self.project_management]['api']['default_schema'] if self.scope == 'assets': self.asset_string_example = CONFIG['rules']['path_variables'][ 'asset']['example'] elif self.scope == 'shots': self.asset_string_example = CONFIG['rules']['path_variables'][ 'shotname']['example'] schema = CONFIG['project_management'][ self.project_management]['tasks'][self.schema] self.proj_man_tasks = schema['long_to_short'][self.scope.lower()] self.proj_man_tasks_short_to_long = schema['short_to_long'][ self.scope.lower()] self.v_layout = QtWidgets.QVBoxLayout(self) self.scope_row = QtWidgets.QHBoxLayout() self.asset_row = QtWidgets.QHBoxLayout(self) self.tasks = [] self.task_row = QtWidgets.QHBoxLayout(self) self.task_combo = AdvComboBox() self.clear_selection_button = QtWidgets.QPushButton('Clear Selection') self.defaults_radio = QtWidgets.QRadioButton('Select Defaults') self.none_radio = QtWidgets.QRadioButton('Select None') self.radio_layout = QtWidgets.QHBoxLayout() self.radio_layout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) self.radio_layout.addWidget(self.defaults_radio) self.radio_layout.addWidget(self.none_radio) self.defaults_radio.setChecked(True) self.defaults_radio.hide() self.none_radio.hide() if self.task_mode: self.create_button = QtWidgets.QPushButton('Create %s' % 'Task(s)') else: self.create_button = QtWidgets.QPushButton('Create %s' % self.scope.title()) self.create_button.setEnabled(False) # asset & shot stuff self.asset_widget = AssetWidget(self, scope=self.scope, title=str(self.path_object.project)) self.asset_widget.name_row.combo.setEnabled(False) self.asset_row.addWidget(self.asset_widget) # task stuff self.task_layout = QtWidgets.QVBoxLayout(self) for each in self.proj_man_tasks: checkbox = QtWidgets.QCheckBox('%s (%s)' % (each, self.proj_man_tasks[each])) checkbox.stateChanged.connect(self.on_checkbox_clicked) self.task_layout.addWidget(checkbox) self.v_layout.addLayout(self.asset_row) self.v_layout.addLayout(self.radio_layout) self.v_layout.addLayout(self.task_layout) self.v_layout.addWidget(self.create_button) self.v_layout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) self.asset_widget.message.hide() # self.asset_widget.message.setPalette(self.red_palette) self.load_categories() self.asset_widget.category_row.combo.currentIndexChanged.connect( self.on_category_selected) self.asset_widget.name_row.combo.editTextChanged.connect( self.process_asset_string) self.create_button.clicked.connect(self.on_create_clicked) if self.scope == 'shots': self.asset_widget.category_row.combo.editTextChanged.connect( self.on_seq_text_changed) self.hide_layout_items(self.task_layout) if self.task_mode: self.on_set_vars()