• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python testing.start_app函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中qgis.testing.start_app函数的典型用法代码示例。如果您正苦于以下问题:Python start_app函数的具体用法?Python start_app怎么用?Python start_app使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了start_app函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_iface

def get_iface():
    """
    Will return a mock QgisInterface object with some methods implemented in a generic way.

    You can further control its behavior
    by using the mock infrastructure. Refer to https://docs.python.org/3/library/unittest.mock.html
    for more details.

        Returns
        -------
        QgisInterface

        A mock QgisInterface
    """

    start_app()

    my_iface = mock.Mock(spec=QgisInterface)

    my_iface.mainWindow.return_value = QMainWindow()

    canvas = QgsMapCanvas(my_iface.mainWindow())
    canvas.resize(QSize(400, 400))

    my_iface.mapCanvas.return_value = canvas

    return my_iface
开发者ID:HeatherHillers,项目名称:QGIS,代码行数:27,代码来源:mocked.py


示例2: setUpClass

 def setUpClass(cls):
     """Run before all tests"""
     QCoreApplication.setOrganizationName("QGIS_Test")
     QCoreApplication.setOrganizationDomain("QGIS_TestPyQgsColorScheme.com")
     QCoreApplication.setApplicationName("QGIS_TestPyQgsColorScheme")
     QSettings().clear()
     start_app()
开发者ID:fritsvanveen,项目名称:QGIS,代码行数:7,代码来源:test_qgscolorscheme.py


示例3: setUpClass

 def setUpClass(cls):
     """Run before all tests"""
     QCoreApplication.setOrganizationName("QGIS_Test")
     QCoreApplication.setOrganizationDomain("QGIS_TestPyQgsWFSProviderGUI.com")
     QCoreApplication.setApplicationName("QGIS_TestPyQgsWFSProviderGUI")
     QgsSettings().clear()
     start_app()
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:7,代码来源:test_qgsshortcutsmanager.py


示例4: setUpClass

    def setUpClass(cls):
        """Run before all tests"""
        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain("QGIS_TestPyQgsColorScheme.com")
        QCoreApplication.setApplicationName("QGIS_TestPyQgsColorScheme")
        QgsSettings().clear()
        start_app()

        # setup some fake connections
        settings = QgsSettings()
        key = 'qgis/connections-wms/test/'
        settings.setValue(key + 'url', 'aaa.bbb.com')
        settings.setValue(key + 'referer', 'my_ref')
        settings.setValue(key + 'ignoreGetMapURI', True)
        settings.setValue(key + 'ignoreGetFeatureInfoURI', True)
        settings.setValue(key + 'smoothPixmapTransform', True)
        settings.setValue(key + 'dpiMode', 4)
        settings.setValue(key + 'ignoreAxisOrientation', True)
        settings.setValue(key + 'invertAxisOrientation', True)

        key = 'qgis/connections-wfs/test/'
        settings.setValue(key + 'url', 'ccc.ddd.com')
        settings.setValue(key + 'version', '1.1.0')
        settings.setValue(key + 'maxnumfeatures', '47')
        settings.setValue(key + 'ignoreAxisOrientation', True)
        settings.setValue(key + 'invertAxisOrientation', True)
开发者ID:CS-SI,项目名称:QGIS,代码行数:26,代码来源:test_qgsowsconnection.py


示例5: setUpClass

    def setUpClass(cls):
        start_app()
        from processing.core.Processing import Processing
        Processing.initialize()
        cls.cleanup_paths = []

        assert Grass7Utils.installedVersion()
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:7,代码来源:Grass7AlgorithmsRasterTest.py


示例6: setUpClass

 def setUpClass(cls):
     start_app()
     from processing.core.Processing import Processing
     Processing.initialize()
     cls.cleanup_paths = []
     cls.in_place_layers = {}
     cls.vector_layer_params = {}
开发者ID:GeoCat,项目名称:QGIS,代码行数:7,代码来源:QgisAlgorithmsTest.py


示例7: setUpClass

 def setUpClass(cls):
     """Run before all tests"""
     QCoreApplication.setOrganizationName("QGIS_Test")
     QCoreApplication.setOrganizationDomain("QGIS_TestPyQgsNewGeoPackageLayerDialog.com")
     QCoreApplication.setApplicationName("QGIS_TestPyQgsNewGeoPackageLayerDialog")
     QgsSettings().clear()
     start_app()
     cls.basetestpath = tempfile.mkdtemp()
开发者ID:jonnyforestGIS,项目名称:QGIS,代码行数:8,代码来源:test_qgsnewgeopackagelayerdialog.py


示例8: setUpClass

 def setUpClass(cls):
     start_app()
     from processing.core.Processing import Processing
     Processing.initialize()
     QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())
     cls.cleanup_paths = []
     cls.in_place_layers = {}
     cls.vector_layer_params = {}
开发者ID:alexbruy,项目名称:QGIS,代码行数:8,代码来源:ProcessingGeneralTest.py


示例9: setUpClass

    def setUpClass(cls):
        start_app()
        from processing.core.Processing import Processing
        Processing.initialize()
        cls.cleanup_paths = []

        cls.temp_dir = tempfile.mkdtemp()
        cls.cleanup_paths.append(cls.temp_dir)
开发者ID:alexbruy,项目名称:QGIS,代码行数:8,代码来源:SagaAlgorithmsTest.py


示例10: setUpClass

 def setUpClass(cls):
     """Run before all tests"""
     QCoreApplication.setOrganizationName("QGIS_Test")
     QCoreApplication.setOrganizationDomain("QGIS_TestPyQgsColorScheme.com")
     QCoreApplication.setApplicationName("QGIS_TestPyQgsColorScheme")
     QgsSettings().clear()
     QLocale.setDefault(QLocale(QLocale.English))
     start_app()
开发者ID:pblottiere,项目名称:QGIS,代码行数:8,代码来源:test_qgsfieldformatters.py


示例11: setUpClass

    def setUpClass(cls):
        """Run before all tests"""
        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain("QGIS_TestPyQgsWFSProviderGUI.com")
        QCoreApplication.setApplicationName("QGIS_TestPyQgsWFSProviderGUI")
        QSettings().clear()
        start_app()

        cls.basetestpath = tempfile.mkdtemp().replace('\\', '/')
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:9,代码来源:test_provider_wfs_gui.py


示例12: setUpClass

 def setUpClass(cls):
     start_app()
     from processing.core.Processing import Processing
     Processing.initialize()
     ProcessingConfig.setSettingValue(ModelerUtils.MODELS_FOLDER, os.path.join(os.path.dirname(__file__), 'models'))
     QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())
     cls.cleanup_paths = []
     cls.in_place_layers = {}
     cls.vector_layer_params = {}
     cls._original_models_folder = ProcessingConfig.getSetting(ModelerUtils.MODELS_FOLDER)
开发者ID:FERRATON,项目名称:QGIS,代码行数:10,代码来源:QgisAlgorithmsTest.py


示例13: setUpClass

    def setUpClass(cls):
        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain("QGIS_TestPyQgsFontUtils.com")
        QCoreApplication.setApplicationName("QGIS_TestPyQgsFontUtils")
        QgsSettings().clear()

        start_app()

        cls._family = getTestFontFamily()
        cls._has_style = QgsFontUtils.fontFamilyHasStyle
开发者ID:cz172638,项目名称:QGIS,代码行数:10,代码来源:test_qgsfontutils.py


示例14: setUpClass

    def setUpClass(cls):
        """Run before all tests"""
        # start ans setup server
        cls.setUpServer()

        # start a standalone qgis application
        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain("TestPyQgsDBManagerPostgis.com")
        QCoreApplication.setApplicationName("TestPyQgsDBManagerPostgis")
        QgsSettings().clear()
        start_app()
开发者ID:SrNetoChan,项目名称:Quantum-GIS,代码行数:11,代码来源:test_db_manager_postgis.py


示例15: setUpClass

    def setUpClass(cls):
        """Run before all tests"""

        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain("TestPyQgsOGRProviderGpkg.com")
        QCoreApplication.setApplicationName("TestPyQgsOGRProviderGpkg")
        QgsSettings().clear()
        start_app()

        # Create test layer
        cls.basetestpath = tempfile.mkdtemp()
开发者ID:ufolr,项目名称:QGIS,代码行数:11,代码来源:test_provider_ogr_gpkg.py


示例16: loadTestFonts

def loadTestFonts():
    start_app()

    global FONTSLOADED  # pylint: disable=W0603
    if FONTSLOADED is False:
        QgsFontUtils.loadStandardTestFonts(["Roman", "Bold"])
        msg = getTestFontFamily() + " base test font styles could not be loaded"
        res = QgsFontUtils.fontFamilyHasStyle(getTestFontFamily(), "Roman") and QgsFontUtils.fontFamilyHasStyle(
            getTestFontFamily(), "Bold"
        )
        assert res, msg
        FONTSLOADED = True
开发者ID:ndavid,项目名称:QGIS,代码行数:12,代码来源:utilities.py


示例17: setUpClass

 def setUpClass(cls):
     start_app()
     from processing.core.Processing import Processing
     Processing.initialize()
     ProcessingConfig.setSettingValue("OTB_ACTIVATE", True)
     ProcessingConfig.setSettingValue(OtbSettings.FOLDER, OTB_INSTALL_DIR)
     ProcessingConfig.setSettingValue(OtbSettings.APP_FOLDER, os.path.join(OTB_INSTALL_DIR, 'lib', 'otb', 'applications'))
     ProcessingConfig.readSettings()
     # Refresh OTB Algorithms after settings are changed.
     for p in QgsApplication.processingRegistry().providers():
         if p.id() == "otb":
             p.refreshAlgorithms()
     cls.descrFolder = os.path.join(OTB_INSTALL_DIR, 'share', 'otb', 'description')
     cls.cleanup_paths = []
开发者ID:dwsilk,项目名称:QGIS,代码行数:14,代码来源:OtbAlgorithmsTest.py


示例18: setUpClass

    def setUpClass(cls):
        """Runs at start."""

        QCoreApplication.setOrganizationName("QGIS")
        QCoreApplication.setOrganizationDomain("qgis.org")
        QCoreApplication.setApplicationName("QGIS-TEST-%s" % uuid.uuid1())
        qgis_app = start_app()

        # Installed plugins
        cls.installed_plugins = {
            'MetaSearch': '0.3.5',
            'QuickWKT': '3.1',
            'db_manager': '0.1.20',
            'firstaid': '2.1.1',
            'InaSAFE': '5.0.0',
            'ipyconsole': '1.8',
            'plugin_reloader': '0.7.4',
            'processing': '2.12.99',
            'qgis-geocoding': '2.18',
            'qgisce': '0.9',
            'redistrict': '0.1'
        }

        data_path = os.path.join(TESTDATA_PATH, 'plugindependencies_data.json')
        with open(data_path) as f:
            cls.plugin_data = json.loads(f.read())
开发者ID:alexbruy,项目名称:QGIS,代码行数:26,代码来源:test_plugindependencies.py


示例19: setUpClass

    def setUpClass(cls):
        """Run before all tests"""
        QCoreApplication.setOrganizationName("QGIS_Test")
        QCoreApplication.setOrganizationDomain("QGIS_TestPyQgsColorScheme.com")
        QCoreApplication.setApplicationName("QGIS_TestPyQgsColorScheme")
        QgsSettings().clear()
        start_app()

        # setup a fake connection
        settings = QgsSettings()
        key = QgsGeoNodeConnectionUtils.pathGeoNodeConnection() + '/test/'

        settings.setValue(key + 'wms/referer', 'my_ref')
        settings.setValue(key + 'wms/ignoreGetMapURI', True)
        settings.setValue(key + 'wms/ignoreGetFeatureInfoURI', True)
        settings.setValue(key + 'wms/smoothPixmapTransform', True)
        settings.setValue(key + 'wms/dpiMode', 4)
        settings.setValue(key + 'wms/ignoreAxisOrientation', True)
        settings.setValue(key + 'wms/invertAxisOrientation', True)

        settings.setValue(key + 'wfs/version', '1.1.0')
        settings.setValue(key + 'wfs/maxnumfeatures', '47')
        settings.setValue(key + 'wfs/ignoreAxisOrientation', True)
        settings.setValue(key + 'wfs/invertAxisOrientation', True)
开发者ID:enzogis,项目名称:QGIS,代码行数:24,代码来源:test_qgsgeonodeconnection.py


示例20: qgis_app

def qgis_app():
    """Start a QGIS application and get the iface.

    Mostly inspired by
    https://github.com/qgis/QGIS/blob/release-2_18/python/testing/mocked.py

    The application is returned as first argument. The QgisInterface is
    returned as second argument.

    The parent can be accessed by iface.mainWindow()
    The canvas can be access by iface.mapCanvas()

    You can further control its behavior
    by using the mock infrastructure.
    Refer to https://docs.python.org/3/library/unittest.mock.html
    for more details.

    :return: The QGIS interface.
    :rtype: QgisInterface
    """
    from qgis.utils import iface
    if iface:
        # We are already in QGIS.
        # I don't know if I can get the current QApplication.
        # But I guess we shouldn't use it too much.
        return None, iface

    # We are not in QGIS, we need to start an app.
    application = start_app()

    my_iface = mock.Mock(spec=QgisInterface)
    my_iface.mainWindow.return_value = QMainWindow()

    canvas = QgsMapCanvas(my_iface.mainWindow())
    canvas.resize(QSize(400, 400))

    my_iface.mapCanvas.return_value = canvas

    return application, my_iface
开发者ID:inasafe,项目名称:inasafe,代码行数:39,代码来源:qgis_app.py



注:本文中的qgis.testing.start_app函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mocked.get_iface函数代码示例发布时间:2022-05-26
下一篇:
Python server.QgsServerSettings类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap