Example #1
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = QtCore.QFileInfo(
            QgsApplication.qgisUserDatabaseFilePath()).path(
            ) + "/python/plugins/DigitizingTools"
        # initialize locale
        QgsMessageLog.logMessage("dir = " + self.plugin_dir)
        localePath = ""

        try:
            locale = QtCore.QSettings().value("locale/userLocale",
                                              "en",
                                              type=str)[0:2]
        except:
            locale = "en"

        if QtCore.QFileInfo(self.plugin_dir).exists():
            localePath = self.plugin_dir + "/i18n/digitizingtools_" + locale + ".qm"

        if QtCore.QFileInfo(localePath).exists():
            self.translator = QtCore.QTranslator()
            self.translator.load(localePath)
            QtCore.QCoreApplication.installTranslator(self.translator)
Example #2
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
        """
        super(SpreadsheetLayersPlugin, self).__init__()
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QtCore.QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'SpreadsheetLayers_{}.qm'.format(locale))

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

            if QtCore.qVersion() > '4.3.3':
                QtCore.QCoreApplication.installTranslator(self.translator)
Example #3
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__)
        # initialize locale
        locale = QtCore.QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'posttelemac_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            #app=QApplication([''])
            self.translator = QtCore.QTranslator()
            #self.translator = QTranslator(app)
            self.translator.load(locale_path)
            QtCore.QCoreApplication.installTranslator(self.translator)
            """

            if qVersion() > '4.3.3':
                print 'ok'
                QCoreApplication.installTranslator(self.translator)
                #app.installTranslator(self.translator)
            """
        #***********************************************************************

        self.pluginLayerType = None
        self.addToRegistry()
        self.slf = []

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&PostTelemac')
        # TODO: We are going to let the user set this up in a future iteration
        #toolbar
        try:
            from qgis.PyQt.QtGui import QToolBar
        except:
            from qgis.PyQt.QtWidgets import QToolBar
        toolbars = self.iface.mainWindow().findChildren(QToolBar)

        test = True
        for toolbar1 in toolbars:
            if toolbar1.windowTitle() == u'Telemac':
                self.toolbar = toolbar1
                test = False
                break
        if test:
            self.toolbar = self.iface.addToolBar(u'Telemac')
            self.toolbar.setObjectName(u'Telemac')

        self.dlg_about = None

        #Processing
        if DOPROCESSING: self.provider = PostTelemacProvider()