def getLastOpenDir(self): """ retrieve remembered path """ last_dir = self.settings.value('LAST_OPEN_DIR').toString() if last_dir is None: return get_app_dir() else: return str(last_dir)
def saveProjAs(self): if self.project is None: return filename = QFileDialog.getSaveFileName(self, get_ui_string("app.window.msg.project.create"), get_app_dir(), get_ui_string("app.extension.db")) # no need to check for file overwrite, because QFileDialog return always confirmed overwrite if not filename.isNull(): filename = str(filename) self.project.set_project_path(filename) self.project.sync(SyncModes.Write) self.saveLastOpenDir(filename[0:filename.rfind("/")]) self.ui.statusbar.showMessage(get_ui_string("app.status.project.saved"))
def saveProjAs(self): if self.project is None: return filename = QFileDialog.getSaveFileName( self, get_ui_string("app.window.msg.project.create"), get_app_dir(), get_ui_string("app.extension.db")) # no need to check for file overwrite, because QFileDialog return always confirmed overwrite if not filename.isNull(): filename = str(filename) self.project.set_project_path(filename) self.project.sync(SyncModes.Write) self.saveLastOpenDir(filename[0:filename.rfind("/")]) self.ui.statusbar.showMessage( get_ui_string("app.status.project.saved"))
# field names for GIS shapefiles GID_FIELD_NAME = "GID" LON_FIELD_NAME = "LON" LAT_FIELD_NAME = "LAT" HT_FIELD_NAME = "HT" ZONE_FIELD_NAME = "ZONE" TAX_FIELD_NAME = "TAXONOMY" CNT_FIELD_NAME = "NUM_BLDGS" AREA_FIELD_NAME = "AREA" COST_FIELD_NAME = "REPCOST" GRP_FIELD_NAME = "GROUP" # names for template files ########################### FILE_PROJ_TEMPLATE = '%s/data/bsddb.template' % get_app_dir() # enumerations ########################### input data related FootprintTypes = Enum("None", "FootprintHt", "Footprint") ZonesTypes = Enum("None", "Landuse", "LanduseCount") SurveyTypes = Enum("None", "CompleteSurvey", "SampledSurvey") OutputTypes = Enum("Zone", "Grid") PopGridTypes = Enum("None", "Grid") ExportTypes = Enum("Shapefile", "KML", "NRML", "CSV") MSExportTypes = Enum("XML", "CSV") SyncModes = Enum("Read", "Write") # project related ProjectStatus = Enum('NotVerified', 'ReadyForExposure', 'ReadyForMS') # processing options
# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # """ constants used by UI """ from PyQt4.QtGui import QApplication from utils.system import get_app_dir from ui.helper.logger import SIDDUILogging # decorator and loggeer for UI function calls logUICall = SIDDUILogging('ui') # constant file names ########################### FILE_MS_DB = '%s/data/ms.db' % get_app_dir() # constant UI widget padding UI_PADDING = 10 # constant display text # QApplication translate can be used to generate # translation files using the pylupdate4 ##################### SIDD_UI_STRINGS = { # Errors ###################### "app.error.title": QApplication.translate('app.error', 'Error', None, QApplication.UnicodeUTF8), "app.error.unexpected":QApplication.translate('app.error', 'Unexpected Error', None, QApplication.UnicodeUTF8), "app.error.project.missing":QApplication.translate('app.error', 'Must open project or create new project', None, QApplication.UnicodeUTF8), "app.error.model":QApplication.translate('app.error', 'Error Processing Request', None, QApplication.UnicodeUTF8),
# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # """ constants used by UI """ from PyQt4.QtGui import QApplication from utils.system import get_app_dir from ui.helper.logger import SIDDUILogging # decorator and loggeer for UI function calls logUICall = SIDDUILogging('ui') # constant file names ########################### FILE_MS_DB = '%s/data/ms.db' % get_app_dir() # constant UI widget padding UI_PADDING = 10 # constant display text # QApplication translate can be used to generate # translation files using the pylupdate4 ##################### SIDD_UI_STRINGS = { # Errors ###################### "app.error.title": QApplication.translate('app.error', 'Error', None, QApplication.UnicodeUTF8), "app.error.unexpected":