예제 #1
0
class Interlis:

    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value("locale/userLocale")[0:2]
        localePath = os.path.join(
            self.plugin_dir, 'i18n', 'interlis_{}.qm'.format(locale))

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

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

        if ogr_version_num() < 2000200:
            raise ImportError("GDAL/OGR 2.0.2 or newer required")

        # Create the dialog (after translation) and keep reference
        self.dlg = InterlisDialog(self)
        # Processing provider
        self.provider = InterlisProvider()

    def initGui(self):
        # Create action that will start plugin configuration
        self.action = QAction(
            QIcon(":/plugins/interlis/icon.png"),
            u"Interlis", self.iface.mainWindow())
        # connect the action to the run method
        self.action.triggered.connect(self.run)

        # Add toolbar button and menu item
        self.iface.addToolBarIcon(self.action)
        self.iface.addPluginToMenu(u"&Interlis", self.action)

        Processing.addProvider(self.provider)

    def unload(self):
        Processing.removeProvider(self.provider)
        # Remove the plugin menu item and icon
        self.iface.removePluginMenu(u"&Interlis", self.action)
        self.iface.removeToolBarIcon(self.action)

    def messageLogWidget(self):
        return self.iface.mainWindow().findChild(QDockWidget, 'MessageLog')

    def run(self):
        self.dlg.setup()
        self.dlg.exec_()
예제 #2
0
class Interlis:
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value("locale/userLocale")[0:2]
        localePath = os.path.join(self.plugin_dir, 'i18n',
                                  'interlis_{}.qm'.format(locale))

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

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

        if ogr_version_num() < 1110000:
            raise ImportError("OGR library 1.11 or newer needed")

        # Create the dialog (after translation) and keep reference
        self.dlg = InterlisDialog(self)

    def initGui(self):
        # Create action that will start plugin configuration
        self.action = QAction(QIcon(":/plugins/interlis/icon.png"),
                              u"Interlis", self.iface.mainWindow())
        # connect the action to the run method
        self.action.triggered.connect(self.run)

        # Add toolbar button and menu item
        self.iface.addToolBarIcon(self.action)
        self.iface.addPluginToMenu(u"&Interlis", self.action)

    def unload(self):
        # Remove the plugin menu item and icon
        self.iface.removePluginMenu(u"&Interlis", self.action)
        self.iface.removeToolBarIcon(self.action)

    def messageLogWidget(self):
        return self.iface.mainWindow().findChild(QDockWidget, 'MessageLog')

    def run(self):
        self.dlg.setup()
        self.dlg.exec_()
예제 #3
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value("locale/userLocale")[0:2]
        localePath = os.path.join(self.plugin_dir, 'i18n',
                                  'interlis_{}.qm'.format(locale))

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

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

        if ogr_version_num() < 1110000:
            raise ImportError("OGR library 1.11 or newer needed")

        # Create the dialog (after translation) and keep reference
        self.dlg = InterlisDialog(self)
예제 #4
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value("locale/userLocale")[0:2]
        localePath = os.path.join(self.plugin_dir, 'i18n', 'interlis_{}.qm'.format(locale))

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

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

        # Create the dialog (after translation) and keep reference
        self.dlg = InterlisDialog(self)
예제 #5
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value("locale/userLocale")[0:2]
        localePath = os.path.join(
            self.plugin_dir, 'i18n', 'interlis_{}.qm'.format(locale))

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

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

        if ogr_version_num() < 2000200:
            raise ImportError("GDAL/OGR 2.0.2 or newer required")

        # Create the dialog (after translation) and keep reference
        self.dlg = InterlisDialog(self)
        # Processing provider
        self.provider = InterlisProvider()