Exemplo n.º 1
0
    def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.setMinimumWidth(1200)
        self.setMinimumHeight(800)
        self.setWindowTitle('Lumbermill Quick Setup')
        self.default_globals = DEFAULT_GLOBALS
        self.default_user_globals = DEFAULT_USER_GLOBALS
        self.default_root = DEFAULT_ROOT
        self.default_code_root = DEFAULT_CODE_ROOT
        size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Preferred)
        size_policy.setVerticalStretch(1)
        layout = QtWidgets.QVBoxLayout(self)
        #layout.setSizePolicy(size_policy)
        grid_layout = QtWidgets.QGridLayout()
        button_layout = QtWidgets.QHBoxLayout()

        company_label = QtWidgets.QLabel('Company Name')
        root_label = QtWidgets.QLabel('CGL Root')
        code_root_label = QtWidgets.QLabel('Code Root')
        self.sync_options_label = QtWidgets.QLabel('<b>Sync Folders:</b>')
        self.sync_folder_label = QtWidgets.QLabel('Production Folder')
        self.sync_folder_message = QtWidgets.QLabel(
            "<i>Don't worry you can edit this later</i>")
        self.sync_cgl_tools_label = QtWidgets.QLabel('CGL_TOOLS Folder')
        self.import_project_hint = QtWidgets.QLabel(
            '<i>hint: Z:\COMPANIES\loneCoconut\source\CGL_TESTPROJECT - copies one project,'
            '     Z:\COMPANIES\loneCoconut\source - copies all projects<\i>')
        self.import_project_hint.setSizePolicy(size_policy)
        self.import_project_hint.setWordWrap(True)

        self.company_line_edit = QtWidgets.QLineEdit()
        self.root_line_edit = QtWidgets.QLineEdit()
        self.code_root_line_edit = QtWidgets.QLineEdit()
        self.sync_folder_line_edit = QtWidgets.QLineEdit()
        self.sync_cgl_tools_line_edit = QtWidgets.QLineEdit()

        self.code_root_line_edit.setText(DEFAULT_CODE_ROOT)
        self.root_line_edit.setText(self.default_root)
        self.sync_cgl_tools_line_edit.setText(
            os.path.join(self.default_root, '_config', 'cgl_tools'))
        self.company_line_edit.setText('lone coconut')

        self.code_root_line_edit.setEnabled(False)
        # self.root_line_edit.setEnabled(False)
        self.sync_cgl_tools_line_edit.setEnabled(False)
        self.sync_folder_line_edit.setEnabled(False)

        self.aws_globals_label = QtWidgets.QLabel()
        self.projects_checkbox = QtWidgets.QCheckBox('Import a Project')
        self.sync_thing_checkbox = QtWidgets.QCheckBox('Set up Remote Syncing')
        self.import_label = QtWidgets.QLabel('Import Project From:')
        self.import_line_edit = QtWidgets.QLineEdit()
        self.import_button = QtWidgets.QToolButton()
        self.import_button.setText('...')
        self.sync_thing_checkbox.setChecked(True)
        self.projects_checkbox.setChecked(True)

        self.company_name = 'Lone Coconut'
        self.company_name_s3 = 'lone-coconut'
        self.company_name_disk = 'loneCoconut'
        self.cgl_tools_path = os.path.join(DEFAULT_HOME, 'downloads',
                                           'cgl_tools.zip')
        self.globals_path = os.path.join(DEFAULT_HOME, 'downloads',
                                         'globals.json')
        self.aws_globals = r'https://%s.s3.amazonaws.com/globals.json' % self.company_name_s3
        self.check_for_globals_button = QtWidgets.QPushButton(
            'Check for Globals')
        self.download_globals_button = QtWidgets.QPushButton(
            'Set Up Lumbermill')

        button_layout.addStretch(1)
        button_layout.addWidget(self.download_globals_button)

        grid_layout.addWidget(root_label, 2, 0)
        grid_layout.addWidget(self.root_line_edit, 2, 1)
        grid_layout.addWidget(code_root_label, 3, 0)
        grid_layout.addWidget(self.code_root_line_edit, 3, 1)
        grid_layout.addWidget(self.import_label, 4, 0)
        grid_layout.addWidget(self.import_line_edit, 4, 1)
        grid_layout.addWidget(self.import_button, 4, 2)
        grid_layout.addWidget(self.import_project_hint, 5, 1)
        grid_layout.addWidget(self.sync_options_label, 6, 0)
        grid_layout.addWidget(self.sync_folder_label, 7, 0)
        grid_layout.addWidget(self.sync_folder_line_edit, 7, 1)
        grid_layout.addWidget(self.sync_folder_message, 8, 1)
        grid_layout.addWidget(self.sync_cgl_tools_label, 9, 0)
        grid_layout.addWidget(self.sync_cgl_tools_line_edit, 9, 1)

        layout.addWidget(company_label)
        layout.addWidget(self.company_line_edit)
        layout.addWidget(self.aws_globals_label)
        layout.addWidget(self.projects_checkbox)
        layout.addWidget(self.sync_thing_checkbox)
        layout.addLayout(grid_layout)
        layout.addLayout(button_layout)
        layout.addStretch(1)
        self.aws_globals_label.hide()
        self.on_projects_checkbox_clicked()
        self.on_sync_thing_checkbox_clicked()
        self.on_company_name_changed()

        self.company_line_edit.editingFinished.connect(
            self.on_company_name_changed)
        self.root_line_edit.textChanged.connect(self.on_root_changed)
        self.download_globals_button.clicked.connect(self.set_up_lumbermill)
        self.projects_checkbox.clicked.connect(
            self.on_projects_checkbox_clicked)
        self.sync_thing_checkbox.clicked.connect(
            self.on_sync_thing_checkbox_clicked)
        self.import_line_edit.editingFinished.connect(
            self.on_import_line_edit_changed)
Exemplo n.º 2
0
    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()