def writeSettings(self): """Write all relevant settings to the project file XML """ if not self.getTimeLayerManager().isEnabled(): return (timeLayerManagerSettings, timeLayerList) = self.getTimeLayerManager().getSaveString() if timeLayerManagerSettings is not None: settings = {'animationFrameLength': self.animationFrameLength, 'playBackwards': self.playBackwards, 'loopAnimation': self.loopAnimation, 'timeLayerManager': timeLayerManagerSettings, 'timeLayerList': timeLayerList, 'currentMapTimePosition': time_util.datetime_to_str( self.getTimeLayerManager().getCurrentTimePosition(), time_util.DEFAULT_FORMAT ), 'timeFrameType': self.getTimeLayerManager().getTimeFrameType(), 'timeFrameSize': self.getTimeLayerManager().getTimeFrameSize(), 'active': self.getTimeLayerManager().isEnabled(), 'mode': int(time_util.is_archaelogical()), 'digits': time_util.getArchDigits(), 'labelFormat': self.guiControl.getLabelFormat(), 'labelFont': self.guiControl.getLabelFont(), 'labelSize': self.guiControl.getLabelSize(), 'labelColor': self.guiControl.getLabelColor(), 'labelBgColor': self.guiControl.getLabelBgColor(), 'labelPlacement': self.guiControl.getLabelPlacement()} TimeManagerProjectHandler.writeSettings(settings)
def sendAnimationOptions(self): path = self.animationDialog.lineEdit.text() if path == "": self.showAnimationOptions() TimeManagerProjectHandler.set_plugin_setting(conf.LAST_ANIMATION_PATH_TAG, path) delay_millis = self.animationDialog.spinBoxDelay.value() export_gif = self.animationDialog.radioAnimatedGif.isChecked() export_video = False # self.animationDialog.radioVideo.isChecked() do_clear = self.animationDialog.clearCheckBox.isChecked() self.signalExportVideo.emit(path, delay_millis, export_gif, export_video, do_clear)
def sendAnimationOptions(self): path = self.animationDialog.lineEdit.text() if path == "": self.showAnimationOptions() TimeManagerProjectHandler.set_plugin_setting(conf.LAST_ANIMATION_PATH_TAG, path) delay_millis = self.animationDialog.spinBoxDelay.value() export_gif = self.animationDialog.radioAnimatedGif.isChecked() export_video = self.animationDialog.radioVideo.isChecked() do_clear = self.animationDialog.clearCheckBox.isChecked() self.signalExportVideo.emit(path, delay_millis, export_gif, export_video, do_clear)
def writeSettings(self): """Write all relevant settings to the project file XML """ if not self.getTimeLayerManager().isEnabled(): return (timeLayerManagerSettings, timeLayerList) = self.getTimeLayerManager().getSaveString() if timeLayerManagerSettings is not None: settings = { 'animationFrameLength': self.animationFrameLength, 'playBackwards': self.playBackwards, 'loopAnimation': self.loopAnimation, 'timeLayerManager': timeLayerManagerSettings, 'timeLayerList': timeLayerList, 'currentMapTimePosition': time_util.datetime_to_str( self.getTimeLayerManager().getCurrentTimePosition(), time_util.DEFAULT_FORMAT), 'timeFrameType': self.getTimeLayerManager().getTimeFrameType(), 'timeFrameSize': self.getTimeLayerManager().getTimeFrameSize(), 'active': self.getTimeLayerManager().isEnabled(), 'mode': int(time_util.is_archaelogical()), 'digits': time_util.getArchDigits(), 'labelFormat': self.guiControl.getLabelFormat(), 'labelFont': self.guiControl.getLabelFont(), 'labelSize': self.guiControl.getLabelSize(), 'labelColor': self.guiControl.getLabelColor(), 'labelBgColor': self.guiControl.getLabelBgColor(), 'labelPlacement': self.guiControl.getLabelPlacement() } TimeManagerProjectHandler.writeSettings(settings)
def readSettings(self): """Load and restore settings from project file""" settings = TimeManagerProjectHandler.readSettings(self.METASETTINGS) restore_functions = { 'mode': (self.setArchaeology, 0), 'digits': (time_util.setArchDigits, conf.DEFAULT_DIGITS), 'currentMapTimePosition': (self.restoreTimePositionFromSettings, None), 'animationFrameLength': (self.setAnimationFrameLength, conf.DEFAULT_FRAME_LENGTH), 'playBackwards': (self.setPlayBackwards, 0), 'loopAnimation': (self.setLoopAnimation, 0), 'timeLayerManager': (self.restoreSettingTimeLayerManager, None), 'timeLayerList': (self.restoreTimeLayers, None), 'timeFrameType': (self.restoreTimeFrameType, conf.DEFAULT_FRAME_UNIT), 'timeFrameSize': (self.guiControl.setTimeFrameSize, conf.DEFAULT_FRAME_SIZE), 'active': (self.setActive, 0), 'labelFormat': (self.guiControl.setLabelFormat, time_util.DEFAULT_FORMAT), 'labelFont': (self.guiControl.setLabelFont, time_util.DEFAULT_LABEL_FONT), 'labelSize': (self.guiControl.setLabelSize, time_util.DEFAULT_LABEL_SIZE), 'labelColor': (self.guiControl.setLabelColor, time_util.DEFAULT_LABEL_COLOR), 'labelBgColor': (self.guiControl.setLabelBgColor, time_util.DEFAULT_LABEL_BGCOLOR), 'labelPlacement': (self.guiControl.setLabelPlacement, time_util.DEFAULT_LABEL_PLACEMENT), } for setting_name in list(self.METASETTINGS.keys()): if setting_name in restore_functions: restore_function, default_value = restore_functions[setting_name] if setting_name not in settings: setting_value = default_value else: setting_value = settings[setting_name] restore_function(setting_value)
def selectAnimationFolder(self): prev_directory = TimeManagerProjectHandler.plugin_setting( conf.LAST_ANIMATION_PATH_TAG) if prev_directory: self.animationDialog.lineEdit.setText( QFileDialog.getExistingDirectory(directory=prev_directory)) else: self.animationDialog.lineEdit.setText( QFileDialog.getExistingDirectory())
def readSettings(self): """Load and restore settings from project file""" settings = TimeManagerProjectHandler.readSettings(self.METASETTINGS) restore_functions = { 'mode': (self.setArchaeology, 0), 'digits': (time_util.setArchDigits, conf.DEFAULT_DIGITS), 'currentMapTimePosition': (self.restoreTimePositionFromSettings, None), 'animationFrameLength': (self.setAnimationFrameLength, conf.DEFAULT_FRAME_LENGTH), 'playBackwards': (self.setPlayBackwards, 0), 'loopAnimation': (self.setLoopAnimation, 0), 'timeLayerManager': (self.restoreSettingTimeLayerManager, None), 'timeLayerList': (self.restoreTimeLayers, None), 'timeFrameType': (self.restoreTimeFrameType, conf.DEFAULT_FRAME_UNIT), 'timeFrameSize': (self.guiControl.setTimeFrameSize, conf.DEFAULT_FRAME_SIZE), 'active': (self.setActive, 0), 'labelFormat': (self.guiControl.setLabelFormat, time_util.DEFAULT_FORMAT), 'labelFont': (self.guiControl.setLabelFont, time_util.DEFAULT_LABEL_FONT), 'labelSize': (self.guiControl.setLabelSize, time_util.DEFAULT_LABEL_SIZE), 'labelColor': (self.guiControl.setLabelColor, time_util.DEFAULT_LABEL_COLOR), 'labelBgColor': (self.guiControl.setLabelBgColor, time_util.DEFAULT_LABEL_BGCOLOR), 'labelPlacement': (self.guiControl.setLabelPlacement, time_util.DEFAULT_LABEL_PLACEMENT), } for setting_name in list(self.METASETTINGS.keys()): if setting_name in restore_functions: restore_function, default_value = restore_functions[ setting_name] if setting_name not in settings: setting_value = default_value else: setting_value = settings[setting_name] restore_function(setting_value)
def selectAnimationFolder(self): prev_directory = TimeManagerProjectHandler.plugin_setting(conf.LAST_ANIMATION_PATH_TAG) if prev_directory: self.animationDialog.lineEdit.setText(QFileDialog.getExistingDirectory(directory=prev_directory)) else: self.animationDialog.lineEdit.setText(QFileDialog.getExistingDirectory())
def is_archaelogical(): return TimeManagerProjectHandler.plugin_setting('mode') == ARCHAELOGY_MODE
def getArchDigits(): return int( TimeManagerProjectHandler.plugin_setting('arch_digits', DEFAULT_DIGITS))
def setArchDigits(digits): TimeManagerProjectHandler.set_plugin_setting('arch_digits', digits)
def getGlobalDigitSetting(): return TimeManagerProjectHandler.plugin_setting('arch_digits', DEFAULT_DIGITS)
def getArchDigits(): return int(TimeManagerProjectHandler.plugin_setting('arch_digits', DEFAULT_DIGITS))
def setCurrentMode(new_mode): TimeManagerProjectHandler.set_plugin_setting('mode', new_mode)