Example #1
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + "/python/plugins/swdedzesearch"
        self.tmpPath = self.plugin_dir + "/tmp"
        # initialize locale
        localePath = ""
        locale = QSettings().value("locale/userLocale").toString()[0:2]

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

        if QFileInfo(localePath).exists():
            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 = swdeDzeSearchDialog() 

        self.dzemodel = QSqlQueryModel(self.dlg)
        self.cmbjew_model = QSqlQueryModel(self.dlg)
        self.cmbobr_model = QSqlQueryModel(self.dlg)
Example #2
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + "/python/plugins/swdedzesearch"
        self.tmpPath = self.plugin_dir + "/tmp"
        # initialize locale
        localePath = ""
        #locale = QSettings().value("locale/userLocale").toString()[0:2]  # u/ generuje problem z unicode bo myśli że ma być unicode w tym miejscu
        locale = 'C:\Users\haku\AppData\Local' # trzeba zmienić na własną ścieżkę

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

        if QFileInfo(localePath).exists():
            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 = swdeDzeSearchDialog() 

        self.dzemodel = QSqlQueryModel(self.dlg)
        self.cmbjew_model = QSqlQueryModel(self.dlg)
        self.cmbobr_model = QSqlQueryModel(self.dlg)