def set_up_lumbermill(self): """ checks s3 for the existance of a globals file and pipeline_designer files. :return: """ # step 1 - download the globals self.download_globals_from_cloud() # Step 2: replace ROOT, and CODEROOT instances in the globals file # Step 3: Copy the edited globals file to the default location self.edit_globals_paths() # Step 3b: Create Default User Globals create_user_globals(self.default_user_globals, self.default_globals) # Step 4: Copy the published CGL_TOOLS to the default location # Step 5: Import any Projects # Step 6: Set up Syncthing self.setup_syncthing() from cgl.ui.widgets.dialog import InputDialog dialog = InputDialog( title='Sync Message', message= 'Your Machine has be submitted for approval for file sharing\n' 'After you have been added, click:\n' ' Sync> Pull From Server\n' 'and you will start syncing folders') dialog.exec_()
def on_delete_menu_clicked(self): index = self.menus.currentIndex() menu_name = self.menus.tabText(index) dialog = InputDialog(title='Delete %s?' % menu_name, message='Are you sure you want to delete %s' % menu_name) dialog.exec_() if dialog.button == 'Ok': self.menus.removeTab(index)
def on_publish_clicked(self): print 'Publishing stuff now' current = PathObject(self.current_location) current.publish() dialog = InputDialog(title='Publish Successful', message='Publish Files at: \n%s' % current.publish_render) dialog.exec_()
def run(): if nuke.selectedNodes(): print 'found selected' if nuke.selectedNodes()[0].Class() == 'Write': print 'launching preflight' preflight.launch_('render') return print 'seinding dialog' dialog = InputDialog(message='Please Select a Valid Write Node to Render') dialog.exec_()
def on_create_company(self): dialog = InputDialog(title='Create Company', message='Enter the name for the company:', line_edit=True) dialog.exec_() if dialog.button == 'Ok': company = dialog.line_edit.text() self.path_object.set_attr(company=company) CreateProductionData(self.path_object, project_management='lumbermill') self.load_companies()
def on_new_software_clicked(self): dialog = InputDialog(title='Add Software', message='Enter or Choose Software', combo_box_items=['', 'lumbermill', 'nuke', 'maya'], regex='[a-zA-Z0-0]{3,}', name_example='Only letters & Numbers Allowed Software Names') dialog.exec_() if dialog.button == 'Ok': software_name = dialog.combo_box.currentText() folder = os.path.join(self.cgl_tools, software_name) os.makedirs(folder) self.software_combo.addItem(software_name) num = self.software_combo.count() self.software_combo.setCurrentIndex(num)
def run(self): if cgl_nuke.check_write_node_version(): self.pass_check('Check Passed') else: dialog = InputDialog( title='Write Version does not match Scene Version', message='Would you like to render anyway?') dialog.exec_() if dialog.button == 'Ok': self.pass_check('Check Passed') else: print 'I made it here somehow' self.fail_check('Check Failed')
def on_add_menu_clicked(self): if self.type == 'preflights' or self.type == 'context-menus': if self.type == 'preflights': singular = 'preflight' elif self.type == 'context-menus': singular = 'Context Menu' elif self.type == 'shelves': singular = 'Shelf' dialog = InputDialog(title='Add %s' % singular, message='Choose Task to Create a %s For\n Or Type to Create Your Own' % singular, line_edit=False, combo_box_items=self.task_list, regex='[a-zA-Z]', name_example='Only letters & Numbers Allowed in %s Names' % singular) dialog.exec_() if dialog.button == 'Ok': long_name = dialog.combo_box.currentText() if long_name in self.schema['long_to_short']['assets']: menu_name = self.schema['long_to_short']['assets'][long_name] elif long_name in self.schema['long_to_short']['shots']: menu_name = self.schema['long_to_short']['shots'][long_name] else: menu_name = long_name self.do_add_menu(menu_name) elif self.type == 'menus' or self.type == 'shelves': dialog = InputDialog(title='Add %s' % self.singular, message='Create a Custom %s' % self.singular, line_edit=True) dialog.exec_() if dialog.button == 'Ok': menu_name = dialog.line_edit.text() self.do_add_menu(menu_name)
def on_create_project(self): if self.title == 'Projects': progress_bar = self.parent().progress_bar dialog = CreateProjectDialog(parent=None, variable='project') dialog.exec_() if dialog.button == 'Ok': project_name = dialog.proj_line_edit.text() self.path_object.set_attr(project=project_name) production_management = dialog.proj_management_combo.currentText( ) print self.path_object.path_root print production_management process_method(progress_bar, self.do_create_project, args=(progress_bar, self.path_object, production_management), text='Creating Project') self.path_object.set_attr(project='*') self.update_location() elif self.title == 'Companies': dialog = InputDialog(title='Create Company', message='Enter the name for the company:', line_edit=True) dialog.exec_() if dialog.button == 'Ok': company = dialog.line_edit.text() self.path_object.set_attr(company=company) CreateProductionData(self.path_object, project_management='lumbermill') self.load_companies()
def on_source_add_clicked(self): print self.path_object.scope dialog = InputDialog(title='Add Source Company or Gear', message='Add an Import Source:', line_edit=True, buttons=['Cancel', 'Add Source']) dialog.exec_() if dialog.button == 'Add Source': root_ = self.path_object.path_root.split(self.path_object.scope)[0] new_source = os.path.join(root_, 'IO', dialog.line_edit.text()) if not os.path.exists(new_source): os.makedirs(new_source) self.parent().parent().centralWidget( ).update_location_to_latest(self.path_object) else: print 'Source %s already exists!' % new_source
def on_add_menu_button(self): if self.menu_type == 'preflights': title_ = 'Add Preflight Step' message = 'Enter a Name for your Preflight Step' elif self.menu_type == 'menus': title_ = 'Add Menu' message = 'Enter a Name for your Menu Button' elif self.menu_type == 'shelves': title_ = 'Add Shelf' message = 'Enter a Name for your shelf button' elif self.menu_type == 'context-menus': title_ = 'Add Context Menu Item' message = 'Enter a name for your Context Menu Item' dialog = InputDialog(title=title_, message=message, line_edit=True, regex='^([A-Z][a-z]+)+$', name_example='class name must be CamelCase - ExamplePreflightName') dialog.exec_() if dialog.button == 'Ok': preflight_name = dialog.line_edit.text() command = self.get_command_text(button_name=preflight_name, menu_type=self.menu_type) module = self.default_preflight_text(preflight_name) if self.menu_type == 'preflights': attrs = {'label': preflight_name, 'name': preflight_name, 'required': 'True', 'module': module} elif self.menu_type == 'menus' or self.menu_type == 'context-menus': attrs = {'label': preflight_name, 'name': preflight_name, 'module': command} elif self.menu_type == 'shelves': attrs = {'label': preflight_name, 'module': command, 'name': preflight_name, 'icon': ''} self.new_button_widget = CGLMenuButton(parent=self.buttons_tab_widget, preflight_name=self.menu_name, preflight_step_name=dialog.line_edit.text(), attrs=attrs, preflight_path=self.menu_path, menu_type=self.menu_type) self.new_button_widget.save_all_signal.connect(self.on_save_clicked) if 'icon' in attrs.keys(): icon = QtGui.QIcon(attrs['icon']) index = self.buttons_tab_widget.addTab(self.new_button_widget, icon, preflight_name) else: index = self.buttons_tab_widget.addTab(self.new_button_widget, preflight_name) self.buttons_tab_widget.setCurrentIndex(index)
def setup_syncthing(self): """ :return: """ cgl_tools_folder = os.path.join(self.default_root, '_config', 'cgl_tools') if not os.path.exists(cgl_tools_folder): os.makedirs(cgl_tools_folder) sync_folders = { r'[root]\_config\cgl_tools': os.path.join(cgl_tools_folder) } # TODO - need to set 2nd value here as a global in globals. sync_sheet: LONE_COCONUT_SYNC_THING syncthing.setup_workstation() dialog = InputDialog( title='Sync Message', message= 'Your Machine has be submitted for approval for file sharing\n' 'After you have been added, click:\n' ' Sync> Sync From Server\n' 'and you will start syncing folders') dialog.exec_()
def do_update_check(widget, progress_bar, show_confirmation=False, print_output=True): if not check_for_latest_master(print_output=print_output): progress_bar.hide() dialog = InputDialog( title='Update Lumbermill', message= 'There is a new version of Lumbermill Available, would you like to update?', buttons=['Cancel', 'Update']) dialog.exec_() if dialog.button == 'Update': update_master() widget.close() else: progress_bar.hide() if show_confirmation: dialog = InputDialog(title='Up to date', message='Lumbermill is up to date!') dialog.exec_() if dialog.button == 'Ok' or dialog.button == 'Cancel': dialog.accept()
def on_assign_button_clicked(self, data): print data task = self.sender().task users_dict = CONFIG['project_management'][ self.project_management]['users'] all_users = [] for each in users_dict.keys(): all_users.append(each.lower()) dialog = InputDialog(title="%s Task Ownership" % task, combo_box_items=users_dict.keys(), message='Who are you assigning this Task?', buttons=['Cancel', 'Start']) index = dialog.combo_box.findText(current_user().lower()) if index != -1: dialog.combo_box.setCurrentIndex(index) dialog.exec_() if dialog.button == 'Start': selected_user = dialog.combo_box.currentText( ) # this denotes the OS login name of the user print selected_user user_info = CONFIG['project_management'][ self.project_management]['users'][selected_user] self.path_object.set_attr(task=task) self.path_object.set_attr(user=selected_user) self.path_object.set_attr(version='000.000') self.path_object.set_attr(resolution='high') self.path_object.set_attr(shot=data.shot) self.path_object.set_attr(seq=data.seq) self.path_object.set_attr(filename=None) self.path_object.set_attr(ext=None) self.path_object.set_attr(filename_base=None) CreateProductionData(path_object=self.path_object, project_management=self.project_management, user_login=user_info['login'], force_pm_creation=True) self.update_task_location(path_object=self.path_object)
def publish_clicked(self): from plugins.preflight.launch import launch_ from cgl.ui.widgets.publish_dialog import PublishDialog selection = cglpath.PathObject(self.path_widget.path_line_edit.text()) if not selection.filename or selection.context == 'source': dialog = InputDialog( title='Invalid Selection', message='Please select a valid file or sequence\nfrom ' 'the "Ready to Review/Publish" Section') dialog.exec_() else: task = selection.task dialog = PublishDialog(path_object=selection) dialog.do_publish.connect(lambda: launch_( self, task, selection, do_review=dialog.do_review)) dialog.exec_()
def on_create_asset(self): if self.current_location['scope'] == 'IO': dialog = InputDialog(self, title='Create Input Company', message='Enter the CLIENT or name of VENDOR', combo_box_items=['CLIENT']) dialog.exec_() self.current_location[ 'ingest_source'] = dialog.combo_box.currentText() ingest_source_location = PathObject( self.current_location).path_root if ingest_source_location.endswith(dialog.combo_box.currentText()): CreateProductionData(self.current_location, json=False) else: from apps.lumbermill.elements import asset_creator if 'asset' in self.current_location: task_mode = True else: task_mode = False dialog = asset_creator.AssetCreator( self, path_dict=self.current_location, task_mode=task_mode) dialog.exec_()
def on_submenu_button_clicked(): dialog = InputDialog(title="Feature In Progress", message="This button will allow you to create a submenu!") dialog.exec_() if dialog.button == 'Ok' or dialog.button == 'Cancel': dialog.accept()
def on_import_menu_button_clicked(): dialog = InputDialog(title="Feature In Progress", message="This button will allow you to import buttons/preflights from other menus") dialog.exec_() if dialog.button == 'Ok' or dialog.button == 'Cancel': dialog.accept()
def do_review(progress_bar=None, path_object=None): import shutil import logging from cgl.core.utils.general import cgl_copy from cgl.ui.widgets.dialog import InputDialog job_id = None if not path_object: print 'No Valid PathObject() found for review' return None else: selection = path_object selection.set_preview_path() selection.set_hd_proxy_path() # selection.set_path() if os.path.isdir(selection.path_root): print 'Choose a sequence or file' return if not os.path.exists(selection.preview_path): print('No Web Preview Found, creating one') job_info = selection.make_preview() job_id = job_info['job_id'] if selection.context == 'render': # lin_images = ['exr', 'dpx'] # LUMBERMILL REVIEWS if PROJ_MANAGEMENT == 'lumbermill': # do this for movies print 'Lumbermill Not connected to review features' # FTRACK REVIEWS elif PROJ_MANAGEMENT == 'ftrack': if selection.filename: if selection.file_type == 'folder' or not selection.file_type: dialog = InputDialog( title='Error: unsupported folder or file_type', message= "%s is a folder or undefined file_type\nunsure how to proceed" % selection.filename) dialog.exec_() if dialog.button == 'Ok' or dialog.button == 'Cancel': dialog.accept() return else: selection.upload_review(job_id=job_id) # CreateProductionData(selection) else: print('Select file for Review') elif PROJ_MANAGEMENT == 'shotgun': if selection.filename: if selection.file_type == 'folder' or not selection.file_type: dialog = InputDialog( title='Error: unsupported folder or file_type', message= "%s is a folder or undefined file_type\nunsure how to proceed" % selection.filename) dialog.exec_() if dialog.button == 'Ok' or dialog.button == 'Cancel': dialog.accept() return else: if os.path.exists(selection.preview_path): print 1 CreateProductionData(path_object=selection) else: selection.upload_review(job_id=job_id) else: print('Select file for Review') else: print('%s is an unknown project management type' % PROJ_MANAGEMENT) selection.set_attr(filename='') selection.set_attr(ext='') else: dialog = InputDialog(title="Prep for Review", message="Move or copy files to review area?", buttons=['Move', 'Copy']) dialog.exec_() move = False if dialog.button == 'Move': move = True if selection.file_type == 'sequence': # sequence_name = selection.filename from_path = os.path.dirname(selection.path_root) to_object = PathObject(from_path) to_object.set_attr(context='render') for each in os.listdir(from_path): from_file = os.path.join(from_path, each) to_file = os.path.join(to_object.path_root, each) if move: shutil.move(from_file, to_file) else: cgl_copy(from_file, to_file) selection.set_attr(filename='') selection.set_attr(ext='') else: to_object = PathObject.copy(selection, context='render') logging.info('Copying %s to %s' % (selection.path_root, to_object.path_root)) if move: shutil.move(selection.path_root, to_object.path_root) else: cgl_copy(selection.path_root, to_object.path_root) selection.set_attr(filename='') selection.set_attr(ext='') if progress_bar: progress_bar.hide() return True