Ejemplo n.º 1
0
def main():
    """Main function to run the example."""
    app = QApplication([])

    default_value_parameter = DefaultValueParameter()
    default_value_parameter.name = 'Value parameter'
    default_value_parameter.help_text = 'Help text'
    default_value_parameter.description = 'Description'
    default_value_parameter.labels = ['Setting', 'Do not report', 'Custom']
    default_value_parameter.options = [0, 1, None]

    parameters = [default_value_parameter]

    extra_parameters = [(DefaultValueParameter, DefaultValueParameterWidget)]

    parameter_container = ParameterContainer(parameters,
                                             extra_parameters=extra_parameters)
    parameter_container.setup_ui()

    widget = QWidget()
    layout = QGridLayout()
    layout.addWidget(parameter_container)

    widget.setLayout(layout)
    widget.setGeometry(0, 0, 500, 500)

    widget.show()

    sys.exit(app.exec_())
Ejemplo n.º 2
0
    def __init__(self, auth_file):

        logger.debug("\n================== ISOGEO API WITH QT ==================")

        # getting credentials :
        logger.debug("Getting credentials")
        self.utils = IsogeoUtils()
        self.app_creds = self.utils.credentials_loader(auth_file)
        self.app_id = self.app_creds.get("client_id")
        self.app_secrets = self.app_creds.get("client_secret")

        # for connection :
        self.naMngr = QNetworkAccessManager()
        self.token_url = "https://id.api.isogeo.com/oauth/token"
        self.request_url = (
            "https://v1.api.isogeo.com/resources/search?_limit=0&_offset=0"
        )

        # init variables :
        self.token = ""
        self.search_type = "init"
        self.checked_kw = {}

        # for ui (launch and display):
        logger.debug("Processing and displaying UI")
        self.app = QApplication(sys.argv)
        self.ui = AuthWidget()
        self.ui.resize(400, 100)
        self.pysdk_checking()
        self.api_authentification()
        self.ui.btn_reset.pressed.connect(self.reset)
        self.ui.show()
        self.app.exec()
def main():
    """Main function to run the example."""
    layer = load_test_vector_layer(
        'aggregation', 'district_osm_jakarta.geojson', clone=True)

    app = QApplication([])

    field_mapping = FieldMappingTab(age_ratio_group, PARENT, IFACE)
    field_mapping.set_layer(layer)

    widget = QWidget()
    layout = QGridLayout()
    layout.addWidget(field_mapping)

    widget.setLayout(layout)

    widget.show()

    sys.exit(app.exec_())
Ejemplo n.º 4
0
    def __init__(self, iface):
        self.iface = iface
        self.plugin_dir = os.path.dirname(__file__)

        self.windowTitle = "3Di Modeller Interface - Powered by QGIS"

        self.app = QApplication.instance()
        self.QApp = QCoreApplication.instance()

        if self.QApp is None:
            self.QApp = QApplication(sys.argv)

        self.QApp.startingUp()
        self.QApp.processEvents()
        self.app.startDragTime()

        self.iface.initializationCompleted.connect(self.customization)
        qApp.processEvents()

        self.applyStyle()
Ejemplo n.º 5
0
                for n in i:
                    us_res_dep.append(n)

            if not bool(us_res_dep):

                if self.L == 'it':
                    QMessageBox.warning(
                        self, "Alert", "Non ci sono geometrie da visualizzare",
                        QMessageBox.Ok)

                elif self.L == 'de':
                    QMessageBox.warning(
                        self, "Alert",
                        "es gibt keine Geometrien, die angezeigt werden können",
                        QMessageBox.Ok)
                else:
                    QMessageBox.warning(self, "Alert",
                                        "There are no geometries to display",
                                        QMessageBox.Ok)
            else:
                self.pyQGIS.charge_vector_layers(us_res_dep)


## Class end

if __name__ == "__main__":
    app = QApplication(sys.argv)
    ui = pyarchinit_US()
    ui.show()
    sys.exit(app.exec_())
Ejemplo n.º 6
0
from QGIS_FMV.klvdata.element import UnknownElement
from QGIS_FMV.klvdata.streamparser import StreamParser
import sys
from qgis.PyQt.QtWidgets import QApplication
app = QApplication([""])

print('Number of arguments:', len(sys.argv), 'arguments.')

if len(sys.argv) == 2:

    print("data: " + sys.argv[1])
    stdout_data = open(sys.argv[1], 'rb').read()

    for packet in StreamParser(stdout_data):
        if isinstance(packet, UnknownElement):
            print("Error interpreting klv data, metadata cannot be read.")
            continue
        data = packet.MetadataList()
        print("First Precision Time Stamp:" + str(data[2]))
Ejemplo n.º 7
0
            self._api.prepare()
        except Exception as err:
            self._api = None
            sys.exit(1)


if __name__ == '__main__':
    if len(sys.argv) != 4:
        print('Usage: python <script> <pap_file> <apis_src_dir> <api_bin_dir>')
        sys.exit(1)
    pap_file = sys.argv[1]
    api_src_dir = sys.argv[2]
    api_bin_dir = sys.argv[3]

    api_files = [
        os.path.join(api_bin_dir, 'PyQGIS.api'),
        os.path.join(api_src_dir, 'Python-3.6.api'),
        os.path.join(api_src_dir, 'PyQt5.api'),
        os.path.join(api_src_dir, 'OSGeo_GEOS-3.6.2.api'),
        os.path.join(api_src_dir, 'OSGeo_GDAL-OGR-2.2.3.api')
    ]
    # print api_files.__repr__()
    # print pap_file.__repr__()

    app = QApplication(sys.argv, False)  # just start a non-gui console app
    api_lexer = QsciLexerPython()
    prepap = PrepareAPIs(api_lexer, api_files, pap_file)
    prepap.prepareAPI()

    sys.exit(app.exec_())
Ejemplo n.º 8
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
/***************************************************************************
        HFF_system Plugin  - A QGIS plugin to manage archaeological dataset
                             -------------------
        begin                : 2007-12-01
        copyright            : (C) 2008 by Luca Mandolesi
        email                : mandoluca at gmail.com
 ***************************************************************************/
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
"""
from __future__ import absolute_import
import os
import subprocess
import sys
import time
import shutil
from builtins import range
from builtins import str
from ..modules.utility.hff_system__OS_utility import Hff_OS_Utility
from ..modules.utility.settings import Settings
from ..modules.db.hff_system__conn_strings import Connection
Ejemplo n.º 9
0
            app_instance.UpdateParameters()
            ct = describe_app(app_instance)
            fh.write(ct)
            fh.close()
        except Exception:
            logger.error(traceback.format_exc())

    sub_algo = [each for each in os.listdir("description") if "-" in each and ".xml" in each]
    for key in sub_algo:
        shutil.copy("description/doc/%s" % key.split("-")[0] + ".html", "description/doc/%s" % key.split(".")[0] + ".html")

if __name__ == "__main__":
    # Prepare the environment
    from qgis.core import QgsApplication
    from qgis.PyQt.QtWidgets import QApplication
    app = QApplication([])
    QgsApplication.setPrefixPath("/usr", True)
    QgsApplication.initQgis()
    # Prepare processing framework
    from processing.core.Processing import Processing
    Processing.initialize()

#    import OTBSpecific_XMLcreation
#     try:
#         import processing
#     except ImportError, e:
#         raise Exception("Processing must be installed and available in PYTHONPATH")

    try:
        import otbApplication
    except ImportError as e:
Ejemplo n.º 10
0
    def run(self):
        """
        Start the library generation
        """

        patched_xml = ['S_01_081_0017', 'S_01_081_0018',
                       'S_14_145_0015', 'S_05_019_0001',
                       'L_19_006_0008', 'L_25_116_0001',
                       'S_11_042_0013', 'L_21_105_0002',
                       'L_21_107_0010', 'L_22_092_0003',
                       'L_22_092_0008', 'L_22_092_0009',
                       'L_22_092_0010', 'L_22_092_0011',
                       'L_22_092_0012', 'P_31_159_0002',
                       'S_01_081_0010', 'S_01_089_0016',
                       'S_05_017_0008', 'S_10_041_0004',
                       'S_13_046_0012', 'S_13_046_0018',
                       'S_14_048_0008', 'S_18_071_0001',
                       'P_28_157_0001', 'P_32_160_0001',
                       'P_33_161_0001']

        # Symbols for which it exists a manually modified svg
        patched_svg = ['P_26_120_0015', 'P_33_172_0001',
                       'P_26_122_0007', 'P_26_124_0004_1',
                       'L_20_099_0006', 'L_20_099_0007',
                       'L_20_099_0009', 'L_20_099_0011',
                       'P_28_157_0001', 'P_32_160_0001',
                       'P_33_161_0001']

        blobs = []
        style = QgsStyle()
        context = Context()
        context.units = QgsUnitTypes.RenderMillimeters
        context.relative_paths = True
        context.picture_folder = os.path.join(
            self.output_directory, 'svg')
        context.convert_fonts = True
        context.force_svg_instead_of_raster = True
        context.parameterise_svg = False
        context.embed_pictures = False

        a = QApplication([])

        for fn in os.listdir(self.bin_directory):
            file = os.path.join(self.bin_directory, fn)
            if os.path.isfile(file):
                blobs.append(file)
                symbol_name = os.path.splitext(fn)[0]

                with open(file, 'rb') as f:
                    context.symbol_name = symbol_name
                    symbol = read_symbol(f, debug=False)
                    qgis_symbol = Symbol_to_QgsSymbol(symbol, context)

                    if symbol_name in patched_xml:
                        xml_file = os.path.join(
                            self.patched_xml_directory,
                            symbol_name + '.xml')
                        style.importXml(xml_file)
                        print("Patch symbol {} with {}".format(
                            symbol_name, xml_file))
                        continue

                    style.addSymbol(symbol_name, qgis_symbol)

        style.exportXml(
            os.path.join(self.output_directory, 'libreria.xml'))

        for svg in patched_svg:
            svg_src = os.path.join(self.patched_svg_directory, svg + '.svg')
            svg_dest = os.path.join(
                self.output_directory, 'svg', svg + '.svg')

            copyfile(svg_src, svg_dest)
            print("Patch svg {} with {}".format(svg_dest, svg_src))