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', '{0}Plugin_{1}.qm'.format(PE, locale) ) if os.path.exists(locale_path): self.translator = QTranslator() self.translator.load(locale_path) QCoreApplication.installTranslator(self.translator) # Declare instance attributes self.actions = [] self.menu = self.tr('&{0}'.format(P_E)) self.toolbar = None # noinspection PyTypeChecker self.explorer_dock_widget = None self._terms_browser = None readSettings() if is_segments_write_key_valid(): analytics.write_key = segments_write_key() if is_sentry_dsn_valid(): sentry_sdk.init(sentry_dsn(), default_integrations=False) self.qgis_hook = sys.excepthook def plugin_hook(t, value, tb): trace = "".join(traceback.format_exception(t, value, tb)) if PLUGIN_NAMESPACE in trace.lower(): try: sentry_sdk.capture_exception(value) except: pass # we swallow all exceptions here, to avoid entering an endless loop self.qgis_hook(t, value, tb) sys.excepthook = plugin_hook metadataFile = os.path.join(os.path.dirname(__file__), "metadata.txt") cp = configparser.ConfigParser() with codecs.open(metadataFile, "r", "utf8") as f: cp.read_file(f) if is_sentry_dsn_valid(): version = cp["general"]["version"] with sentry_sdk.configure_scope() as scope: scope.set_context("plugin_version", version) scope.set_context("qgis_version", Qgis.QGIS_VERSION)
def __init__(self, iface): self.iface = iface try: from webappbuilder.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "Web App Builder") except: pass readSettings()
def __init__(self, iface): self.iface = iface readSettings() try: from qgistester.tests import addTestModule from geoserverexplorer.test import testplugin addTestModule(testplugin, "GeoServer") except Exception as ex: pass
def __init__(self, iface): self.iface = iface readSettings() try: from qgistester.tests import addTestModule from geoserverexplorer.test import testplugin addTestModule(testplugin, "GeoServer") except Exception as ex: pass
def __init__(self, iface): self.iface = iface try: from .tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "Data Cube Plugin") except: pass readSettings()
def __init__(self, iface): self.iface = iface readSettings() self.initConfigParams() sys.excepthook = self.excepthook self.askToSaveMemoryLayers = QgsSettings().value( "askToSaveMemoryLayers", True, section=QgsSettings.App) QgsSettings().setValue("askToSaveMemoryLayers", False, section=QgsSettings.App)
def __init__(self, iface): self.iface = iface readSettings() try: from qgistester.tests import addTestModule from lessons.test import testerplugin addTestModule(testerplugin, "Lessons") except Exception as e: pass self.lessonWidget = None
def __init__(self, iface): self.iface = iface readSettings() try: from qgistester.tests import addTestModule from lessons.test import testerplugin addTestModule(testerplugin, "Lessons") except Exception as e: pass self.lessonWidget = None
def __init__(self, iface): self.iface = iface config.iface = iface if processingOk: self.provider = GeoServerProvider() readSettings() try: from qgistester.tests import addTestModule from geoserverexplorer.test import testplugin from geoserverexplorer.test import testpkiplugin addTestModule(testplugin, "GeoServer") addTestModule(testpkiplugin, "PKI GeoServer") except Exception as ex: pass
def __init__(self, iface): self.iface = iface try: from what3words.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "what3words") except: pass self.mapTool = None if processingOk: self.provider = W3WProvider() readSettings()
def __init__(self, iface): self.iface = iface config.iface = iface readSettings() config.initConfigParams() layers = list(QgsMapLayerRegistry.instance().mapLayers().values()) for layer in layers: trackLayer(layer) try: from qgistester.tests import addTestModule from geogig.tests import testplugin addTestModule(testplugin, "GeoGig Light") except Exception as e: pass QSettings().setValue("/qgis/walForSqlite3", False)
def __init__(self, iface): self.iface = iface config.iface = iface readSettings() config.initConfigParams() layers = list(QgsMapLayerRegistry.instance().mapLayers().values()) for layer in layers: trackLayer(layer) try: from qgistester.tests import addTestModule from geogig.tests import testplugin addTestModule(testplugin, "GeoGig Light") except Exception as e: pass QSettings().setValue("/qgis/walForSqlite3", False)
def __init__(self, iface): self.iface = iface try: from .tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "Boundless Basemaps") except Exception as e: pass try: from lessons import addLessonsFolder folder = os.path.join(os.path.dirname(__file__), "_lessons") addLessonsFolder(folder) except: pass readSettings() if not pluginSetting('first_time_setup_done'): self.iface.initializationCompleted.connect(self.setup)
def __init__(self, iface): self.logger = logging.getLogger(__name__) self.logger.info("GDAL version in this QGIS is: " + gdal.__version__) self.iface = iface self.mapTool = None self.doAdd = False self.total_image_list = [] self.new_image_list = [] self.counter = 0 self.start_time = time.time() readSettings() self.camera = pluginSetting("camera") self.image_path = pluginSetting("gtifPath") self.gtif_path = pluginSetting("gtifoutPath") self.trans_path = pluginSetting("translatedPath") self.refreshInterval = pluginSetting("refreshInterval") self.out_format = pluginSetting("out_format") self.logger.info("Input Images Path: " + self.image_path) self.logger.info("Trans Images Path: " + self.trans_path) self.logger.info("Warped Images Path: " + self.gtif_path) self.logger.info("Refresh Interval: " + str(self.refreshInterval)) self.logger.info("Camera is: " + str(self.camera))
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', '{0}Plugin_{1}.qm'.format(PE, locale)) if os.path.exists(locale_path): self.translator = QTranslator() self.translator.load(locale_path) QCoreApplication.installTranslator(self.translator) # Declare instance attributes self.actions = [] self.menu = self.tr('&{0}'.format(P_E)) self.toolbar = None # noinspection PyTypeChecker self.explorer_dock_widget = None self._terms_browser = None readSettings() if is_segments_write_key_valid(): analytics.write_key = segments_write_key() if is_sentry_dsn_valid(): sentry_sdk.init(sentry_dsn(), default_integrations=False) self.qgis_hook = sys.excepthook def plugin_hook(t, value, tb): trace = "".join(traceback.format_exception(t, value, tb)) if PLUGIN_NAMESPACE in trace.lower(): try: sentry_sdk.capture_exception(value) except: pass # we swallow all exceptions here, to avoid entering an endless loop s = "" if issubclass(t, requests.exceptions.Timeout): s = "Connection to Planet server timed out." elif issubclass(t, requests.exceptions.ConnectionError): s = "Connection error.\n Verify that your computer is correctly connected to the Internet" elif issubclass(t, requests.exceptions.ProxyError): s = "ProxyError.\n Verify that your proxy is correctly configured in the QGIS settings" elif issubclass(t, planet.api.exceptions.ServerError): s = "Server Error.\n Please, try again later" if s: QMessageBox.warning(self.iface.mainWindow(), "Error", s) else: self.qgis_hook(t, value, tb) else: self.qgis_hook(t, value, tb) sys.excepthook = plugin_hook if is_sentry_dsn_valid(): with sentry_sdk.configure_scope() as scope: scope.set_context( "versions", { "plugin_version", plugin_version(), "qgis_version", Qgis.QGIS_VERSION })
def setUpClass(cls): readSettings(_testFile('settings.json'))
def setUpClass(cls): readSettings(_testFile('settings.json')) loadTestProject("raleigh")
qgs = QgsApplication(argvb, True) # Load providers qgs.initQgis() search_request = json.loads('''{"item_types": ["PSScene4Band", "PSScene3Band"], "filter": {"type": "AndFilter", "config": [{"field_name": "geometry", "type": "GeometryFilter", "config": {"type": "Polygon", "coordinates": [ [[-124.60010884388858, 36.207866384307614], [-119.61878664869495, 36.207866384307614], [-119.61878664869495, 39.705780131667844], [-124.60010884388858, 39.705780131667844], [-124.60010884388858, 36.207866384307614]]]}}, {"field_name": "cloud_cover", "type": "RangeFilter", "config": {"gte": 0, "lte": 100}}]}}''') readSettings(settings_path=os.path.join(plugin_path, 'settings.json')) SETTINGS_NAMESPACE = None # tree = PlanetSearchResultsView( # parent=None, iface=None, api_key=apikey, # request_type=RESOURCE_DAILY, request=search_request) # tree.show() wdgt = PlanetSearchResultsWidget( parent=None, iface=None, api_key=apikey, request_type=RESOURCE_DAILY, request=search_request, sort_order=('acquired', 'desc')) # wrap in dialog dlg = QDialog() layout = QVBoxLayout(dlg)
def setUpClass(cls): readSettings( os.path.join(os.path.dirname(__file__), 'data', 'settings.json'))