当前位置: 首页>>代码示例>>Python>>正文


Python QgsApplication.svgPaths方法代码示例

本文整理汇总了Python中qgis.core.QgsApplication.svgPaths方法的典型用法代码示例。如果您正苦于以下问题:Python QgsApplication.svgPaths方法的具体用法?Python QgsApplication.svgPaths怎么用?Python QgsApplication.svgPaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgis.core.QgsApplication的用法示例。


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

示例1: getQgisTestApp

# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgPaths [as 别名]
def getQgisTestApp():
    """ Start one QGis application to test agaist

    Input
        NIL

    Output
        handle to qgis app


    If QGis is already running the handle to that app will be returned
    """

    global QGISAPP  # pylint: disable=W0603

    if QGISAPP is None:
        myGuiFlag = True  # All test will run qgis in gui mode
        QGISAPP = QgsApplication(sys.argv, myGuiFlag)
        if 'QGIS_PREFIX_PATH' in os.environ:
            myPath = os.environ['QGIS_PREFIX_PATH']
            myUseDefaultPathFlag = True
            QGISAPP.setPrefixPath(myPath, myUseDefaultPathFlag)

        if sys.platform.startswith('darwin'):
            # override resource paths, otherwise looks for Resources in app
            if 'QGIS_MAC_PKGDATA_DIR' in os.environ:
                myPkgPath = os.environ['QGIS_MAC_PKGDATA_DIR']
                QGISAPP.setPkgDataPath(myPkgPath)
            if 'QGIS_MAC_SVG_DIR'  in os.environ:
                mySVGPath = os.environ['QGIS_MAC_SVG_DIR']
                mySVGPaths = QGISAPP.svgPaths()
                # doesn't get rid of incorrect path, just adds correct one
                mySVGPaths.prepend(mySVGPath)
                QGISAPP.setDefaultSvgPaths(mySVGPaths)

        QGISAPP.initQgis()
        s = QGISAPP.showSettings()
        print s

    global PARENT  # pylint: disable=W0603
    if PARENT is None:
        PARENT = QtGui.QWidget()

    global CANVAS  # pylint: disable=W0603
    if CANVAS is None:
        CANVAS = QgsMapCanvas(PARENT)
        CANVAS.resize(QtCore.QSize(400, 400))

    global IFACE  # pylint: disable=W0603
    if IFACE is None:
        # QgisInterface is a stub implementation of the QGIS plugin interface
        IFACE = QgisInterface(CANVAS)

    return QGISAPP, CANVAS, IFACE, PARENT
开发者ID:namhh,项目名称:Quantum-GIS,代码行数:56,代码来源:utilities.py

示例2: on_exception_but_clicked

# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgPaths [as 别名]
    def on_exception_but_clicked(self):
        # Local vars for testing value display in debugger
        t01 = QgsApplication.pluginPath()
        t02 = QgsApplication.svgPaths()
        # t03 = QChar('x')
        t04 = QPoint(4, 5)
        t05 = QPointF(4.1, 5.1)
        t06 = QDate()
        t07 = QTime()
        t08 = QDir()
        t09 = QFile()
        t10 = QUrl()

        x01 = 42
        x02 = "fortytwo"

        raise Exception("Exception raised. Check local variables in your debugger.")
开发者ID:neogis-de,项目名称:qgis-remote-debug,代码行数:19,代码来源:remotedebug_dialog.py

示例3: print

# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgPaths [as 别名]
# coding: utf-8
from PyQt4.QtCore import QSettings
from qgis.core import QgsApplication
from qgis.gui import QgsSvgSelectorWidget

# Print the SVG paths
print(QgsApplication.svgPaths())

# Specific to our use case.
# QgsApplication.setDefaultSvgPaths did not alter all the paths.
# Default value for "svg/searchPathsForSVG" is $HOME but as we had many git
# repositories under $HOME, QGIS was scanning all of them to look for SVG.
# Uncomment or not depending of your case
# s = QSettings()
# s.setValue("svg/searchPathsForSVG", "/tmp")  # Change the path if on Windows

# To confirm the difference if you apply above two previous lines
print(QgsApplication.svgPaths())

svg_selector_widget = QgsSvgSelectorWidget()
svg_selector_widget.show()


def on_svg_selected(path):
    print(path)

# Signal
svg_selector_widget.svgSelected.connect(on_svg_selected)

# Functions
print(svg_selector_widget.currentSvgPath())  # Path in the current bottom left QLineEdit
开发者ID:GEO-IASS,项目名称:pyqgis-samples,代码行数:33,代码来源:qgis-sample-QgsSvgSelectorWidget.py

示例4: check_styles_paths

# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import svgPaths [as 别名]
 def check_styles_paths(self):
     plugin_svg_path = path.join(self.plugin_dir, 'svg/')
     svg_paths = QgsApplication.svgPaths()
     if not plugin_svg_path in svg_paths:
         svg_paths.append(plugin_svg_path)
         QgsApplication.setDefaultSvgPaths(svg_paths)
开发者ID:nextgis,项目名称:ngq_compulink,代码行数:8,代码来源:compulink_tools.py


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