def __init__(self, iface): """Class constructor. On instantiation, the plugin instance will be assigned a copy of the QGIS iface object which will allow this plugin to access and manipulate the running QGIS instance that spawned it. Args: iface - a Quantum GIS QGisAppInterface instance. This instance is automatically passed to the plugin by QGIS when it loads the plugin. Returns: None. Raises: no exceptions explicitly raised. """ # Save reference to the QGIS interface self.iface = iface self.translator = None self.toolbar = None self.actions = [] # list of all QActions we create for InaSAFE self.setupI18n() #print self.tr('InaSAFE') custom_logging.setup_logger()
def __init__(self, iface): """Class constructor. On instantiation, the plugin instance will be assigned a copy of the QGIS iface object which will allow this plugin to access and manipulate the running QGIS instance that spawned it. :param iface:Quantum GIS iface instance. This instance is automatically passed to the plugin by QGIS when it loads the plugin. :type iface: QGisAppInterface """ # Save reference to the QGIS interface self.iface = iface self.dock_widget = None self.action_import_dialog = None self.action_save_scenario = None self.action_batch_runner = None self.action_shake_converter = None self.action_minimum_needs = None self.key_action = None self.action_function_browser = None self.action_options = None self.action_reset_dock = None self.action_keywords_dialog = None self.translator = None self.toolbar = None self.actions = [] # list of all QActions we create for InaSAFE self.setup_i18n() self.action_dock = None #print self.tr('InaSAFE') custom_logging.setup_logger() # For enable/disable the keyword editor icon self.iface.currentLayerChanged.connect(self.layer_changed)
def __init__(self, iface): """Class constructor. On instantiation, the plugin instance will be assigned a copy of the QGIS iface object which will allow this plugin to access and manipulate the running QGIS instance that spawned it. :param iface:Quantum GIS iface instance. This instance is automatically passed to the plugin by QGIS when it loads the plugin. :type iface: QGisAppInterface """ # Save reference to the QGIS interface self.iface = iface self.dock_widget = None self.action_import_dialog = None self.action_save_scenario = None self.action_batch_runner = None self.action_shake_converter = None self.action_minimum_needs = None self.key_action = None self.action_function_browser = None self.action_options = None self.action_keywords_dialog = None self.translator = None self.toolbar = None self.actions = [] # list of all QActions we create for InaSAFE self.action_dock = None #print self.tr('InaSAFE') custom_logging.setup_logger() # For enable/disable the keyword editor icon self.iface.currentLayerChanged.connect(self.layer_changed)
def __init__(self, iface): """Class constructor. On instantiation, the plugin instance will be assigned a copy of the QGIS iface object which will allow this plugin to access and manipulate the running QGIS instance that spawned it. :param iface:Quantum GIS iface instance. This instance is automatically passed to the plugin by QGIS when it loads the plugin. :type iface: QGisAppInterface """ # Save reference to the QGIS interface self.iface = iface self.translator = None self.toolbar = None self.actions = [] # list of all QActions we create for InaSAFE self.setup_i18n() #print self.tr('InaSAFE') custom_logging.setup_logger() # For enable/disable the keyword editor icon self.iface.currentLayerChanged.connect(self.layer_changed)
# os.path.exists(translation_path))) # MONKEYPATCHING safe.defaults.get_defaults to use breakdown_defaults # see safe_qgis.utilities.defaults for more details import safe.defaults from safe_qgis.utilities.defaults import breakdown_defaults safe.defaults.get_defaults = lambda the_default=None: breakdown_defaults( the_default) try: # When upgrading, using the plugin manager, you may get an error when # doing the following import, so we wrap it in a try except # block and then display a friendly message to restart QGIS from safe_qgis.utilities.custom_logging import setup_logger setup_logger() except ImportError: # Note we use translate directly but the string may still not translate # at this early stage since the i18n setup routines have not been called # yet. import traceback trace = ''.join(traceback.format_tb(sys.exc_info()[2])) # Note that we do a late import here to avoid QPaintDevice before # QApplication errors when running tests of safe package. TS from PyQt4.QtCore import QCoreApplication from PyQt4.QtGui import QMessageBox myWarning = QCoreApplication.translate( 'Plugin', 'Please restart QGIS to use this plugin. If you experience ' 'further problems after restarting please report the issue ' 'to the InaSAFE team.')
# translation_path, # os.path.exists(translation_path))) # MONKEYPATCHING safe.defaults.get_defaults to use breakdown_defaults # see safe_qgis.utilities.defaults for more details import safe.defaults from safe_qgis.utilities.defaults import breakdown_defaults safe.defaults.get_defaults = lambda the_default=None: breakdown_defaults( the_default) try: # When upgrading, using the plugin manager, you may get an error when # doing the following import, so we wrap it in a try except # block and then display a friendly message to restart QGIS from safe_qgis.utilities.custom_logging import setup_logger setup_logger() except ImportError: # Note we use translate directly but the string may still not translate # at this early stage since the i18n setup routines have not been called # yet. import traceback trace = ''.join(traceback.format_tb(sys.exc_info()[2])) # Note that we do a late import here to avoid QPaintDevice before # QApplication errors when running tests of safe package. TS from PyQt4.QtCore import QCoreApplication from PyQt4.QtGui import QMessageBox myWarning = QCoreApplication.translate( 'Plugin', 'Please restart QGIS to use this plugin. If you experience ' 'further problems after restarting please report the issue ' 'to the InaSAFE team.')