コード例 #1
0
    def __init__(self,
                 parent=None,
                 company='',
                 config_dict=None,
                 root=r"C:\CGLUMBERJACK\COMPANIES"):
        QtWidgets.QDialog.__init__(self, parent)
        self.app_config = config_dict
        self.proj_management_label = QtWidgets.QLabel('Project Management')
        self.contents = {}
        self.company = company
        self.global_config = {}
        self.root = root
        self.user_name = self.get_user_name()
        self.api_key = ''
        self.api_script = ''
        self.api_user = ''
        self.project_management = ''
        self.api_server = ''
        self.setWindowTitle('Create Globals')

        layout = QtWidgets.QVBoxLayout(self)
        self.project_management_label = QtWidgets.QLabel('Project Management:')
        self.project_management_label.setProperty('class', 'ultra_title')
        self.proj_management_label = QtWidgets.QLabel('Software:')
        self.proj_management_combo = QtWidgets.QComboBox()
        self.proj_management_combo.addItems(
            ['lumbermill', 'ftrack', 'shotgun'])
        # self.red_palette, self.green_palette, self.black_palette = define_palettes()

        self.user_email_label = QtWidgets.QLabel('User Email:')
        self.user_email_line_edit = QtWidgets.QLineEdit()
        self.user_name_label = QtWidgets.QLabel('User Name:')
        self.user_name_line_edit = QtWidgets.QLineEdit()
        self.user_name_line_edit.setText(self.user_name)
        self.globals_label = QtWidgets.QLabel('Globals')
        self.globals_label.setProperty('class', 'ultra_title')
        self.paths_label = QtWidgets.QLabel('Paths')
        self.paths_label.setProperty('class', 'ultra_title')

        self.server_label = QtWidgets.QLabel('server url:')
        self.api_key_label = QtWidgets.QLabel('api key:')
        self.api_user_label = QtWidgets.QLabel('api user:'******'api script:')
        self.root_label = QtWidgets.QLabel('Production Root:')
        self.server_line_edit = QtWidgets.QLineEdit()
        self.api_key_line_edit = QtWidgets.QLineEdit()
        self.api_user_line_edit = QtWidgets.QLineEdit()
        self.api_script_line_edit = QtWidgets.QLineEdit()

        self.choose_folder_button = QtWidgets.QToolButton()
        self.choose_folder_button.setText('...')
        self.choose_root = QtWidgets.QToolButton()
        self.choose_root.setText('...')
        self.choose_code_root_button = QtWidgets.QToolButton()
        self.choose_code_root_button.setText('...')

        self.proj_man_grid = QtWidgets.QGridLayout()
        self.proj_man_grid.addWidget(self.proj_management_label, 0, 0)
        self.proj_man_grid.addWidget(self.proj_management_combo, 0, 1)
        self.proj_man_grid.addWidget(self.api_key_label, 1, 0)
        self.proj_man_grid.addWidget(self.api_key_line_edit, 1, 1)
        self.proj_man_grid.addWidget(self.api_user_label, 2, 0)
        self.proj_man_grid.addWidget(self.api_user_line_edit, 2, 1)
        self.proj_man_grid.addWidget(self.server_label, 3, 0)
        self.proj_man_grid.addWidget(self.server_line_edit, 3, 1)
        self.proj_man_grid.addWidget(self.api_script_label, 4, 0)
        self.proj_man_grid.addWidget(self.api_script_line_edit, 4, 1)
        self.proj_man_grid.addWidget(self.user_name_label, 5, 0)
        self.proj_man_grid.addWidget(self.user_name_line_edit, 5, 1)
        self.proj_man_grid.addWidget(self.user_email_label, 6, 0)
        self.proj_man_grid.addWidget(self.user_email_line_edit, 6, 1)

        self.cancel_button = QtWidgets.QPushButton('Cancel')
        self.ok_button = QtWidgets.QPushButton('Ok')
        self.button = ''
        self.ok_button.setEnabled(False)
        self.create_globals_button = QtWidgets.QPushButton('Create Globals')
        self.create_globals_button.setEnabled(False)

        # self.project_management = self.app_config['account_info']['project_management']

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

        # self.globals_tree_widget = DictionaryTreeWidget({})
        this = __file__.split('cglumberjack')[0]
        if not self.app_config:
            dialog = QuickSync()
            dialog.exec_()
            globals_path = dialog.globals_path
            cgl_tools_path = dialog.cgl_tools_path
            if globals_path:
                dict_ = read_write.load_json(globals_path)
                self.inherited_globals = True
            else:
                self.inherited_globals = False
                this = __file__.split('cglumberjack')[0]
                dict_ = read_write.load_json(
                    os.path.join(this, 'cglumberjack', 'cgl', 'cfg',
                                 'globals_template.json'))
        self.proj_man_dict = dict_['project_management']
        self.path_item_widget = PathItemWidget(paths_dict=dict_['paths'],
                                               hide_on_find=True)

        if self.path_item_widget.widget_dict['root']['line_edit'].text():
            self.show_project_management_basics()
        else:
            self.hide_project_management_basics()
        self.widget_dict = self.path_item_widget.widget_dict

        layout.addWidget(self.globals_label)
        layout.addWidget(self.path_item_widget)
        layout.addWidget(self.project_management_label)
        layout.addLayout(self.proj_man_grid)
        # layout.addWidget(self.globals_tree_widget)
        # layout.addWidget(QHLine())
        layout.addLayout(button_layout)
        layout.addStretch(1)

        # self.user_globals_line_edit.setEnabled(False)
        self.proj_management_combo.currentIndexChanged.connect(
            self.on_pm_changed)
        self.path_item_widget.line_edit_changed.connect(
            self.on_line_edits_changed)
        self.ok_button.clicked.connect(self.on_ok_clicked)
        self.ok_button.hide()
        self.cancel_button.clicked.connect(self.cancel_clicked)
        self.create_globals_button.clicked.connect(
            self.on_create_globals_clicked)
        self.path_item_widget.root_set.connect(self.on_root_line_edit_set)
        self.user_email_line_edit.textChanged.connect(
            self.check_ok_to_create_globals)
        self.user_name_line_edit.textChanged.connect(
            self.check_ok_to_create_globals)
        self.proj_management_combo.currentIndexChanged.connect(
            self.check_ok_to_create_globals)
        self.get_input()

        self.hide_api_info()
        self.set_proj_man()
        self.check_user_config()
        # self.globals_tree_widget.hide()
        self.on_globals_changed()
        self.set_some_stuff()
コード例 #2
0
ファイル: designer.py プロジェクト: Eric-coder/cglumberjack
    def __init__(self, parent=None, type_=None, menu_path=None, pm_tasks=None):
        LJDialog.__init__(self, parent)
        self.type = type_
        self.cgl_tools = get_cgl_tools()
        self.singular = ''

        self.menu_path = menu_path
        self.software = ''
        self.setWindowTitle('Pipeline Designer')
        self.schema = pm_tasks
        self.task_list = []
        try:
            for each in self.schema['long_to_short']['assets']:
                if each not in self.task_list:
                    self.task_list.append(each)
            for each in self.schema['long_to_short']['shots']:
                if each not in self.task_list:
                    self.task_list.append(each)
        except TypeError:
            print 'Problems found in your globals "schema"'
            return
        self.task_list.sort()
        self.task_list.insert(0, '')

        # create layouts
        layout = QtWidgets.QVBoxLayout(self)
        tool_bar = QtWidgets.QHBoxLayout()
        self.title_widget = QtWidgets.QWidget()
        title_widget_layout = QtWidgets.QHBoxLayout()
        self.title_widget.setLayout(title_widget_layout)
        grid_layout = QtWidgets.QGridLayout()
        menu_type_row = QtWidgets.QHBoxLayout()
        # create widgets
        self.software_label = QtWidgets.QLabel('Software:')
        self.software_label.setProperty('class', 'title')
        self.software_combo = QtWidgets.QComboBox()
        self.menu_type_label = QtWidgets.QLabel('Menu Type:')
        self.menu_type_label.setProperty('class', 'title')
        self.menu_type_combo = QtWidgets.QComboBox()
        self.menu_type_combo.addItems(['', 'menus', 'context-menus', 'shelves', 'preflights'])

        self.new_software_button = QtWidgets.QPushButton('Add Software')
        self.new_software_button.setProperty('class', 'add_button')
        self.menus = QtWidgets.QTabWidget()
        self.menus.setMovable(True)
        self.title_label = QtWidgets.QLabel()
        self.title_label.setProperty('class', 'ultra_title')
        self.add_menu_button = QtWidgets.QPushButton('add')
        self.delete_menu_button = QtWidgets.QPushButton('delete')
        self.add_menu_button.setProperty('class', 'add_button')
        self.delete_menu_button.setProperty('class', 'add_button')

        # self.save_menu_button = QtWidgets.QPushButton('save menu')
        # self.save_menu_button.setProperty('class', 'add_button')
        self.title_widget.hide()
        # layout the GUI
        title_widget_layout.addWidget(self.title_label)
        title_widget_layout.addWidget(self.add_menu_button)
        title_widget_layout.addWidget(self.delete_menu_button)
        title_widget_layout.addStretch(1)
        # title_widget_layout.addWidget(self.save_menu_button)
        grid_layout.addWidget(self.software_label, 0, 0)
        grid_layout.addWidget(self.software_combo, 0, 1)
        grid_layout.addWidget(self.new_software_button, 0, 2)
        grid_layout.addWidget(self.menu_type_label, 1, 0)
        grid_layout.addWidget(self.menu_type_combo, 1, 1)
        tool_bar.addLayout(grid_layout)
        tool_bar.addStretch(1)
        layout.addLayout(tool_bar)
        layout.addWidget(self.title_widget)
        layout.addLayout(menu_type_row)
        layout.addWidget(self.menus)

        # SIGNALS AND SLOTS
        self.add_menu_button.clicked.connect(self.on_add_menu_clicked)
        self.delete_menu_button.clicked.connect(self.on_delete_menu_clicked)
        self.new_software_button.clicked.connect(self.on_new_software_clicked)

        # Load the Menu Designer
        self.load_software()
        self.software_combo.currentIndexChanged.connect(self.update_menu_path)
        self.menu_type_combo.currentIndexChanged.connect(self.update_menu_path)