Ejemplo n.º 1
0
 def test_CreateProject(self, skipTest=False):
     logging.debug('test_CreateProject %s' % skipTest)
     
     proj_file = '%stest.db' % self.test_tmp_dir
     proj = Project(self.test_config, self.taxonomy)
     proj.set_project_path(proj_file)
     proj.operator_options = self.operator_options        
     if skipTest:
         return (proj, proj_file)
     
     # clean up
     del proj
     os.remove(proj_file)
Ejemplo n.º 2
0
 def openProjectFile(self, path_to_file):
     """ 
     load project from given path
     shows error if path does not exist 
     """
     # NOTE: set_project_path will create new project if path_to_file
     #       does not exist, os.path.exists check is not optional
     if os.path.exists(path_to_file):
         # read file to create project
         project = Project(self.app_config, self.taxonomy)
         project.set_project_path(path_to_file)
         project.sync(SyncModes.Read)
         # open project and sync UI        
         self.setProject(project)
Ejemplo n.º 3
0
    def createWizard(self):
        try:
            # should not update preview while using wizard
            self.setVisible(False)
            self.previewInput = False

            wizard = WidgetDataWizard(self,
                                      Project(self.app_config, self.taxonomy))
            if wizard.exec_() == QDialog.Accepted:
                # setProject makes call to GIS component that requires visibility
                self.setVisible(True)
                self.previewInput = True
                self.setProject(wizard.project)
                self.ui.statusbar.showMessage(
                    get_ui_string("app.status.project.created"))
            # else
            # do nothing?
        except:
            pass
        finally:
            # return to normal window
            # these calls are reached
            # 1. in case any exception occurs,
            # 2. wizard finished or cancelled
            self.setVisible(True)
            self.previewInput = True
Ejemplo n.º 4
0
 def createBlank(self):
     """ create a new project """
     # create new project file
     project = Project(self.app_config, self.taxonomy)
     # open project and sync UI
     self.setProject(project, skipVerify=True)
     self.ui.statusbar.showMessage(
         get_ui_string("app.status.project.created"))
Ejemplo n.º 5
0
 def test_LoadProject(self, skipTest=False):
     logging.debug('test_LoadProject %s' % skipTest)
     
     proj = Project(self.test_config, self.taxonomy)
     proj.set_project_path(self.proj_file)
     proj.sync(SyncModes.Read)
     if skipTest:
         return proj
Ejemplo n.º 6
0
 def openProjectFile(self, path_to_file):
     """ 
     load project from given path
     shows error if path does not exist 
     """
     # NOTE: set_project_path will create new project if path_to_file
     #       does not exist, os.path.exists check is not optional
     if os.path.exists(path_to_file):
         # read file to create project
         project = Project(self.app_config, self.taxonomy)
         project.set_project_path(path_to_file)
         project.sync(SyncModes.Read)
         # open project and sync UI
         self.setProject(project)
Ejemplo n.º 7
0
 def test_BuildExposure(self):
     logging.debug('test_BuildWorkflow')        
     
     logAPICall.setLevel(logAPICall.DEBUG_L2)
     
     # create temp dir for project data
     proj_tmp_dir = '%s/%s/' % (self.test_tmp_dir, get_random_name())
     if not os.path.exists(proj_tmp_dir):
         os.mkdir(proj_tmp_dir)
     
     proj = Project(self.test_config, self.taxonomy)
     proj.set_project_path(self.proj_file3)
     proj.sync(SyncModes.Read)
     
     proj.operator_options['tmp_dir'] = proj_tmp_dir
     proj.temp_dir = proj_tmp_dir
     proj.fp_file = self.fp_path 
     proj.survey_file = self.survey_path 
     proj.zone_file = self.zone_path 
     
     proj.verify_data()
     proj.build_exposure()
     self.assertTrue(os.path.exists(proj.exposure_file))
     del proj