def app_init(splash_image='lubmermill.jpg'): from cgl.core.path import image_path app_ = QtWidgets.QApplication([]) splash_pix = QtGui.QPixmap(image_path(splash_image)) splash_ = QtWidgets.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash_.setMask(splash_pix.mask()) splash_.show() app_.setStyleSheet(load_style_sheet()) return app_, splash_
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)
def __init__(self, parent=None, path_object=None): QtWidgets.QFrame.__init__(self, parent) if path_object: self.path_object = cglpath.PathObject(path_object) self.path_root = self.path_object.path_root else: return layout = QtWidgets.QHBoxLayout(self) self.path_line_edit = QtWidgets.QLineEdit() self.path_line_edit.setMinimumHeight(ICON_WIDTH) self.text = self.path_object.path_root layout.addWidget(self.path_line_edit) # add css self.setProperty('class', 'light_grey') self.path_line_edit.setProperty('class', 'medium_grey')
def __init__(self, parent=None, path_object=None, search_box=None, my_tasks=False): QtWidgets.QWidget.__init__(self, parent) # Create the Middle Panel if path_object: self.path_object = path_object.copy(seq='*', shot='*', ingest_source='*', resolution='', version='', user=None) else: return self.my_tasks = my_tasks self.panel = QtWidgets.QVBoxLayout(self) self.assets = None self.assets_filter_default = filter self.root = CONFIG['paths']['root'] self.radio_filter = 'Everything' self.clear_layout() self.assets = AssetWidget(self, title="", search_box=search_box) self.assets.add_button.show() self.set_scope_radio() self.panel.addWidget(self.assets) self.load_assets() self.assets.data_table.selected.connect(self.on_main_asset_selected) self.assets.shots_radio.clicked.connect(self.on_filter_radio_changed) self.assets.assets_radio.clicked.connect(self.on_filter_radio_changed) self.assets.tasks_radio.clicked.connect(self.load_tasks)
def __init__(self, parent=None, path_object=None): QtWidgets.QWidget.__init__(self, parent) if path_object: self.path_object = path_object.copy(seq=None, shot=None, ingest_source=None, resolution='', version='', user=None, scope=None) else: return self.panel = QtWidgets.QVBoxLayout(self) for each in ['assets', 'shots']: if each == 'assets': image_name = 'flower_80px.png' elif each == 'shots': image_name = 'shots96px.png' elif each == 'my tasks': image_name = 'star96px.png' else: image_name = 'ingest96px.png' button = LJButton(str(each)) 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)
def __init__(self, parent=None, path_object=None, search_box=None, title='Projects'): QtWidgets.QWidget.__init__(self, parent) self.path_object = path_object self.project_management = CONFIG['account_info']['project_management'] self.user_email = CONFIG['project_management'][ self.project_management]['users'][current_user()] self.root = CONFIG['paths']['root'] # Company Specific self.user_root = CONFIG['cg_lumberjack_dir'] self.left_column_visibility = True self.title = title # Create the Left Panel self.panel = QtWidgets.QVBoxLayout(self) if title == 'Projects': pixmap = QtGui.QPixmap(icon_path('project24px.png')) elif title == 'Companies': pixmap = QtGui.QPixmap(icon_path('company24px.png')) self.project_filter = ProjectWidget(title=title, pixmap=pixmap, search_box=search_box, path_object=self.path_object) self.panel.addWidget(self.project_filter) if title == 'Projects': self.load_projects() elif title == 'Companies': self.load_companies() self.project_filter.data_table.doubleClicked.connect( self.on_project_changed) self.project_filter.add_button.clicked.connect(self.on_create_project)
def load_transcript(self): speaker_labels = self.transcript['results']['speaker_labels'] previous_speaker = '' speakers = [] row = -1 for segment in speaker_labels['segments']: # find out if we're doing the same speaker or a new one: segment_list = [] speaker = segment['speaker_label'].upper() start_time = float(segment['start_time']) end_time = float(segment['end_time']) for w in self.words: # find the start and end index for the 'segment' if 'start_time' in w.keys(): if float(w['start_time']) >= start_time: in_segment = True if float(w['start_time']) < end_time: segment_list.append(w['alternatives'][0]['content']) if float(w['start_time']) > end_time: in_segment = False else: if in_segment: segment_list.append(w['alternatives'][0]['content']) if speaker != previous_speaker: if speaker not in speakers: row += 1 speaker_label = QtWidgets.QLabel('%s NAME:' % speaker.upper()) speaker_line_edit = QtWidgets.QLineEdit('TYPE SPEAKER HERE') speaker_line_edit.setProperty('class', 'screen_play_edit') self.grid.addWidget(speaker_label, row, 0) self.grid.addWidget(speaker_line_edit, row, 1) speakers.append(speaker) self.screenplay_text_edit.append('\n\n%s' % speaker) self.screenplay_text_edit.setAlignment(QtCore.Qt.AlignCenter) # TODO is there any way for me to capture the correlation between the cursro position of the word i'm adding # and its index within the json file? self.screenplay_text_edit.append(string_from_segment_list(segment_list)) self.screenplay_text_edit.setAlignment(QtCore.Qt.AlignLeft) else: self.screenplay_text_edit.moveCursor(QtGui.QTextCursor.End) self.screenplay_text_edit.insertPlainText(string_from_segment_list(segment_list)) self.screenplay_text_edit.setAlignment(QtCore.Qt.AlignLeft) self.screenplay_text_edit.moveCursor(QtGui.QTextCursor.End) previous_speaker = speaker
def _do_qt_init(): """ set up the QT app Returns: QtGui.Application """ app = QtWidgets.QApplication([]) return app
def __init__(self, parent=None, path_object=None, user_email='', machine_user=None, show_import=False): QtWidgets.QWidget.__init__(self, parent) # self.setWidgetResizable(True) self.work_files = [] self.in_current_folder = False self.render_files_widget = None self.high_files = [] self.render_files = [] self.version_obj = None self.task = path_object.task self.task_widgets_dict = {} self.show_import = show_import self.path_object = path_object 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.user_info = CONFIG['project_management'][ self.project_management]['users'][current_user()] 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.current_location = path_object.data self.panel = QtWidgets.QVBoxLayout(self) self.tasks = QtWidgets.QHBoxLayout() self.in_file_tree = None self.user_changed_versions = False self.user_email = user_email if machine_user: self.user = machine_user else: self.user = current_user() self.project_management = CONFIG['account_info']['project_management'] self.on_task_selected(self.path_object) self.panel.addLayout(self.tasks) self.panel.addStretch(1) self.force_clear = False self.auto_publish_tasks = ['plate', 'element']
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
def paintEvent(self, event): painter = QtWidgets.QStylePainter(self) opt = QtWidgets.QStyleOptionTab() for i in range(self.count()): self.initStyleOption(opt, i) painter.drawControl(QtWidgets.QStyle.CE_TabBarTabShape, opt) painter.save() s = opt.rect.size() s.transpose() r = QtCore.QRect(QtCore.QPoint(), s) r.moveCenter(opt.rect.center()) opt.rect = r c = self.tabRect(i).center() painter.translate(c) painter.rotate(90) painter.translate(-c) painter.drawControl(QtWidgets.QStyle.CE_TabBarTabLabel, opt) painter.restore()
def __init__(self, parent=None, paths_dict=None, hide_on_find=False): QtWidgets.QWidget.__init__(self, parent) self.layout = QtWidgets.QVBoxLayout(self) self.globals_layout = QtWidgets.QGridLayout() self.paths_layout = QtWidgets.QGridLayout() self.vfx_paths_layout = QtWidgets.QGridLayout() self.user_dir = os.path.expanduser("~") self.user_name = self.get_user_name() self.cgl_dir = self.get_default_cgl_dir() self.user_globals_path = self.get_user_config(self.cgl_dir) self.globals_label = QtWidgets.QLabel('Globals Locations') self.globals_label.setProperty('class', 'ultra_title') self.paths_label = QtWidgets.QLabel('CGL Tool Paths') self.paths_label.setProperty('class', 'ultra_title') self.paths_label.hide() self.vfx_label = QtWidgets.QLabel('VFX Paths') self.vfx_label.setProperty('class', 'ultra_title') self.vfx_label.hide() # self.red_palette, self.green_palette, self.black_palette = define_palettes() self.cgl_tools_folder = None self.widget_dict = {} # Add User Globals, Root and The "Paths" label to the first slots. i = 0 i = self.add_path_line(self.globals_layout, 'root', paths_dict, i, hide_on_find) self.add_path_line(self.globals_layout, 'user_globals', paths_dict, i, hide_on_find) self.layout.addWidget(self.paths_label) self.layout.addLayout(self.globals_layout) self.layout.addWidget(self.paths_label) self.layout.addLayout(self.paths_layout) self.layout.addWidget(self.vfx_label) self.layout.addLayout(self.vfx_paths_layout) default_paths = [ 'cgl_tools', 'code_root', 'dev_pkg', 'ffmpeg', 'ffplay', 'ffprobe', 'magick', 'wget', 'globals' ] vfx_paths = ['ari_convert', 'maketx', 'mayapy', 'nuke'] prow = 0 vrow = 0 for key in paths_dict: if key in default_paths: prow += 2 self.add_path_line(self.paths_layout, key, paths_dict, prow, hide_on_find) elif key in vfx_paths: vrow += 2 self.add_path_line(self.vfx_paths_layout, key, paths_dict, vrow, hide_on_find)
def __init__(self, parent=None, title='Setup'): LJDialog.__init__(self) print "hello" self.setWindowTitle("Setup") self.authorization = "" self.project_dict = {} self.project_names = self.get_projects() self.label_asana = QtWidgets.QLabel("Asana") self.edit_label = QtWidgets.QLabel("API_Key") self.project_label = QtWidgets.QLabel("Project") self.label_asana.setProperty('class', 'ultra_title') self.submit_button = QtWidgets.QPushButton("Submit") self.submit_button.setProperty('class', 'basic') self.user_line_edit = QtWidgets.QLineEdit() self.project_combo = AdvComboBox() self.project_combo.addItems("") num = self.project_combo.findText("") self.project_combo.setCurrentIndex(num) layout = QtWidgets.QFormLayout() user_id = QtWidgets.QHBoxLayout() user_id.addWidget(self.edit_label) user_id.addWidget(self.user_line_edit) project_row = QtWidgets.QHBoxLayout() project_row.addWidget(self.project_label) project_row.addWidget(self.project_combo) layout.addRow(self.label_asana) layout.addRow(user_id) layout.addRow(project_row) layout.addWidget(self.submit_button) self.setLayout(layout) self.submit_button.hide() self.user_line_edit.editingFinished.connect(self.set_projects) self.project_combo.currentIndexChanged.connect(self.get_project_id) self.submit_button.clicked.connect(self.submit_info)
def add_button(self, menu, label='', annotation='', command='', icon='', image_overlay_label='', hot_key=''): module = command.split()[1] module_name = module.split('.')[-1] try: loaded_module = __import__(module, globals(), locals(), module_name, -1) action = QtWidgets.QAction(label, self) self.menu_dict[menu].addAction(action) function = getattr(loaded_module, 'run') action.triggered.connect(lambda: function(self.centralWidget())) except ImportError: pass pass
def __init__(self, parent=None, path_object=None, search_box=None): QtWidgets.QWidget.__init__(self, parent) self.search_box = search_box self.path_object = path_object self.panel = QtWidgets.QVBoxLayout(self) pixmap = QtGui.QPixmap(icon_path('company24px.png')) #self.company_widget = LJListWidget('Companies', pixmap=pixmap, search_box=search_box) self.data_table = LJTableWidget(self, path_object=self.path_object) self.company_widget.add_button.setText('add company') self.company_widget.list.setSizePolicy( QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) self.user_root = CONFIG['cg_lumberjack_dir'] self.panel.addWidget(self.company_widget) self.panel.addStretch(0) self.load_companies() self.project_management = 'lumbermill' self.company_widget.add_button.clicked.connect(self.on_create_company) self.company_widget.list.itemDoubleClicked.connect( self.on_company_changed)
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, 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)
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)
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()
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()
' Sync> Pull From Server\n' 'and you will start syncing folders') dialog.exec_() # set_up_syncthing(folders=[os.path.join(self.default_root, '_config', 'cgl_tools')]) def create_user_globals(user_globals, globals_path): if user_globals: if not os.path.exists(os.path.dirname(user_globals)): os.makedirs(os.path.dirname(user_globals)) d = { "globals": globals_path, "previous_path": "", "previous_paths": {}, "methodology": "local", "my_tasks": {} } print "saving user_globals to %s" % user_globals read_write.save_json(user_globals, d) else: print 'No Root Defined, cannot save user globals' if __name__ == "__main__": # from cgl.core.utils import load_style_sheet app = QtWidgets.QApplication([]) #app = QtWidgets.QApplication([]) form = QuickSync() form.show() app.exec_()
def __init__(self, path_object): LJDialog.__init__(self) self.path_object = path_object if self.path_object.context == 'source': self.other_path_object = PathObject.copy(path_object, context='render') else: self.other_path_object = PathObject.copy(path_object, context='source') # TODO - i need something here to check if i'm in a task or not, if not send a popup task = path_object.task seq = path_object.seq shot = path_object.shot self.to_object = None self.root = '' all_ = r'%s/%s/%s' % (seq, shot, task) self.setWindowTitle('Export %s to drive' % all_) v_layout = QtWidgets.QVBoxLayout(self) grid_layout = QtWidgets.QGridLayout() button_layout = QtWidgets.QHBoxLayout() drive_label = QtWidgets.QLabel('External Drive:') self.drive_combo = AdvComboBox() root_label = QtWidgets.QLabel('External Drive Root:') self.root_line_edit = QtWidgets.QLineEdit() copy_from_label = QtWidgets.QLabel('copy from:') self.copy_from_path = QtWidgets.QLabel(path_object.path_root) copy_to_label = QtWidgets.QLabel('copy to') self.copy_to_path = QtWidgets.QLabel('') self.message = QtWidgets.QLabel('') self.cancel_button = QtWidgets.QPushButton('Cancel') self.ok_button = QtWidgets.QPushButton('Copy Task') grid_layout.addWidget(drive_label, 0, 0) grid_layout.addWidget(self.drive_combo, 0, 1) grid_layout.addWidget(root_label, 1, 0) grid_layout.addWidget(self.root_line_edit, 1, 1) grid_layout.addWidget(copy_from_label, 2, 0) grid_layout.addWidget(self.copy_from_path, 2, 1) grid_layout.addWidget(copy_to_label, 3, 0) grid_layout.addWidget(self.copy_to_path, 3, 1) button_layout.addStretch(1) button_layout.addWidget(self.cancel_button) button_layout.addWidget(self.ok_button) v_layout.addLayout(grid_layout) v_layout.addWidget(self.message) v_layout.addLayout(button_layout) self.drive_combo.currentIndexChanged.connect(self.on_drive_changed) self.root_line_edit.textChanged.connect(self.on_root_edited) self.cancel_button.clicked.connect(self.on_cancel_clicked) self.ok_button.clicked.connect(self.on_copy_clicked) self.get_available_drives()
def __init__(self, parent=None, path_object=None): QtWidgets.QWidget.__init__(self, parent) if path_object: self.path_object = path_object else: print 'No Path Object found, exiting' return self.project_management = CONFIG['account_info']['project_management'] self.schema = CONFIG['project_management'][ self.project_management]['api']['default_schema'] self.schema_dict = CONFIG['project_management'][ self.project_management]['tasks'][self.schema] self.path_object_next = None self.panel = QtWidgets.QVBoxLayout(self) h_layout = QtWidgets.QHBoxLayout() self.title = 'Import to %s' % path_object.project self.task = None self.version = '000.000' self.latest_version = '000.000' self.user = None self.resolution = None self.root = None self.company = None self.project = None self.data_frame = None self.width_hint = 1300 self.height_hint = 1200 self.current_selection = None self.path_object.set_attr(scope='IO') self.path_object.set_attr(ingest_source='*') self.data_frame = None self.pandas_path = '' self.io_statuses = ['Imported', 'Tagged', 'Published'] self.file_tree = LJTreeWidget(self) #self.width_hint = self.file_tree.width_hint pixmap = QtGui.QPixmap(icon_path('back24px.png')) import_empty_icon = QtGui.QIcon(pixmap) self.source_widget = LJListWidget('Sources', pixmap=None) self.ingest_widget = LJListWidget('Ingests', pixmap=None, empty_state_text='Select Source', empty_state_icon=import_empty_icon) # self.import_events.hide()f self.tags_title = QtWidgets.QLineEdit( "<b>Select File(s) or Folder(s) to tag</b>") self.tags_title.setReadOnly(True) self.tags_title.setProperty('class', 'feedback') self.tags_button = QtWidgets.QPushButton('View Publish') self.tags_button.setProperty('class', 'basic') self.tags_button.setMaximumWidth(180) self.tags_title_row = QtWidgets.QHBoxLayout() self.tags_title_row.addWidget(self.tags_title) self.tags_title_row.addWidget(self.tags_button) self.tags_button.hide() self.scope_label = QtWidgets.QLabel('Scope') self.scope_combo = AdvComboBox() self.scope_combo.addItems(['', 'assets', 'shots']) self.seq_row = QtWidgets.QHBoxLayout() self.seq_row.addWidget(self.scope_label) self.seq_row.addWidget(self.scope_combo) self.feedback_area = QtWidgets.QLabel('') self.seq_label = QtWidgets.QLabel('Seq ') self.seq_combo = AdvComboBox() self.seq_row.addWidget(self.seq_label) self.seq_row.addWidget(self.seq_combo) self.shot_label = QtWidgets.QLabel('Shot') self.shot_combo = AdvComboBox() self.seq_row.addWidget(self.shot_label) self.seq_row.addWidget(self.shot_combo) self.task_label = QtWidgets.QLabel('Task') self.task_combo = AdvComboBox() self.task_combo.setEditable(False) self.seq_row.addWidget(self.task_label) self.seq_row.addWidget(self.task_combo) self.tags_label = QtWidgets.QLabel("Tags") self.tags_label.setWordWrap(True) self.tags_label.setMaximumWidth(100) self.tags_line_edit = QtWidgets.QLineEdit() self.tags_row = QtWidgets.QHBoxLayout() self.tags_row.addWidget(self.tags_label) self.tags_row.addWidget(self.tags_line_edit) # create buttons row self.buttons_row = QtWidgets.QHBoxLayout() self.publish_button = QtWidgets.QPushButton('Publish Selected') self.view_in_lumbermill = QtWidgets.QPushButton('View in Lumbermill') self.view_in_lumbermill.setMinimumWidth(220) self.refresh_button = QtWidgets.QPushButton('Refresh') self.refresh_button.hide() self.publish_button.setProperty('class', 'basic') self.view_in_lumbermill.setProperty('class', 'basic') self.refresh_button.setProperty('class', 'basic') self.buttons_row.addStretch(1) self.buttons_row.addWidget(self.refresh_button) self.buttons_row.addWidget(self.view_in_lumbermill) self.buttons_row.addWidget(self.publish_button) self.empty_state = EmptyStateWidgetIO(path_object=self.path_object) self.empty_state.setText( 'Select a Source:\n Click + to Create a new one') self.progress_bar = ProgressGif() self.progress_bar.hide() self.view_in_lumbermill.hide() h_layout.addWidget(self.source_widget) h_layout.addWidget(self.ingest_widget) self.panel.addLayout(h_layout) self.panel.addWidget(self.file_tree) self.panel.addWidget(self.empty_state) self.panel.addLayout(self.tags_title_row) self.panel.addWidget(self.progress_bar) self.panel.addLayout(self.seq_row) self.panel.addLayout(self.tags_row) self.panel.addLayout(self.buttons_row) self.panel.addWidget(self.feedback_area) self.panel.addStretch(1) self.load_companies() self.ingest_widget.empty_state.show() self.ingest_widget.list.hide() self.hide_tags() self.file_tree.hide() self.view_in_lumbermill.clicked.connect( self.on_view_in_lumbermill_clicked) self.refresh_button.clicked.connect(self.on_ingest_selected) self.scope_combo.currentIndexChanged.connect(self.on_scope_changed) self.seq_combo.currentIndexChanged.connect(self.on_seq_changed) self.file_tree.selected.connect(self.on_file_selected) self.seq_combo.currentIndexChanged.connect(self.edit_data_frame) self.shot_combo.currentIndexChanged.connect(self.edit_data_frame) self.task_combo.currentIndexChanged.connect(self.edit_data_frame) self.tags_line_edit.textChanged.connect(self.edit_tags) self.source_widget.add_button.clicked.connect( self.on_source_add_clicked) self.source_widget.list.clicked.connect(self.on_source_selected) self.ingest_widget.list.clicked.connect(self.on_ingest_selected) self.ingest_widget.add_button.clicked.connect(self.on_add_ingest_event) self.publish_button.clicked.connect(self.publish_selected_asset) self.empty_state.files_added.connect(self.new_files_dragged) logging.info('Testing the popup') self.on_scope_changed()
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()
def __init__(self, show_import=False, user_info=None, start_time=None, previous_path=None): LJMainWindow.__init__(self) if start_time: print 'Finished Loading Modules in %s seconds' % (time.time() - start_time) self.user_config = UserConfig().d if previous_path: self.previous_path = previous_path self.previous_paths = [] else: self.previous_path = self.user_config['previous_path'] self.previous_paths = self.user_config['previous_paths'] self.filter = 'Everything' self.project_management = CONFIG['account_info']['project_management'] self.user_info = '' self.user_email = '' self.user_name = '' self.company = '' self.pd_menus = {} self.menu_dict = {} self.menus = {} self.setCentralWidget( CGLumberjackWidget(self, project_management=self.project_management, user_email=user_info['login'], company=self.company, path=self.previous_path, radio_filter=self.filter, show_import=show_import)) if user_info['first']: self.setWindowTitle('Lumbermill - Logged in as %s' % user_info['first']) else: self.setWindowTitle('Lumbermill - Logged in as %s' % user_info['login']) self.status_bar = QtWidgets.QStatusBar() self.setStatusBar(self.status_bar) # Load Style Sheet and set up Styles: w = 400 h = 500 self.resize(w, h) self.menu_bar = self.menuBar() self.two_bar = self.menuBar() icon = QtGui.QPixmap(":/images/lumberjack.24px.png").scaled(24, 24) self.setWindowIcon(icon) login = QtWidgets.QAction('login', self) time_tracking = QtWidgets.QAction('time', self) proj_man = QtWidgets.QAction('%s' % self.project_management, self) update_button = QtWidgets.QAction('Check For Updates', self) report_bug_button = QtWidgets.QAction('Report Bug', self) request_feature_button = QtWidgets.QAction('Request Feature', self) tools_menu = self.menu_bar.addMenu('&Tools') sync_menu = self.menu_bar.addMenu('&Sync') if self.project_management != 'lumbermill': self.proj_man_link = self.two_bar.addAction(proj_man) self.login_menu = self.two_bar.addAction(login) self.two_bar.addAction(time_tracking) settings = QtWidgets.QAction('Settings', self) open_globals = QtWidgets.QAction('Go to Company Globals', self) open_user_globals = QtWidgets.QAction('Go to User Globals', self) create_project = QtWidgets.QAction('Import .csv', self) settings.setShortcut('Ctrl+,') pipeline_designer = QtWidgets.QAction('Pipeline Designer', self) set_up_sync_thing_server = QtWidgets.QAction('Set up Server', self) set_up_sync_thing_workstation = QtWidgets.QAction( 'Set Up Workstation', self) check_machines_action = QtWidgets.QAction('Check for new Machines', self) add_machines_to_folders = QtWidgets.QAction( 'Share Folders With Machines', self) pull_from_server = QtWidgets.QAction('Pull from Server', self) manage_sharing_action = QtWidgets.QAction('Manage Sharing', self) launch_syncthing = QtWidgets.QAction('Relaunch Sync', self) kill_syncthing = QtWidgets.QAction('Kill Sync', self) fix_paths = QtWidgets.QAction('Fix File Paths', self) # add actions to the file menu tools_menu.addAction(settings) tools_menu.addAction(open_globals) tools_menu.addAction(open_user_globals) tools_menu.addSeparator() tools_menu.addAction(create_project) tools_menu.addAction(pipeline_designer) tools_menu.addSeparator() tools_menu.addAction(update_button) tools_menu.addAction(report_bug_button) tools_menu.addAction(request_feature_button) # connect signals and slots sync_menu.addAction(manage_sharing_action) sync_menu.addSeparator() sync_menu.addAction(set_up_sync_thing_server) sync_menu.addAction(check_machines_action) sync_menu.addAction(add_machines_to_folders) sync_menu.addSeparator() sync_menu.addAction(set_up_sync_thing_workstation) sync_menu.addAction(pull_from_server) sync_menu.addAction(fix_paths) sync_menu.addSeparator() sync_menu.addAction(kill_syncthing) sync_menu.addAction(launch_syncthing) # connect signals and slots kill_syncthing.triggered.connect(self.on_kill_syncthing) launch_syncthing.triggered.connect(self.on_launch_syncthing) pull_from_server.triggered.connect( self.enable_server_connection_clicked) check_machines_action.triggered.connect( self.check_for_machines_clicked) sync_menu.triggered.connect(self.add_machines_to_folders_clicked) manage_sharing_action.triggered.connect( self.manage_sharing_action_clicked) set_up_sync_thing_server.triggered.connect( self.set_up_st_server_clicked) set_up_sync_thing_workstation.triggered.connect( self.set_up_st_workstation_clicked) fix_paths.triggered.connect(self.fix_paths_clicked) open_globals.triggered.connect(self.open_company_globals) open_user_globals.triggered.connect(self.open_user_globals) create_project.triggered.connect(self.open_create_project_dialog) settings.triggered.connect(self.on_settings_clicked) pipeline_designer.triggered.connect(self.on_menu_designer_clicked) login.triggered.connect(self.on_login_clicked) proj_man.triggered.connect(self.on_proj_man_menu_clicked) update_button.triggered.connect(self.update_lumbermill_clicked) report_bug_button.triggered.connect(self.report_bug_clicked) request_feature_button.triggered.connect(self.feature_request_clicked) time_tracking.triggered.connect(self.time_tracking_clicked) # Load any custom menus that the user has defined self.load_pipeline_designer_menus()
def __init__(self, parent=None, project_management=None, user_email=None, company=None, path=None, radio_filter=None, show_import=False): QtWidgets.QWidget.__init__(self, parent) try: font_db = QtGui.QFontDatabase() font_db.addApplicationFont( os.path.join(cglpath.font_path(), 'ARCADECLASSIC.TTF')) font_db.addApplicationFont( os.path.join(cglpath.font_path(), 'ka1.ttf')) except AttributeError: logging.error('Skipping Loading Fonts - possible Pyside2 issue') # Environment Stuff self.show_import = show_import self.user_email = user_email self.company = company self.project_management = project_management self.root = CONFIG['paths']['root'] # Company Specific self.user_root = CONFIG['cg_lumberjack_dir'] self.context = 'source' self.path_object = None self.panel = None self.radio_filter = radio_filter self.source_selection = [] self.setMinimumWidth(840) self.setMinimumHeight(800) self.frame_range = None self.layout = QtWidgets.QVBoxLayout(self) self.setContentsMargins(0, 0, 0, 0) self.layout.setContentsMargins(0, 0, 0, 0) if path: try: self.path_object = cglpath.PathObject(path) if self.path_object.context == 'render': self.path_object.set_attr(context='source') self.path_object.set_attr(resolution=None) self.path_object.set_attr(version=None) self.path_object.set_attr(user='') if not self.path_object.task: self.path_object.set_attr(task='*') self.path_object.set_attr(filename='') self.path_object.set_attr(ext='') except IndexError: logging.error('Path is not set') pass else: self.path_object = cglpath.PathObject(self.root) # self.project = '*' self.scope = 'assets' self.shot = '*' self.seq = '*' self.ingest_source = '*' if self.path_object: if self.path_object.project: self.project = self.path_object.project if self.path_object.scope: self.scope = self.path_object.scope if self.path_object.shot: self.shot = self.path_object.shot if self.path_object.seq: self.seq = self.path_object.seq self.user_favorites = '' self.task = '' self.resolution = '' self.in_file_tree = None self.nav_widget = NavigationWidget(path_object=self.path_object) self.path_widget = PathWidget(path_object=self.path_object) self.progress_bar = ProgressGif() self.progress_bar.hide() # self.nav_widget.update_buttons() self.path_widget.update_path(path_object=self.path_object) self.nav_widget.location_changed.connect(self.update_location) self.nav_widget.refresh_button_clicked.connect( self.update_location_to_latest) self.nav_widget.my_tasks_clicked.connect(self.show_my_tasks) self.nav_widget.location_changed.connect(self.path_widget.update_path) self.layout.addWidget(self.nav_widget) self.update_location(self.path_object)
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)
def __init__(self, parent=None, software=None, menu_type='menus', menu_name='', menu=None, menu_path=''): QtWidgets.QWidget.__init__(self, parent) # initialize variables self.menu_type = menu_type if self.menu_type == 'shelves': self.singular = 'shelf' elif self.menu_type == 'menus': self.singular = 'menu' elif self.menu_type == 'preflights': self.singular = 'preflight' elif self.menu_type == 'context-menus': self.singular = 'context-menu' else: self.singluar = 'not defined' self.software = software self.menu = menu self.menu_name = menu_name self.menu_path = menu_path self.new_button_widget = None # create layouts layout = QtWidgets.QVBoxLayout(self) title_layout = QtWidgets.QHBoxLayout() if menu_type != 'shelves': self.buttons_tab_widget = LJTabWidget() self.buttons_tab_widget.setProperty('class', 'vertical') self.buttons_tab_widget.tabBar().setProperty('class', 'vertical') else: self.buttons_tab_widget = QtWidgets.QTabWidget() self.title = '' if self.menu_type == 'menus': self.title = QtWidgets.QLabel('%s %s Buttons: (Drag to Reorder)' % (self.menu_name, self.menu_type.title())) elif self.menu_type == 'preflights': self.title = QtWidgets.QLabel('%s %s Steps: (Drag to Reorder)' % (self.menu_name, self.menu_type.title())) elif self.menu_type == 'shelves': self.title = QtWidgets.QLabel('%s Shelf Buttons: (Drag to Reorder)' % self.menu_name) elif self.menu_type == 'context-menus': self.title = QtWidgets.QLabel('Context Menu Buttons: (Drag to Reorder)') self.title.setProperty('class', 'title') if self.menu_type == 'shelves': self.add_button = QtWidgets.QPushButton('add shelf button') self.import_menu_button = QtWidgets.QPushButton('import shelf button') elif self.menu_type == 'preflights': self.add_button = QtWidgets.QPushButton('add preflight step') self.import_menu_button = QtWidgets.QPushButton('import preflight step') else: self.add_button = QtWidgets.QPushButton('add %s button' % self.singular) self.import_menu_button = QtWidgets.QPushButton('import %s button' % self.singular) self.add_submenu_button = QtWidgets.QPushButton('add submenu') self.add_submenu_button.hide() self.import_menu_button.hide() self.add_button.setProperty('class', 'add_button') self.add_submenu_button.setProperty('class', 'add_button') self.import_menu_button.setProperty('class', 'add_button') # set parameters self.buttons_tab_widget.setMovable(True) # layout the widget title_layout.addWidget(self.title) title_layout.addWidget(self.add_submenu_button) title_layout.addWidget(self.import_menu_button) title_layout.addWidget(self.add_button) title_layout.addStretch(1) layout.addLayout(title_layout) layout.addWidget(self.buttons_tab_widget) # connect SIGNALS and SLOTS self.add_button.clicked.connect(self.on_add_menu_button) self.add_submenu_button.clicked.connect(self.on_submenu_button_clicked) self.import_menu_button.clicked.connect(self.on_import_menu_button_clicked) self.load_buttons()
def __init__(self, parent=None, path_object=None): QtWidgets.QFrame.__init__(self, parent) if path_object: self.path_object = path_object else: return self.setProperty('class', 'light_grey') self.my_tasks_button = QtWidgets.QPushButton() self.my_tasks_button.setToolTip('My Tasks') tasks_icon = os.path.join(cglpath.icon_path(), 'star24px.png') self.my_tasks_button.setProperty('class', 'grey_border') self.my_tasks_button.setIcon(QtGui.QIcon(tasks_icon)) self.my_tasks_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.refresh_button = QtWidgets.QPushButton() self.refresh_button.setToolTip('Refresh') refresh_icon = os.path.join(cglpath.icon_path(), 'spinner11.png') self.refresh_button.setProperty('class', 'grey_border') self.refresh_button.setIcon(QtGui.QIcon(refresh_icon)) self.refresh_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.ingest_button = QtWidgets.QPushButton() self.ingest_button.setToolTip('My Tasks') self.ingest_button.setProperty('class', 'grey_border') ingest_icon = os.path.join(cglpath.icon_path(), 'ingest24px.png') self.ingest_button.setIcon(QtGui.QIcon(ingest_icon)) self.ingest_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.back_button = QtWidgets.QPushButton() self.back_button.setToolTip('Go back') self.projects_button = QtWidgets.QPushButton() self.projects_button.setToolTip('Go to Projects') self.companies_button = QtWidgets.QPushButton() self.companies_button.setToolTip('Go to Companies') self.my_tasks_button.setProperty('class', 'grey_border') self.back_button.setStyleSheet("background: transparent;") self.projects_button.setStyleSheet("background: transparent;") self.companies_button.setStyleSheet("background: transparent;") back_icon = os.path.join(cglpath.icon_path(), 'back24px.png') home_icon = os.path.join(cglpath.icon_path(), 'project24px.png') company_icon = os.path.join(cglpath.icon_path(), 'company24px.png') self.back_button.setIcon(QtGui.QIcon(back_icon)) self.back_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.companies_button.setIcon(QtGui.QIcon(company_icon)) self.companies_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.projects_button.setIcon(QtGui.QIcon(home_icon)) self.projects_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.current_location_line_edit = QtWidgets.QLineEdit() self.current_location_line_edit.setReadOnly(True) self.current_location_line_edit.setMinimumHeight(ICON_WIDTH * 1.28) self.current_location_line_edit.hide() self.search_box = LJSearchEdit(self) layout = QtWidgets.QVBoxLayout(self) self.cl_row = QtWidgets.QHBoxLayout() self.cl_row.addWidget(self.back_button) self.cl_row.addWidget(self.companies_button) self.cl_row.addWidget(self.projects_button) self.cl_row.addWidget(self.my_tasks_button) self.cl_row.addWidget(self.refresh_button) self.cl_row.addWidget(self.search_box) self.cl_row.addWidget(self.ingest_button) layout.addLayout(self.cl_row) layout.addWidget(self.current_location_line_edit) self.my_tasks_button.clicked.connect(self.my_tasks_pressed) self.ingest_button.clicked.connect(self.ingest_clicked) self.refresh_button.clicked.connect(self.refresh_clicked) self.back_button.clicked.connect(self.back_button_pressed) self.companies_button.clicked.connect(self.buttons_pressed) self.projects_button.clicked.connect(self.buttons_pressed) self.set_text(self.path_object.path_root)
def copy_settings(self): """ Settings for pycharm editor will already be setup by onboarding setup script :return: """ githook_file = os.path.join(ROOT, 'resources', 'githooks', 'post-checkout') destination_file = os.path.join(ROOT, '.git', 'hooks', 'post-checkout') shutil.copy(githook_file, destination_file) def edit_xml(self, user_id, project_id): xml_file = os.path.join(ROOT, 'resources', 'pycharm_setup', 'workspace.xml') docs = load_xml(xml_file) for item in docs['project']['component']: if item['@name'] == "TaskManager": item['servers']['Generic']['username'] = user_id # print item['servers']['Generic']['username'] for element in item['servers']['Generic']['option']: if element['@name'] == "templateVariables": element['list']['TemplateVariable'][0]['option'][1]['@value'] = project_id # print element['list']['TemplateVariable'][0]['option'][1]['@value'] idea_xml = os.path.join(ROOT, '.idea', 'workspace.xml') save_xml(idea_xml, docs) if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) s = SetupGUI() s.show() app.exec_()