def load_projects(self): try: project_startup = utilities.load_json_file(STARTUP_LOCATION) utilities.window_stay_on_top(project_startup['window_stay_on_top'], self.main_ui) self.window_stay_on_top_action.setChecked( project_startup['window_stay_on_top']) except: pass if os.path.exists(DATA_PATH): for data_file in os.listdir(DATA_PATH): try: data = data_file.split('.')[-1] if data == 'project': project_name = data_file.split('.')[:-1][0] utilities.add_remove_combo(self.project_combo, add=True, data=project_name) except: pass if os.path.exists(STARTUP_LOCATION): try: project_number = utilities.search_combo_items( self.project_combo, project_startup['main_project']) self.project_combo.setCurrentIndex(project_number) except: pass self.set_project_dir()
def add_project( self ): project_name = str( PyQt4.QtGui.QInputDialog.getText( self, 'Input Dialog', 'Project Name:' )[0] ) # @UndefinedVariable existing_projects = utilities.get_combo_items( self.project_combo ) if any( i in project_name for i in existing_projects ) == False: if project_name != '': project_dir = PyQt4.QtGui.QFileDialog.getExistingDirectory( self, 'Set Project Folder' ) if project_dir != '': utilities.add_remove_combo( self.project_combo, add = True, data = project_name ) project_dir = project_dir.replace( "\\", '/' ) self.create_project_file( project_name, project_dir ) utilities.set_line( self.dir_line, '{0}/'.format( project_dir ) ) self.message_report( error_level = 0, message = "Project is set to {0}".format( project_dir ) ) else: self.message_report( error_level = 2, message = "Name is invalid!" ) else: self.message_report( error_level = 2, message = "Directory is invalid!" ) else: self.message_report( error_level = 2, message = "This project already exists!" )
def load_projects( self ): try: project_startup = utilities.load_json_file( STARTUP_LOCATION ) utilities.window_stay_on_top( project_startup['window_stay_on_top'], self.main_ui ) self.window_stay_on_top_action.setChecked( project_startup['window_stay_on_top'] ) except: pass if os.path.exists( DATA_PATH ): for data_file in os.listdir( DATA_PATH ): try: data = data_file.split( '.' )[-1] if data == 'project': project_name = data_file.split( '.' )[:-1][0] utilities.add_remove_combo( self.project_combo, add = True, data = project_name ) except: pass if os.path.exists( STARTUP_LOCATION ): try: project_number = utilities.search_combo_items( self.project_combo, project_startup['main_project'] ) self.project_combo.setCurrentIndex( project_number ) except: pass self.set_project_dir()
def remove_project( self ): project_name = str( self.project_combo.currentText() ) if project_name != "": dialog_value = utilities.yes_no_dialog( self, 'Delete Project', 'Are you sure you want to remove {0} project?'.format( project_name ) ) if dialog_value: project_file = '{0}{1}.project'.format( DATA_PATH, project_name ) if os.path.isfile( project_file ): try: os.remove( project_file ) except: pass utilities.add_remove_combo( self.project_combo, remove = True )
def remove_project(self): project_name = str(self.project_combo.currentText()) if project_name != "": dialog_value = utilities.yes_no_dialog( self, 'Delete Project', 'Are you sure you want to remove {0} project?'.format( project_name)) if dialog_value: project_file = '{0}{1}.project'.format(DATA_PATH, project_name) if os.path.isfile(project_file): try: os.remove(project_file) except: pass utilities.add_remove_combo(self.project_combo, remove=True)
def add_project(self): project_name = str( PyQt4.QtGui.QInputDialog.getText( self, 'Input Dialog', 'Project Name:')[0]) # @UndefinedVariable existing_projects = utilities.get_combo_items(self.project_combo) if any(i in project_name for i in existing_projects) == False: if project_name != '': project_dir = PyQt4.QtGui.QFileDialog.getExistingDirectory( self, 'Set Project Folder') if project_dir != '': utilities.add_remove_combo(self.project_combo, add=True, data=project_name) project_dir = project_dir.replace("\\", '/') self.create_project_file(project_name, project_dir) utilities.set_line(self.dir_line, '{0}/'.format(project_dir)) self.message_report( error_level=0, message="Project is set to {0}".format(project_dir)) else: self.message_report(error_level=2, message="Name is invalid!") else: self.message_report(error_level=2, message="Directory is invalid!") else: self.message_report(error_level=2, message="This project already exists!")