Skip to content

Commit

Permalink
Merge pull request #1 from remotesensinginfo/qgis3
Browse files Browse the repository at this point in the history
Implementation for QGIS3
  • Loading branch information
petebunting authored Jul 7, 2020
2 parents dbe64df + b6033e9 commit 833c3ac
Show file tree
Hide file tree
Showing 12 changed files with 185 additions and 144 deletions.
2 changes: 2 additions & 0 deletions ClassAccuracyMain/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
[general]
name=ClassAccuracy
qgisMinimumVersion=2.0
qgisMaximumVersion=3.99
description=Manually review the accuracy of a classification
version=0.1
author=Pete Bunting
[email protected]


# End of mandatory metadata

# Recommended items:
Expand Down
55 changes: 36 additions & 19 deletions ClassAccuracyMain/plugin_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
Authors: A. Pasotti, V. Picavet
git sha : $TemplateVCSFormat
"""
from __future__ import print_function

from future import standard_library
standard_library.install_aliases()
from builtins import input
import sys
import getpass
import xmlrpclib
import xmlrpc.client
from optparse import OptionParser

# Configuration
Expand All @@ -31,25 +35,36 @@ def main(parameters, arguments):
parameters.server,
parameters.port,
ENDPOINT)
print "Connecting to: %s" % hide_password(address)
# fix_print_with_import
print("Connecting to: %s" % hide_password(address))

server = xmlrpclib.ServerProxy(address, verbose=VERBOSE)
server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE)

try:
plugin_id, version_id = server.plugin.upload(
xmlrpclib.Binary(open(arguments[0]).read()))
print "Plugin ID: %s" % plugin_id
print "Version ID: %s" % version_id
except xmlrpclib.ProtocolError, 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 xmlrpclib.Fault, err:
print "A fault occurred"
print "Fault code: %d" % err.faultCode
print "Fault string: %s" % err.faultString
xmlrpc.client.Binary(open(arguments[0]).read()))
# fix_print_with_import
print("Plugin ID: %s" % plugin_id)
# fix_print_with_import
print("Version ID: %s" % version_id)
except xmlrpc.client.ProtocolError as err:
# fix_print_with_import
print("A protocol error occurred")
# fix_print_with_import
print("URL: %s" % hide_password(err.url, 0))
# fix_print_with_import
print("HTTP/HTTPS headers: %s" % err.headers)
# fix_print_with_import
print("Error code: %d" % err.errcode)
# fix_print_with_import
print("Error message: %s" % err.errmsg)
except xmlrpc.client.Fault as err:
# fix_print_with_import
print("A fault occurred")
# fix_print_with_import
print("Fault code: %d" % err.faultCode)
# fix_print_with_import
print("Fault string: %s" % err.faultString)


def hide_password(url, start=6):
Expand Down Expand Up @@ -85,7 +100,8 @@ def hide_password(url, start=6):
help="Specify server name", metavar="plugins.qgis.org")
options, args = parser.parse_args()
if len(args) != 1:
print "Please specify zip file.\n"
# fix_print_with_import
print("Please specify zip file.\n")
parser.print_help()
sys.exit(1)
if not options.server:
Expand All @@ -95,8 +111,9 @@ def hide_password(url, start=6):
if not options.username:
# interactive mode
username = getpass.getuser()
print "Please enter user name [%s] :" % username,
res = raw_input()
# fix_print_with_import
print("Please enter user name [%s] :" % username, end=' ')
res = input()
if res != "":
options.username = res
else:
Expand Down
11 changes: 5 additions & 6 deletions ClassAccuracyMain/resources_rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

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

from PyQt4 import QtCore
from PyQt5 import QtCore

qt_resource_data = "\
qt_resource_data = b"\
\x00\x00\x04\x96\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
Expand Down Expand Up @@ -88,7 +87,7 @@
\x44\xae\x42\x60\x82\
"

qt_resource_name = "\
qt_resource_name = b"\
\x00\x07\
\x07\x3b\xe0\xb3\
\x00\x70\
Expand All @@ -104,7 +103,7 @@
\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
"

qt_resource_struct = "\
qt_resource_struct = 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\
Expand Down
11 changes: 7 additions & 4 deletions ClassAccuracyMain/rsgisclassacc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
* *
***************************************************************************/
"""
from PyQt4.QtCore import QSettings, QTranslator, qVersion, QCoreApplication
from PyQt4.QtGui import QAction, QIcon
"""from PyQt4.QtCore import QSettings, QTranslator, qVersion, QCoreApplication
from PyQt4.QtGui import QAction, QIcon"""
from PyQt5.QtCore import QSettings, QTranslator, QVersionNumber, QCoreApplication, Qt, QObject, pyqtSignal
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QAction, QDialog, QFormLayout
# Initialize Qt resources from file resources.py
import resources_rc
from . import resources_rc
# Import the code for the dialog
from rsgisclassacc_dialog import ClassAccuracyMainDialog
from .rsgisclassacc_dialog import ClassAccuracyMainDialog
import os.path


Expand Down
Loading

0 comments on commit 833c3ac

Please sign in to comment.