def setArchaeology(self, enabled=0): if enabled == 0 : if filter(lambda x:time_util.is_archaeological_layer(x), self.getTimeLayerManager().layers()): QMessageBox.information(self.iface.mainWindow(),'Error', "Already have archaeological layers in the project."+\ "Please delete them to switch to normal mode") self.guiControl.setArchaeologyPressed(True) return time_util.setCurrentMode(time_util.NORMAL_MODE) self.guiControl.setWindowTitle("Time Manager") self.guiControl.setArchaeologyPressed(False) self.guiControl.disableArchaeologyTextBox() else: if filter(lambda x: not time_util.is_archaeological_layer(x), self.getTimeLayerManager().layers()): QMessageBox.information(self.iface.mainWindow(),'Error', "Already have non archaeological layers in the project."+\ "Please delete them to switch to archaeological mode") self.guiControl.setArchaeologyPressed(False) return time_util.setCurrentMode(time_util.ARCHAELOGY_MODE) self.guiControl.setWindowTitle("Time Manager Archaeology Mode") self.guiControl.setArchaeologyPressed(True) ctx = self.guiControl.dock.objectName() try: self.guiControl.setTimeFrameType(QCoreApplication.translate(ctx,'years')) except: error("should only happen during testing") self.guiControl.enableArchaeologyTextBox() self.showMessage("Archaelogy mode enabled. Expecting data of the form {0} BC or {0} AD.".format("Y"*time_util.getArchDigits())+\ " Disable to work with regular datetimes from year 1 onwards")
def setArchaeology(self, enabled=0): if enabled == 0: if filter(lambda x: time_util.is_archaeological_layer(x), self.getTimeLayerManager().layers()): QMessageBox.information(self.iface.mainWindow(), 'Error', "Already have archaeological layers in the project." + "Please delete them to switch to normal mode") self.guiControl.setArchaeologyPressed(True) return time_util.setCurrentMode(time_util.NORMAL_MODE) self.guiControl.setWindowTitle("Time Manager") self.guiControl.setArchaeologyPressed(False) self.guiControl.disableArchaeologyTextBox() else: if filter(lambda x: not time_util.is_archaeological_layer(x), self.getTimeLayerManager().layers()): QMessageBox.information(self.iface.mainWindow(), 'Error', "Already have non archaeological layers in the project." + "Please delete them to switch to archaeological mode") self.guiControl.setArchaeologyPressed(False) return time_util.setCurrentMode(time_util.ARCHAELOGY_MODE) self.guiControl.setWindowTitle("Time Manager Archaeology Mode") self.guiControl.setArchaeologyPressed(True) ctx = self.guiControl.dock.objectName() try: self.guiControl.setTimeFrameType(QCoreApplication.translate(ctx, 'years')) except: error("should only happen during testing") self.guiControl.enableArchaeologyTextBox() self.showMessage( "Archaelogy mode enabled. Expecting data of the form {0} BC or {0} AD.".format( "Y" * time_util.getArchDigits()) + " Disable to work with regular datetimes from year 1 onwards")