def change_i18n(self, new_lang): """Change internationalisation for the plugin. Override the system locale and then see if we can get a valid translation file for whatever locale is effectively being used. """ #os.environ["LANG"] = str(new_lang) root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) translation_path = os.path.join( root, self.name, I18N_FOLDER, self.name+"_" + str(new_lang) + ".qm") if os.path.exists(translation_path): self.translator = QTranslator() result = self.translator.load(translation_path) if not result: error( "Translation file {} for lang {} was not loaded properly," + "falling back to English".format(translation_path, new_lang) ) return if qVersion() > "4.3.3": QCoreApplication.installTranslator(self.translator) else: self.translator = None warn("Translation not supported for Qt <= {}".format(qVersion())) else: if new_lang != "en": warn("Translation failed for lang {}, falling back to English".format(new_lang))
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'geosudRefToa_{}.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 = geosudRefToaDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Geosud Toa Reflectance') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'geosudRefToa') self.toolbar.setObjectName(u'geosudRefToa') #KO_QGis Info Bar self.bar = QgsMessageBar() self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.dlg.glInfo.addWidget(self.bar, 0,0,1,1) #KO_Connect self.dlg.pbLoadImg.clicked.connect(self.displayDirFile) self.dlg.pbMetadata.clicked.connect(self.displayDirMetadata) self.dlg.pbLucky.clicked.connect(self.autoLoadMetadata) self.dlg.pbGetParam.clicked.connect(self.displayMetadata) self.dlg.cbOutput.clicked.connect(self.activeOutputDir) self.dlg.pbOutput.clicked.connect(self.outputDir) self.dlg.pbConvert.clicked.connect(self.processToa) self.dlg.pbAbout.clicked.connect(self.helpFile) self.dlg.pbClear.clicked.connect(self.clearHistory) #KO_Disabled self.dlg.pbOutput.setEnabled(False) self.dlg.cbOutput.setEnabled(False) self.dlg.pbConvert.setEnabled(False) self.dlg.leOutput.setEnabled(False) #KO_Checked self.dlg.rbRefNorm.setChecked(True)
def __init__(self):#, iface): # initialize plugin directory self._dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')#[0:2] locale_path = os.path.join( self._dir, 'i18n', 'CUDARaster_{}.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 = CUDARasterDialog() self.dlg2 = CUDARasterDialogCrash() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&CUDA Raster') self.dlg.input_line.clear() self.dlg.input_button.clicked.connect(self.select_input_file) self.dlg.output_line.clear() self.dlg.output_button.clicked.connect(self.select_output_folder) self.dlg.slope_check.setChecked(False) self.dlg.aspect_check.setChecked(False) self.dlg.hillshade_check.setChecked(False)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', '{}.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) # Declare instance attributes self.plugin_name = self.tr('&Menu Builder') # reference to plugin actions self.actions = [] # used to store active menus self.menus = [] # Create the dialog (after translation) and keep reference self.dlg = MenuBuilderDialog(self)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'segreg_{}.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 = segregDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Segreg') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'segreg') self.toolbar.setObjectName(u'segreg')
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] locale_path = os.path.join( self.plugin_dir, 'i18n', 'ARPAP_SpatialReport_{}.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 = ARPAP_SpatialReportDialog(iface = self.iface) #QObject.connect(self.dlg.testButton, SIGNAL('pressed()'),self.test) #QObject.connect(self.dlg.browseConfigFileOutputButton, SIGNAL('clicked()'),self.outConfigFile) #QObject.connect(self.dlg.browseConfigFileInputButton, SIGNAL('clicked()'),self.inConfigFile) QObject.connect(self.dlg.runButton, SIGNAL('clicked()'),self.runAlgorithm) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&ARPAP SpatialReport') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'ARPAP_SpatialReport') self.toolbar.setObjectName(u'ARPAP_SpatialReport')
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 = QSettings().value("locale/userLocale", "en")[0:2] if not locale in ['en','nl'] : locale = 'en' locale_path = os.path.join( self.plugin_dir, 'i18n', '{}.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.vmmQryDlg = vmmQryDialog(self.iface, self.iface.mainWindow() ) self.settingsDlg = settingsDlg(self.iface, self.iface.mainWindow()) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Spatial Subset Query tool') self.toolbar = self.iface.addToolBar(u'vmmQry') self.toolbar.setObjectName(u'vmmQry')
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', '{}_{}.qm'.format(DelimitationToolbox.__modname__, locale)) if os.path.exists(locale_path): self.translator = QTranslator() self.translator.load(locale_path) if qVersion() > '4.3.3': QCoreApplication.installTranslator(self.translator) # Declare instance attributes self.actions = [] self.dock = None
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 pluginPath = QFileInfo(os.path.realpath(__file__)).path() # initialize locale using the QGIS locale locale = QSettings().value("locale/userLocale")[0:2] if QFileInfo(pluginPath).exists(): locale_path = os.path.join(pluginPath, "i18n", "{}.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 = histogramDialog(self.iface) # Declare instance attributes self.menu = self.tr(u"&Histogram")
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'RCMRD_LandDegr_{}.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 = RCMRD_LandDegrDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&RCRMD: land degradation') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'RCMRD: land degradation') self.toolbar.setObjectName(u'RCMRD: land degradation') # Declare user instance variables self.roiDefinitions = None self.roiDefinitions = [{"name":"IGAD", "roiXY":[21.8094, -4.6775, 51.417, 22.227]}, {"name":"Djibouti", "roiXY":[41.749110148,10.929824931, 43.418711785,12.707912502]}, {"name":"Eritrea", "roiXY":[36.423647095,12.360021871, 43.123871290,18.004828192]}, {"name":"Ethiopia", "roiXY":[32.989799845,3.403333435, 47.979169149,14.879532166]}, {"name":"Kenya", "roiXY":[33.890468384,-4.677504165, 41.885019165,5.030375823]}, {"name":"Sudan", "roiXY":[42.647246541,7.996515605, 48.93911199991,11.498928127]}, {"name":"South Sudan", "roiXY":[24.121555623,3.490201518, 35.920835409,12.216154684]}, {"name":"Somali Land", "roiXY":[42.647246541,7.996515605, 48.93911199991,11.498928127]}, {"name":"Somalia", "roiXY":[40.965385376,-1.69628316498, 51.417037811,11.989118646]}, {"name":"Uganda", "roiXY":[29.548459513,-1.475205994, 35.006472615,4.219691875]}] #self.selectedRoi = None self.raster_list = [] # list all files open in QGis, contains file objects self.dictReproj = None # dictionary: 'input filename' -> reprojected filename self.clipLayer = None # store the clipping vector layer self.listIDInputs={} # dictionary: key -> layer name. See keys definition in the code ('VGT', 'RFE', ...) self.listIDWeightsPotential={} self.listIDWeightsActual={} SettingsOrganisation='RCMRD_QGIS' SettingsApplication='RCMRD_LandDegr'
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 self.canvas = self.iface.mapCanvas() # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) print self.plugin_dir # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'ArcheoTool_{}.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)
def __init__(self, iface): try: debug() except: print 'Debugger not enabled' # save reference to the QGIS interface # Save reference to the QGIS interface self.iface = iface # initialize plugin directory self.plugin_dir = \ QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + \ "/python/plugins/qchainage" # initialize locale locale_path = "" locale = QSettings().value("locale/userLocale")[0:2] if QFileInfo(self.plugin_dir).exists(): locale_path = self.plugin_dir + "/i18n/qchainage_" + locale + ".qm" if QFileInfo(locale_path).exists(): self.translator = QTranslator() self.translator.load(locale_path) if qVersion() > '4.3.3': QCoreApplication.installTranslator(self.translator)
def __init__(self, iface): """Inizialize the plug in :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 #set preferences self.prefs = prefs.RadarPrefs() self.prefs.set_prefs() # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'Marsis_{}.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) # self.iface = iface self.marsis_menu = None
def __init__(self, iface): # Save reference to the QGIS interface self.iface = iface # initialize plugin directory self.plugin_dir = os.path.dirname(QFile.decodeName(__file__)) # initialize locale settings = QSettings() locale = settings.value("locale/userLocale", "")[0:2] localePath = os.path.join(self.plugin_dir, 'i18n', '{0}.qm'.format(locale)) if os.path.exists(localePath): self.translator = QTranslator() self.translator.load(localePath) if qVersion() > '4.3.3': QCoreApplication.installTranslator(self.translator) self.pluginName = self.tr("TileLayerPlugin") self.downloadTimeout = int(settings.value("/TileLayerPlugin/timeout", 30, type=int)) self.navigationMessagesEnabled = int(settings.value("/TileLayerPlugin/naviMsg", Qt.Checked, type=int)) self.crs3857 = None self.layers = {} # register plugin layer type self.tileLayerType = TileLayerType(self) QgsPluginLayerRegistry.instance().addPluginLayerType(self.tileLayerType) # connect signal-slot QgsMapLayerRegistry.instance().layerRemoved.connect(self.layerRemoved)
def __init__(self, iface): self.iface = iface # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'featureLoader_{}.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) self.wkbText = {0:"GeometryUnknown", 1:"Point", 2:"LineString", 3:"Polygon", 4:"MultiPoint", 5:"MultiLineString", 6:"MultiPolygon", 7:"NoGeometry", 8:"Point25D", 9:"LineString25D", 10:"Polygon25D", 11:"MultiPoint25D", 12:"MultiLineString25D", 13:"MultiPolygon25D", 100:"NoGeometry"} #sometime qgis cannot return geometry type truly. this bug is handling in here self.geometryText = {0:"Point", 1:"LineString", 2:"Polygon", 3:"GeometryUnknown", 4:"NoGeometry"} # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Feature Loader') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'featureLoader') self.toolbar.setObjectName(u'featureLoader')
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 = QSettings().value("locale/userLocale")[0:2] locale_path = os.path.join(self.plugin_dir, "i18n", "AttributeSplit_{}.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 = AttributeSplitDialog(iface) # Declare instance attributes self.actions = [] self.menu = self.tr(u"&Attribute Split") self.toolbar = self.iface.addToolBar(u"AttributeSplit") self.toolbar.setObjectName(u"AttributeSplit")
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] locale_path = os.path.join( self.plugin_dir, 'i18n', 'ProbabilisticMapAlgebraTool_{}.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 = ProbabilisticMapAlgebraToolDialog(self.iface) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Probabilistic Map Algebra Tool') self.toolbar = self.iface.addToolBar(u'ProbabilisticMapAlgebraTool') self.toolbar.setObjectName(u'ProbabilisticMapAlgebraTool')
def generateVersionInfo(linesep = '\n'): """ Module function to generate a string with various version infos. @param linesep string to be used to separate lines (string) @return string with version infos (string) """ try: import sipconfig sip_version_str = sipconfig.Configuration().sip_version_str except ImportError: sip_version_str = "sip version not available" info = "Version Numbers:%s Python %s%s" % \ (linesep, sys.version.split()[0], linesep) if KdeQt.isKDEAvailable(): info += " KDE %s%s PyKDE %s%s" % \ (str(KdeQt.kdeVersionString()), linesep, str(KdeQt.pyKdeVersionString()), linesep) info += " Qt %s%s PyQt4 %s%s" % \ (str(qVersion()), linesep, str(PYQT_VERSION_STR), linesep) info += " sip %s%s QScintilla %s%s" % \ (str(sip_version_str), linesep, str(QSCINTILLA_VERSION_STR), linesep) info += " %s %s%s" % \ (Program, Version, linesep * 2) info += "Platform: %s%s%s%s" % \ (sys.platform, linesep, sys.version, linesep) return info
def aboutHtml(self): import sys from PyQt4.QtCore import qVersion, PYQT_VERSION_STR import sipconfig from PyQt4 import QtWebKit from Tc2Lib.gocr import gocr p = '<html><head>' p += '<LINK REL=StyleSheet HREF="default.css" TYPE="text/css" MEDIA=screen>' p += '</head><body>' p += '<div class="textBox">' p += '<div class="headerBox">About TableCrab</div>' p += '<ul>' p += '<li>%s: %s' % (Tc2Config.ApplicationName, Tc2Config.Version) p += '<li>Author: %s' % Tc2Config.Author p += '<li>Mail: [email protected]' p += '</ul>' p += '<ul>' p += '<li>Python: %s.%s.%s' % sys.version_info[:3] p += '<li>Sip: %s\n' % sipconfig.Configuration().sip_version_str p += '<li>Qt: %s' % qVersion() p += '<li>PyQt: %s' % PYQT_VERSION_STR p += '<li>WebKit: %s\n' % QtWebKit.qWebKitVersion() p += '<li>Gocr: %s\n' % gocr.version() p += '</ul>' p += '</div>' p += '</body></html>' return p
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] locale_path = os.path.join( self.plugin_dir, 'i18n', 'TwitterLocation_{}.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) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&TwitterLocation') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'TwitterLocation') self.toolbar.setObjectName(u'TwitterLocation')
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 """ self.dlg = None # Save reference to the QGIS interface self.iface = iface self.canvas = iface.mapCanvas() # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'OSRM_{}.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) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Routing with OSRM') self.toolbar = self.iface.addToolBar(u'Routing with OSRM') self.toolbar.setObjectName(u'Routing with OSRM')
def __init__(self, iface): self.iface = iface self.plugin_dir = dirname(__file__) # initialize locale locale = QSettings().value("locale/userLocale")[0:2] locale_path = join( self.plugin_dir, 'i18n', 'GeoHealth_{}.qm'.format(locale)) if exists(locale_path): self.translator = QTranslator() self.translator.load(locale_path) if qVersion() > '4.3.3': # noinspection PyCallByClass,PyTypeChecker,PyArgumentList QCoreApplication.installTranslator(self.translator) self.plugin_menu = None self.geohealth_menu = None self.main_action = None self.xy_action = None self.blur_action = None self.incidence_action = None self.density_action = None self.histogram_action = None # Add to processing self.provider = Provider() Processing.addProvider(self.provider, True)
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] locale_path = os.path.join( self.plugin_dir, 'i18n', 'MahalanobisDistance_{}.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 = MahalanobisDistanceDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Mahalanobis Distance') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'Mahalanobis Distance') self.toolbar.setObjectName(u'Mahalanobis Distance') # signals and slots self.dlg.addBtn.clicked.connect(self.add_layer) self.dlg.removeBtn.clicked.connect(self.remove_layer) self.dlg.outputBtn.clicked.connect(self.output) self.dlg.buttonBox.accepted.connect(self.calculate) self.dlg.buttonBox.rejected.connect(self.dlg.close)
def __init__(self, iface): """Constructor.""" # 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] locale_path = os.path.join( self.plugin_dir, 'i18n', 'ApexQuality_{}.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) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Apex Quality Assessment') self.spectralTool = SpectralTool(self.iface.mapCanvas()) self.path = os.path.dirname(os.path.realpath(__file__))
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 self.canvas = self.iface.mapCanvas() # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value("locale/userLocale")[0:2] locale_path = os.path.join(self.plugin_dir, "i18n", "smart-editing-tools_{}.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) # Declare instance attributes self.actions = [] self.name = self.tr(u"&Smart editing tools") self.menu = self.iface.vectorMenu().addMenu(QIcon(":/plugins/smart-editing-tools/icon.png"), self.name) self.toolbar = self.iface.addToolBar(u"Smart_editing_tools") self.toolbar.setObjectName(u"Smart_editing_tools") self.oldTool = None self.disconnection = None
def collectVersions(self): csw = Misc.Switcher(0, "#ffffff", "#eeeeee") buf = ['<table><tr bgcolor="#dddddd"><th>Component/Library</th><th>Version</th></tr>'] buf.append('<tr bgcolor="%s"><td>SimuVis4</td><td>%s</td></tr>' % (csw(), Globals.version_string)) buf.append('<tr bgcolor="%s"><td>Python</td><td>%s | %s</td></tr>' % \ (csw(), '.'.join([str(i) for i in sys.version_info]), sys.version)) buf.append('<tr bgcolor="%s"><td>PyQt</td><td>%s | %s</td></tr>' % (csw(), PYQT_VERSION_STR, PYQT_VERSION)) buf.append('<tr bgcolor="%s"><td>Qt</td><td>%s</td></tr>' % (csw(), qVersion())) if sys.modules.has_key('vtk'): v = sys.modules['vtk'].vtkVersion.GetVTKVersion() vl = sys.modules['vtk'].vtkVersion.GetVTKSourceVersion() buf.append('<tr bgcolor="%s"><td>Vtk</td><td>%s | %s</td></tr>' % (csw(), v, vl)) if sys.modules.has_key('OpenGL'): v = sys.modules['OpenGL'].__version__ buf.append('<tr bgcolor="%s"><td>PyOpenGL</td><td>%s</td></tr>' % (csw(), v)) for p in Globals.mainWin.plugInManager.plugIns.values(): buf.append('<tr bgcolor="%s"><td>PlugIn: %s</td><td>%s</td></tr>' % (csw(), p.name, p.version)) if sys.platform == 'linux2': n = QCoreApplication.translate('AboutDlg', 'Operating System') d = getLinuxDistro() k = os.popen('uname -o -s -r', 'r').readlines()[0] buf.append('<tr bgcolor="%s"><td>%s</td><td>%s (%s)</td></tr>' % (csw(), n, d, k)) if sys.platform == 'win32': n = QCoreApplication.translate('AboutDlg', 'Operating System') v, vs = getWindowsVersion() buf.append('<tr bgcolor="%s"><td>%s</td><td>%s</td></tr>' % (csw(), n, vs)) buf.append('</table>') self.VersionView.setHtml('\n'.join(buf))
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'metriquePhenologique_{}.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 = metriquePhenologiqueDialog() QApplication.restoreOverrideCursor() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&pretraitement et pheno') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'metriquePhenologique') self.toolbar.setObjectName(u'metriquePhenologique') self.dlg.pushButton_cheminNDVI.clicked.connect(self.accesRepertoireNdvi) self.dlg.pushButton_cheminDOY.clicked.connect(self.accesRepertoireDoy) self.dlg.pushButton_cheminOut.clicked.connect(self.accesCheminSave) self.dlg.pushButton_cheminNDVI_metrique.clicked.connect(self.accesRepertoireNdviMetrique) self.dlg.pushButton_cheminNDVI_metrique_fichier.clicked.connect(self.accesFichierNdviMetriqueMultiannuelle) self.dlg.pushButton_cheminOut_metrique.clicked.connect(self.accesCheminSaveMetrique) self.dlg.pushButton_cheminZoneEtudes.clicked.connect(self.accesZoneEtudes) self.dlg.pushButton_execution.clicked.connect(self.active_progressbar,1) self.dlg.pushButton_execution.clicked.connect(self.validation) self.dlg.pushButton_execution_metrique.clicked.connect(self.active_progressbar_metrique,1) self.dlg.pushButton_execution_metrique.clicked.connect(self.validationMetrique) self.dlg.radioButton_DOY.clicked.connect(self.selectionDOY) self.dlg.radioButton_NDVI.clicked.connect(self.selectionNDVI) self.dlg.radioButton_default.clicked.connect(self.selectionDefault) self.dlg.radioButton_seuil.clicked.connect(self.selectionSeuil) self.dlg.MOD13Q1.currentChanged[int].connect(self.choixTab) #permet de réaliser une tache en fonction de l'option de pretraitement choisie self.dlg.outilPretraitement.currentChanged[int].connect(self.choix)
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 = QSettings().value("locale/userLocale")[0:2] locale_path = os.path.join(self.plugin_dir, "i18n", "LidarProcessor_{}.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 = LidarProcessorDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u"&LiDAR Processor") # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u"LidarProcessor") self.toolbar.setObjectName(u"LidarProcessor") # Button Calls # Select Input Button self.dlg.inputDir.clear() self.dlg.inputDirButton.clicked.connect(self.select_input_file) # Select Output Button self.dlg.outputDir.clear() self.dlg.outputDirButton.clicked.connect(self.select_output_file) # Select Lastools Directory Button self.dlg.lastoolDir.clear() self.dlg.lastoolDirButton.clicked.connect(self.select_lastool_file) # Start Processing Button self.dlg.startProc.clicked.connect(self.proc_start) # To make the Status box uneditable by the user self.dlg.statusBox.setReadOnly(True) # Set Resolution Button for DEM FIles self.dlg.setres.clicked.connect(self.enablespin) count = 0 self.dlg.closeButton.clicked.connect(self.closeplugin)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'ZRisk_{}.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 = ZRiskDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&ZRisk') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'ZRisk') self.toolbar.setObjectName(u'ZRisk') #Definisanje signala i slotova: #Detektovanje da li su lejeri u ulaznim poljima promenjeni QObject.connect(self.dlg.mMapLayerComboBoxHazard, QtCore.SIGNAL("currentIndexChanged(const QString&)"), self.layerChanged) QObject.connect(self.dlg.mMapLayerComboBoxPovredljivost, QtCore.SIGNAL("currentIndexChanged(const QString&)"), self.layerChanged) QObject.connect(self.dlg.mMapLayerComboBoxZgrade, QtCore.SIGNAL("currentIndexChanged(const QString&)"), self.layerChanged) #Detektovanje promena u ulalaznim poljima: QObject.connect(self.dlg.mFieldComboBoxHPGA, QtCore.SIGNAL("fieldChanged(const QString &)"), self.fieldChanged) QObject.connect(self.dlg.mFieldComboBoxZPGA, QtCore.SIGNAL("fieldChanged(const QString &)"), self.fieldChanged) QObject.connect(self.dlg.mFieldComboBoxOstecenje, QtCore.SIGNAL("fieldChanged(const QString &)"), self.fieldChanged) QObject.connect(self.dlg.mFieldComboBoxLJudi, QtCore.SIGNAL("fieldChanged(const QString &)"), self.fieldChanged) QObject.connect(self.dlg.mFieldComboBoxStanari, QtCore.SIGNAL("fieldChanged(const QString &)"), self.fieldChanged) QObject.connect(self.dlg.mFieldComboBoxKljudi, QtCore.SIGNAL("fieldChanged(const QString &)"), self.fieldChanged) QObject.connect(self.dlg.mFieldComboBoxKpovred, QtCore.SIGNAL("fieldChanged(const QString &)"), self.fieldChanged) #Glavni signal i dugme OK QObject.connect(self.dlg.pushButtonOK, QtCore.SIGNAL('clicked()'), self.sracunaj) #Dugme Odustani QObject.connect(self.dlg.pushButtonOdustani, QtCore.SIGNAL('clicked()'), self.close) #Detektovanje promene da li se raspolaze PGA podacima QObject.connect(self.dlg.radioButton, QtCore.SIGNAL('clicked()'), self.kliknuto)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'UniumPlugin_{}.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) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&UniumPlugin') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.pluginToolBar() #self.iface.addToolBar(u'UniumPlugin') self.toolbar.setObjectName(u'UniumPlugin') #print "** INITIALIZING UniumPlugin" self.pluginIsActive = False self.dockwidget = None # initialize dict for saving data about importing sml self.sml_data = {} # initialize layers data self.categories = {} self.layers = {} self.src_info = {} self.selected_id = u'' self.selected_files = [] self.mercator = QgsCoordinateReferenceSystem() mercatorWKT = u'PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]' mercatorProj4 = u'+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs' #self.mercator.createFromProj4() self.mercator.createFromWkt(mercatorWKT) # default configuration self.default_config = """{"files_folder": "",
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 """ ############################################# #Deixa o Canvas do QGIS manuseável, não tenho muita certeza ainda self.iface = iface #QgsMapTool.__init__(self, iface.mapCanvas()) self.canvas = self.iface.mapCanvas() #QgsMapToolEmitPoint.__init__(self.canvas) self.clickTool = QgsMapToolEmitPoint(self.canvas) ############################################# # 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] locale_path = os.path.join(self.plugin_dir, 'i18n', 'BrasilIDF_{}.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 = BrasilIDFDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Brasil IDF') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'BrasilIDF') self.toolbar.setObjectName(u'BrasilIDF') #======================================================================# #Limpa o texto que ja foi escrito e conecta ao select_output_file1 self.dlg.caminhoTexto.clear() self.dlg.botaoTexto.clicked.connect(self.select_output_file) #DURACAO - Pega o clique do botão rodar e conecta ao run self.dlg.rodarDuracao.clicked.connect(self.run) #BLOCOS_ALTERNADOS - Pega o clique do botão rodar e conecta ao run1 self.dlg.rodarBlocos.clicked.connect(self.run1) #CURVA_I-D-F - Pega o clique do botão rodar e conecta ao run2 self.dlg.rodarIDF.clicked.connect(self.run2) #CURVA_P-D-F - Pega o clique do botão rodar e conecta ao run3 self.dlg.rodarPDF.clicked.connect(self.run3) #Pega o clique do botão fechar e conect a função fechar self.dlg.fechar.clicked.connect(self.fechar)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'ExportToHE_{}.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 = ExportToHEDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Export to HE') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'ExportToHE') self.toolbar.setObjectName(u'ExportToHE') # Anfang Eigene Funktionen ------------------------------------------------- # (jh, 08.02.2017) logger.info('\n\nQKan_ExportHE initialisiert...') # -------------------------------------------------------------------------- # Pfad zum Arbeitsverzeichnis sicherstellen wordir = os.path.join(site.getuserbase(), 'qkan') if not os.path.isdir(wordir): os.makedirs(wordir) # -------------------------------------------------------------------------- # Konfigurationsdatei qkan.json lesen # self.configfil = os.path.join(wordir, 'qkan.json') if os.path.exists(self.configfil): with codecs.open(self.configfil, 'r', 'utf-8') as fileconfig: self.config = json.loads(fileconfig.read().replace('\\', '/')) else: self.config['database_HE'] = '' # Vorlagedatenbank nur für den Fall, dass der Anwender keine eigene Vorlage erstellen will self.config['dbtemplate_HE'] = os.path.join( os.path.dirname(__file__), "templates", "itwh.idbf") self.config['database_QKan'] = '' with codecs.open(self.configfil, 'w', 'utf-8') as fileconfig: fileconfig.write(json.dumps(self.config)) # Standard für Suchverzeichnis festlegen project = QgsProject.instance() self.default_dir = os.path.dirname(project.fileName()) if 'database_QKan' in self.config: database_QKan = self.config['database_QKan'] else: database_QKan = '' self.dlg.tf_QKanDB.setText(database_QKan) self.dlg.pb_selectQKanDB.clicked.connect(self.selectFile_QKanDB) if 'database_HE' in self.config: database_HE = self.config['database_HE'] else: database_HE = '' self.dlg.tf_heDB_dest.setText(database_HE) self.dlg.pb_selectHeDB_dest.clicked.connect(self.selectFile_HeDB_dest) if 'dbtemplate_HE' in self.config: dbtemplate_HE = self.config['dbtemplate_HE'] else: dbtemplate_HE = '' self.dlg.tf_heDB_template.setText(dbtemplate_HE) self.dlg.pb_selectHeDB_template.clicked.connect( self.selectFile_HeDB_template) if 'datenbanktyp' in self.config: datenbanktyp = self.config['datenbanktyp'] else: datenbanktyp = 'spatialite' pass # Es gibt noch keine Wahlmöglichkeit self.dlg.pb_exportall.clicked.connect(self.exportall) self.dlg.pb_modifyall.clicked.connect(self.modifyall) self.dlg.pb_initall.clicked.connect(self.initall) self.dlg.pb_exportnone.clicked.connect(self.exportnone) self.dlg.pb_modifynone.clicked.connect(self.modifynone) self.dlg.pb_initnone.clicked.connect(self.initnone) # Auswahl der zu exportierenden Tabellen ---------------------------------------------- # Eigene Funktion für die zahlreichen Checkboxen def cb_set(name, cbox, default): if name in self.config: checked = self.config[name] else: checked = default cbox.setChecked(checked) return checked export_schaechte = cb_set('export_schaechte', self.dlg.cb_export_schaechte, True) export_auslaesse = cb_set('export_auslaesse', self.dlg.cb_export_auslaesse, True) export_speicher = cb_set('export_speicher', self.dlg.cb_export_speicher, True) export_haltungen = cb_set('export_haltungen', self.dlg.cb_export_haltungen, True) export_pumpen = cb_set('export_pumpen', self.dlg.cb_export_pumpen, False) export_wehre = cb_set('export_wehre', self.dlg.cb_export_wehre, False) export_flaechenrw = cb_set('export_flaechenrw', self.dlg.cb_export_flaechenrw, True) export_flaechensw = cb_set('export_flaechensw', self.dlg.cb_export_flaechensw, True) export_abflussparameter = cb_set('export_abflussparameter', self.dlg.cb_export_abflussparameter, True) export_regenschreiber = cb_set('export_regenschreiber', self.dlg.cb_export_regenschreiber, False) export_rohrprofile = cb_set('export_rohrprofile', self.dlg.cb_export_rohrprofile, False) export_speicherkennlinien = cb_set( 'export_speicherkennlinien', self.dlg.cb_export_speicherkennlinien, False) export_bodenklassen = cb_set('export_bodenklassen', self.dlg.cb_export_bodenklassen, False) modify_schaechte = cb_set('modify_schaechte', self.dlg.cb_modify_schaechte, False) modify_auslaesse = cb_set('modify_auslaesse', self.dlg.cb_modify_auslaesse, False) modify_speicher = cb_set('modify_speicher', self.dlg.cb_modify_speicher, False) modify_haltungen = cb_set('modify_haltungen', self.dlg.cb_modify_haltungen, False) modify_pumpen = cb_set('modify_pumpen', self.dlg.cb_modify_pumpen, False) modify_wehre = cb_set('modify_wehre', self.dlg.cb_modify_wehre, False) modify_flaechenrw = cb_set('modify_flaechenrw', self.dlg.cb_modify_flaechenrw, False) modify_flaechensw = cb_set('modify_flaechensw', self.dlg.cb_modify_flaechensw, False) modify_abflussparameter = cb_set('modify_abflussparameter', self.dlg.cb_modify_abflussparameter, False) modify_regenschreiber = cb_set('modify_regenschreiber', self.dlg.cb_modify_regenschreiber, False) modify_rohrprofile = cb_set('modify_rohrprofile', self.dlg.cb_modify_rohrprofile, False) modify_speicherkennlinien = cb_set( 'modify_speicherkennlinien', self.dlg.cb_modify_speicherkennlinien, False) modify_bodenklassen = cb_set('modify_bodenklassen', self.dlg.cb_modify_bodenklassen, False) init_schaechte = cb_set('init_schaechte', self.dlg.cb_init_schaechte, False) init_auslaesse = cb_set('init_auslaesse', self.dlg.cb_init_auslaesse, False) init_speicher = cb_set('init_speicher', self.dlg.cb_init_speicher, False) init_haltungen = cb_set('init_haltungen', self.dlg.cb_init_haltungen, False) init_pumpen = cb_set('init_pumpen', self.dlg.cb_init_pumpen, False) init_wehre = cb_set('init_wehre', self.dlg.cb_init_wehre, False) init_flaechenrw = cb_set('init_flaechenrw', self.dlg.cb_init_flaechenrw, False) init_flaechensw = cb_set('init_flaechensw', self.dlg.cb_init_flaechensw, False) init_abflussparameter = cb_set('init_abflussparameter', self.dlg.cb_init_abflussparameter, False) init_regenschreiber = cb_set('init_regenschreiber', self.dlg.cb_init_regenschreiber, False) init_rohrprofile = cb_set('init_rohrprofile', self.dlg.cb_init_rohrprofile, False) init_speicherkennlinien = cb_set('init_speicherkennlinien', self.dlg.cb_init_speicherkennlinien, False) init_bodenklassen = cb_set('init_bodenklassen', self.dlg.cb_init_bodenklassen, False) export_difftezg = cb_set('export_difftezg', self.dlg.cb_export_difftezg, True) export_verschneidung = cb_set('export_verschneidung', self.dlg.cb_export_verschneidung, True)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'TECView_{}.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) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&SRH2D_TECViewer') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'TECView') self.toolbar.setObjectName(u'TECView') self.all_Attrs = list() self.dlg = TECViewDialog() self.dlg.fileListWidget.clear() self.dlg.attributeList.clear() self.dlg.progressBar.setVisible(False) # - Button Connections - # self.dlg.selectProjFolder.clicked.connect(self.selectProjFolder) self.dlg.geoRefBtn.clicked.connect(self.selectCrs) self.dlg.addFileBtn.clicked.connect(self.selectTECFile) self.dlg.deleteFileBtn.clicked.connect(self.removeTECfile) self.dlg.fileListWidget.itemSelectionChanged.connect(self.showAttr) self.dlg.cancelLoadBtn.clicked.connect(lambda: self.dlg.done(0)) self.dlg.attributeList.clicked.connect(self.selectToShow) self.dlg.loadTECBtn.clicked.connect(self.loadTECfiles) self.dlg.callSettingsBtn.clicked.connect(self.runSettings) self.dlg.fileListWidget.customContextMenuRequested.connect( self.subMenuOnFileList) self.animation = makeAnimation(self.iface) self.profiler = profilePlot(self.iface) self.contourPlot = contourPlot(self.iface) self.makeKml = kmlExport(self.iface) self.vecPlot = vecPlot(self.iface) self.settings = QSettings('ManySplendid', 'SRH2D_TEC_Viewer') try: self.systemCRS = self.settings.value('crs') except (AttributeError): self.settings.setValue('crs', 3826) crsType = QgsCoordinateReferenceSystem.InternalCrsId self.systemCRS = QgsCoordinateReferenceSystem(3826, crsType)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'ImportFromHE_{}.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_he = ImportFromHEDialog() self.dlg_lz = ResultsFromHEDialog() # Anfang Eigene Funktionen ------------------------------------------------- # (jh, 09.10.2016) # -------------------------------------------------------------------------------------------------- # Pfad zum Arbeitsverzeichnis sicherstellen wordir = os.path.join(site.getuserbase(), 'qkan') if not os.path.isdir(wordir): os.makedirs(wordir) # -------------------------------------------------------------------------------------------------- # Konfigurationsdatei qkan.json lesen # self.configfil = os.path.join(wordir, 'qkan.json') if os.path.exists(self.configfil): with open(self.configfil, 'r') as fileconfig: self.config = json.loads(fileconfig.read()) # Standard für Suchverzeichnis festlegen project = QgsProject.instance() self.default_dir = os.path.dirname(project.fileName()) # Formularereignisse run_import() self.dlg_he.pb_selectqkanDB.clicked.connect(self.selectFile_qkanDBHE) self.dlg_he.pb_selectHeDB.clicked.connect(self.selectFile_HeDB) self.dlg_he.pb_selectKBS.clicked.connect(self.selectKBS) self.dlg_he.pb_selectProjectFile.clicked.connect( self.selectProjectFile) # Formularereignisse run_results() self.dlg_lz.pb_selectqmlfile.clicked.connect(self.selectqmlfileResults) # Klick auf eine Option zum Layerstil aktiviert/deaktiviert das Textfeld und die Schaltfläche self.dlg_lz.pb_selectHeDB.clicked.connect(self.selectFile_HeErgDB) self.dlg_lz.rb_userqml.clicked.connect(self.enable_tf_qmlfile) self.dlg_lz.rb_uebh.clicked.connect(self.disable_tf_qmlfile) self.dlg_lz.rb_uebvol.clicked.connect(self.disable_tf_qmlfile) self.dlg_lz.rb_none.clicked.connect(self.disable_tf_qmlfile)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'SuewsSimple_{}.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 = SuewsSimpleDialog() self.dlg.pushButtonIMPcalcBuild.clicked.connect(self.IMCP) self.dlg.pushButtonIMPcalcVeg.clicked.connect(self.IMCP) self.dlg.pushButtonLCFPcalc.clicked.connect(self.LCFP) self.dlg.pushButtonImport_IMPB.clicked.connect(self.import_file_IMPB) self.dlg.pushButtonImport_IMPV.clicked.connect(self.import_file_IMPV) self.dlg.pushButtonImport_LCFP.clicked.connect(self.import_file_LCFP) self.dlg.defaultButton.clicked.connect(self.set_default_settings) self.dlg.helpButton.clicked.connect(self.help) self.dlg.runButton.clicked.connect(self.start_progress) self.dlg.pushButtonSave.clicked.connect(self.folder_path) self.dlg.pushButtonImport.clicked.connect(self.met_file) self.dlg.pushButtonImportInitial.clicked.connect(self.import_initial) self.dlg.pushButtonExportInitial.clicked.connect(self.export_initial) self.fileDialog = QFileDialog() self.fileDialog.setNameFilter("(*Point_isotropic.txt)") self.fileDialogInit = QFileDialog() self.fileDialogInit.setNameFilter("(*.nml)") self.fileDialogMet = QFileDialog() self.fileDialogMet.setNameFilter("(*.txt)") self.fileDialogOut = QFileDialog() self.fileDialogOut.setFileMode(4) self.fileDialogOut.setAcceptMode(1) self.folderPathOut = None self.folderPath = None self.ret = 0 # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Suews Simple') # TODO: We are going to let the user set this up in a future iteration # self.toolbar = self.iface.addToolBar(u'SuewsSimple') # self.toolbar.setObjectName(u'SuewsSimple') self.model_dir = os.path.normpath(self.plugin_dir + os.sep + os.pardir + os.sep + 'suewsmodel')
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'kNN_{}.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) # Declare instance attributes self.dlg = kNNDialog() self.actions = [] self.menu = self.tr(u'&kNN') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'kNN') self.toolbar.setObjectName(u'kNN') ###########Clears line########### self.dlg.save_lineEdit.clear() ###########Launches event when button clicked########### self.dlg.save_browse.clicked.connect(self.select_output_file) ###########Launches event when item in dropdown menu is changed########### self.dlg.multiband_dropdown.currentIndexChanged.connect( self.updatebands) # self.dlg.mask_dropdown.currentIndexChanged.connect(self.upadtemask) self.dlg.mask_dropdown.currentIndexChanged.connect(self.updateMASK) self.dlg.SHP_dropdown.currentIndexChanged.connect(self.updateSHP) self.dlg.list_select_descriptors.itemClicked.connect( self.updateDescriptors) self.dlg.list_select_tobe_classified.itemClicked.connect( self.updateToBeClassified) self.dlg.list_select_bands.itemClicked.connect( self.updateSelectedBands) ###########Disable save path editing########### self.dlg.save_lineEdit.setEnabled(False) ###########Set default tab (Basic not advanced)########### self.dlg.tabWidget.setCurrentIndex(0) ###Set default values for check boxes### self.dlg.FeatureWghtLine.setEnabled(False) self.dlg.Geo_dist_spinBox.setEnabled(False) self.dlg.mask_checkbox.setEnabled(True) ###Call update Feature Wght and GeoDistance on state change### self.dlg.FeatureWghtLine_checkBox.stateChanged.connect( self.updateFeatureWghtLine) self.dlg.Geo_Dist_Checkbox.stateChanged.connect(self.updateGeoDistance)
def __init__(self, iface): """Constructor. Args: iface (QgsInterface): 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. """ # 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] locale_path = os.path.join(self.plugin_dir, 'i18n', 'pat_plugin_{}.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) self.actions = [] # Look for the existing menu self.menuPrecAg = self.iface.mainWindow().findChild(QMenu, 'm{}Menu'.format(PLUGIN_SHORT)) # If the menu does not exist, create it! if not self.menuPrecAg: self.menuPrecAg = QMenu('{}'.format(PLUGIN_SHORT), self.iface.mainWindow().menuBar()) self.menuPrecAg.setObjectName('m{}Menu'.format(PLUGIN_SHORT)) actions = self.iface.mainWindow().menuBar().actions() lastAction = actions[-1] self.iface.mainWindow().menuBar().insertMenu(lastAction, self.menuPrecAg) # create a toolbar self.toolbar = self.iface.addToolBar(u'{} Toolbar'.format(PLUGIN_SHORT)) self.toolbar.setObjectName(u'm{}ToolBar'.format(PLUGIN_SHORT)) # Load Defaults settings for First time... for eaKey in ['BASE_IN_FOLDER', 'BASE_OUT_FOLDER']: sFolder = read_setting(PLUGIN_NAME + '/' + eaKey) if sFolder is None or not os.path.exists(sFolder): sFolder = os.path.join(os.path.expanduser('~'), PLUGIN_NAME) if not os.path.exists(sFolder): os.mkdir(sFolder) write_setting(PLUGIN_NAME + '/' + eaKey, os.path.join(os.path.expanduser('~'), PLUGIN_NAME)) self.DEBUG = config.get_debug_mode() self.vesper_queue = [] self.vesper_queue_showing = False self.processVesper = None self.vesper_exe = check_vesper_dependency(iface) if not os.path.exists(TEMPDIR): os.mkdir(TEMPDIR)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'PeregrineFalcon_{}.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 = PeregrineFalconDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Peregrine Falcon') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'PeregrineFalcon') self.toolbar.setObjectName(u'PeregrineFalcon') ################################################################################################################## ################################################################################################################## # Initialisation des variables self.input_wetland = "" self.input_water = "" self.input_dem = "" self.plugin_name = "PeregrineFalcon" # Initialisation de la progress bar self.initialize_progress_bar() # Gérer les évènements des boutons self.dlg.demPushButton.clicked.connect(self.select_dem_file) self.dlg.waterPushButton.clicked.connect(self.select_water_file) self.dlg.wetLandPushButton.clicked.connect(self.select_wetland_file) self.dlg.outPushButton.clicked.connect(self.select_output_folder) self.dlg.helpPushButton.clicked.connect(self.show_help) # Gérer les évènements des LineEdits self.dlg.demLineEdit.editingFinished.connect(self.write_dem_srs) self.dlg.waterLineEdit.editingFinished.connect(self.write_water_srs) self.dlg.wetLandLineEdit.editingFinished.connect( self.write_wetland_srs) # Gérer les évènements des Sliders self.dlg.slopeAreaSlider.valueChanged.connect( self.show_slope_area_value) self.dlg.waterAreaSlider.valueChanged.connect( self.show_water_area_value) self.dlg.slopeDegSlider.valueChanged.connect(self.show_slope_deg_value) self.dlg.wetLandAreaSlider.valueChanged.connect( self.show_wet_land_value) # Régler les valeurs minimum et maximum des Sliders self.dlg.slopeAreaSlider.setMinimum(2) self.dlg.slopeAreaSlider.setMaximum(1000) self.dlg.slopeDegSlider.setMinimum(20) self.dlg.slopeDegSlider.setMaximum(90) self.dlg.waterAreaSlider.setMinimum(2) self.dlg.waterAreaSlider.setMaximum(1000) self.dlg.wetLandAreaSlider.setMinimum(2) self.dlg.wetLandAreaSlider.setMaximum(1000) # Initialiser des valeurs par défaut pour les paramètres self.dlg.slopeAreaSlider.setValue(5) self.dlg.waterAreaSlider.setValue(5) self.dlg.wetLandAreaSlider.setValue(5) self.dlg.slopeDegSlider.setValue(40) # Initialisation des classes de communication et de validation self.communications = communications(self.iface, self.progress, self.progressMessageBar, self.plugin_name) self.validate = validation(self.iface, self.communications, self.plugin_name) ################################# VALEURS TEMPORAIRES POUR DEBUG ############################################## # self.dlg.demLineEdit.setText(r"/home/prototron/.qgis2/python/plugins/qgis-plugin-peregrine-falcon/in_data/dem_highres_2.tif") # self.dlg.waterLineEdit.setText(r"/home/prototron/.qgis2/python/plugins/qgis-plugin-peregrine-falcon/in_data/waterbody_2.shp") # self.dlg.outLineEdit.setText(r'/home/prototron/.qgis2/python/plugins/qgis-plugin-peregrine-falcon/out_data/') # self.dlg.wetLandLineEdit.setText(r'/home/prototron/.qgis2/python/plugins/qgis-plugin-peregrine-falcon/in_data/saturated_soil_2.shp') # self.dlg.demLineEdit.setText(r"C:\Users\Myriam\Documents\S5 - H2016\GMQ580\qgis-plugin-peregrine-falcon\in_data\proj\dem_highres_proj.tif") # self.dlg.waterLineEdit.setText(r"C:\Users\Myriam\Documents\S5 - H2016\GMQ580\qgis-plugin-peregrine-falcon\in_data\proj\waterbody_3.shp") # self.dlg.outLineEdit.setText(r'C:\Users\Myriam\Documents\S5 - H2016\GMQ580\qgis-plugin-peregrine-falcon\out_data') # self.dlg.wetLandLineEdit.setText(r'C:\Users\Myriam\Documents\S5 - H2016\GMQ580\qgis-plugin-peregrine-falcon\in_data\proj\saturated_soil_2.shp') self.dlg.demLineEdit.setText( r"C:\OSGeo4W64\apps\qgis\python\plugins\qgis-plugin-peregrine-falcon\in_data\proj\dem_highres_proj.tif" ) self.dlg.waterLineEdit.setText( r"C:\OSGeo4W64\apps\qgis\python\plugins\qgis-plugin-peregrine-falcon\in_data\proj\waterbody_3.shp" ) self.dlg.outLineEdit.setText(r'C:\TEMP') self.dlg.wetLandLineEdit.setText( r'C:\OSGeo4W64\apps\qgis\python\plugins\qgis-plugin-peregrine-falcon\in_data\proj\saturated_soil_2.shp' )
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'DataPlot_{}.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 = DataPlotDialog() # Add data to plotTypeCombo self.plot_types = { 'pie': self.tr('Pie chart'), 'box': self.tr('Box plot'), 'histogram': self.tr('Histogram'), 'bar': self.tr('Bar Chart'), 'distribution': self.tr('Distribution plot'), 'scatter': self.tr('Scatter plot'), 'scatter3d': self.tr('Scatter plot 3D') } self.dlg.plotTypeCombo.clear() for k, v in self.plot_types.items(): self.dlg.plotTypeCombo.addItem(v, k) self.plot_types_widgets = { self.dlg.LayerCombo: ['all'], self.dlg.LayerCombo_label: ['all'], self.dlg.expFieldX: ['all'], self.dlg.expFieldY: ['all'], self.dlg.legendCheck: ['all'], self.dlg.plotTitle: ['all'], self.dlg.alpha: ['all'], self.dlg.alpha_label: ['all'], self.dlg.alphaBox: ['all'], self.dlg.colorButton: ['all_but_pie'], self.dlg.colorButton_label: ['all_but_pie'], self.dlg.xAxisCheck: ['all_but_pie'], self.dlg.xAxisText: ['all_but_pie'], self.dlg.yAxisCheck: ['all_but_pie'], self.dlg.yAxisText: ['all_but_pie'], self.dlg.colorButton2: ['bar', 'box'], self.dlg.colorButton2_label: ['bar', 'box'], self.dlg.widthBox: ['bar', 'box'], self.dlg.widthBox_label: ['bar', 'box'], self.dlg.barCombo: ['bar'], self.dlg.barCombo_label: ['bar'], self.dlg.orientationCombo: ['bar'], self.dlg.orientationCombo_label: ['bar'], self.dlg.histCombo: ['histogram'], self.dlg.outlierCombo: ['box'], self.dlg.outlierCombo_label: ['box'], self.dlg.statCombo: ['box'], self.dlg.statCombo_label: ['box'], self.dlg.rugCheck: ['distribution'], self.dlg.histCheck: ['distribution'], self.dlg.curveCheck: ['distribution'], self.dlg.binSize: ['distribution'], self.dlg.curveCombo: ['distribution'], self.dlg.regressionCheck: ['scatter'], self.dlg.equationCheck: ['scatter'], self.dlg.rangeCheck: ['scatter'], self.dlg.logXCheck: ['scatter'], self.dlg.logYCheck: ['scatter'], self.dlg.symbolCombo: ['scatter', 'scatter3d'], self.dlg.symbolCombo_label: ['scatter', 'scatter3d'], self.dlg.Size: ['scatter', 'scatter3d'], self.dlg.Size_label: ['scatter', 'scatter3d'], self.dlg.dataDefined: ['scatter'], self.dlg.expFieldZ: ['scatter3d'], self.dlg.expFieldZ_label: ['scatter3d'], self.dlg.dataDefined: ['scatter3d'], self.dlg.zAxisCheck: ['scatter3d'], self.dlg.zAxisText: ['scatter3d'] } # Add data to vertical/horizontal combo self.orientations = { 'v': self.tr('Vertical'), 'h': self.tr('Horizontal') } self.dlg.orientationCombo.clear() for k, v in self.orientations.items(): self.dlg.orientationCombo.addItem(v, k) # Add data to symbol type combo self.symbolType = { 'markers': self.tr('Points'), 'lines': self.tr('Lines'), 'markers+lines': self.tr('Points and Lines') } self.dlg.symbolCombo.clear() for k, v in self.symbolType.items(): self.dlg.symbolCombo.addItem(v, k) # Add data to vertical/horizontal combo self.figureTypes = { 'classic': self.tr(u'Classic'), 'subplots': self.tr(u'Subplots with shared axis') } # Add data for the showing statistics type (box plot only) self.statType = { True: self.tr('Mean'), 'sd': self.tr('Standard Deviation'), False: self.tr('No Statistics') } self.dlg.statCombo.clear() for k, v in self.statType.items(): self.dlg.statCombo.addItem(v, k) # Add data for the showing outliers (box plot only) self.outlierType = { False: self.tr('No Outliers'), 'all': self.tr('Show All Outliers'), 'suspectedoutliers': self.tr('Only Suspected Outliers'), 'outliers': self.tr('Outliers') } self.dlg.outlierCombo.clear() for k, v in self.outlierType.items(): self.dlg.outlierCombo.addItem(v, k) # Add overlaying mode for bars self.overlaying = { 'overlay': self.tr('Overlay'), 'stack': self.tr('Stacked') } self.dlg.histCombo.clear() for k, v in self.overlaying.items(): self.dlg.histCombo.addItem(v, k) # self.dlg.figureTypeCombo.clear() for k, v in self.figureTypes.items(): self.dlg.figureTypeCombo.addItem(v, k) self.dataPlotTraces = {} self.dataPlotFigures = [] # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Data Plot') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'DataPlot') self.toolbar.setObjectName(u'DataPlot')
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'WATCHData_{}.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 # connections to buttons self.dlg = WATCHDataDialog() self.dlg.cmdSelectPoint.clicked.connect(self.select_point) self.dlg.cmdRunDownload.clicked.connect(self.download) self.dlg.cmdChooseLQFResults.clicked.connect(self.folderAH) self.dlg.cmdRunRefine.clicked.connect(self.refine) self.dlg.pushButtonHelp.clicked.connect(self.help) # Disable refiner buttons to start with (no downloaded data to refine!) self.dlg.cmdChooseLQFResults.setEnabled(False) self.dlg.cmdRunRefine.setEnabled(False) self.fileDialog = QFileDialog() self.fileDialog.setFileMode(4) self.fileDialog.setAcceptMode(1) self.dlg.progressBar.setRange(0,100) self.dlg.progressBar.setValue(0) self.watch_vars = ['Tair', 'Wind', 'LWdown', 'PSurf', 'Qair', 'Rainf', 'Snowf', 'SWdown'] # Parameters for downloader self.lat = None self.lon = None self.start_date = None self.end_date = None self.save_downloaded_file = None # Parameters for refiner self.site_height = None self.utc_offset = None self.rainy_hours = None self.save_refined_file = None self.lqf_path = None # Declare instance attributes self.actions = [] self.menu = self.tr(u'&WATCH data') # TODO: We are going to let the user set this up in a future iteration # get reference to the canvas self.canvas = self.iface.mapCanvas() self.degree = 5.0 self.point = None self.pointx = None self.pointy = None # #g pin tool self.pointTool = QgsMapToolEmitPoint(self.canvas) self.pointTool.canvasClicked.connect(self.create_point) text_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'WFDEIDownloader/WFDEI-land-long-lat-height.txt') gzip_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'WFDEIDownloader/WFDEI-land-long-lat-height.txt.gz') try: a = open(text_file) except IOError,e: try: import gzip with gzip.open(gzip_file, 'rb') as zipFile: a = zipFile.read() with open(text_file, 'wb') as outFile: outFile.write(a) except Exception, e: QMessageBox.critical(None, 'ha', str(e)) raise Exception('Could not locate mappings textfile, nor decompress its zipped copy')
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'importdyna_{}.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 = ImportFromDynaDialog() # # Declare instance attributes # self.actions = [] # self.menu = self.tr(u'&QKan Import aus DYNA-Datei') # # TODO: We are going to let the user set this up in a future iteration # self.toolbar = self.iface.addToolBar(u'ImportFromDyna') # self.toolbar.setObjectName(u'ImportFromDyna') # Anfang Eigene Funktionen ------------------------------------------------- # (jh, 09.10.2016) logger.info(u'\n\nQKan_ImportDyna initialisiert...') # -------------------------------------------------------------------------------------------------- # Pfad zum Arbeitsverzeichnis sicherstellen wordir = os.path.join(site.getuserbase(), u'qkan') if not os.path.isdir(wordir): os.makedirs(wordir) # -------------------------------------------------------------------------------------------------- # Konfigurationsdatei qkan.json lesen # self.configfil = os.path.join(wordir, u'qkan.json') if os.path.exists(self.configfil): with open(self.configfil, 'r') as fileconfig: self.config = json.loads(fileconfig.read()) else: self.config = {'epsg': '25832'} # Projektionssystem self.config['database_QKan'] = '' self.config['dynafile'] = '' self.config['projectfile'] = '' with open(self.configfil, 'w') as fileconfig: fileconfig.write(json.dumps(self.config)) # Standard für Suchverzeichnis festlegen project = QgsProject.instance() self.default_dir = os.path.dirname(project.fileName()) if 'database_QKan' in self.config: database_QKan = self.config['database_QKan'] else: database_QKan = '' self.dlg.tf_qkanDB.setText(database_QKan) self.dlg.pb_selectqkanDB.clicked.connect(self.selectFile_qkanDB) if 'dynafile' in self.config: dynafile = self.config['dynafile'] else: dynafile = '' self.dlg.tf_dynaFile.setText(dynafile) self.dlg.pb_selectDynaFile.clicked.connect(self.select_dynaFile) if 'epsg' in self.config: self.epsg = self.config['epsg'] else: self.epsg = '25832' self.dlg.tf_epsg.setText(self.epsg) self.dlg.pb_selectKBS.clicked.connect(self.selectKBS) if 'projectfile' in self.config: projectfile = self.config['projectfile'] else: projectfile = '' self.dlg.tf_projectFile.setText(projectfile) self.dlg.pb_selectProjectFile.clicked.connect(self.selectProjectFile) if 'check_inittab' in self.config: check_inittab = self.config['check_inittab'] else: check_inittab = True self.dlg.cb_import_tabinit.setChecked(check_inittab)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'LandCoverFractionGrid_{}.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 = LandCoverFractionGridDialog() self.dlg.runButton.clicked.connect(self.start_progress) self.dlg.pushButtonSave.clicked.connect(self.folder_path) self.dlg.helpButton.clicked.connect(self.help) self.dlg.progressBar.setValue(0) self.fileDialog = QFileDialog() self.fileDialog.setFileMode(4) self.fileDialog.setAcceptMode(1) # Save for i in range(1, 25): if 360 % i == 0: self.dlg.degreeBox.addItem(str(i)) self.dlg.degreeBox.setCurrentIndex(4) self.folderPath = 'None' self.degree = 5.0 self.dsm = None self.dem = None self.scale = None self.steps = 0 # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Land Cover Fraction Grid') # self.toolbar = self.iface.addToolBar(u'LandCoverFractionGrid') # self.toolbar.setObjectName(u'LandCoverFractionGrid') # self.layerComboManagerPolygrid = VectorLayerCombo(self.dlg.comboBox_Polygrid) # fieldgen = VectorLayerCombo(self.dlg.comboBox_Polygrid, initLayer="", options={"geomType": QGis.Polygon}) self.layerComboManagerPolygrid = QgsMapLayerComboBox( self.dlg.widget_Polygrid) self.layerComboManagerPolygrid.setCurrentIndex(-1) self.layerComboManagerPolygrid.setFilters( QgsMapLayerProxyModel.PolygonLayer) self.layerComboManagerPolygrid.setFixedWidth(175) self.layerComboManagerPolyField = QgsFieldComboBox( self.dlg.widget_Field) self.layerComboManagerPolyField.setFilters(QgsFieldProxyModel.Numeric) self.layerComboManagerPolygrid.layerChanged.connect( self.layerComboManagerPolyField.setLayer) # self.layerComboManagerPolyField = FieldCombo(self.dlg.comboBox_Field, fieldgen) #, options={"fieldType":QGis.Float32} # self.layerComboManagerLCgrid = RasterLayerCombo(self.dlg.comboBox_lcgrid) # RasterLayerCombo(self.dlg.comboBox_lcgrid, initLayer="") self.layerComboManagerLCgrid = QgsMapLayerComboBox( self.dlg.widget_lcgrid) self.layerComboManagerLCgrid.setFilters( QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerLCgrid.setFixedWidth(175) self.layerComboManagerLCgrid.setCurrentIndex(-1) if not (os.path.isdir(self.plugin_dir + '/data')): os.mkdir(self.plugin_dir + '/data')
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] locale_path = os.path.join(self.plugin_dir, 'i18n', 'FootprintModel_{}.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 = FootprintModelDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Footprint model') # TODO: We are going to let the user set this up in a future iteration # self.toolbar = self.iface.addToolBar(u'FootprintModel') # self.toolbar.setObjectName(u'FootprintModel') # get reference to the canvas self.canvas = self.iface.mapCanvas() self.poiLayer = None self.polyLayer = None self.folderPath = 'None' self.degree = 5.0 self.point = None self.pointx = None self.pointy = None self.provider = None # #g pin tool self.pointTool = QgsMapToolEmitPoint(self.canvas) self.pointTool.canvasClicked.connect(self.create_point) self.dlg.pushButtonImport.clicked.connect(self.import_file) self.dlg.runButton.clicked.connect(self.start_process) self.dlg.pushButtonSave.clicked.connect(self.folder_path) self.dlg.selectpoint.clicked.connect(self.select_point) # self.dlg.generateArea.clicked.connect(self.generate_area) self.dlg.helpButton.clicked.connect(self.help) self.dlg.progressBar.setValue(0) self.dlg.checkBoxOnlyBuilding.toggled.connect(self.text_enable) self.dlg.comboBoxFPM.currentIndexChanged.connect(self.bl_enable) self.fileDialogOpen = QFileDialog() self.filePath = None self.data = None self.fileDialog = QFileDialog() self.fileDialog.setFileMode(4) self.fileDialog.setAcceptMode(1) # self.layerComboManagerPoint = VectorLayerCombo(self.dlg.comboBox_Point) # fieldgen = VectorLayerCombo(self.dlg.comboBox_Point, initLayer="", options={"geomType": QGis.Point}) self.layerComboManagerPoint = QgsMapLayerComboBox( self.dlg.widgetPointLayer) self.layerComboManagerPoint.setCurrentIndex(-1) self.layerComboManagerPoint.setFilters( QgsMapLayerProxyModel.PointLayer) self.layerComboManagerPoint.setFixedWidth(175) # self.layerComboManagerPointField = FieldCombo(self.dlg.comboBox_Field, fieldgen, initField="") # self.layerComboManagerDSMbuildground = RasterLayerCombo(self.dlg.comboBox_DSMbuildground) # RasterLayerCombo(self.dlg.comboBox_DSMbuildground, initLayer="") # self.layerComboManagerDEM = RasterLayerCombo(self.dlg.comboBox_DEM) # RasterLayerCombo(self.dlg.comboBox_DEM, initLayer="") # self.layerComboManagerDSMbuild = RasterLayerCombo(self.dlg.comboBox_DSMbuild) # RasterLayerCombo(self.dlg.comboBox_DSMbuild, initLayer="") # self.layerComboManagerVEGDSM = RasterLayerCombo(self.dlg.comboBox_vegdsm) # RasterLayerCombo(self.dlg.comboBox_vegdsm, initLayer="") self.layerComboManagerDSMbuildground = QgsMapLayerComboBox( self.dlg.widgetDSMbuildground) self.layerComboManagerDSMbuildground.setFilters( QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerDSMbuildground.setFixedWidth(175) self.layerComboManagerDSMbuildground.setCurrentIndex(-1) self.layerComboManagerDEM = QgsMapLayerComboBox(self.dlg.widgetDEM) self.layerComboManagerDEM.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerDEM.setFixedWidth(175) self.layerComboManagerDEM.setCurrentIndex(-1) self.layerComboManagerDSMbuild = QgsMapLayerComboBox( self.dlg.widgetDSMbuild) self.layerComboManagerDSMbuild.setFilters( QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerDSMbuild.setFixedWidth(175) self.layerComboManagerDSMbuild.setCurrentIndex(-1) self.layerComboManagerVEGDSM = QgsMapLayerComboBox( self.dlg.widgetVegDSM) self.layerComboManagerVEGDSM.setFilters( QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerVEGDSM.setFixedWidth(175) self.layerComboManagerVEGDSM.setCurrentIndex(-1) if not (os.path.isdir(self.plugin_dir + '/data')): os.mkdir(self.plugin_dir + '/data')
logger.error("Unable to find '%s'" % newArgs[0]) print >> sys.stderr, "Error - Unable to find '%s' for -x/--xvfb option" % newArgs[ 0] sys.exit(1) # Prepare outout ("1" means STDOUT) if options.output is None: options.output = sys.stdout else: options.output = open(options.output, "w") # Revert url quote sanitization. QUrl will encode the url later on. options.url = options.url.replace('%22', '"') logger.debug("Version %s, Python %s, Qt %s", VERSION, sys.version, qVersion()) # Technically, this is a QtGui application, because QWebPage requires it # to be. But because we will have no user interaction, and rendering can # not start before 'app.exec_()' is called, we have to trigger our "main" # by a timer event. def __main_qt(): # Render the page. # If this method times out or loading failed, a # RuntimeException is thrown try: # Initialize WebkitRenderer object renderer = WebkitRenderer() renderer.logger = logger renderer.width = options.geometry[0] renderer.height = options.geometry[1]
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 """ # Path to plugin directory self.plugin_directory = os.path.dirname(os.path.realpath(__file__)) # Path to config json file self.config_file = os.path.join(self.plugin_directory, CONFIG_FILE) # Config loaded self.is_config_local_loaded = False self.is_config_remote_loaded = False self.remote_config = {} self.local_config = {} # 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] locale_path = os.path.join(self.plugin_dir, 'i18n', 'RasterIndexExtract_{}.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 = RasterIndexExtractDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Raster Index Extract') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'RasterIndexExtract') self.toolbar.setObjectName(u'RasterIndexExtract') # Connect Run and Cancel buttons self.dlg.pbRun.clicked.connect(self.runExtract) self.dlg.pbCancel.clicked.connect(self.cancel) # Clear editLine for source and destination path and connect select_source_directory and select_destination_directory to buttons self.dlg.leSrcPath.clear() self.dlg.pbChooseSrcPath.clicked.connect(self.select_source_directory) self.dlg.leDstPath.clear() self.dlg.pbChooseDstPath.clicked.connect( self.select_destination_directory) # Connect radio buttons for remote source self.dlg.rb_locale.toggled.connect(self.rb_locale_clicked) self.dlg.rb_remote.toggled.connect(self.rb_remote_clicked) self.dlg.cb_remote.activated[str].connect(self.select_source_remote) self.dlg.cbIndexLayers.activated[str].connect(self.load_cb_index_layer)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'RCMRD_LandDegr_{}.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 = RCMRD_LandDegrDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&RCRMD: land degradation') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'RCMRD: land degradation') self.toolbar.setObjectName(u'RCMRD: land degradation') # Declare user instance variables self.roiDefinitions = None self.roiDefinitions = [{ "name": "IGAD", "roiXY": [21.8094, -4.6775, 51.417, 22.227] }, { "name": "Djibouti", "roiXY": [41.749110148, 10.929824931, 43.418711785, 12.707912502] }, { "name": "Eritrea", "roiXY": [36.423647095, 12.360021871, 43.123871290, 18.004828192] }, { "name": "Ethiopia", "roiXY": [32.989799845, 3.403333435, 47.979169149, 14.879532166] }, { "name": "Kenya", "roiXY": [33.890468384, -4.677504165, 41.885019165, 5.030375823] }, { "name": "Sudan", "roiXY": [42.647246541, 7.996515605, 48.93911199991, 11.498928127] }, { "name": "South Sudan", "roiXY": [24.121555623, 3.490201518, 35.920835409, 12.216154684] }, { "name": "Somali Land", "roiXY": [42.647246541, 7.996515605, 48.93911199991, 11.498928127] }, { "name": "Somalia", "roiXY": [40.965385376, -1.69628316498, 51.417037811, 11.989118646] }, { "name": "Uganda", "roiXY": [29.548459513, -1.475205994, 35.006472615, 4.219691875] }] #self.selectedRoi = None self.raster_list = [ ] # list all files open in QGis, contains file objects self.dictReproj = None # dictionary: 'input filename' -> reprojected filename self.clipLayer = None # store the clipping vector layer self.listIDInputs = { } # dictionary: key -> layer name. See keys definition in the code ('VGT', 'RFE', ...) self.listIDWeightsPotential = {} self.listIDWeightsActual = {} SettingsOrganisation = 'RCMRD_QGIS' SettingsApplication = 'RCMRD_LandDegr'
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'TreeGenerator_{}.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 = TreeGeneratorDialog() self.dlg.runButton.clicked.connect(self.start_progress) self.dlg.pushButtonSave.clicked.connect(self.folder_path) self.dlg.helpButton.clicked.connect(self.help) self.fileDialog = QFileDialog() self.fileDialog.setFileMode(4) self.fileDialog.setAcceptMode(1) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Tree Generator') # TODO: We are going to let the user set this up in a future iteration # self.toolbar = self.iface.addToolBar(u'TreeGenerator') # self.toolbar.setObjectName(u'TreeGenerator') # self.layerComboManagerPoint = VectorLayerCombo(self.dlg.comboBox_pointlayer) # fieldgen = VectorLayerCombo(self.dlg.comboBox_pointlayer, initLayer="", options={"geomType": QGis.Point}) # self.layerComboManagerTreeTypeField = FieldCombo(self.dlg.comboBox_ttype, fieldgen, initField="") # self.layerComboManagerTotalHeightField = FieldCombo(self.dlg.comboBox_totalheight, fieldgen, initField="") # self.layerComboManagerTrunkHeightField = FieldCombo(self.dlg.comboBox_trunkheight, fieldgen, initField="") # self.layerComboManagerDiameterField = FieldCombo(self.dlg.comboBox_diameter, fieldgen, initField="") self.layerComboManagerPoint = QgsMapLayerComboBox(self.dlg.widgetPointLayer) self.layerComboManagerPoint.setCurrentIndex(-1) self.layerComboManagerPoint.setFilters(QgsMapLayerProxyModel.PointLayer) self.layerComboManagerPoint.setFixedWidth(175) self.layerComboManagerTreeTypeField = QgsFieldComboBox(self.dlg.widgetTreeType) self.layerComboManagerTreeTypeField.setFilters(QgsFieldProxyModel.Numeric) self.layerComboManagerPoint.layerChanged.connect(self.layerComboManagerTreeTypeField.setLayer) self.layerComboManagerTotalHeightField = QgsFieldComboBox(self.dlg.widgetTotalHeight) self.layerComboManagerTotalHeightField.setFilters(QgsFieldProxyModel.Numeric) self.layerComboManagerPoint.layerChanged.connect(self.layerComboManagerTotalHeightField.setLayer) self.layerComboManagerTrunkHeightField = QgsFieldComboBox(self.dlg.widgetTrunkHeight) self.layerComboManagerTrunkHeightField.setFilters(QgsFieldProxyModel.Numeric) self.layerComboManagerPoint.layerChanged.connect(self.layerComboManagerTrunkHeightField.setLayer) self.layerComboManagerDiameterField = QgsFieldComboBox(self.dlg.widgetDiameter) self.layerComboManagerDiameterField.setFilters(QgsFieldProxyModel.Numeric) self.layerComboManagerPoint.layerChanged.connect(self.layerComboManagerDiameterField.setLayer) # self.layerComboManagerDSM = RasterLayerCombo(self.dlg.comboBox_DSM) # RasterLayerCombo(self.dlg.comboBox_DSM, initLayer="") # self.layerComboManagerDEM = RasterLayerCombo(self.dlg.comboBox_DEM) # RasterLayerCombo(self.dlg.comboBox_DEM, initLayer="") # self.layerComboManagerBuild = RasterLayerCombo(self.dlg.comboBox_Build) # RasterLayerCombo(self.dlg.comboBox_Build, initLayer="") # self.layerComboManagerCDSM = RasterLayerCombo(self.dlg.comboBox_CDSM) # RasterLayerCombo(self.dlg.comboBox_CDSM, initLayer="") # self.layerComboManagerTDSM = RasterLayerCombo(self.dlg.comboBox_TDSM) # RasterLayerCombo(self.dlg.comboBox_TDSM, initLayer="") self.layerComboManagerDSM = QgsMapLayerComboBox(self.dlg.widgetDSM) self.layerComboManagerDSM.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerDSM.setFixedWidth(175) self.layerComboManagerDSM.setCurrentIndex(-1) self.layerComboManagerDEM = QgsMapLayerComboBox(self.dlg.widgetDEM) self.layerComboManagerDEM.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerDEM.setFixedWidth(175) self.layerComboManagerDEM.setCurrentIndex(-1) self.layerComboManagerBuild = QgsMapLayerComboBox(self.dlg.widgetBuild) self.layerComboManagerBuild.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerBuild.setFixedWidth(175) self.layerComboManagerBuild.setCurrentIndex(-1) self.layerComboManagerCDSM = QgsMapLayerComboBox(self.dlg.widgetCDSM) self.layerComboManagerCDSM.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerCDSM.setFixedWidth(175) self.layerComboManagerCDSM.setCurrentIndex(-1) self.layerComboManagerTDSM = QgsMapLayerComboBox(self.dlg.widgetTDSM) self.layerComboManagerTDSM.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerTDSM.setFixedWidth(175) self.layerComboManagerTDSM.setCurrentIndex(-1)
def __init__(self, iface): """!@brief 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 declare all fields to fill, such as output raster, columns to find from a shp... """ QDialog.__init__(self) sender = self.sender() """ """ # Save reference to the QGIS interface self.iface = iface legendInterface = self.iface.legendInterface() # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'HistoricalMap_{}.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 = HistoricalMapDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Historical Map') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'HistoricalMap') self.toolbar.setObjectName(u'HistoricalMap') ## Init to choose file (to load or to save) self.dlg.outRaster.clear() self.dlg.selectRaster.clicked.connect(self.select_output_file) self.dlg.outModel.clear() self.dlg.selectModel.clicked.connect(self.select_output_file) self.dlg.outMatrix.clear() self.dlg.selectMatrix.clicked.connect(self.select_output_file) self.dlg.btnFilter.clicked.connect(self.runFilter) self.dlg.btnTrain.clicked.connect(self.runTrain) self.dlg.btnClassify.clicked.connect(self.runClassify) self.dlg.inModel.clear() self.dlg.selectModelStep3.clicked.connect(self.select_load_file) self.dlg.outShp.clear() self.dlg.selectOutShp.clicked.connect(self.select_output_file) ## init fields self.dlg.inTraining.currentIndexChanged[int].connect( self.onChangedLayer) ## By default field list is empty, so we fill with current layer ## if no currentLayer, no filling, or it will crash Qgis self.dlg.inField.clear() if self.dlg.inField.currentText( ) == '' and self.dlg.inTraining.currentLayer( ) and self.dlg.inTraining.currentLayer() != 'NoneType': activeLayer = self.dlg.inTraining.currentLayer() provider = activeLayer.dataProvider() fields = provider.fields() listFieldNames = [field.name() for field in fields] self.dlg.inField.addItems(listFieldNames) ## hide/show nfolds spinbox self.dlg.nFolds.hide()
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'SEBE_{}.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 = SEBEDialog() self.dlg.runButton.clicked.connect(self.start_progress) self.dlg.pushButtonHelp.clicked.connect(self.help) # self.dlg.shadowCheckBox.stateChanged.connect(self.checkbox_changed) self.dlg.pushButtonSave.clicked.connect(self.folder_path) self.dlg.pushButtonImport.clicked.connect(self.read_metdata) self.dlg.pushButtonSaveIrradiance.clicked.connect(self.save_radmat) self.fileDialog = QFileDialog() self.fileDialog.setFileMode(4) self.fileDialog.setAcceptMode(1) self.fileDialogFile = QFileDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&SEBE - Solar Energy on Building Envelopes') # TODO: We are going to let the user set this up in a future iteration # self.toolbar = self.iface.addToolBar(u'SEBE') # self.toolbar.setObjectName(u'SEBE') # self.layerComboManagerDSM = RasterLayerCombo(self.dlg.comboBox_dsm) # RasterLayerCombo(self.dlg.comboBox_dsm, initLayer="") # self.layerComboManagerVEGDSM = RasterLayerCombo(self.dlg.comboBox_vegdsm) # RasterLayerCombo(self.dlg.comboBox_vegdsm, initLayer="") # self.layerComboManagerVEGDSM2 = RasterLayerCombo(self.dlg.comboBox_vegdsm2) # RasterLayerCombo(self.dlg.comboBox_vegdsm2, initLayer="") # self.layerComboManagerWH = RasterLayerCombo(self.dlg.comboBox_wallheight) # RasterLayerCombo(self.dlg.comboBox_wallheight, initLayer="") # self.layerComboManagerWA = RasterLayerCombo(self.dlg.comboBox_wallaspect) # RasterLayerCombo(self.dlg.comboBox_wallaspect, initLayer="") self.layerComboManagerDSM = QgsMapLayerComboBox(self.dlg.widgetDSM) self.layerComboManagerDSM.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerDSM.setFixedWidth(175) self.layerComboManagerDSM.setCurrentIndex(-1) self.layerComboManagerVEGDSM = QgsMapLayerComboBox(self.dlg.widgetCDSM) self.layerComboManagerVEGDSM.setFilters( QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerVEGDSM.setFixedWidth(175) self.layerComboManagerVEGDSM.setCurrentIndex(-1) self.layerComboManagerVEGDSM2 = QgsMapLayerComboBox( self.dlg.widgetTDSM) self.layerComboManagerVEGDSM2.setFilters( QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerVEGDSM2.setFixedWidth(175) self.layerComboManagerVEGDSM2.setCurrentIndex(-1) self.layerComboManagerWH = QgsMapLayerComboBox(self.dlg.widgetWH) self.layerComboManagerWH.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerWH.setFixedWidth(175) self.layerComboManagerWH.setCurrentIndex(-1) self.layerComboManagerWA = QgsMapLayerComboBox(self.dlg.widgetWA) self.layerComboManagerWA.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerWA.setFixedWidth(175) self.layerComboManagerWA.setCurrentIndex(-1) self.folderPath = None self.usevegdem = 0 self.scale = None self.gdal_dsm = None self.dsm = None self.vegdsm = None self.vegdsm2 = None self.usevegdem = None self.folderPathMetdata = None self.metdata = None self.radmatfile = None self.thread = None self.worker = None self.steps = 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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'DigitalConnectorPlugin_{}.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) ##### Windows configuration # check for JAVA in Program Files if platform.system() == 'Windows': java_path = None # Look in both Program Files and Program Files x86 for i in os.listdir('C:\\Program Files'): if 'Java' in i: java_path_temp = 'C:\\Program Files\\' + i for k in os.listdir(java_path_temp): if 'jdk' in k: java_path_temp = java_path_temp + '\\' + k + '\\bin' java_path = java_path_temp else: pass if java_path != None: pass else: for j in os.listdir('C:\\Program Files (x86)'): if 'Java' in j: java_path_temp = 'C:\\Program Files (x86)\\' + j for k in os.listdir(java_path_temp): if 'jdk' in k: java_path_temp = java_path_temp + '\\' + k + '\\bin' java_path = java_path_temp else: pass # ERROR cannot find Java installation if java_path == None: self.iface.messageBar().pushMessage("Error", "No Java installation found in Program Files. Please install Java", level=QgsMessageBar.CRITICAL) # Add missing PATHs for windows current_execs = os.environ['PATH'] if not 'Java' in current_execs: os.environ['PATH'] += ';' + java_path ##### # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Digital Connector Plugin') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'DigitalConnectorPlugin') self.toolbar.setObjectName(u'DigitalConnectorPlugin') # Edit recipe dialog class self.dialog_instance = EditRecipe() # Create the dialog (after translation) and keep reference self.dlg = DigitalConnectorPluginDialog() # Add button functionalities self.dlg.lineEdit.clear() self.dlg.pushButton.clicked.connect(self.select_dc_directory) self.dlg.pushButton_2.clicked.connect(self.visualise_recipe) self.dlg.pushButton_3.clicked.connect(self.edit_recipe) # Add DC icon img_path = self.resolve('dc_logo.png') print img_path self.dlg.label_3.setPixmap(QPixmap(img_path))
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 """ self.templatepath = os.path.join(pluginDirectory('qkan'), u"database/templates") # 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] locale_path = os.path.join( self.plugin_dir, 'i18n', 'ExportToKP_{}.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 = ExportToKPDialog() # Anfang Eigene Funktionen ------------------------------------------------- # (jh, 08.02.2017) logger.info('\n\nQKan_ExportKP initialisiert...') # -------------------------------------------------------------------------- # Pfad zum Arbeitsverzeichnis sicherstellen wordir = os.path.join(site.getuserbase(), 'qkan') if not os.path.isdir(wordir): os.makedirs(wordir) # -------------------------------------------------------------------------- # Konfigurationsdatei qkan.json lesen # self.configfil = os.path.join(wordir, 'qkan.json') if os.path.exists(self.configfil): with open(self.configfil, 'r') as fileconfig: self.config = json.loads(fileconfig.read()) else: self.config['dynafile'] = '' # Vorlagedatenbank nur für den Fall, dass der Anwender keine eigene Vorlage erstellen will self.config['template_dyna'] = os.path.join(os.path.dirname(__file__), "templates", "dyna.ein") self.config['database_QKan'] = '' with open(self.configfil, 'w') as fileconfig: fileconfig.write(json.dumps(self.config)) # Standard für Suchverzeichnis festlegen project = QgsProject.instance() self.default_dir = os.path.dirname(project.fileName()) # Formularereignisse anbinden ---------------------------------------------- self.dlg.pb_select_KP_dest.clicked.connect(self.selectFile_kpDB_dest) self.dlg.pb_select_KP_template.clicked.connect(self.selectFile_kpDB_template) self.dlg.lw_teilgebiete.itemClicked.connect(self.lw_teilgebieteClick) self.dlg.cb_selActive.stateChanged.connect(self.selActiveClick) self.dlg.button_box.helpRequested.connect(self.helpClick) self.dlg.pb_selectQKanDB.clicked.connect(self.selectFile_QKanDB)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'Flaechenzuordnungen_{}.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.dlgpr = QgsadaptDialog() self.dlgop = QKanOptionsDialog() self.dlgro = RunoffParamsDialog() # Anfang Eigene Funktionen ------------------------------------------------- # (jh, 12.06.2017) logger.info(u'\n\nQKan_Tools initialisiert...') # -------------------------------------------------------------------------- # Pfad zum Arbeitsverzeichnis sicherstellen wordir = os.path.join(site.getuserbase(), 'qkan') if not os.path.isdir(wordir): os.makedirs(wordir) # -------------------------------------------------------------------------------------------------- # Konfigurationsdatei qkan.json lesen # self.configfil = os.path.join(wordir, 'qkan.json') if os.path.exists(self.configfil): with open(self.configfil, 'r') as fileconfig: self.config = json.loads(fileconfig.read()) else: self.config = {'epsg': '25832'} # Projektionssystem with open(self.configfil, 'w') as fileconfig: fileconfig.write(json.dumps(self.config)) # Formularereignisse anbinden ---------------------------------------------- # Formular dlgpr self.dlgpr.pb_selectProjectFile.clicked.connect(self.dlgpr_selectFileProjectfile) self.dlgpr.pb_selectQKanDB.clicked.connect(self.dlgpr_selectFile_qkanDB) self.dlgpr.pb_selectProjectTemplate.clicked.connect(self.dlgpr_selectFileProjectTemplate) # Formular dlgop self.dlgop.pb_fangradiusDefault.clicked.connect(self.dlgop_fangradiusDefault) self.dlgop.pb_mindestflaecheDefault.clicked.connect(self.dlgop_mindestflaecheDefault) self.dlgop.pb_max_loopsDefault.clicked.connect(self.dlgop_maxLoopsDefault) self.dlgop.pb_selectKBS.clicked.connect(self.dlgop_selectKBS) # Formular dlgro self.dlgro.lw_teilgebiete.itemClicked.connect(self.dlgro_lwTeilgebieteClick) self.dlgro.lw_abflussparameter.itemClicked.connect(self.dlgro_lwAbflussparamsClick) self.dlgro.cb_selTgbActive.stateChanged.connect(self.dlgro_selTgbActiveClick) self.dlgro.cb_selParActive.stateChanged.connect(self.dlgro_selParActiveClick) self.dlgro.button_box.helpRequested.connect(self.dlgro_helpClick) self.dlgro.pb_selectQKanDB.clicked.connect(self.dlgro_selectFile_qkanDB)
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 """ # Estes atributos sao fornecidos no momento de criacao da estancia # Save reference to the QGIS interface self.iface = iface self.featFinder = None # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'Remotwatch_{}.qm'.format(locale)) #print "epdro",locale_path 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 = RemotwatchDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&RemotWatch') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'Remotwatch') self.toolbar.setObjectName(u'Remotwatch') self.dlg.lineEdit.clear() self.dlg.pushButton.clicked.connect(self.select_output_file) #self.dlg.pushButtontsp.clicked.connect(self.open_graph) ############################################# # Aqui chama a localizao das funcoes se algum checkbox for ativado # Se o .checkBoxLOS for ativado vai executar o que estÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂá na funcao # self.changeActivelos # Event handler #self.dlg.nomedowidget,o que vai deterar ,nome do metodo que vai chamar ################################################# global loscheck global heighcheck global cohercheck cohercheck = 0 heighcheck = 0 loscheck = 0 QObject.connect(self.dlg.checkBoxLOS, SIGNAL("stateChanged(int)"), self.changeActivelos) QObject.connect(self.dlg.checkBox_HEI, SIGNAL("stateChanged(int)"), self.changeActivehei) QObject.connect(self.dlg.checkBox_COHE, SIGNAL("stateChanged(int)"), self.changeActivecohe) QObject.connect(self.dlg.checkBox_RHEIG, SIGNAL("stateChanged(int)"), self.changeActiverhei) QObject.connect(self.dlg.checkBoxTEMP, SIGNAL("stateChanged(int)"), self.changeActivetemp) ###mouse no ponto #QObject.connect(self.dlg.clickTool, SIGNAL("canvasClicked(const QgsPoint &, Qt::MouseButton)"), self.selectFeature): ################################ # Tudo o que diga respeito ao mapa ################################ # Store reference to the map canvas self.canvas = self.iface.mapCanvas() # Create the map tool using the canvas reference #self.pointTool = QgsMapToolEmitPoint(self.canvas) # self.pointEmitter = QgsMapToolEmitPoint(self.iface.mapCanvas()) # barriginha # QObject.connect( self.pointEmitter, SIGNAL("canvasClicked(const QgsPoint, Qt::MouseButton)"), self.selectNow) # self.iface.mapCanvas().setMapTool( self.pointEmitter ) #result = QObject.connect(self.clickTool, SIGNAL("canvasClicked(const QgsPoint &, Qt::MouseButton)"), self.selectFeature) # connect signal that the canvas was clicked #self.pointTool.canvasClicked.connect(self.display_point) #self.dlg.Slidercoherence = QSlider() #self.dlg.Slidercoherence.setOrientation(Qt.Horizontal) #self.label = QLabel('Slider at position 0') #self.dlg.addWidget(self.label) #self.dlg.addWidget(self.slider) # Valor por defeito da coerencia self.dlg.labelcoherence.setText('0.0') # O que acontece se mover o slidder da coerencia self.dlg.Slidercoherence.valueChanged.connect(self.slider_moved)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'PacSafe_{}.qm'.format(locale)) splash_pix = QPixmap('splash.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() QApplication.processEvents() start = time.time() while time.time() - start <= 1: time.sleep(0.001) QApplication.processEvents() 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 = PacSafeDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&PacSafe') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'PacSafe') self.toolbar.setObjectName(u'PacSafe') # Load projects dynamically: if os.path.exists(os.path.join(os.getcwd(), 'data')): self.dataPath = os.path.join(os.getcwd(), 'data') LOGGER.info("Setting data path to {0}".format(self.dataPath)) else: self.dataPath = None # Set a globally-accessible list of countries for which we have # projects & data available. The two-letter abbreviation must match # the name of the sub-directory in the project/data folders. self.countryList = {"Fiji": "FJ", "Tonga": "TO"} for c in sorted(self.countryList.keys()): self.dlg.countryListWidget.addItem(c) cl = self.dlg.countryListWidget self.updateProjectList(1) cl.currentIndexChanged.connect(self.updateProjectList) #event signals/slots btnDataFolder = self.dlg.btnDataFolder btnDataFolder.clicked.connect(self.selectDataFolder) btnProject = self.dlg.btnProject btnProject.clicked.connect(self.openProject) btnRemote = self.dlg.btnRemote btnRemote.clicked.connect(self.openRemote) btnHelp = self.dlg.btnHelp btnHelp.clicked.connect(self.help) btnClose = self.dlg.btnClose btnClose.clicked.connect(self.dlg.close)
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'LandCoverFractionGrid_{}.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 = LCZ_testDialog() self.dlg.radioButton_2.toggled.connect(self.LCZ_selection) self.dlg.runButton.clicked.connect(self.start_progress) self.dlg.closeButton.clicked.connect(self.close) self.dlg.pushButtonSelect.clicked.connect(self.folder_path) self.dlg.helpButton.clicked.connect(self.help) self.dlg.tableWidget.setEnabled(False) self.dlg.checkBox.toggled.connect(self.text_enable) self.dlg.radioButton.toggled.connect(self.allclass) self.dlg.colorButton.clicked.connect(self.color) self.dlg.progressBar.setValue(0) self.fileDialog = QFileDialog() self.fileDialog.setFileMode(4) self.fileDialog.setAcceptMode(1) # Save if self.dlg.radioButton_2.isChecked(): self.dlg.pushButton_2.clicked.connect(self.updatetable) if self.dlg.radioButton.isChecked(): self.dlg.pushButton_2.clicked.connect(self.updatetable2) # self.dlg.pushButton_2.clicked.connect(self.bla) # self.layerComboManagerPolygrid = VectorLayerCombo(self.dlg.comboBox_2) # fieldgen = VectorLayerCombo(self.dlg.comboBox_2, initLayer="", options={"geomType": QGis.Polygon}) # self.layerComboManagerPolyField = FieldCombo(self.dlg.comboBox_31, fieldgen) #, options={"fieldType":QGis.Float32} self.layerComboManagerPolygrid = QgsMapLayerComboBox(self.dlg.widgetPolyLayer) self.layerComboManagerPolygrid.setCurrentIndex(-1) self.layerComboManagerPolygrid.setFilters(QgsMapLayerProxyModel.PolygonLayer) self.layerComboManagerPolygrid.setFixedWidth(175) self.layerComboManagerPolyField = QgsFieldComboBox(self.dlg.widgetField) self.layerComboManagerPolyField.setFilters(QgsFieldProxyModel.Numeric) self.layerComboManagerPolygrid.layerChanged.connect(self.layerComboManagerPolyField.setLayer) # self.layerComboManagerLCgrid = RasterLayerCombo(self.dlg.comboBox) # RasterLayerCombo(self.dlg.comboBox, initLayer="") self.layerComboManagerLCgrid = QgsMapLayerComboBox(self.dlg.widgetLC) self.layerComboManagerLCgrid.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerLCgrid.setFixedWidth(175) self.layerComboManagerLCgrid.setCurrentIndex(-1) self.urbanchoices = ['100% grass','100% decidious trees','100% evergreen trees','100% bare soil','100% water','50% grass, 25% dec. trees, 25% ev. trees','Each 20%'] self.treechoices = ['100% evergreen', '100% decidious', '50% evergreen, 50% decidious','30% evergreen, 70% decidious','70% evergreen, 30% decidious'] self.LCZs = [1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 101., 102., 103.] self.heightfr = ['No trees', '0 - 5m', '5 - 10m', '10 - 15m', '15 - 20m', '> 20m'] self.folderPath = 'None' self.steps = 0 # Declare instance attributes self.actions = [] self.menu = self.tr(u'&LCZ_converter') self.toolbar = self.iface.addToolBar(u'LCZ_test') self.toolbar.setObjectName(u'LCZ_test') if not (os.path.isdir(self.plugin_dir + '/data')): os.mkdir(self.plugin_dir + '/data')
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'SkyViewFactorCalculator_{}.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 = SkyViewFactorCalculatorDialog() self.dlg.runButton.clicked.connect(self.start_progress) self.dlg.pushButtonHelp.clicked.connect(self.help) self.dlg.pushButtonSave.clicked.connect(self.folder_path) self.dlg.checkBoxUseVeg.toggled.connect(self.text_enable) self.dlg.checkBoxTrunkExist.toggled.connect(self.text_enable2) self.fileDialog = QFileDialog() self.fileDialog.setFileMode(4) self.fileDialog.setAcceptMode(1) # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Sky View Factor Calculator') # TODO: We are going to let the user set this up in a future iteration # self.toolbar = self.iface.addToolBar(u'SkyViewFactorCalculator') # self.toolbar.setObjectName(u'SkyViewFactorCalculator') # self.layerComboManagerDSM = RasterLayerCombo(self.dlg.comboBox_dsm) # RasterLayerCombo(self.dlg.comboBox_dsm, initLayer="") # self.layerComboManagerVEGDSM = RasterLayerCombo(self.dlg.comboBox_vegdsm) # RasterLayerCombo(self.dlg.comboBox_vegdsm, inityLayer="") # self.layerComboManagerVEGDSM2 = RasterLayerCombo(self.dlg.comboBox_vegdsm2) # RasterLayerCombo(self.dlg.comboBox_vegdsm2, initLayer="") self.layerComboManagerDSM = QgsMapLayerComboBox(self.dlg.widget_dsm) self.layerComboManagerDSM.setFilters(QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerDSM.setFixedWidth(200) self.layerComboManagerDSM.setCurrentIndex(-1) self.layerComboManagerVEGDSM = QgsMapLayerComboBox( self.dlg.widget_vegdsm) self.layerComboManagerVEGDSM.setFilters( QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerVEGDSM.setFixedWidth(200) self.layerComboManagerVEGDSM.setCurrentIndex(-1) self.layerComboManagerVEGDSM2 = QgsMapLayerComboBox( self.dlg.widget_vegdsm2) self.layerComboManagerVEGDSM2.setFilters( QgsMapLayerProxyModel.RasterLayer) self.layerComboManagerVEGDSM2.setFixedWidth(200) self.layerComboManagerVEGDSM2.setCurrentIndex(-1) self.thread = None self.worker = None self.vegthread = None self.vegworker = None self.svftotal = None self.folderPath = None self.usevegdem = None self.vegdsm = None self.vegdsm2 = None self.svfbu = None self.dsm = None self.scale = None self.steps = 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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'Flaechenzuordnungen_{}.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_at = AssigntgebDialog() self.dlg_cl = CreatelineflDialog() self.dlg_sw = CreatelineswDialog() self.dlg_ul = UpdateLinksDialog() self.dlg_mg = ManagegroupsDialog() # Anfang Eigene Funktionen ------------------------------------------------- # (jh, 12.06.2017) logger.info(u'\n\nQKan_LinkFlaechen initialisiert...') # -------------------------------------------------------------------------- # Pfad zum Arbeitsverzeichnis sicherstellen wordir = os.path.join(site.getuserbase(), 'qkan') if not os.path.isdir(wordir): os.makedirs(wordir) # -------------------------------------------------------------------------------------------------- # Konfigurationsdatei qkan.json lesen # self.configfil = os.path.join(wordir, 'qkan.json') if os.path.exists(self.configfil): with open(self.configfil, 'r') as fileconfig: self.config = json.loads(fileconfig.read()) else: self.config = {'epsg': '25832'} # Projektionssystem self.config['autokorrektur'] = False self.config['suchradius'] = u'50' self.config['mindestflaeche'] = u'0.5' self.config['bezug_abstand'] = 'kante' with open(self.configfil, 'w') as fileconfig: fileconfig.write(json.dumps(self.config)) # Formularereignisse anbinden ---------------------------------------------- # Dialog dlg_cl self.dlg_cl.lw_flaechen_abflussparam.itemClicked.connect(self.cl_lw_flaechen_abflussparamClick) self.dlg_cl.lw_hal_entw.itemClicked.connect(self.cl_lw_hal_entwClick) self.dlg_cl.lw_teilgebiete.itemClicked.connect(self.cl_lw_teilgebieteClick) self.dlg_cl.cb_selFlActive.stateChanged.connect(self.cl_selFlActiveClick) self.dlg_cl.cb_selHalActive.stateChanged.connect(self.cl_selHalActiveClick) self.dlg_cl.cb_selTgbActive.stateChanged.connect(self.cl_selTgbActiveClick) self.dlg_cl.button_box.helpRequested.connect(self.cl_helpClick) # Dialog dlg_sw self.dlg_sw.lw_hal_entw.itemClicked.connect(self.sw_lw_hal_entwClick) self.dlg_sw.lw_teilgebiete.itemClicked.connect(self.sw_lw_teilgebieteClick) self.dlg_sw.cb_selHalActive.stateChanged.connect(self.sw_selHalActiveClick) self.dlg_sw.cb_selTgbActive.stateChanged.connect(self.sw_selTgbActiveClick) self.dlg_sw.button_box.helpRequested.connect(self.sw_helpClick) # Dialog dlg_at self.dlg_at.rb_within.clicked.connect(self.select_within) self.dlg_at.rb_overlaps.clicked.connect(self.select_overlaps) # Dialog dlg_mg self.dlg_mg.lw_gruppen.itemClicked.connect(self.listGroupAttr) self.dlg_mg.pb_storegroup.clicked.connect(self.storegrouptgb) self.dlg_mg.pb_reloadgroup.clicked.connect(self.reloadgrouptgb)
def __init__(self, iface): self.iface = iface self.plugin_dir = os.path.dirname(__file__) locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'geobricks_trmm_qgis_{}.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) self.layout = QVBoxLayout() self.username = QLineEdit() self.username.setPlaceholderText( self.tr('e.g. [email protected]')) self.password = QLineEdit() self.password.setEchoMode(QLineEdit.Password) self.password.setPlaceholderText( self.tr('e.g. [email protected]')) self.download_folder = QLineEdit() try: if self.last_download_folder is not None: self.download_folder.setText(self.last_download_folder) except: self.last_download_folder = None self.frequency = QComboBox() self.frequency.addItem(self.tr('Daily Sum'), 'SUM') self.frequency.addItem(self.tr('Daily Average'), 'AVG') self.frequency.addItem(self.tr('None'), 'NONE') self.from_date = QCalendarWidget() self.to_date = QCalendarWidget() self.bar = QgsMessageBar() self.lbl_0 = QLabel('<b>' + self.tr('Username') + '</b>') self.lbl_1 = QLabel('<b>' + self.tr('Password') + '</b>') self.lbl_2 = QLabel('<b>' + self.tr('Aggregation') + '</b>') self.from_date_label = QLabel( '<b>' + self.tr('From Date') + '</b>: ' + QDate(2015, 7, 31).toString('MMMM d, yyyy')) self.to_date_label = QLabel( '<b>' + self.tr('To Date') + '</b>: ' + QDate(2015, 7, 31).toString('MMMM d, yyyy')) self.lbl_5 = QLabel('<b>' + self.tr('Download Folder') + '</b>') self.lbl_6 = QLabel('<i style="color: blue;">' + self.tr('Create an account') + '</i>') self.lbl_7 = QLabel('<b>' + self.tr('Data availability') + '</b>: ' + self.tr('from January 1st 1998 to July 31st 2015')) self.palette = QPalette() self.from_date_widget = QWidget() self.from_date_widget_layout = QVBoxLayout() self.dates_widget = QWidget() self.dates_widget_layout = QHBoxLayout() self.username_widget = QWidget() self.username_layout = QVBoxLayout() self.password_widget = QWidget() self.password_layout = QVBoxLayout() self.progressBar = QProgressBar() self.progress_label = QLabel('<b>' + self.tr('Progress') + '</b>') self.login_widget = QWidget() self.login_layout = QHBoxLayout() self.download_folder_widget = QWidget() self.download_folder_layout = QHBoxLayout() self.download_folder_button = QPushButton(self.tr('...')) self.download_button = QPushButton(self.tr('Start Download')) self.close_button = QPushButton(self.tr('Close Window')) self.add_to_canvas = QCheckBox(self.tr('Add output layer to canvas')) self.add_to_canvas.setChecked(True) self.to_date_widget = QWidget() self.to_date_widget_layout = QVBoxLayout() self.spacing = 16 self.dlg = GeobricksTRMMDialog() self.actions = [] self.menu = self.tr('Download Data') self.toolbar = self.iface.addToolBar(self.tr('TRMM Data Downloader')) self.toolbar.setObjectName('TRMMDataDownloader') self.is_rendered = False
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 = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join(self.plugin_dir, 'i18n', 'UMEP_{}.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 = UMEPDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&UMEP') # TODO: We are going to let the user set this up in a future iteration #self.toolbar = self.iface.addToolBar(u'UMEP') #self.toolbar.setObjectName(u'UMEP') # Main menu self.UMEP_Menu = QMenu("UMEP") # First-order sub-menus self.Pre_Menu = QMenu("Pre-Processor") self.UMEP_Menu.addMenu(self.Pre_Menu) self.Pro_Menu = QMenu("Processor") self.UMEP_Menu.addMenu(self.Pro_Menu) self.Pos_Menu = QMenu("Post-Processor") self.UMEP_Menu.addMenu(self.Pos_Menu) self.About_Menu = QMenu("Help") self.UMEP_Menu.addMenu(self.About_Menu) # Sub-menus and actions to Pre-processor self.MD_Menu = QMenu("Meteorological Data") self.Pre_Menu.addMenu(self.MD_Menu) self.SP_Menu = QMenu("Spatial Data") self.Pre_Menu.addMenu(self.SP_Menu) self.UG_Menu = QMenu("Urban Geometry") self.Pre_Menu.addMenu(self.UG_Menu) self.ULC_Menu = QMenu("Urban Land Cover") self.Pre_Menu.addMenu(self.ULC_Menu) self.SM_Menu = QMenu("Urban Morphology") self.Pre_Menu.addMenu(self.SM_Menu) self.SUEWSPrepare_Action = QAction("SUEWS Prepare", self.iface.mainWindow()) self.Pre_Menu.addAction(self.SUEWSPrepare_Action) self.SUEWSPrepare_Action.triggered.connect(self.SUEWS_Prepare) # Sub-actions to Surface Morphology self.IMCP_Action = QAction("Morphometric Calculator (Point)", self.iface.mainWindow()) self.SM_Menu.addAction(self.IMCP_Action) self.IMCP_Action.triggered.connect(self.IMCP) self.IMCG_Action = QAction("Morphometric Calculator (Grid)", self.iface.mainWindow()) self.SM_Menu.addAction(self.IMCG_Action) self.IMCG_Action.triggered.connect(self.IMCG) self.FP_Action = QAction("Source Area Model (Point)", self.iface.mainWindow()) self.SM_Menu.addAction(self.FP_Action) self.FP_Action.triggered.connect(self.FP) # Sub-actions to Meteorological Data Preparation self.PED_Action = QAction("Prepare Existing Data", self.iface.mainWindow()) self.MD_Menu.addAction(self.PED_Action) self.PED_Action.triggered.connect(self.PED) self.PFD_Action = QAction("Download data (WATCH)", self.iface.mainWindow()) self.MD_Menu.addAction(self.PFD_Action) self.PFD_Action.triggered.connect(self.WA) # Sub-actions to Spatial Data Preparation self.SDD_Action = QAction("Spatial Data Downloader", self.iface.mainWindow()) self.SP_Menu.addAction(self.SDD_Action) self.SDD_Action.triggered.connect(self.UD) self.DSMGenerator_Action = QAction("DSM Generator", self.iface.mainWindow()) self.SP_Menu.addAction(self.DSMGenerator_Action) self.DSMGenerator_Action.triggered.connect(self.DSMG) self.TreeGenerator_Action = QAction("Tree Generator", self.iface.mainWindow()) self.SP_Menu.addAction(self.TreeGenerator_Action) self.TreeGenerator_Action.triggered.connect(self.TG) self.WC_Action = QAction("LCZ Converter", self.iface.mainWindow()) self.SP_Menu.addAction(self.WC_Action) self.WC_Action.triggered.connect(self.WC) # Sub-actions to Urban Geometry self.SVF_Action = QAction("Sky View Factor", self.iface.mainWindow()) self.UG_Menu.addAction(self.SVF_Action) self.SVF_Action.triggered.connect(self.SVF) # self.HW_Action = QAction("Height/Width Ratio", self.iface.mainWindow()) # self.UG_Menu.addAction(self.HW_Action) # self.HW_Action.setEnabled(False) self.WH_Action = QAction("Wall Height and Aspect", self.iface.mainWindow()) self.UG_Menu.addAction(self.WH_Action) self.WH_Action.triggered.connect(self.WH) # Sub-actions to Urban Land Cover self.ULCUEBRC_Action = QAction("Land Cover Reclassifier", self.iface.mainWindow()) self.ULC_Menu.addAction(self.ULCUEBRC_Action) self.ULCUEBRC_Action.triggered.connect(self.LCRC) self.ULCUEBP_Action = QAction("Land Cover Fraction (Point)", self.iface.mainWindow()) self.ULC_Menu.addAction(self.ULCUEBP_Action) self.ULCUEBP_Action.triggered.connect(self.LCP) self.ULCUEBG_Action = QAction("Land Cover Fraction (Grid)", self.iface.mainWindow()) self.ULC_Menu.addAction(self.ULCUEBG_Action) self.ULCUEBG_Action.triggered.connect(self.LCG) # Sub-menus to Processor self.OTC_Menu = QMenu("Outdoor Thermal Comfort") self.Pro_Menu.addMenu(self.OTC_Menu) self.UEB_Menu = QMenu("Urban Energy Balance") self.Pro_Menu.addMenu(self.UEB_Menu) self.SUN_Menu = QMenu("Solar radiation") self.Pro_Menu.addMenu(self.SUN_Menu) # self.NUHI_Action = QAction("Nocturnal Urban Heat Island", self.iface.mainWindow()) # self.Pro_Menu.addAction(self.NUHI_Action) # Sub-menus to Outdoor Thermal Comfort self.PET_Action = QAction("Comfort Index (PET/UCTI)", self.iface.mainWindow()) self.OTC_Menu.addAction(self.PET_Action) self.PET_Action.setEnabled(False) self.MRT_Action = QAction("Mean Radiant Temperature (SOLWEIG)", self.iface.mainWindow()) self.OTC_Menu.addAction(self.MRT_Action) self.MRT_Action.triggered.connect(self.SO) self.PWS_Action = QAction("Pedestrian Wind Speed", self.iface.mainWindow()) self.OTC_Menu.addAction(self.PWS_Action) self.PWS_Action.setEnabled(False) self.EF_Action = QAction("Extreme Finder", self.iface.mainWindow()) self.OTC_Menu.addAction(self.EF_Action) self.EF_Action.triggered.connect(self.EF) # Sub-menus to Urban Energy Balance self.QFL_Action = QAction("Antropogenic heat - GQf (Greater Qf)", self.iface.mainWindow()) self.UEB_Menu.addAction(self.QFL_Action) self.QFL_Action.triggered.connect(self.GF) self.QF_Action = QAction("Antropogenic heat - LQf (LUCY)", self.iface.mainWindow()) self.UEB_Menu.addAction(self.QF_Action) self.QF_Action.triggered.connect(self.LF) self.SUEWSSIMPLE_Action = QAction( "Urban Energy Balance (SUEWS, Simple)", self.iface.mainWindow()) self.UEB_Menu.addAction(self.SUEWSSIMPLE_Action) self.SUEWSSIMPLE_Action.triggered.connect(self.SUEWS_simple) self.SUEWS_Action = QAction( "Urban Energy Balance (SUEWS/BLUEWS, Advanced)", self.iface.mainWindow()) self.UEB_Menu.addAction(self.SUEWS_Action) self.SUEWS_Action.triggered.connect(self.SUEWS_advanced) # self.LUMPS_Action = QAction("Urban Energy Balance (LUMPS)", self.iface.mainWindow()) # self.UEB_Menu.addAction(self.LUMPS_Action) # self.LUMPS_Action.setEnabled(False) # self.CBL_Action = QAction("UEB + CBL (BLUEWS/BLUMPS)", self.iface.mainWindow()) # self.UEB_Menu.addAction(self.CBL_Action) # self.CBL_Action.setEnabled(False) # Sub-menus to Solar radiation self.SEBE_Action = QAction("Solar Energy on Building Envelopes (SEBE)", self.iface.mainWindow()) self.SUN_Menu.addAction(self.SEBE_Action) self.SEBE_Action.triggered.connect(self.SE) self.DSP_Action = QAction("Daily Shadow Pattern", self.iface.mainWindow()) self.SUN_Menu.addAction(self.DSP_Action) self.DSP_Action.triggered.connect(self.SH) # Sub-menus to Post-processing self.SUNpos_Menu = QMenu("Solar Radiation") self.Pos_Menu.addMenu(self.SUNpos_Menu) self.OTCpos_Menu = QMenu("Outdoor Thermal Comfort") self.Pos_Menu.addMenu(self.OTCpos_Menu) self.UEBpos_Menu = QMenu("Urban Energy Balance") self.Pos_Menu.addMenu(self.UEBpos_Menu) self.BSS_Action = QAction("Benchmarking System", self.iface.mainWindow()) self.Pos_Menu.addAction(self.BSS_Action) self.BSS_Action.triggered.connect(self.BSS) # Sub-menus to Solar radiation, post processing self.SEBEv_Action = QAction("SEBE (Visualisation)", self.iface.mainWindow()) self.SUNpos_Menu.addAction(self.SEBEv_Action) self.SEBEv_Action.triggered.connect(self.SEv) # Sub-menus to Outdoor thermal comfort, post processing self.SOLWEIGa_Action = QAction("SOLWEIG Analyzer", self.iface.mainWindow()) self.OTCpos_Menu.addAction(self.SOLWEIGa_Action) self.SOLWEIGa_Action.triggered.connect(self.SOv) # Sub-menus to Urban Energy Balance, post processing self.SUEWSa_Action = QAction("SUEWS Analyzer", self.iface.mainWindow()) self.UEBpos_Menu.addAction(self.SUEWSa_Action) self.SUEWSa_Action.triggered.connect(self.SUv) # Sub-menus to About self.About_Action = QAction("About", self.iface.mainWindow()) self.About_Menu.addAction(self.About_Action) self.Manual_Action = QAction("UMEP on the web", self.iface.mainWindow()) self.About_Menu.addAction(self.Manual_Action) self.Manual_Action.triggered.connect(self.help) # Icons self.SUEWSPrepare_Action.setIcon( QIcon(self.plugin_dir + "/Icons/SuewsLogo.png")) self.SUEWSSIMPLE_Action.setIcon( QIcon(self.plugin_dir + "/Icons/SuewsLogo.png")) self.SUEWS_Action.setIcon( QIcon(self.plugin_dir + "/Icons/SuewsLogo.png")) self.SVF_Action.setIcon(QIcon(self.plugin_dir + "/Icons/icon_svf.png")) self.IMCG_Action.setIcon( QIcon(self.plugin_dir + "/Icons/ImageMorphIcon.png")) self.IMCP_Action.setIcon( QIcon(self.plugin_dir + "/Icons/ImageMorphIconPoint.png")) self.DSP_Action.setIcon( QIcon(self.plugin_dir + "/Icons/ShadowIcon.png")) self.ULCUEBG_Action.setIcon( QIcon(self.plugin_dir + "/Icons/LandCoverFractionGridIcon.png")) self.ULCUEBP_Action.setIcon( QIcon(self.plugin_dir + "/Icons/LandCoverFractionPointIcon.png")) self.ULCUEBRC_Action.setIcon( QIcon(self.plugin_dir + "/Icons/LandCoverReclassifierIcon.png")) self.WH_Action.setIcon(QIcon(self.plugin_dir + "/Icons/WallsIcon.png")) self.SEBE_Action.setIcon(QIcon(self.plugin_dir + "/Icons/sebeIcon.png")) self.SEBEv_Action.setIcon( QIcon(self.plugin_dir + "/Icons/sebeIcon.png")) self.FP_Action.setIcon(QIcon(self.plugin_dir + "/Icons/FootPrint.png")) self.About_Action.setIcon( QIcon(self.plugin_dir + "/Icons/icon_umep.png")) self.Manual_Action.setIcon( QIcon(self.plugin_dir + "/Icons/icon_umep.png")) self.PED_Action.setIcon(QIcon(self.plugin_dir + "/Icons/metdata.png")) self.PFD_Action.setIcon(QIcon(self.plugin_dir + "/Icons/watch.png")) self.MRT_Action.setIcon( QIcon(self.plugin_dir + "/Icons/icon_solweig.png")) self.SOLWEIGa_Action.setIcon( QIcon(self.plugin_dir + "/Icons/icon_solweig.png")) self.SUEWSa_Action.setIcon( QIcon(self.plugin_dir + "/Icons/SuewsLogo.png")) self.TreeGenerator_Action.setIcon( QIcon(self.plugin_dir + "/Icons/icon_tree.png")) self.DSMGenerator_Action.setIcon( QIcon(self.plugin_dir + "/Icons/DSMGeneratorIcon.png")) self.EF_Action.setIcon( QIcon(self.plugin_dir + "/Icons/icon_extreme.png")) self.WC_Action.setIcon(QIcon(self.plugin_dir + "/Icons/LCZ_icon.png")) self.SDD_Action.setIcon( QIcon(self.plugin_dir + "/Icons/icon_spatialdownloader.png")) self.QFL_Action.setIcon(QIcon(self.plugin_dir + "/Icons/icon_GQF.png")) self.QF_Action.setIcon(QIcon(self.plugin_dir + "/Icons/icon_LQF.png")) self.BSS_Action.setIcon(QIcon(self.plugin_dir + "/Icons/icon_BSS.png")) self.iface.mainWindow().menuBar().insertMenu( self.iface.firstRightStandardMenu().menuAction(), self.UMEP_Menu) self.dlgAbout = UMEPDialogAbout()
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', 'sun_{}.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.visDlg = VisualizerDialog() self.polyLayer = None self.dir_path = None self.layer = None self.point1 = None self.point2 = None self.gl_widget = None self.max_energy = 0 self.energy_array = None self.asc_array = None self.ncols = None self.nrows = None self.xllcorner = None self.yllcorner = None self.cellsize = None self.roofground_file = 'Energyyearroof.tif' self.veg_file = 'Vegetationdata.txt' self.wall_file = 'Energyyearwall.txt' self.height_file = 'dsm.tif' self.fileDialog = QFileDialog() self.fileDialog.setFileMode(2) self.fileDialog.setAcceptMode(0) #Create a reference to the map canvas self.canvas = self.iface.mapCanvas() #Create tools self.areaTool = AreaTool(self.canvas) self.thread = None self.worker = None self.steps = 0 self.areaTool.areaComplete.connect(self.display_area) self.visDlg.pushButtonSelect.clicked.connect(self.area) self.visDlg.pushButtonDirectory.clicked.connect(self.path_directory) self.visDlg.pushButtonVisualize.clicked.connect(self.visualize) self.visDlg.helpButton.clicked.connect(self.help)