Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add qgis3 support #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 74 additions & 55 deletions EOxWCSClient/wcs_client.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
*********************************************************************************/
This script initializes the plugin, making it known to QGIS.
"""
from __future__ import absolute_import

def classFactory(iface):
# load QgsWcsClient2 class from file QgsWcsClient2
from qgswcsclient2 import QgsWcsClient2
from .qgswcsclient2 import QgsWcsClient2
return QgsWcsClient2(iface)
66 changes: 49 additions & 17 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*********************************************************************************/
configuration for the QgsWcsClient2 plugin
"""
from __future__ import print_function

# some global setttings
settings = {}
Expand Down Expand Up @@ -66,23 +67,54 @@ def read_srv_list():
# check if a insrvlst exists if not create a default one; this way we don't need to distribute a sepaerate file
# and an already existing 'config_srvlist.pkl' doesn't get overwritten during the installation
def chk_srvlist(insrvlst):
print 'Creating a default Server-list file'
f = open(insrvlst,'wb')
print >> f, "(dp0"
print >> f, "S'servers'"
print >> f, "p1"
print >> f, "(lp2"
print >> f, "(lp3"
print >> f, "VOGC: WCS 2.0/EO-WCS 1.0 - Reference Implemetation (EOxServer)"
print >> f, "p4"
print >> f, "aVhttp://ows.eox.at/cite/eoxserver/ows?"
print >> f, "p5"
print >> f, "aa(lp6"
print >> f, "VOGC: WCS 2.0 - Reference Implementation (MapServer)"
print >> f, "p7"
print >> f, "aVhttp://ows.eox.at/cite/mapserver/ows?"
print >> f, "p8"
print >> f, "aas.",
# fix_print_with_import
print('Creating a default Server-list file')
f = open(insrvlst,'w')
# fix_print_with_import
# fix_print_with_import
print("(dp0", file=f)
# fix_print_with_import
# fix_print_with_import
print("S'servers'", file=f)
# fix_print_with_import
# fix_print_with_import
print("p1", file=f)
# fix_print_with_import
# fix_print_with_import
print("(lp2", file=f)
# fix_print_with_import
# fix_print_with_import
print("(lp3", file=f)
# fix_print_with_import
# fix_print_with_import
print("VOGC: WCS 2.0/EO-WCS 1.0 - Reference Implemetation (EOxServer)", file=f)
# fix_print_with_import
# fix_print_with_import
print("p4", file=f)
# fix_print_with_import
# fix_print_with_import
print("aVhttp://ows.eox.at/cite/eoxserver/ows?", file=f)
# fix_print_with_import
# fix_print_with_import
print("p5", file=f)
# fix_print_with_import
# fix_print_with_import
print("aa(lp6", file=f)
# fix_print_with_import
# fix_print_with_import
print("VOGC: WCS 2.0 - Reference Implementation (MapServer)", file=f)
# fix_print_with_import
# fix_print_with_import
print("p7", file=f)
# fix_print_with_import
# fix_print_with_import
print("aVhttp://ows.eox.at/cite/mapserver/ows?", file=f)
# fix_print_with_import
# fix_print_with_import
print("p8", file=f)
# fix_print_with_import
# fix_print_with_import
print("aas.", end=' ', file=f)
f.close()


Expand Down
42 changes: 15 additions & 27 deletions display_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,33 @@

# Form implementation generated from reading ui file 'display_txt.ui'
#
# Created: Mon Apr 10 15:55:21 2017
# by: PyQt4 UI code generator 4.10.4
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING! All changes made in this file will be lost!
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.

from PyQt4 import QtCore, QtGui

try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
from PyQt5 import QtCore, QtGui, QtWidgets

try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)

class Ui_Dialog_Disp(object):
def setupUi(self, Dialog_Disp):
Dialog_Disp.setObjectName(_fromUtf8("Dialog_Disp"))
Dialog_Disp.setObjectName("Dialog_Disp")
Dialog_Disp.resize(721, 610)
self.gridLayout = QtGui.QGridLayout(Dialog_Disp)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.textBrowser_Disp = QtGui.QTextBrowser(Dialog_Disp)
self.textBrowser_Disp.setObjectName(_fromUtf8("textBrowser_Disp"))
self.gridLayout = QtWidgets.QGridLayout(Dialog_Disp)
self.gridLayout.setObjectName("gridLayout")
self.textBrowser_Disp = QtWidgets.QTextBrowser(Dialog_Disp)
self.textBrowser_Disp.setObjectName("textBrowser_Disp")
self.gridLayout.addWidget(self.textBrowser_Disp, 0, 0, 1, 1)
self.pushButton_DIsp_Done = QtGui.QPushButton(Dialog_Disp)
self.pushButton_DIsp_Done.setObjectName(_fromUtf8("pushButton_DIsp_Done"))
self.pushButton_DIsp_Done = QtWidgets.QPushButton(Dialog_Disp)
self.pushButton_DIsp_Done.setObjectName("pushButton_DIsp_Done")
self.gridLayout.addWidget(self.pushButton_DIsp_Done, 1, 0, 1, 1)

self.retranslateUi(Dialog_Disp)
QtCore.QObject.connect(self.pushButton_DIsp_Done, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog_Disp.close)
self.pushButton_DIsp_Done.clicked.connect(Dialog_Disp.close) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog_Disp)

def retranslateUi(self, Dialog_Disp):
Dialog_Disp.setWindowTitle(_translate("Dialog_Disp", "Dialog", None))
self.pushButton_DIsp_Done.setText(_translate("Dialog_Disp", "Done", None))

_translate = QtCore.QCoreApplication.translate
Dialog_Disp.setWindowTitle(_translate("Dialog_Disp", "Dialog"))
self.pushButton_DIsp_Done.setText(_translate("Dialog_Disp", "Done"))
16 changes: 9 additions & 7 deletions display_txtdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@
a popoup window to display the full-version of XML-Response messages and Error
as well as Error or other messages
"""
from __future__ import absolute_import

import os, pickle
#from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4 import QtCore, QtGui
from ui_qgswcsclient2 import Ui_QgsWcsClient2
#from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from qgis.PyQt import QtCore, QtGui
from .ui_qgswcsclient2 import Ui_QgsWcsClient2
# create the dialog for zoom to point
from display_txt import Ui_Dialog_Disp
from .display_txt import Ui_Dialog_Disp

#global setttings and saved server list
global config
import config
from . import config



Expand Down
13 changes: 9 additions & 4 deletions downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
*********************************************************************************/
A donwload tool utilizing the QNetworkAccessManager instance
"""
from __future__ import print_function

from PyQt4.QtCore import QCoreApplication, QFile, QUrl
from PyQt4.QtNetwork import QNetworkRequest, QNetworkReply
from builtins import str
from qgis.PyQt.QtCore import QCoreApplication, QFile, QUrl
from qgis.PyQt.QtNetwork import QNetworkRequest, QNetworkReply


def download_url(manager, url, output_path, progress_dialog=None):
Expand All @@ -65,8 +67,8 @@ def read_data():
xml_result.append(reply.readAll().data())

def read_data1():
xml_result1 = []
global xml_result1
xml_result1 = []
xml_result1.append(reply.readAll().data())
return xml_result1

Expand Down Expand Up @@ -126,6 +128,7 @@ def read_data1():
def progress_event(received, total):
QCoreApplication.processEvents()


progress_dialog.setLabelText("%s / %s" % (received, total))
progress_dialog.setMaximum(total)
progress_dialog.setValue(received)
Expand All @@ -146,7 +149,9 @@ def cancel_action():

if reply.attribute(QNetworkRequest.RedirectionTargetAttribute):
redir_url = reply.attribute(QNetworkRequest.RedirectionTargetAttribute).toString().split('?')[0]+'?'
print 'Redirection-Url:',redir_url, type(redir_url)
# fix_print_with_import
# fix_print_with_import
print('Redirection-Url:',redir_url, type(redir_url))
return True, None, 'Redirection-URL:\t'+redir_url

if result == QNetworkReply.NoError:
Expand Down
2 changes: 1 addition & 1 deletion help/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.todo', 'sphinx.ext.pngmath', 'sphinx.ext.viewcode']
extensions = ['sphinx.ext.todo', 'sphinx.ext.imgmath', 'sphinx.ext.viewcode']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
2 changes: 1 addition & 1 deletion metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

[general]
name = QgsWcsClient2
qgisMinimumVersion = 2.0
qgisMinimumVersion = 3.0
description = A OGC WCS 2.0/EO-WCS Client; a tool to download (and subset in space and time) a time-series of raster data.
version = version 0.3.2

Expand Down
65 changes: 46 additions & 19 deletions plugin_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
#
# Author: A. Pasotti, V. Picavet

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

Expand All @@ -17,24 +21,44 @@
def main(options, args):
address = "%s://%s:%s@%s:%s%s" % (PROTOCOL, options.username, options.password,
options.server, options.port, ENDPOINT)
print "Connecting to: %s" % hidepassword(address)
# fix_print_with_import
# fix_print_with_import
print("Connecting to: %s" % hidepassword(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(args[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" % hidepassword(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
plugin_id, version_id = server.plugin.upload(xmlrpc.client.Binary(open(args[0]).read()))
# fix_print_with_import
# fix_print_with_import
print("Plugin ID: %s" % plugin_id)
# fix_print_with_import
# 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
# fix_print_with_import
print("URL: %s" % hidepassword(err.url, 0))
# fix_print_with_import
# fix_print_with_import
print("HTTP/HTTPS headers: %s" % err.headers)
# fix_print_with_import
# fix_print_with_import
print("Error code: %d" % err.errcode)
# fix_print_with_import
# 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
# fix_print_with_import
print("Fault code: %d" % err.faultCode)
# fix_print_with_import
# fix_print_with_import
print("Fault string: %s" % err.faultString)

def hidepassword(url, start=6):
"""Returns the http url with password part replaced with '*'."""
Expand All @@ -55,7 +79,8 @@ def hidepassword(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 @@ -65,8 +90,10 @@ def hidepassword(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
# fix_print_with_import
print("Please enter user name [%s] :"%username, end=' ')
res = input()
if res != "":
options.username = res
else:
Expand Down
Loading