def __init__(self, iface): self.iface = iface self.lastSettings = {} self.widget = None self.iface.initializationCompleted.connect(self.hideWidget) addTestModule(manualtests, "Tester Plugin")
def __init__(self, iface): ''' This plugin has tests that use the Tester plugin. If the plugin is available and loaded, tests are added to it. Otherwise, they are ignored ''' try: from what3words.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "what3words") except: pass self.mapTool = None ''' Create the Processing provider if Processing is availabel and loaded ''' if processingOk: self.provider = W3WProvider() ''' This must be added in the __init__ method, to tell the qgiscommons library that it has to load the settings for this plugin. It will find them automatically in a file named 'settings.json' in the plugin folder ''' readSettings()
def __init__(self, iface): try: from lessons import addLessonModule except: return folder = os.path.join(os.path.dirname(__file__), "_lessons") def isPackage(d): d = os.path.join(folder, d) return os.path.isdir(d) and glob.glob( os.path.join(d, '__init__.py*')) packages = filter(isPackage, os.listdir(folder)) for p in packages: m = __import__(__name__.split(".")[0] + "._lessons." + p, fromlist="dummy") addLessonModule(m) # add tests to test plugin try: from qgistester.tests import addTestModule from examplelessons.test import testplugin addTestModule(testplugin, "Example lessons") except Exception as ex: pass
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
def __init__(self, iface): self.iface = iface try: from reportingtool.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "Support tool") except: pass
def __init__(self, iface): self.iface = iface try: from tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "MGRS tools") except: pass
def __init__(self, iface): self.iface = iface try: from coretests.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "Core Tests") except Exception as e: 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 coretests.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "Core Tests") except Exception as e: raise pass
def __init__(self, iface): self.iface = iface try: from .tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "[pluginname]") except: pass readSettings()
def __init__(self, iface): self.iface = iface config.iface = iface self.provider = GeoServerProvider() try: from qgistester.tests import addTestModule from geoserverexplorer.test import testplugin addTestModule(testplugin, "GeoServer") except: pass
def __init__(self, iface): self.iface = iface try: from mgrstools.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, 'MGRS tools') except: pass if processingOk: self.provider = MgrsProvider()
def __init__(self, iface): self.iface = iface self.lastSettings = {} self.widget = None self.iface.initializationCompleted.connect(self.hideWidget) try: from qgistester.manualtests import manualtests addTestModule(manualtests, 'Tester Plugin') except: pass
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 # add tests to test plugin try: from qgistester.tests import addTestModule from lessons.test import testplugin addTestModule(testplugin, "Lessons") except Exception as ex: pass self.lessonWidget = None
def __init__(self, iface): self.iface = iface # add tests to tester plugin try: from qgistester.tests import addTestModule from lessonscreator.test import testerplugin addTestModule(testerplugin, "LessonsCreator") except Exception as e: pass self.capturing = False
def __init__(self, iface): self.iface = iface # add tests to test plugin try: from qgistester.tests import addTestModule from lessons.test import testerplugin addTestModule(testerplugin, "Lessons") except Exception as e: pass self.lessonWidget = None
def testAddTestModule(self): """check addTestModule method to add a test in the qgistester plugin.""" from qgistester import tests if tests.tests is None: tests.tests = [] from data import plugin1 addTestModule(plugin1, 'Plugin1') test_names = [utw.name for utw in tests.tests] self.assertIn('Test that fails', test_names) self.assertIn('Test that passes', test_names) self.assertIn('Functional test', test_names)
def testAddTestModule(self): """check addTestModule method to add a test in the qgistester plugin.""" from qgistester import tests if tests.tests is None: tests.tests = [] from .data import plugin1 addTestModule(plugin1, 'Plugin1') test_names = [utw.name for utw in tests.tests] self.assertIn('Test that fails', test_names) self.assertIn('Test that passes', test_names) self.assertIn('Functional test', test_names)
def classFactory(iface): if Qgis.QGIS_VERSION_INT >= QGIS_REQUIRED_VERSION_INT: try: Logger().info(__name__, "STARTING LADM-COL ASSISTANT...") from .asistente_ladm_col_plugin import AsistenteLADMCOLPlugin except ImportError as e: iface.messageBar().clearWidgets() widget = iface.messageBar().createMessage( "Asistente LADM-COL", QCoreApplication.translate( "__init__", "There was a problem loading the plugin {}. See the log for details." ).format(PLUGIN_NAME)) button = QPushButton(widget) button.setText( QCoreApplication.translate("__init__", "Open log panel...")) button.pressed.connect(partial(open_log, iface)) widget.layout().addWidget(button) iface.messageBar().pushWidget(widget, Qgis.Warning, 0) Logger().critical(__name__, "ERROR while loading the plugin: " + repr(e)) from mock import Mock return Mock() try: from asistente_ladm_col.tests.gui_tests import gui_tests_model_baker from qgistester.tests import addTestModule addTestModule(gui_tests_model_baker, PLUGIN_NAME) except: Logger().warning( __name__, "QGIS Tester plugin was not found. Therefore, no GUI tests could be registered!" ) return AsistenteLADMCOLPlugin(iface) else: iface.messageBar().pushMessage( "Asistente LADM-COL", QCoreApplication.translate( "__init__", "{} plugin requires QGIS {} version or higher. Please install the required version." ).format(PLUGIN_NAME, QGIS_REQUIRED_VERSION), 1, 0) Logger().critical( __name__, "ERROR while loading the plugin: QGIS version {} not supported! Required: {}" .format(Qgis.QGIS_VERSION_INT, QGIS_REQUIRED_VERSION_INT)) from mock import Mock return Mock()
def __init__(self): QObject.__init__(self) self.plugins = dict() self.localCache = dict() self.repoCache = dict() try: from qgistester.tests import addTestModule from boundlessconnect.test import testplugin addTestModule(testplugin, "Boundless Connect") 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()
def __init__(self, iface): self.iface = iface config.iface = iface if processingOk: self.provider = GeoServerProvider() 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 milstd2525.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, 'MIL-STD-2525') except: pass self._rendererMetadata = MilStd2525RendererMetadata() self._widgetWrapperFactory = SIDCWidgetWrapperFactory() QgsRendererV2Registry.instance().addRenderer(self._rendererMetadata) QgsEditorWidgetRegistry.instance().registerWidget('SIDC code editor', self._widgetWrapperFactory)
def __init__(self, iface): self.iface = iface try: from boundlessconnect.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, 'Boundless Connect') except Exception as e: pass self.dockWidget = None readSettings() self.iface.initializationCompleted.connect(self.checkFirstRun)
def __init__(self, iface): self.iface = iface try: from .tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, 'MIL-STD-2525') except: pass self._rendererMetadata = MilStd2525RendererMetadata() self._widgetWrapperFactory = SIDCWidgetWrapperFactory() QgsRendererV2Registry.instance().addRenderer(self._rendererMetadata) QgsEditorWidgetRegistry.instance().registerWidget('SIDC code editor', self._widgetWrapperFactory)
def __init__(self, iface): self.iface = iface QSettings().setValue('/UI/Customization/enabled', False) try: from profiles.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, 'Profiles plugin') except: pass self.userProfileAction = None self.profilesMenu = None iface.initializationCompleted.connect(self.initProfile)
def __init__(self, iface): self.iface = iface config.iface = iface 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 self.action_setting = None self.action_about = None self.action_run = None if not self.is_supported(): return # noinspection PyBroadException try: # noinspection PyPackageRequirements,PyUnresolvedReferences from .tests import testerplugin # noinspection PyUnresolvedReferences from qgistester.tests import addTestModule addTestModule(testerplugin, "OS Certificate Store") except: pass
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): """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 """:type : QgsInterface""" self.mw = iface.mainWindow() """:type : QMainWindow""" try: from tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, 'PopulateAuthSystem') except: pass # 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', 'populateauthsystem_{}.qm'.format(locale)) if os.path.exists(locale_path): self.translator = QTranslator() self.translator.load(locale_path) if qVersion() > '4.3.3': # noinspection PyArgumentList QCoreApplication.installTranslator(self.translator) # Declare instance attributes self.title = self.tr(u'Populate Authentication System') self.action = None # Set up automated enacting of plugin at end of app launch self.iface.initializationCompleted.connect(self.app_initialized)
def __init__(self, iface): self.iface = iface # noinspection PyBroadException try: from milstd2525.tests import testerplugin # noinspection PyUnresolvedReferences from qgistester.tests import addTestModule addTestModule(testerplugin, 'MIL-STD-2525') except: pass self._rendererMetadata = MilStd2525RendererMetadata() self._widgetWrapperFactory = SIDCWidgetWrapperFactory() # noinspection PyArgumentList QgsApplication.rendererRegistry().addRenderer(self._rendererMetadata) # noinspection PyArgumentList QgsGui.instance().editorWidgetRegistry().registerWidget( 'SIDC code editor', self._widgetWrapperFactory)
def __init__(self, iface): self.iface = iface try: from .tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, "Print Templates Creator") except: pass overrideLocale = QSettings().value("locale/overrideFlag", False, bool) if not overrideLocale: locale = QLocale.system().name()[:2] else: locale = QSettings().value("locale/userLocale", "") qmPath = "{}/i18n/templatescreator_{}.qm".format(pluginPath, locale) if os.path.exists(qmPath): self.translator = QTranslator() self.translator.load(qmPath) QCoreApplication.installTranslator(self.translator)
def __init__(self, iface): self.iface = iface config.iface = iface class QgisLogHandler(logging.Handler): def __init__(self): logging.Handler.__init__(self) def emit(self, record): try: QgsMessageLog.logMessage(self.format(record), "GeoGig") except AttributeError: #prevent error in case the log object is None pass logFile = os.path.join(userFolder(), "geogig.log") handler = logging.FileHandler(logFile) logger.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) handler.setLevel(logging.DEBUG) logger.addHandler(handler) qgisHandler = QgisLogHandler() qgisFormatter = logging.Formatter('%(levelname)s - %(message)s') qgisHandler.setFormatter(qgisFormatter) qgisHandler.setLevel(logging.DEBUG) logger.addHandler(qgisHandler) config.initConfigParams() layers = QgsMapLayerRegistry.instance().mapLayers().values() for layer in layers: if layer not in trackers: trackLayer(layer) try: from qgistester.tests import addTestModule from geogig.tests import testplugin addTestModule(testplugin, "GeoGig") except Exception as e: pass
def __init__(self, iface): self.iface = iface config.iface = iface class QgisLogHandler(logging.Handler): def __init__(self): logging.Handler.__init__(self) def emit(self, record): try: QgsMessageLog.logMessage(self.format(record), "GeoGig") except AttributeError: #prevent error in case the log object is None pass logFile = os.path.join(userFolder(), "geogig.log") handler = logging.FileHandler(logFile) logger.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) handler.setLevel(logging.DEBUG) logger.addHandler(handler) qgisHandler = QgisLogHandler() qgisFormatter = logging.Formatter('%(levelname)s - %(message)s') qgisHandler.setFormatter(qgisFormatter) qgisHandler.setLevel(logging.DEBUG) logger.addHandler(qgisHandler) config.initConfigParams() layers = QgsMapLayerRegistry.instance().mapLayers().values() for layer in layers: if layer not in trackers: trackLayer(layer) try: from qgistester.tests import addTestModule from geogig.tests import testplugin addTestModule(testplugin, "GeoGig") except Exception as e: pass
def __init__(self, iface): try: from lessons import addLessonModule except: return folder = os.path.join(os.path.dirname(__file__), "_lessons") def isPackage(d): d = os.path.join(folder, d) return os.path.isdir(d) and glob.glob(os.path.join(d, '__init__.py*')) packages = filter(isPackage, os.listdir(folder)) for p in packages: m = __import__(__name__.split(".")[0] + "._lessons." + p, fromlist="dummy") addLessonModule(m) # add tests to test plugin try: from qgistester.tests import addTestModule from examplelessons.test import testplugin addTestModule(testplugin, "Example lessons") except Exception as ex: pass
def __init__(self, iface): self.iface = iface try: from boundlessconnect.tests import testerplugin from qgistester.tests import addTestModule addTestModule(testerplugin, 'Boundless Connect') except Exception as e: pass overrideLocale = QSettings().value('locale/overrideFlag', False, bool) if not overrideLocale: locale = QLocale.system().name()[:2] else: locale = QSettings().value('locale/userLocale', '') qmPath = '{}/i18n/boundlessconnect_{}.qm'.format(pluginPath, locale) if os.path.exists(qmPath): self.translator = QTranslator() self.translator.load(qmPath) QCoreApplication.installTranslator(self.translator) self.iface.initializationCompleted.connect(self.startFirstRunWizard)