Skip to content

Commit 833c3ac

Browse files
authored
Merge pull request #1 from remotesensinginfo/qgis3
Implementation for QGIS3
2 parents dbe64df + b6033e9 commit 833c3ac

12 files changed

+185
-144
lines changed

ClassAccuracyMain/metadata.txt

+2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
[general]
1010
name=ClassAccuracy
1111
qgisMinimumVersion=2.0
12+
qgisMaximumVersion=3.99
1213
description=Manually review the accuracy of a classification
1314
version=0.1
1415
author=Pete Bunting
1516
1617

18+
1719
# End of mandatory metadata
1820

1921
# Recommended items:

ClassAccuracyMain/plugin_upload.py

+36-19
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
Authors: A. Pasotti, V. Picavet
55
git sha : $TemplateVCSFormat
66
"""
7+
from __future__ import print_function
78

9+
from future import standard_library
10+
standard_library.install_aliases()
11+
from builtins import input
812
import sys
913
import getpass
10-
import xmlrpclib
14+
import xmlrpc.client
1115
from optparse import OptionParser
1216

1317
# Configuration
@@ -31,25 +35,36 @@ def main(parameters, arguments):
3135
parameters.server,
3236
parameters.port,
3337
ENDPOINT)
34-
print "Connecting to: %s" % hide_password(address)
38+
# fix_print_with_import
39+
print("Connecting to: %s" % hide_password(address))
3540

36-
server = xmlrpclib.ServerProxy(address, verbose=VERBOSE)
41+
server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE)
3742

3843
try:
3944
plugin_id, version_id = server.plugin.upload(
40-
xmlrpclib.Binary(open(arguments[0]).read()))
41-
print "Plugin ID: %s" % plugin_id
42-
print "Version ID: %s" % version_id
43-
except xmlrpclib.ProtocolError, err:
44-
print "A protocol error occurred"
45-
print "URL: %s" % hide_password(err.url, 0)
46-
print "HTTP/HTTPS headers: %s" % err.headers
47-
print "Error code: %d" % err.errcode
48-
print "Error message: %s" % err.errmsg
49-
except xmlrpclib.Fault, err:
50-
print "A fault occurred"
51-
print "Fault code: %d" % err.faultCode
52-
print "Fault string: %s" % err.faultString
45+
xmlrpc.client.Binary(open(arguments[0]).read()))
46+
# fix_print_with_import
47+
print("Plugin ID: %s" % plugin_id)
48+
# fix_print_with_import
49+
print("Version ID: %s" % version_id)
50+
except xmlrpc.client.ProtocolError as err:
51+
# fix_print_with_import
52+
print("A protocol error occurred")
53+
# fix_print_with_import
54+
print("URL: %s" % hide_password(err.url, 0))
55+
# fix_print_with_import
56+
print("HTTP/HTTPS headers: %s" % err.headers)
57+
# fix_print_with_import
58+
print("Error code: %d" % err.errcode)
59+
# fix_print_with_import
60+
print("Error message: %s" % err.errmsg)
61+
except xmlrpc.client.Fault as err:
62+
# fix_print_with_import
63+
print("A fault occurred")
64+
# fix_print_with_import
65+
print("Fault code: %d" % err.faultCode)
66+
# fix_print_with_import
67+
print("Fault string: %s" % err.faultString)
5368

5469

5570
def hide_password(url, start=6):
@@ -85,7 +100,8 @@ def hide_password(url, start=6):
85100
help="Specify server name", metavar="plugins.qgis.org")
86101
options, args = parser.parse_args()
87102
if len(args) != 1:
88-
print "Please specify zip file.\n"
103+
# fix_print_with_import
104+
print("Please specify zip file.\n")
89105
parser.print_help()
90106
sys.exit(1)
91107
if not options.server:
@@ -95,8 +111,9 @@ def hide_password(url, start=6):
95111
if not options.username:
96112
# interactive mode
97113
username = getpass.getuser()
98-
print "Please enter user name [%s] :" % username,
99-
res = raw_input()
114+
# fix_print_with_import
115+
print("Please enter user name [%s] :" % username, end=' ')
116+
res = input()
100117
if res != "":
101118
options.username = res
102119
else:

ClassAccuracyMain/resources_rc.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
# Resource object code
44
#
5-
# Created: Mon Aug 17 20:54:54 2015
6-
# by: The Resource Compiler for PyQt (Qt v4.8.6)
5+
# Created by: The Resource Compiler for PyQt5 (Qt v5.6.2)
76
#
87
# WARNING! All changes made in this file will be lost!
98

10-
from PyQt4 import QtCore
9+
from PyQt5 import QtCore
1110

12-
qt_resource_data = "\
11+
qt_resource_data = b"\
1312
\x00\x00\x04\x96\
1413
\x89\
1514
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
@@ -88,7 +87,7 @@
8887
\x44\xae\x42\x60\x82\
8988
"
9089

91-
qt_resource_name = "\
90+
qt_resource_name = b"\
9291
\x00\x07\
9392
\x07\x3b\xe0\xb3\
9493
\x00\x70\
@@ -104,7 +103,7 @@
104103
\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
105104
"
106105

107-
qt_resource_struct = "\
106+
qt_resource_struct = b"\
108107
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
109108
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
110109
\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\

ClassAccuracyMain/rsgisclassacc.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
* *
2121
***************************************************************************/
2222
"""
23-
from PyQt4.QtCore import QSettings, QTranslator, qVersion, QCoreApplication
24-
from PyQt4.QtGui import QAction, QIcon
23+
"""from PyQt4.QtCore import QSettings, QTranslator, qVersion, QCoreApplication
24+
from PyQt4.QtGui import QAction, QIcon"""
25+
from PyQt5.QtCore import QSettings, QTranslator, QVersionNumber, QCoreApplication, Qt, QObject, pyqtSignal
26+
from PyQt5.QtGui import QIcon
27+
from PyQt5.QtWidgets import QAction, QDialog, QFormLayout
2528
# Initialize Qt resources from file resources.py
26-
import resources_rc
29+
from . import resources_rc
2730
# Import the code for the dialog
28-
from rsgisclassacc_dialog import ClassAccuracyMainDialog
31+
from .rsgisclassacc_dialog import ClassAccuracyMainDialog
2932
import os.path
3033

3134

0 commit comments

Comments
 (0)