Beispiel #1
0
    def __init__(self,
                 parent=None,
                 path_object=None,
                 element='task',
                 pixmap=None):
        QtWidgets.QWidget.__init__(self, parent)
        self.element = element
        if path_object:
            self.path_object = path_object
            elements = self.path_object.glob_project_element(element)
        else:
            return
        self.project_management = CONFIG['account_info']['project_management']
        self.schema = CONFIG['project_management'][
            self.project_management]['api']['default_schema']
        schema = CONFIG['project_management'][
            self.project_management]['tasks'][self.schema]
        self.proj_man_tasks = schema['long_to_short'][self.path_object.scope]
        self.proj_man_tasks_short_to_long = schema['short_to_long'][
            self.path_object.scope]
        self.panel = QtWidgets.QVBoxLayout(self)
        self.title_layout = QtWidgets.QHBoxLayout()
        self.task_button = QtWidgets.QToolButton()
        self.task_button.setText('add %s' % element)
        self.task_button.setProperty('class', 'add_button')
        if pixmap:
            self.icon = QtWidgets.QLabel()
            self.icon.setPixmap(pixmap)
            self.h_layout.addWidget(self.icon)
            self.title_layout.addWidget(pixmap)
        self.title = QtWidgets.QLabel('%ss' % element.title())
        self.title.setProperty('class', 'ultra_title')
        self.title_layout.addWidget(self.title)
        self.title_layout.addStretch(1)
        self.title_layout.addWidget(self.task_button)

        self.panel.addLayout(self.title_layout)
        self.task_button.clicked.connect(self.add_button_clicked)
        for each in elements:
            if 'elem' in each:
                task = each
            else:
                try:
                    task = self.proj_man_tasks_short_to_long[each]
                except KeyError:
                    print('%s not found in short_to_long' % each)
                    task = each
            button = LJButton(str(task))
            # button.setIcon(QtGui.QIcon(QtGui.QPixmap(os.path.join(icon_path(), image_name))))
            # button.setIconSize(QtCore.QSize(50, 50))
            button.setProperty('class', 'ultra_button')
            self.panel.addWidget(button)
            button.clicked.connect(self.on_button_clicked)
        self.panel.addStretch(1)
Beispiel #2
0
    def add_path_line(self, layout_, key, paths_dict, row, hide_on_find):
        """

        :param layout_:
        :param key:
        :param paths_dict:
        :param row:
        :param hide_on_find:
        :return:
        """
        label = QtWidgets.QLabel(key)
        line_edit = QtWidgets.QLineEdit()

        line_edit.setText(paths_dict[key])
        if key == 'root':
            line_edit.editingFinished.connect(self.on_root_set)

        folder_button = QtWidgets.QToolButton()
        if key == 'cgl_tools':
            self.cgl_tools_folder = folder_button
        folder_button.setIcon(QtGui.QIcon(self.icon_path('folder24px.png')))
        folder_button.line_edit = line_edit
        folder_button.label = label
        message = QtWidgets.QLabel('Path Not Found, Please Specify %s' % key)
        # message.setPalette(self.red_palette)
        folder_button.message = message
        self.widget_dict[key] = {
            'label': label,
            'line_edit': line_edit,
            'message': message
        }
        layout_.addWidget(label, row, 0)
        layout_.addWidget(line_edit, row, 1)
        layout_.addWidget(folder_button, row, 2)
        layout_.addWidget(message, row + 1, 1)
        folder_button.clicked.connect(self.on_path_chosen)
        self.check_path(key,
                        label,
                        line_edit,
                        message,
                        folder_button,
                        hide_on_find=hide_on_find)
        line_edit.textChanged.connect(lambda: self.on_line_edit_changed(key))
        return row + 2
Beispiel #3
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)
Beispiel #4
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()
Beispiel #5
0
    def __init__(self, parent=None, preflight_name='', preflight_step_name='', attrs=None, preflight_path='',
                 menu_type='preflights'):
        # TODO - we need to choose better variable names, this is obviously "preflight" specific.
        QtWidgets.QWidget.__init__(self, parent)

        try:
            dialog = self.parent().parent().parent()
            print dialog
            self.software = dialog.software_combo.currentText()
        except AttributeError:
            # TODO - look into this a bit deeper, this is a fairly generic catch right now.
            dialog = self.parent().parent().parent().parent().parent()
            self.software = dialog.software_combo.currentText()
        self.menu_type = menu_type
        self.attrs = attrs
        self.name = preflight_step_name
        self.preflight_name = preflight_name
        self.preflight_path = preflight_path
        self.do_save = True
        # Create the Layouts
        layout = QtWidgets.QVBoxLayout(self)
        grid_layout = QtWidgets.QGridLayout()
        tool_row = QtWidgets.QHBoxLayout()

        # labels
        module_label = QtWidgets.QLabel('module')
        required_label = QtWidgets.QLabel('required')
        label_label = QtWidgets.QLabel('label')
        icon_button = QtWidgets.QToolButton()
        icon_button.setIcon(QtGui.QIcon(os.path.join(icon_path(), 'folder24px.png')))
        self.icon_label = QtWidgets.QLabel('icon')
        name_label = QtWidgets.QLabel('name')

        # line edits
        self.command_line_edit = QtWidgets.QLineEdit()
        self.command_line_edit.setEnabled(False)
        self.required_line_edit = QtWidgets.QLineEdit()
        self.required_line_edit.setText('True')
        self.icon_path_line_edit = QtWidgets.QLineEdit()
        # self.required_line_edit.setEnabled(False)
        self.label_line_edit = QtWidgets.QLineEdit()
        self.name_line_edit = QtWidgets.QLineEdit()
        self.attrs_dict = {'module': self.command_line_edit,
                           'required': self.required_line_edit,
                           'label': self.label_line_edit,
                           'name': self.name_line_edit,
                           'icon': self.icon_path_line_edit}



        # tool buttons
        delete_button = QtWidgets.QPushButton('Delete')
        delete_button.setProperty('class', 'basic')
        open_button = QtWidgets.QPushButton('Open in Editor')
        open_button.setProperty('class', 'basic')
        self.save_button = QtWidgets.QPushButton('Save All')
        self.save_button.setProperty('class', 'basic')

        # Text Edit
        self.code_text_edit = QtWidgets.QPlainTextEdit()
        metrics = QtGui.QFontMetrics(self.code_text_edit.font())
        self.code_text_edit.setTabStopWidth(4 * metrics.width(' '))
        Highlighter(self.code_text_edit.document())
        # Layout the Grid

        grid_layout.addWidget(label_label, 0, 0)
        grid_layout.addWidget(self.label_line_edit, 0, 1)
        grid_layout.addWidget(module_label, 1, 0)
        grid_layout.addWidget(self.command_line_edit, 1, 1)
        grid_layout.addWidget(required_label, 2, 0)
        grid_layout.addWidget(self.required_line_edit, 2, 1)
        grid_layout.addWidget(self.icon_label, 3, 0)
        grid_layout.addWidget(self.icon_path_line_edit, 3, 1)
        grid_layout.addWidget(icon_button, 3, 2)
        grid_layout.addWidget(name_label, 4, 0)
        grid_layout.addWidget(self.name_line_edit, 4, 1)

        name_label.hide()
        self.name_line_edit.hide()

        if self.menu_type != 'shelves':
            self.icon_label.hide()
            self.icon_path_line_edit.hide()
            icon_button.hide()
        else:
            self.required_line_edit.hide()
            required_label.hide()

        # Layout the tool row
        tool_row.addStretch(1)
        tool_row.addWidget(open_button)
        tool_row.addWidget(delete_button)
        tool_row.addWidget(self.save_button)

        # layout the widget
        layout.addLayout(grid_layout)
        layout.addWidget(self.code_text_edit)
        layout.addLayout(tool_row)

        # Signals and Slots
        self.code_text_edit.textChanged.connect(self.on_code_changed)
        icon_button.clicked.connect(self.on_icon_button_clicked)
        delete_button.clicked.connect(self.on_delete_clicked)
        open_button.clicked.connect(self.on_open_clicked)
        self.save_button.clicked.connect(self.on_save_clicked)
        self.load_attrs()
        self.label_line_edit.textChanged.connect(self.on_code_changed)
Beispiel #6
0
    def __init__(self, parent=None):
        LJDialog.__init__(self, parent)
        self.setWindowTitle('RoboGary')
        trifecta_layout = QtWidgets.QHBoxLayout(self)
        trifecta_layout.setContentsMargins(0, 96, 0, 96)
        highlight_icon = os.path.join(icon_path(), 'highlight_24px.png')
        # self.transcript_file = r'B:\Users\tmiko\Downloads\tom_ahmed_conversation_12_10_2019.json'
        self.transcript_file = r'\\Mac\Home\Downloads\tom_ahmed_conversation_12_10_2019.json'
        self.transcript = load_json(self.transcript_file)
        self.words = self.transcript['results']['items']
        self.next_words_length = 5
        self.cgl_word_dict = self.create_cgl_word_dict()
        self.tools_layout = QtWidgets.QVBoxLayout()
        self.script_layout = QtWidgets.QVBoxLayout()
        self.title_line_edit = QtWidgets.QLineEdit()
        self.gridA = QtWidgets.QGridLayout()
        self.gridA.setContentsMargins(96, 0, 0, 12)
        self.grid = QtWidgets.QGridLayout()
        self.grid.setContentsMargins(96, 0, 0, 0)

        # Screenplay stuff
        self.title_label = QtWidgets.QLabel('TITLE:')
        self.title_line_edit.setProperty('class', 'screen_play_edit')
        self.title_line_edit.setText('TYPE TITLE HERE')
        self.screenplay_text_edit = ScreenPlayTextEdit()
        self.screenplay_text_edit.setProperty('class', 'screen_play')
        self.width = 816
        self.screenplay_text_edit.setMinimumWidth(self.width)
        self.screenplay_text_edit.setMaximumWidth(self.width)
        self.punctuation = [',', '.', '?']

        # Details stuff
        self.description_label = QtWidgets.QLabel("DESCRIPTION:")
        self.description_line_edit = QtWidgets.QLineEdit('TYPE DESCRIPTION HERE')
        self.description_line_edit.setProperty('class', 'screen_play_edit')
        self.location_label = QtWidgets.QLabel("LOCATION: ")
        self.location_line_edit = QtWidgets.QLineEdit('TYPE LOCATION HERE')
        self.location_line_edit.setProperty('class', 'screen_play_edit')
        self.date_label = QtWidgets.QLabel("DATE: ")
        self.date_line_edit = QtWidgets.QLineEdit('TYPE DATE HERE')
        self.date_line_edit.setProperty('class', 'screen_play_edit')
        self.selection_start_label = QtWidgets.QLabel("Start:")
        self.selection_start_line_edit = QtWidgets.QLineEdit()
        self.selection_end_label = QtWidgets.QLabel("End:")
        self.selection_end_line_edit = QtWidgets.QLineEdit()



        # grid
        self.gridA.addWidget(self.title_label, 10, 0)
        self.gridA.addWidget(self.title_line_edit, 10, 1)
        self.grid.addWidget(self.description_label, 11, 0)
        self.grid.addWidget(self.description_line_edit, 11, 1)
        self.grid.addWidget(self.location_label, 12, 0)
        self.grid.addWidget(self.location_line_edit, 12, 1)
        self.grid.addWidget(self.date_label, 13, 0)
        self.grid.addWidget(self.date_line_edit, 13, 1)
        self.grid.addWidget(self.selection_start_label, 14, 0)
        self.grid.addWidget(self.selection_start_line_edit, 14, 1)
        self.grid.addWidget(self.selection_end_label, 15, 0)
        self.grid.addWidget(self.selection_end_line_edit, 15, 1)

        # Toolbar
        toolbar = QtWidgets.QHBoxLayout()
        toolbar.setContentsMargins(96, 0, 0, 0)

        self.script_layout.addLayout(self.gridA)
        self.script_layout.addLayout(toolbar)
        self.script_layout.addWidget(self.screenplay_text_edit)

        self.tools_layout.addLayout(self.grid)

        self.highlight_button = QtWidgets.QToolButton()
        self.highlight_button.setIcon(QtGui.QIcon(highlight_icon))
        toolbar.addWidget(self.highlight_button)
        toolbar.addStretch(1)

        trifecta_layout.addLayout(self.script_layout)
        trifecta_layout.addLayout(self.tools_layout)
        self.tools_layout.addStretch(1)

        self.highlight_button.clicked.connect(self.on_highlight_clicked)
        self.screenplay_text_edit.selectionChanged.connect(self.on_selected)
        self.load_transcript()