Usage:
js = JSCaller(frame)
js.someJsMethod({"arg1":'test'}, "Hello World")
QToolTip | |
{ | |
border: 1px solid #222; | |
background-color: #333; | |
color: @text; | |
} | |
QWidget | |
{ | |
color: @text; |
index = self.cmbConnectionsServices.findText(to_select) | |
if index == -1: | |
index = 0 | |
if not to_select: | |
index = self.cmbConnectionServices.count() - 1 | |
self.cmbConnectionServices.setCurrentIndex(index) |
Usage:
js = JSCaller(frame)
js.someJsMethod({"arg1":'test'}, "Hello World")
e import QgsApplication, QgsMapLayerRegistry | |
from qgis.gui import QgsMapCanvas | |
from qgis.core import QgsVectorLayer | |
from contextlib import contextmanager | |
@contextmanager | |
def qgisapp(): | |
GUIEnabled=True | |
app = QgsApplication([], GUIEnabled) |
FOREACH(module core) | |
ADD_CUSTOM_TARGET(py${module} ALL) | |
FILE(GLOB_RECURSE PY_FILES "${module}/*.py") | |
INSTALL(FILES ${PY_FILES} DESTINATION "${QGIS_PYTHON_DIR}/${module}") | |
ADD_CUSTOM_COMMAND(TARGET py${module} | |
POST_BUILD | |
COMMAND ${CMAKE_COMMAND} -E make_directory "${QGIS_PYTHON_OUTPUT_DIRECTORY}/${module}" | |
COMMAND ${CMAKE_COMMAND} -E copy ${PY_FILES} "${QGIS_PYTHON_OUTPUT_DIRECTORY}/${module}" | |
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
[core] | |
autocrlf = true | |
[alias] | |
st = status -s | |
ci = commit | |
br = branch | |
co = checkout | |
amend = commit --amend | |
aa = add --all | |
ac = add -u |
def change_values(layer, **kwargs): | |
featuremap = {} | |
for feature, values in kwargs.iteritems(): | |
attrs = {} | |
for field, value in values.iteritems(): | |
index = layer.dataProvider().fieldNameIndex(field) | |
attrs[index] = value | |
featuremap[feature.id()] = attrs | |
return layer.dataProvider().changeAttributeValues(featuremap) | |
Usage:
>>> selection.update(field1=1, field2="balh")
>>> selection['mylayer'].update(field1=1, field2="balh")
import os | |
import sys | |
import glob | |
import expressions | |
from qgis.core import QgsApplication | |
def load_user_expressions(path): | |
""" | |
Load all user expressions from the given paths |
REM Drag and drop OGR2OGR file for importing a layer into the database | |
REM Drop a file that OGR supports to kick off import | |
@ECHO OFF | |
SET dbserver=localhost\SQLEXPRESS | |
SET dbname=Test | |
SET db="MSSQL:server=%dbserver%;database=%dbname%;trusted_connection=yes" | |
SET ARGS=-s_src EPSG:28356 -progress -overwrite -lco GEOM_NAME:SP_GEOMETRY |