From 7936bfd317cd94cc0962fb8281737bb9313ed719 Mon Sep 17 00:00:00 2001 From: spertl Date: Fri, 3 May 2024 05:07:03 +0000 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Erster Upload --- GemeindeTools.py | 269 +++++++++++++++++++++++++++++++++++++++++++++++ __init__.py | 27 +++++ config.toml | 10 ++ plugin_upload.py | 111 +++++++++++++++++++ resources.py | 129 +++++++++++++++++++++++ 5 files changed, 546 insertions(+) create mode 100644 GemeindeTools.py create mode 100644 __init__.py create mode 100644 config.toml create mode 100644 plugin_upload.py create mode 100644 resources.py diff --git a/GemeindeTools.py b/GemeindeTools.py new file mode 100644 index 0000000..60e4aca --- /dev/null +++ b/GemeindeTools.py @@ -0,0 +1,269 @@ +# -*- coding: utf-8 -*- +""" +/*************************************************************************** + GemeindeMessdatenImport + A QGIS plugin + Importiert Messdaten im TXT-Format in die Gemeindeeigene Messdaten-Datenbank. + + + ------------------- + begin : 2024-02-01 + git sha : $Format:%H$ + copyright : (C) 2024 by Sebastian Pertl + email : sebastian.pertl@fridolfing.bayern.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 qgis.PyQt import uic +from qgis.PyQt import QtWidgets +from qgis.PyQt.QtWidgets import QFileDialog +from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication +from qgis.PyQt.QtGui import QIcon +from qgis.PyQt.QtWidgets import QAction, QComboBox, QLabel + +from qgis.core import QgsVectorLayer, QgsVectorFileWriter, QgsProviderRegistry + +from qgis.utils import iface + +# Initialize Qt resources from file resources.py +from .resources import * +# Import the code for the dialog +#from .gdeMessdatenImport_dialog import GemeindeMessdatenImportDialog + +import os +import os.path +import toml + + +class GemeindeTools: + """QGIS Plugin Implementation.""" + + 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 + # initialize plugin directory + self.plugin_dir = os.path.dirname(__file__) + + # Declare instance attributes + # Eintrag Menüband Oben + self.actions = [] + self.messdatenImportActions = [] + self.menu = u'&Gemeinde Tools-Menu' + + # Check if plugin was started the first time in current QGIS session + # Must be set in initGui() to survive plugin reloads + self.first_start = None + + with open(os.path.join(self.plugin_dir, 'config.toml'), 'r') as f: + self.config = toml.load(f) + + self.geschossNavi = '' + + def initGui(self): + """Create the menu entries and toolbar icons inside the QGIS GUI.""" + + self.messdatenImport = GemeindeMessdatenImport(self.config['database']['messdaten']) + + self.messdatenImportMenu = u"Gemeinde-Tools: Messdaten Import" + + self.toolBar1 = self.iface.addToolBar(self.messdatenImportMenu) + + icon_path = os.path.join(self.plugin_dir, 'icon/txt.png') + action = QAction(QIcon(icon_path), u'Import Messdaten', self.iface.mainWindow()) + action.triggered.connect(self.messdatenImport.run_import_txt) + self.toolBar1.addAction(action) + self.iface.addPluginToMenu(self.messdatenImportMenu, action) # Menüband oben + self.messdatenImportActions.append(action) + + icon_path = os.path.join(self.plugin_dir, 'icon/dupl.png') + action = QAction(QIcon(icon_path), u'Lösche Vorhandene', self.iface.mainWindow()) + action.triggered.connect(self.messdatenImport.run_del_dup) + self.toolBar1.addAction(action) + self.iface.addPluginToMenu(self.messdatenImportMenu, action) + self.messdatenImportActions.append(action) + + icon_path = os.path.join(self.plugin_dir, 'icon/db.png') + action = QAction(QIcon(icon_path), u'Gemeinde Übertrag', self.iface.mainWindow()) + action.triggered.connect(self.messdatenImport.run_save) + self.toolBar1.addAction(action) + self.iface.addPluginToMenu(self.messdatenImportMenu, action) + self.messdatenImportActions.append(action) + + + self.toolBar2 = self.iface.addToolBar("Gemeinde-Tools: Geschossnavigation") + + self.lab = QLabel(self.iface.mainWindow()) + self.lab.setText("Geschossauswahl: ") + self.toolBar2.addWidget(self.lab) + + self.act = QComboBox(self.iface.mainWindow()) + for k in self.config['geschossnavi']['ziele']: + self.act.addItem(self.config['geschossnavi']['ziele'][k]) + #self.act.currentTextChanged.connect(self.geschossNavi.run) + self.toolBar2.addWidget(self.act) + + + + self.first_start = True + + + def unload(self): + """Removes the plugin menu item and icon from QGIS GUI.""" + for action in self.messdatenImportActions: + self.iface.removePluginMenu(self.messdatenImportMenu, action) + self.iface.removeToolBarIcon(action) + + + + +class GemeindeMessdatenImport(): + def __init__(self, inp_file, parent=None): + """Constructor.""" + + self.inp_file = inp_file + + self.md = QgsProviderRegistry.instance().providerMetadata("ogr") + self.con = self.md.createConnection( self.inp_file, {}) + + + def run_import_txt(self): + + qfd = QFileDialog() + filename = QFileDialog.getOpenFileName(qfd, "Wähle Vermessungsdaten","::{645ff040-5081-101b-9f08-00aa002f954e}", '*.txt') + + csv = filename[0] + rutacsv = 'file:///' + csv + '?delimiter=,&xField=field_3&yField=field_2&useHeader=no' + tabla = QgsVectorLayer(rutacsv, os.path.basename(csv), 'delimitedtext') + + opt = QgsVectorFileWriter.SaveVectorOptions() + opt.EditionCapability = QgsVectorFileWriter.CanAddNewLayer + opt.layerName = "messdaten_imp" + opt.actionOnExistingFile = QgsVectorFileWriter.CreateOrOverwriteLayer + QgsVectorFileWriter.writeAsVectorFormat(tabla, self.inp_file, opt) + + # Datensätze bereinigen + query = """UPDATE messdaten_imp SET + field_6 = replace(field_6 ,"HSDV:",""), + field_7 = replace(field_7 ,"VSDV:",""), + field_8 = replace(field_8 ,"STATUS:",""), + field_9 = replace(field_9 ,"SATS:",""), + field_10 = replace(field_10,"AGE:",""), + field_11 = replace(field_11,"PDOP:",""), + field_12 = replace(field_12,"HDOP:",""), + field_13 = replace(field_13,"VDOP:",""), + field_14 = replace(field_14,"TDOP:",""), + field_15 = replace(field_15,"GDOP:",""), + field_16 = replace(field_16,"NSDV:",""), + field_17 = replace(field_17,"ESDV:",""), + field_18 = replace(field_18,"DATE:",""), + field_19 = replace(field_19,"TIME:","");""" + self.con.executeSql(query) + + ## Erzeuge Geometrie für Vorschau + #query = """UPDATE messdaten_imp SET geom = AsGPB(setsrid(makepoint(field_3, field_2), 25832));""" + #con.executeSql(query) + + # Datum formatieren + query = """UPDATE messdaten_imp SET field_18 = substr(field_18,7,4)||'-'||substr(field_18,1,2)||'-'||substr(field_18,4,2);""" + self.con.executeSql(query) + + iface.mapCanvas().refreshAllLayers() + + def run_del_dup(self): + # Duplikate löschen + query = """DELETE FROM messdaten_imp WHERE field_3 || field_2 || field_4 in (SELECT rw || hw || höhe FROM messdaten);""" + self.con.executeSql(query) + query = """DELETE FROM messdaten_imp WHERE field_1 in (SELECT Nummer FROM messdaten);""" + self.con.executeSql(query) + + iface.mapCanvas().refreshAllLayers() + + + def run_save(self): + + # Daten übertragen + query = """INSERT INTO + messdaten + ( + "fid", + "geom", + "Nummer", + "RW", + "HW", + "Höhe", + "Beschreibung", + "HSDV", + "VSDV", + "STATUS", + "SATS", + "AGE", + "PDOP", + "HDOP", + "VDOP", + "TDOP", + "GDOP", + "NSDV", + "ESDV", + "aufnahme_dat", + "aufnahme_uhr", + "import_dat", + "Anmerkung", + "Quelle" + ) + SELECT + NULL, + NULL, + field_1, + field_3, + field_2, + field_4, + field_5, + field_6 , + field_7 , + field_8 , + field_9 , + field_10, + field_11, + field_12, + field_13, + field_14, + field_15, + field_16, + field_17, --ESDV + field_18, + field_19, + DATE('now'), + '', + 'Vermessung Bauhof' + FROM messdaten_imp;""" + self.con.executeSql(query) + + query = """UPDATE messdaten SET geom = setsrid(makepoint(RW, HW), 25832) WHERE "import_dat" = DATE('now')""" + self.con.executeSql(query) + + # Anzahl der Objekte aktuallisieren + query = """DELETE FROM messdaten_imp WHERE field_1 in (SELECT Nummer FROM messdaten);""" + self.con.executeSql(query) + + # Import-Tabelle leeren + query = """DELETE FROM messdaten_imp;""" + self.con.executeSql(query) + + iface.mapCanvas().refreshAllLayers() + \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..041a610 --- /dev/null +++ b/__init__.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +""" +/*************************************************************************** + Gemeinde-Tools + A QGIS plugin + Importiert Messdaten + ------------------- + begin : 2024-02-01 + copyright : (C) 2024 by Sebastian Pertl + email : sebastian.pertl@fridolfing.bayern.de + git sha : $Format:%H$ + ***************************************************************************/ + + This script initializes the plugin, making it known to QGIS. +""" + + +# noinspection PyPep8Naming +def classFactory(iface): # pylint: disable=invalid-name + """Load GemeindeTools class from file GemeindeTools. + + :param iface: A QGIS interface instance. + :type iface: QgsInterface + """ + # + from .GemeindeTools import GemeindeTools + return GemeindeTools(iface) diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..0455177 --- /dev/null +++ b/config.toml @@ -0,0 +1,10 @@ + + + +[database] + +messdaten = "T:/RIWA-GIS/Layer/fridolfing.gpkg" + +[geschossnavi] + +ziele = { all = "Alle", 09_KG = "Kellergeschoss", 10_EG = "Erdgeschoss", 11_OG = "1. Obergeschoss", 12_OG = "2. Obergeschoss", 13_OG = "3. Obergeschoss"} \ No newline at end of file diff --git a/plugin_upload.py b/plugin_upload.py new file mode 100644 index 0000000..a88ea2b --- /dev/null +++ b/plugin_upload.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# coding=utf-8 +"""This script uploads a plugin package to the plugin repository. + Authors: A. Pasotti, V. Picavet + git sha : $TemplateVCSFormat +""" + +import sys +import getpass +import xmlrpc.client +from optparse import OptionParser + +standard_library.install_aliases() + +# Configuration +PROTOCOL = 'https' +SERVER = 'plugins.qgis.org' +PORT = '443' +ENDPOINT = '/plugins/RPC2/' +VERBOSE = False + + +def main(parameters, arguments): + """Main entry point. + + :param parameters: Command line parameters. + :param arguments: Command line arguments. + """ + address = "{protocol}://{username}:{password}@{server}:{port}{endpoint}".format( + protocol=PROTOCOL, + username=parameters.username, + password=parameters.password, + server=parameters.server, + port=parameters.port, + endpoint=ENDPOINT) + print("Connecting to: %s" % hide_password(address)) + + server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE) + + try: + with open(arguments[0], 'rb') as handle: + plugin_id, version_id = server.plugin.upload( + xmlrpc.client.Binary(handle.read())) + print("Plugin ID: %s" % plugin_id) + print("Version ID: %s" % version_id) + except xmlrpc.client.ProtocolError as err: + print("A protocol error occurred") + print("URL: %s" % hide_password(err.url, 0)) + print("HTTP/HTTPS headers: %s" % err.headers) + print("Error code: %d" % err.errcode) + print("Error message: %s" % err.errmsg) + except xmlrpc.client.Fault as err: + print("A fault occurred") + print("Fault code: %d" % err.faultCode) + print("Fault string: %s" % err.faultString) + + +def hide_password(url, start=6): + """Returns the http url with password part replaced with '*'. + + :param url: URL to upload the plugin to. + :type url: str + + :param start: Position of start of password. + :type start: int + """ + start_position = url.find(':', start) + 1 + end_position = url.find('@') + return "%s%s%s" % ( + url[:start_position], + '*' * (end_position - start_position), + url[end_position:]) + + +if __name__ == "__main__": + parser = OptionParser(usage="%prog [options] plugin.zip") + parser.add_option( + "-w", "--password", dest="password", + help="Password for plugin site", metavar="******") + parser.add_option( + "-u", "--username", dest="username", + help="Username of plugin site", metavar="user") + parser.add_option( + "-p", "--port", dest="port", + help="Server port to connect to", metavar="80") + parser.add_option( + "-s", "--server", dest="server", + help="Specify server name", metavar="plugins.qgis.org") + options, args = parser.parse_args() + if len(args) != 1: + print("Please specify zip file.\n") + parser.print_help() + sys.exit(1) + if not options.server: + options.server = SERVER + if not options.port: + options.port = PORT + if not options.username: + # interactive mode + username = getpass.getuser() + print("Please enter user name [%s] :" % username, end=' ') + + res = input() + if res != "": + options.username = res + else: + options.username = username + if not options.password: + # interactive mode + options.password = getpass.getpass() + main(options, args) diff --git a/resources.py b/resources.py new file mode 100644 index 0000000..65d7d9c --- /dev/null +++ b/resources.py @@ -0,0 +1,129 @@ +# -*- coding: utf-8 -*- + +# Resource object code +# +# Created by: The Resource Compiler for PyQt5 (Qt v5.15.2) +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore + +qt_resource_data = b"\ +\x00\x00\x04\x0a\ +\x89\ +\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ +\x00\x00\x17\x00\x00\x00\x18\x08\x06\x00\x00\x00\x11\x7c\x66\x75\ +\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\ +\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\ +\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\ +\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xd9\x02\x15\ +\x16\x11\x2c\x9d\x48\x83\xbb\x00\x00\x03\x8a\x49\x44\x41\x54\x48\ +\xc7\xad\x95\x4b\x68\x5c\x55\x18\xc7\x7f\xe7\xdc\x7b\x67\xe6\xce\ +\x4c\x66\x26\x49\xd3\x24\x26\xa6\xc6\xf8\x40\x21\xa5\x04\xb3\x28\ +\xda\x98\x20\xa5\x0b\xad\x55\xa8\x2b\xc5\x50\x1f\xa0\x6e\x34\x2b\ +\x45\x30\x14\x02\xba\x52\x69\x15\x17\x66\x63\x45\x97\x95\xa0\xad\ +\x0b\xfb\xc0\x06\x25\xb6\x71\x61\x12\x41\x50\xdb\x2a\x21\xd1\xe2\ +\x24\xf3\x9e\xc9\xcc\xbd\xe7\x1c\x17\x35\x43\x1e\x33\x21\xb6\xfd\ +\x56\x87\xf3\x9d\xfb\xfb\x1e\xf7\xff\x9d\x23\x8c\x31\x43\x95\xf4\ +\x85\x1e\x3f\x3b\x35\xac\xfd\xcc\x43\xdc\xa4\x49\x3b\xfe\x9d\x1d\ +\xdb\x7b\x22\x90\x78\xf8\xb2\x28\xa7\xbe\x7d\xc1\x4b\x9d\x79\xdf\ +\x18\x15\xe5\x16\x99\x10\x56\xde\x69\xdc\x3f\x22\xfd\xec\xd4\xf0\ +\xad\x04\x03\x18\xa3\xa2\x7e\x76\x6a\x58\xde\x68\x2b\xb4\x36\xf8\ +\xbe\xc6\x18\x53\xdb\xef\xe7\xfa\xec\xed\x67\x63\x10\x42\x00\xf0\ +\xfb\xd5\x65\x2a\x15\x45\xc7\x6d\x0d\x00\xc4\xa2\xc1\xaa\x6f\x0d\ +\x3e\x6c\xab\xc2\x1c\x56\xa4\x77\x4b\xb0\xf2\x35\x15\x5f\x21\x85\ +\xe0\xc8\x6b\x5f\x92\x2d\x37\x33\x39\xf9\x03\x27\x8e\x1f\xa2\xf7\ +\xbe\x9d\x04\x1c\x0b\x37\xe4\xac\xff\xa6\x30\x87\xbd\xba\x00\x6a\ +\x06\x79\xe5\xf5\xaf\x89\xd9\x92\xc5\xcc\x0a\xd9\x7c\x19\xcf\xe9\ +\xe2\xe4\xa9\x2f\x78\x7c\xff\x01\x72\x85\x0a\x2b\x65\x1f\xa5\x4c\ +\xb5\xb2\x55\x16\x80\xbd\x31\xda\xda\x20\x1f\x7d\x3e\xcd\xc2\xfd\ +\x59\xa6\x93\x39\x92\xd1\x22\xea\x9b\x16\xce\x9d\x3f\xce\xe0\x83\ +\x03\x24\x82\x59\x3a\xdb\x7b\x88\xc7\x82\x68\x63\x58\xc9\xcc\x62\ +\x8c\x21\x18\xb0\x6a\xc3\x37\x06\x49\x16\xff\x24\x6b\xa5\x49\xbb\ +\x25\xbc\xa2\xa6\x21\xbb\x40\x7f\xdf\x00\x83\xbd\x01\x8e\x3c\xd5\ +\x45\xd7\x8e\x6b\x9c\x9c\x98\x25\x1a\xb6\xe8\xbe\x3d\xc2\xdd\x77\ +\x44\x48\xc4\x1c\x22\xe1\xeb\x58\x59\xaf\xcf\xd3\x33\x29\x2e\x34\ +\x2d\x91\x93\x3e\xbe\x34\x78\x01\xc5\xe2\x61\xc5\xae\x72\x8e\x70\ +\xc8\xc2\x0d\x5a\xbc\xf5\xee\x2f\x9c\xfa\x3e\x86\x69\x7a\x8e\xcf\ +\x26\xe6\xf9\x63\xa1\x44\xa1\xa4\xd0\xda\x6c\x0d\x2f\x15\x7c\xb4\ +\x67\x28\x59\x0a\xcf\xd6\x54\xe2\x06\x13\x87\x2b\x6f\x68\xa6\x27\ +\xaf\x31\x32\x36\xc7\xb2\x7f\x17\xef\x7d\x7c\x8c\x33\x67\xcf\x12\ +\x70\x24\x4a\x69\xd6\x6a\x46\xd6\xd3\x70\x72\xa9\x82\x67\x34\x45\ +\xad\x28\xdb\x1a\x15\x34\x98\xff\x46\xed\xef\x37\x0d\x99\xbf\x4a\ +\x3c\x30\x38\xc0\xc8\x4b\xaf\x92\x5a\x9c\xe2\xe0\x23\x6d\x74\xb4\ +\xba\x84\x5d\x0b\x29\x45\x7d\xb8\x94\x82\x96\xb6\x10\xf3\xc5\x12\ +\x2a\xef\x53\x11\x1a\x63\xad\x3f\x93\x19\x85\xf1\xb1\x77\x58\x5a\ +\xf8\x99\x97\x9f\xe9\xa6\x75\x47\x90\xc6\xb8\x43\xd8\xb5\xb6\xce\ +\xfc\xfa\xfd\x00\xfb\x3e\xf4\xc8\x05\x35\xba\x5e\xeb\x46\x21\xf9\ +\xcf\x0a\xa9\x8c\x87\xe3\x48\xdc\x90\xb5\x6e\x98\x6a\xaa\x65\xf2\ +\x52\x92\x43\x2f\x5e\xc2\x8c\x02\x1a\x10\xf5\x07\xac\xc3\x75\x70\ +\x83\x92\x80\xb3\xf9\xd0\x26\xf8\x8f\xb3\x29\xc6\x3e\xb8\x8c\x19\ +\x35\x75\x6b\x7b\x7e\x3c\xca\x45\x0c\x7e\x49\x31\xf4\x58\x3b\xf7\ +\xf6\x34\x90\x88\x39\x04\x1c\x59\x1f\xfe\xdb\xd5\x3c\x5f\x9d\x4b\ +\x32\xfd\x44\xb2\xba\xd7\xfa\xb6\x60\xcf\xde\x16\xdc\x90\x45\x4c\ +\x4a\x2a\x9e\x62\xfe\x4e\xc5\xc8\xc1\x4e\xda\x76\x86\xe8\xe9\x0a\ +\xe3\xd8\x92\x58\xd4\xc6\xb2\x44\x6d\x78\x2a\x53\xe1\xca\x7c\x99\ +\x63\x5d\xbf\x56\x9d\xbd\x9f\x44\x18\x7a\xba\x95\x27\x0f\xb4\xd3\ +\xdc\x18\xc0\xf3\x0d\x52\x40\xd8\xb5\xb0\xa4\x20\x14\xb2\x70\x6c\ +\x81\x63\xcb\xaa\x42\xd6\xfd\xb7\xf4\xec\xa3\x06\xa0\x50\x52\xd8\ +\x4e\x1b\x7e\x4a\xd3\x31\xf9\x29\xcf\xfe\xd4\x49\x7f\x5f\x13\xfb\ +\xfa\x9b\x71\x43\x92\x58\xd4\x21\x18\x90\xac\xde\xb0\x42\x50\x13\ +\x58\x33\xf3\x88\x6b\xa1\xfd\x65\x96\xf2\x79\xc6\x43\x7b\xd8\x75\ +\x38\xcc\x3d\xdd\xd1\xaa\xcf\x71\xe4\xff\x7f\x91\x56\x33\xaf\xea\ +\x37\xe7\xa1\x94\x21\x16\xb5\xd1\x06\x2c\x29\x36\xf5\x72\x9b\x96\ +\x95\xc0\xc4\xda\x9d\x78\x83\x43\x53\x22\x80\x65\x09\x1c\xfb\x86\ +\xc1\x00\xe7\x25\x70\x14\x48\x6f\x1e\x22\x51\xe3\x75\xd9\xb6\xa5\ +\x81\xa3\x32\xb1\xfb\xf4\x0c\x30\xb8\xb1\x82\x9b\xb0\x09\x60\x30\ +\xb1\xfb\xf4\xcc\xbf\xa0\xe9\x6e\xae\x5a\xdf\x4b\x81\x00\x00\x00\ +\x00\x49\x45\x4e\x44\xae\x42\x60\x82\ +" + +qt_resource_name = b"\ +\x00\x07\ +\x07\x3b\xe0\xb3\ +\x00\x70\ +\x00\x6c\x00\x75\x00\x67\x00\x69\x00\x6e\x00\x73\ +\x00\x12\ +\x0c\xdb\xec\x14\ +\x00\x67\ +\x00\x64\x00\x65\x00\x4d\x00\x65\x00\x73\x00\x73\x00\x64\x00\x61\x00\x74\x00\x65\x00\x6e\x00\x49\x00\x6d\x00\x70\x00\x6f\x00\x72\ +\x00\x74\ +\x00\x08\ +\x0a\x61\x5a\xa7\ +\x00\x69\ +\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\ +" + +qt_resource_struct_v1 = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ +\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ +\x00\x00\x00\x3e\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +" + +qt_resource_struct_v2 = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x3e\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +\x00\x00\x01\x8d\x65\x49\xdd\xcd\ +" + +qt_version = [int(v) for v in QtCore.qVersion().split('.')] +if qt_version < [5, 8, 0]: + rcc_version = 1 + qt_resource_struct = qt_resource_struct_v1 +else: + rcc_version = 2 + qt_resource_struct = qt_resource_struct_v2 + +def qInitResources(): + QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources()