コード例 #1
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface

        # i18n support
        override_locale = QSettings().value('locale/overrideFlag', False, type=bool)
        if not override_locale:
            locale_full_name = QLocale.system().name()
        else:
            locale_full_name = QSettings().value('locale/userLocale', '', type=unicode)

        self.locale_path = '%s/i18n/rugeocoder_%s.qm' % (_current_path, locale_full_name[0:2])
        if QFileInfo(self.locale_path).exists():
            self.translator = QTranslator()
            self.translator.load(self.locale_path)
            QCoreApplication.installTranslator(self.translator)

        # menu && toolbars
        self.menu_name = self.tr(u'&RuGeocoder')
        self.toolbar = self.iface.addToolBar(self.menu_name)
        self.toolbar.setObjectName(u'RuGeocoderToolbar')

        # instances
        self.__converter_dlg = ConverterDialog()
        self.__geocoder_dlg = BatchGeocodingDialog()

        # Dock tree panel
        self.__quick_tlb = QuickGeocodingToolbox(self.iface)
        self.iface.addDockWidget(PluginSettings.dock_area(), self.__quick_tlb)
        self.__quick_tlb.setFloating(PluginSettings.dock_floating())
        self.__quick_tlb.resize(PluginSettings.dock_size())
        self.__quick_tlb.move(PluginSettings.dock_pos())
        self.__quick_tlb.setVisible(PluginSettings.dock_visibility())
        self.__quick_tlb.set_active_geocoder(PluginSettings.dock_geocoder_name())
        self.__quick_tlb.setWindowIcon(QIcon(path.join(_current_path, 'edit-find-project.png')))
コード例 #2
0
ファイル: ng_connect.py プロジェクト: agsh/nextgis_connect
    def initGui(self):
        # import pydevd
        # pydevd.settrace('localhost', port=5566, stdoutToServer=True, stderrToServer=True, suspend=False)

        """Create the menu entries and toolbar icons inside the QGIS GUI."""
        # Dock tree panel
        self.dockWidget = TreePanel(self.iface, self.iface.mainWindow())
        self.iface.addDockWidget(PluginSettings.dock_area(), self.dockWidget)
        self.dockWidget.setFloating(PluginSettings.dock_floating())
        self.dockWidget.resize(PluginSettings.dock_size())
        self.dockWidget.move(PluginSettings.dock_pos())
        self.dockWidget.setVisible(PluginSettings.dock_visibility())

        # Tools for NGW communicate
        icon_path = self.plugin_dir + '/icon.png'
        self.add_action(
            icon_path,
            text=self.tr(u'Show/Hide NextGIS Connect panel'),
            checkable=True,
            is_checked=PluginSettings.dock_visibility(),
            callback=self.dockWidget.setVisible,
            parent=self.iface.mainWindow())

        # self.iface.legendInterface().addLegendLayerAction(
        #     self.dockWidget.inner_control.actionImportQGISProject,
        #     self.tr(u"NextGIS Connect"),
        #     u"",
        #     QgsMapLayer.RasterLayer,
        #     True
        # )
        # self.iface.legendInterface().addLegendLayerAction(
        #     self.dockWidget.inner_control.actionImportQGISProject,
        #     self.tr(u"NextGIS Connect"),
        #     u"",
        #     QgsMapLayer.VectorLayer,
        #     True
        # )

        self.iface.legendInterface().addLegendLayerAction(
            self.dockWidget.inner_control.actionImportQGISResource,
            self.tr(u"NextGIS Connect"),
            u"",
            QgsMapLayer.RasterLayer,
            True
        )
        self.iface.legendInterface().addLegendLayerAction(
            self.dockWidget.inner_control.actionImportQGISResource,
            self.tr(u"NextGIS Connect"),
            u"",
            QgsMapLayer.VectorLayer,
            True
        )
        self.iface.legendInterface().addLegendLayerAction(
            self.dockWidget.inner_control.actionImportUpdateStyle,
            self.tr(u"NextGIS Connect"),
            u"",
            QgsMapLayer.VectorLayer,
            True
        )
コード例 #3
0
    def initGui(self):
        # import pydevd
        # pydevd.settrace('localhost', port=5566, stdoutToServer=True, stderrToServer=True, suspend=False)

        """Create the menu entries and toolbar icons inside the QGIS GUI."""
        # Dock tree panel
        self.dockWidget = TreePanel(self.iface, self.iface.mainWindow())
        self.iface.addDockWidget(PluginSettings.dock_area(), self.dockWidget)
        self.dockWidget.setFloating(PluginSettings.dock_floating())
        self.dockWidget.resize(PluginSettings.dock_size())
        self.dockWidget.move(PluginSettings.dock_pos())
        self.dockWidget.setVisible(PluginSettings.dock_visibility())

        # Tools for NGW communicate
        icon_path = self.plugin_dir + '/icon.png'
        self.add_action(
            icon_path,
            text=self.tr(u'Show/Hide NextGIS Connect panel'),
            checkable=True,
            is_checked=PluginSettings.dock_visibility(),
            callback=self.dockWidget.setVisible,
            parent=self.iface.mainWindow())

        self.iface.legendInterface().addLegendLayerAction(
            self.dockWidget.inner_control.actionImportQGISProject,
            self.tr(u"NextGIS Connect"),
            u"",
            QgsMapLayer.RasterLayer,
            True
        )
        self.iface.legendInterface().addLegendLayerAction(
            self.dockWidget.inner_control.actionImportQGISProject,
            self.tr(u"NextGIS Connect"),
            u"",
            QgsMapLayer.VectorLayer,
            True
        )

        self.iface.legendInterface().addLegendLayerAction(
            self.dockWidget.inner_control.actionImportQGISResource,
            self.tr(u"NextGIS Connect"),
            u"",
            QgsMapLayer.RasterLayer,
            True
        )
        self.iface.legendInterface().addLegendLayerAction(
            self.dockWidget.inner_control.actionImportQGISResource,
            self.tr(u"NextGIS Connect"),
            u"",
            QgsMapLayer.VectorLayer,
            True
        )
コード例 #4
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface

        # i18n support
        override_locale = QSettings().value('locale/overrideFlag',
                                            False,
                                            type=bool)
        if not override_locale:
            locale_full_name = QLocale.system().name()
        else:
            locale_full_name = QSettings().value('locale/userLocale',
                                                 '',
                                                 type=unicode)

        self.locale_path = '%s/i18n/rugeocoder_%s.qm' % (_current_path,
                                                         locale_full_name[0:2])
        if QFileInfo(self.locale_path).exists():
            self.translator = QTranslator()
            self.translator.load(self.locale_path)
            QCoreApplication.installTranslator(self.translator)

        # menu && toolbars
        self.menu_name = self.tr(u'&RuGeocoder')
        self.toolbar = self.iface.addToolBar(self.menu_name)
        self.toolbar.setObjectName(u'RuGeocoderToolbar')

        # instances
        self.__converter_dlg = ConverterDialog()
        self.__geocoder_dlg = BatchGeocodingDialog()

        # Dock tree panel
        self.__quick_tlb = QuickGeocodingToolbox(self.iface)
        self.iface.addDockWidget(PluginSettings.dock_area(), self.__quick_tlb)
        self.__quick_tlb.setFloating(PluginSettings.dock_floating())
        self.__quick_tlb.resize(PluginSettings.dock_size())
        self.__quick_tlb.move(PluginSettings.dock_pos())
        self.__quick_tlb.setVisible(PluginSettings.dock_visibility())
        self.__quick_tlb.set_active_geocoder(
            PluginSettings.dock_geocoder_name())
        self.__quick_tlb.setWindowIcon(
            QIcon(path.join(_current_path, 'edit-find-project.png')))