示例#1
0
    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()
示例#2
0
    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!" )
示例#3
0
    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()
示例#4
0
    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 )
示例#5
0
    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)
示例#6
0
    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!")