Esempio n. 1
0
    def __init__(self, iface):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # MapCanvas
        self.canvas = iface.mapCanvas()
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'addressLookup_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = addressLookupDialog()
        self.settingsDlg = settingsDialog()

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Adresssuche')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'addressLookup')
        self.toolbar.setObjectName(u'addressLookup')

        libpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'libs')
        if not libpath in sys.path:
            # Make sure geopy is imported from current path
            sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'libs'))

        # Variables
        self.layerid = ''
        self.srs = QgsCoordinateReferenceSystem()
        self.srs.createFromOgcWmsCrs("EPSG:32633")
        self.defaultPoint = pointTo3857(QgsPoint(407719.7, 5279324.9), QgsCoordinateReferenceSystem("EPSG:32633"))
        if QSettings().value("addressLookup/mode") == None:
            QSettings().setValue("addressLookup/mode", 1)
 def setUp(self):
     """Runs before each test."""
     self.dialog = addressLookupDialog(None)