def __init__(self, iface=None): QDialog.__init__(self) self.iface = iface self.setupUi(self) self.setWindowTitle("QGIS WPS-Client " + version()) self.tabWidget.setCurrentIndex(0) # setup labels ver = version() dt = date() self.lblVersion.setText(self.tr("Version: %s" % ver)) self.lblDate.setText(self.tr("Date: %s" % dt)) # setup texts aboutString = "The goal of QgsWPS is to provide client to connect to any WPS-Server. " contribString = "<p><center><b>The following people contributed to QgsWPS:</b></center></p>" contribString += "<p>Horst Düster (Maintainer)<br>" contribString += "Pirmin Kalberer (Sextante Integration)<br>" contribString += "Germán Carrillo<br>" contribString += "Sören Gebbert<br>" contribString += "Eugeniy Nikulin<br>" contribString += "Marco Hugentobler<br>" contribString += "Luca Delucchi<br>" contribString += "Alexander Bruy (About GUI) <br>" contribString += "Robert Szczepanek (Icon) <br><br>" contribString += "<b>and special thanks to the QGIS team</b></p>" sponsorString = "<p><center><b>The following people or institutions funded QgsWPS:</b></center></p><br<br>" sponsorString += "Kanton Solothurn<br><br>" sponsorString += "Provincia di Terni - Ufficio Cave, Difesa del suolo, Protezione Civile e SIT <br>with the collaboration of Studio Associato GfosServices <br>" licenseString = "LICENSING INFORMATION:\n\n" licenseString += "QgsWPS Plugin is copyright (C) 2009 Dr. Horst Duester\n\n" licenseString += "[email protected]\n\n" licenseString += "QgsWPS-Plugin icon is copyright (C) 2009 Robert Szczepanek\n\n" licenseString += "[email protected]\n\n" licenseString += "Licensed under the terms of GNU GPL 2.\n\n" licenseString += "This program is free software; you can redistribute it and/or modify it under " licenseString += "the terms of the GNU General Public License as published by the Free " licenseString += "Software Foundation; either version 2 of the License, or (at your option) " licenseString += "any later version.\n" licenseString += "This code is distributed in the hope that it will be useful, but WITHOUT ANY " licenseString += "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS " licenseString += "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more " licenseString += "details.\n" licenseString += "A copy of the GNU General Public License is available on the World Wide Web " licenseString += "at http://www.gnu.org/copyleft/gpl.html. You can also obtain it by writing " licenseString += "to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, " licenseString += "MA 02111-1307, USA." # write texts self.memAbout.setText(self.tr(aboutString)) self.memContrib.setText(self.tr(contribString)) self.memSponsoring.setText(self.tr(sponsorString)) self.memAcknowl.setText(self.tr(licenseString))
def __init__(self, parent=None): """ Constructor """ QDialog.__init__(self, parent) self.setupUi(self) self.setWindowTitle('QGIS WPS-Client ' + version())
def helpAbout(self): # set the version source = ogr2layersinit.version() # set the dialog of about/help self.aboutDlg = OGR2LayersAboutDialog() # set the regular expression for found the version regexVers = QRegExp("Version ([\d]+\.[\d]+\.[\d]+)") if regexVers.indexIn(source) > -1: # set the version number version = regexVers.cap(1) # add version to the label self.aboutDlg.uiAbout.version_n.setText( QApplication.translate( "AboutDialog", '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "' 'http://www.w3.org/TR/REC-html40/strict.dtd">\n' "<html><head><meta " 'name="qrichtext" content="1" /><style type="text/css">\n' "p," " li { white-space: pre-wrap; }\n" '</style></head><body style=" ' "font-family:'Sans Serif'; font-size:9pt; font-weight:400; " 'font-style:normal;">\n' '<p style=" margin-top:0px; margin-bottom:' "0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; " 'text-indent:0px;"><span style=" font-size:12pt; font-weight:400;' '" align="center">' + version + "</span></p></body></html>", None, QApplication.UnicodeUTF8, ) ) # show dialog self.aboutDlg.show()
def about( self ): dlgAbout = QDialog() dlgAbout.setWindowTitle( QApplication.translate( "Reporter", "About Reporter" ) ) lines = QVBoxLayout( dlgAbout ) title = QLabel( QApplication.translate( "Reporter", "<b>Reporter</b>" ) ) title.setAlignment( Qt.AlignHCenter | Qt.AlignVCenter ) lines.addWidget( title ) ver = QLabel( QApplication.translate( "Reporter", "Version: %1" ).arg( version() ) ) ver.setAlignment( Qt.AlignHCenter | Qt.AlignVCenter ) lines.addWidget( ver ) lines.addWidget( QLabel( QApplication.translate( "Reporter", "Generates reports." ) ) ) lines.addWidget( QLabel( QApplication.translate( "Reporter", "<b>Developers:</b>" ) ) ) lines.addWidget( QLabel( " NextGIS, http://nextgis.org" ) ) lines.addWidget( QLabel( QApplication.translate( "Reporter", "<b>Homepage:</b>") ) ) overrideLocale = QSettings().value( "locale/overrideFlag", QVariant( False ) ).toBool() if not overrideLocale: localeFullName = QLocale.system().name() else: localeFullName = QSettings().value( "locale/userLocale", QVariant( "" ) ).toString() localeShortName = localeFullName[ 0:2 ] #if localeShortName in [ "ru", "uk" ]: link = QLabel( "<a href=\"http://gis-lab.info/qa/reporter.html\">http://gis-lab.info/qa/reporter.html</a>" ) #else: # link = QLabel( "<a href=\"http://gis-lab.info/qa/reporter-eng.html\">http://gis-lab.info/qa/reporter-eng.html</a>" ) link.setOpenExternalLinks( True ) lines.addWidget( link ) btnClose = QPushButton( QApplication.translate( "Reporter", "Close" ) ) lines.addWidget( btnClose ) QObject.connect( btnClose, SIGNAL( "clicked()" ), dlgAbout, SLOT( "close()" ) ) dlgAbout.exec_()
def __init__(self, fl, parent=None): """ Constructor """ QDialog.__init__(self, parent, fl) self.setupUi(self) self.setWindowTitle('QGIS WPS-Client ' + version()) self.initTreeWPSServices()
def __init__(self): """ Set up the user interface from Designer. """ QTextEdit.__init__(self) self.setPlainText("Script Runner %s\n" % plugin_metatdata.version()) # cursor for the StdoutTextEdit self.cursor = QTextCursor(self.textCursor()) self.setTextCursor(self.cursor)
def serve_rpc_request(request): ''' This method handles rpc calls based on the content type of the request ''' if request.method == "POST" and len(request.POST) > 0: # Handle POST request with RPC payload if LOG_REQUESTS_RESPONSES: logging.debug('Incoming request: %s' %str(request.raw_post_data)) if _is_xmlrpc_request(request): if RESTRICT_XML: raise Http404 if not _check_request_permission(request, 'xml'): return HttpResponseForbidden() resp = dispatcher.xmldispatch(request.raw_post_data) response_type = 'text/xml' else: if RESTRICT_JSON: raise Http404 if not _check_request_permission(request, 'json'): return HttpResponseForbidden() resp = dispatcher.jsondispatch(request.raw_post_data) response_type = 'application/json' if LOG_REQUESTS_RESPONSES: logging.debug('Outgoing %s response: %s' %(response_type, resp)) return HttpResponse(resp, response_type) else: # Handle GET request if RESTRICT_METHOD_SUMMARY: # hide the documentation by raising 404 raise Http404 # show documentation methods = dispatcher.list_methods() template_data = { 'methods': methods, 'url': URL, # rpc4django version 'version': version(), # restricts the ability to test the rpc server from the docs 'restrict_rpctest': RESTRICT_RPCTEST, } return render_to_response('rpc4django/rpcmethod_summary.html', \ template_data)
def __init__(self): QDialog.__init__(self) self.setupUi(self) self.btnHelp = self.buttonBox.button(QDialogButtonBox.Help) self.lblLogo.setPixmap(QPixmap(":/icons/molusce.png")) self.lblVersion.setText(self.tr("Version: %1").arg(version())) doc = QTextDocument() doc.setHtml(self.getAboutText()) self.textBrowser.setDocument(doc) self.buttonBox.helpRequested.connect(self.openHelp)
def about(self): dlgAbout = QDialog() dlgAbout.setWindowTitle(QApplication.translate("ShiftPoints", "About Shift Points", "Window title")) lines = QVBoxLayout(dlgAbout) title = QLabel(QApplication.translate("ShiftPoints", "<b>Shift Points</b>")) title.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) lines.addWidget(title) ver = QLabel(QApplication.translate("ShiftPoints", "Version: %1").arg(version())) ver.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) lines.addWidget(ver) lines.addWidget(QLabel(QApplication.translate("ShiftPoints", "Moves overlapped points with same\ncoordinates in a circle around the\noriginal position."))) lines.addWidget(QLabel(QApplication.translate("ShiftPoints", "<b>Developers:</b>"))) lines.addWidget(QLabel(" Alexander Bruy")) lines.addWidget(QLabel(QApplication.translate("ShiftPoints", "<b>Homepage:</b>"))) overrideLocale = QSettings().value("locale/overrideFlag", QVariant(False)).toBool() if not overrideLocale: localeFullName = QLocale.system().name() else: localeFullName = QSettings().value("locale/userLocale", QVariant("")).toString() localeShortName = localeFullName[0:2] if localeShortName in ["ru", "uk"]: link = QLabel("<a href=\"http://gis-lab.info/qa/point-displacement.html\">http://gis-lab.info/qa/point-displacement.html</a>") else: link = QLabel("<a href=\"http://gis-lab.info/qa/point-displacement-eng.html\">http://gis-lab.info/qa/point-displacement-eng.html</a>") link.setOpenExternalLinks(True) lines.addWidget(link) lines.addWidget(QLabel(QApplication.translate("ShiftPoints", "<b>Report bugs at:</b>"))) linkBugs = QLabel("<a href=\"http://hub.qgis.org/projects/shiftpoints\">http://hub.qgis.org/projects/shiftpoints</a>") linkBugs.setOpenExternalLinks(True) lines.addWidget(linkBugs) btnClose = QPushButton(QApplication.translate("ShiftPoints", "Close")) lines.addWidget(btnClose) QObject.connect(btnClose, SIGNAL("clicked()"), dlgAbout, SLOT("close()")) dlgAbout.exec_()
def about( self ): dlgAbout = QDialog() dlgAbout.setWindowTitle( QApplication.translate( "CSW Client", "About CSW Client", "Window title" ) ) lines = QVBoxLayout( dlgAbout ) title = QLabel( QApplication.translate( "CSW Client", "<b>CSW Client</b>" ) ) title.setAlignment( Qt.AlignHCenter | Qt.AlignVCenter ) lines.addWidget( title ) version = QLabel( QApplication.translate( "CSW Client", "Version: %1" ).arg( version() ) ) version.setAlignment( Qt.AlignHCenter | Qt.AlignVCenter ) lines.addWidget( version ) lines.addWidget( QLabel( QApplication.translate( "CSW Client", "Catalogue Services browser. Provide\ninterface for discovering and retrieval\nof spatial data and services metadata." ) ) ) lines.addWidget( QLabel( QApplication.translate( "CSW Client", "<b>Developers:</b>" ) ) ) lines.addWidget( QLabel( " <a href=\"http://nextgis.ru\">NextGIS</a>" ) ) lines.addWidget( QLabel( " Alexander Bruy" ) ) lines.addWidget( QLabel( " Maxim Dubinin" ) ) lines.addWidget( QLabel( QApplication.translate( "CSW Client", "<b>Homepage:</b>") ) ) overrideLocale = QSettings().value( "locale/overrideFlag", QVariant( False ) ).toBool() if not overrideLocale: localeFullName = QLocale.system().name() else: localeFullName = QSettings().value( "locale/userLocale", QVariant( "" ) ).toString() localeShortName = localeFullName[ 0:2 ] if localeShortName in [ "ru", "uk" ]: link = QLabel( "<a href=\"http://gis-lab.info/qa/cswclient.html\">http://gis-lab.info/qa/cswclient.html</a>" ) else: link = QLabel( "<a href=\"http://gis-lab.info/qa/cswclient-eng.html\">http://gis-lab.info/qa/cswclient-eng.html</a>" ) link.setOpenExternalLinks( True ) lines.addWidget( link ) btnClose = QPushButton( QApplication.translate( "CSW Client", "Close" ) ) lines.addWidget( btnClose ) QObject.connect( btnClose, SIGNAL( "clicked()" ), dlgAbout, SLOT( "close()" ) ) dlgAbout.exec_()
def helpAbout(self): #set the version source = ogr2layersinit.version() #set the dialog of about/help self.aboutDlg = OGR2LayersAboutDialog() #set the regular expression for found the version regexVers = QRegExp('Version ([\d]+\.[\d]+\.[\d]+)') if regexVers.indexIn(source) > -1: #set the version number version = regexVers.cap(1) #add version to the label self.aboutDlg.uiAbout.version_n.setText(QApplication.translate( "AboutDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \""\ "http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta "\ "name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p,"\ " li { white-space: pre-wrap; }\n" "</style></head><body style=\" "\ "font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; "\ "font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:"\ "0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; "\ "text-indent:0px;\"><span style=\" font-size:12pt; font-weight:400;" \ "\" align=\"center\">" + version + "</span></p></body></html>", None, QApplication.UnicodeUTF8)) #show dialog self.aboutDlg.show()
def __init__(self, iface): """ Constructor """ QDockWidget.__init__(self, iface.mainWindow()) self.setupUi(self) self.iface = iface self.tools = QgsWpsTools(self.iface) self.doc = QtXml.QDomDocument() self.tmpPath = QDir.tempPath() self.uploadFinished = False self.status = '' self.btnKill.setEnabled(False) self.btnConnect.setEnabled(True) self.dataStream = None # Used for streaming self.setWindowTitle('QGIS WPS-Client '+version()) self.defaultServers = {'Kappasys WPS':'http://www.kappasys.ch/pywps/pywps.cgi', 'geodati.fmach.it':'http://geodati.fmach.it/zoo/', 'zoo project':'http://zoo-project.org/wps-foss4g2011/zoo_loader.cgi', 'zoo project grass':'http://zoo-project.org/cgi-grass/zoo_loader.cgi', '52 North':'http://geoprocessing.demo.52north.org:8080/wps/WebProcessingService' } flags = Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint # QgisGui.ModalDialogFlags self.dlg = QgsWpsGui(self.iface.mainWindow(), flags) self.dlg.getDescription.connect( self.getDescription ) self.dlg.newServer.connect( self.newServer ) self.dlg.editServer.connect( self.editServer ) self.dlg.deleteServer.connect( self.deleteServer ) self.dlg.connectServer.connect( self.cleanGui ) self.dlg.addDefaultServer.connect( self.addDefaultServer ) self.dlg.requestDescribeProcess.connect( self.requestDescribeProcess ) QObject.connect(self.dlg, SIGNAL("bookmarksChanged()"), self, SIGNAL("bookmarksChanged()")) self.killed.connect(self.stopStreaming)
def __init__(self, parent, fl): QDialog.__init__(self, parent, fl) self.setupUi(self) self.fl = fl self.setWindowTitle('QGIS WPS-Client ' + version()) self.dlgAbout = DlgAbout(parent)
def __init__(self, parent, fl): QDialog.__init__(self, parent, fl) self.setupUi(self) self.setWindowTitle('QGIS WPS-Client ' + version()) self.selectedServiceName = parent.cmbConnections.currentText()
def serve_rpc_request(request): ''' Handles rpc calls based on the content type of the request or returns the method documentation page if the request was a GET. **Parameters** ``request`` the Django HttpRequest object ''' if request.method == "POST" and request.META.get('CONTENT_LENGTH', 0) > 0: # Handle POST request with RPC payload if LOG_REQUESTS_RESPONSES: logger.debug('Incoming request: %s' %str(request.body)) if is_xmlrpc_request(request): if RESTRICT_XML: raise Http404 if not check_request_permission(request, 'xml'): return HttpResponseForbidden() resp = dispatcher.xmldispatch(request.body, \ request=request) response_type = 'text/xml' else: if RESTRICT_JSON: raise Http404 if not check_request_permission(request, 'json'): return HttpResponseForbidden() resp = dispatcher.jsondispatch(request.body, \ request=request) response_type = 'application/json' if LOG_REQUESTS_RESPONSES: logger.debug('Outgoing %s response: %s' %(response_type, resp)) return HttpResponse(resp, response_type) elif request.method == 'OPTIONS': # Handle OPTIONS request for "preflighted" requests # see https://developer.mozilla.org/en/HTTP_access_control response = HttpResponse('', 'text/plain') origin = request.META.get('HTTP_ORIGIN', 'unknown origin') response['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' response['Access-Control-Max-Age'] = 0 response['Access-Control-Allow-Credentials'] = \ str(HTTP_ACCESS_CREDENTIALS).lower() response['Access-Control-Allow-Origin']= HTTP_ACCESS_ALLOW_ORIGIN response['Access-Control-Allow-Headers'] = \ request.META.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS', '') if LOG_REQUESTS_RESPONSES: logger.debug('Outgoing HTTP access response to: %s' %(origin)) return response else: # Handle GET request if RESTRICT_METHOD_SUMMARY: # hide the documentation by raising 404 raise Http404 # show documentation methods = dispatcher.list_methods() template_data = { 'methods': methods, 'url': URL, # rpc4django version 'version': version(), # restricts the ability to test the rpc server from the docs 'restrict_rpctest': RESTRICT_RPCTEST, } from django.template import RequestContext return render_to_response('rpc4django/rpcmethod_summary.html', template_data, context_instance=RequestContext(request))
def about(self): dlgAbout = QDialog() dlgAbout.setWindowTitle( QApplication.translate("ShiftPoints", "About Shift Points", "Window title")) lines = QVBoxLayout(dlgAbout) title = QLabel( QApplication.translate("ShiftPoints", "<b>Shift Points</b>")) title.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) lines.addWidget(title) ver = QLabel( QApplication.translate("ShiftPoints", "Version: %1").arg(version())) ver.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) lines.addWidget(ver) lines.addWidget( QLabel( QApplication.translate( "ShiftPoints", "Moves overlapped points with same\ncoordinates in a circle around the\noriginal position." ))) lines.addWidget( QLabel(QApplication.translate("ShiftPoints", "<b>Developers:</b>"))) lines.addWidget(QLabel(" Alexander Bruy")) lines.addWidget( QLabel(QApplication.translate("ShiftPoints", "<b>Homepage:</b>"))) overrideLocale = QSettings().value("locale/overrideFlag", QVariant(False)).toBool() if not overrideLocale: localeFullName = QLocale.system().name() else: localeFullName = QSettings().value("locale/userLocale", QVariant("")).toString() localeShortName = localeFullName[0:2] if localeShortName in ["ru", "uk"]: link = QLabel( "<a href=\"http://gis-lab.info/qa/point-displacement.html\">http://gis-lab.info/qa/point-displacement.html</a>" ) else: link = QLabel( "<a href=\"http://gis-lab.info/qa/point-displacement-eng.html\">http://gis-lab.info/qa/point-displacement-eng.html</a>" ) link.setOpenExternalLinks(True) lines.addWidget(link) lines.addWidget( QLabel( QApplication.translate("ShiftPoints", "<b>Report bugs at:</b>"))) linkBugs = QLabel( "<a href=\"http://hub.qgis.org/projects/shiftpoints\">http://hub.qgis.org/projects/shiftpoints</a>" ) linkBugs.setOpenExternalLinks(True) lines.addWidget(linkBugs) btnClose = QPushButton(QApplication.translate("ShiftPoints", "Close")) lines.addWidget(btnClose) QObject.connect(btnClose, SIGNAL("clicked()"), dlgAbout, SLOT("close()")) dlgAbout.exec_()
def serve_rpc_request(request): """ This method handles rpc calls based on the content type of the request """ if request.method == "POST" and len(request.POST) > 0: # Handle POST request with RPC payload if LOG_REQUESTS_RESPONSES: logging.debug("Incoming request: %s" % str(request.raw_post_data)) if _is_xmlrpc_request(request): if RESTRICT_XML: raise Http404 if not _check_request_permission(request, "xml"): return HttpResponseForbidden() resp = dispatcher.xmldispatch(request.raw_post_data, request=request) response_type = "text/xml" else: if RESTRICT_JSON: raise Http404 if not _check_request_permission(request, "json"): return HttpResponseForbidden() resp = dispatcher.jsondispatch(request.raw_post_data, request=request) response_type = "application/json" if LOG_REQUESTS_RESPONSES: logging.debug("Outgoing %s response: %s" % (response_type, resp)) return HttpResponse(resp, response_type) elif request.method == "OPTIONS": # Handle OPTIONS request for "preflighted" requests # see https://developer.mozilla.org/en/HTTP_access_control response = HttpResponse("", "text/plain") origin = request.META.get("HTTP_ORIGIN", "unknown origin") response["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS" response["Access-Control-Max-Age"] = 0 response["Access-Control-Allow-Credentials"] = str(HTTP_ACCESS_CREDENTIALS).lower() response["Access-Control-Allow-Origin"] = HTTP_ACCESS_ALLOW_ORIGIN response["Access-Control-Allow-Headers"] = request.META.get("HTTP_ACCESS_CONTROL_REQUEST_HEADERS", "") if LOG_REQUESTS_RESPONSES: logging.debug("Outgoing HTTP access response to: %s" % (origin)) return response else: # Handle GET request if RESTRICT_METHOD_SUMMARY: # hide the documentation by raising 404 raise Http404 # show documentation methods = dispatcher.list_methods() template_data = { "methods": methods, "url": URL, # rpc4django version "version": version(), # restricts the ability to test the rpc server from the docs "restrict_rpctest": RESTRICT_RPCTEST, } return render_to_response("rpc4django/rpcmethod_summary.html", template_data)
def serve_rpc_request(request): ''' Handles rpc calls based on the content type of the request or returns the method documentation page if the request was a GET. **Parameters** ``request`` the Django HttpRequest object ''' if request.method == "POST": # Handle POST request with RPC payload if LOG_REQUESTS_RESPONSES: logger.debug('Incoming request: %s' %str(request.raw_post_data)) # From now on only JSON protocol = dispatcher.jsonrpcdispatcher response_type = 'application/json' try: if response_type not in request.META.get('CONTENT_TYPE'): raise BadDataException('Use %s content type' % response_type) dispatcher.check_request_permission(request) response = protocol.dispatch(request.raw_post_data, request=request) except RpcException as e: if settings.DEBUG: traceback.print_exc() response = protocol.encode_error(e) except Exception as e: traceback.print_exc() response = protocol.encode_error(UnknownProcessingError('%s: %s' % (e.__class__.__name__, e.message))) return HttpResponse(response, response_type) elif request.method == 'OPTIONS': # Handle OPTIONS request for "preflighted" requests # see https://developer.mozilla.org/en/HTTP_access_control response = HttpResponse('', 'text/plain') origin = request.META.get('HTTP_ORIGIN', 'unknown origin') response['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' response['Access-Control-Max-Age'] = 0 response['Access-Control-Allow-Credentials'] = str(HTTP_ACCESS_CREDENTIALS).lower() response['Access-Control-Allow-Origin']= HTTP_ACCESS_ALLOW_ORIGIN response['Access-Control-Allow-Headers'] = request.META.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS', '') if LOG_REQUESTS_RESPONSES: logger.debug('Outgoing HTTP access response to: %s' %(origin)) return response else: # Handle GET request if RESTRICT_METHOD_SUMMARY: # hide the documentation by raising 404 raise Http404 # show documentation methods = dispatcher.list_methods() template_data = { 'methods': methods, 'url': URL, # rpc4django version 'version': version(), # restricts the ability to test the rpc server from the docs 'restrict_rpctest': RESTRICT_RPCTEST, } return render_to_response('rpc4django/rpcmethod_summary.html', template_data)
def test(): # index conversion print('index:', coda.c_index_to_fortran_index([4, 10], 9)) # NaN, Inf print(coda.NaN(), coda.MinInf(), coda.PlusInf()) print(coda.isNaN(0), coda.isNaN(coda.NaN())) print(coda.isInf(0), coda.isInf(coda.PlusInf()), coda.isInf(coda.MinInf())) print(coda.isMinInf(0), coda.isMinInf(coda.MinInf()), coda.isMinInf(coda.PlusInf())) print(coda.isPlusInf(0), coda.isPlusInf(coda.PlusInf()), coda.isPlusInf(coda.MinInf())) # open product what = coda.recognize_file('madis-raob.nc') print('what:', what) product = coda.open('madis-raob.nc') print('class', coda.get_product_class(product)) print('type', coda.get_product_type(product)) print('version', coda.get_product_version(product)) print('deffile', coda.get_product_definition_file(product)) print('file size', coda.get_product_file_size(product)) print('filename', coda.get_product_filename(product)) print('format', coda.get_product_format(product)) print('root type', coda.type_get_class(coda.get_product_root_type(product))) # fetch array array = coda.fetch(product, 'tpTropQCD') print(array) # fetch scalar scalar = coda.fetch(product, 'globalInventory') print(scalar) # read scalar int32 cursor = coda.Cursor() coda.cursor_set_product(cursor, product) print('cursor has attrs', coda.cursor_has_attributes(cursor)) type_ = coda.cursor_get_type(cursor) print('type has attrs', coda.type_has_attributes(type_)) a = coda.type_get_attributes(type_) print('attrs type name', coda.type_get_class_name(coda.type_get_class(a))) coda.cursor_goto(cursor, 'globalInventory') gi = coda.cursor_read_int32(cursor) print('globalInventory:', gi) try: coda.cursor_read_uint16(cursor) except coda.CodacError as e: print(str(e)) coda.cursor_goto_root(cursor) expr = coda.expression_from_string('2 * int(./globalInventory)') print('expr:', coda.expression_eval_integer(expr, cursor)) coda.expression_delete(expr) # read double array coda.cursor_goto_root(cursor) type_ = coda.cursor_get_type(cursor) cl = coda.cursor_get_type_class(cursor) print('cl', cl) print('num recs:', coda.type_get_num_record_fields(type_)) print('nt name:', coda.type_get_native_type_name(coda.type_get_read_type(type_))) print('0 hidden:', coda.type_get_record_field_hidden_status(type_, 0)) print('0 available:', coda.type_get_record_field_available_status(type_, 0)) print('field type:', coda.type_get_class(coda.type_get_record_field_type(type_, 0))) print('field name:', coda.type_get_record_field_name(type_, 0)) print('field realname:', coda.type_get_record_field_real_name(type_, 0)) print('index:', coda.type_get_record_field_index_from_name(type_, 'nStaticIds')) print('index:', coda.cursor_get_record_field_index_from_name(cursor, 'nStaticIds')) print('indexreal:', coda.type_get_record_field_index_from_real_name(type_, 'nStaticIds')) print('has attributes:', coda.type_has_attributes(type_)) print('unit:', coda.type_get_unit(type_)) print('union status:', coda.type_get_record_union_status(type_)) print('union av i:', coda.cursor_get_available_union_field_index(cursor)) print('product file', coda.get_product_filename(coda.cursor_get_product_file(cursor))) coda.cursor_goto_root(cursor) coda.cursor_goto_record_field_by_index(cursor, 0) coda.cursor_goto_root(cursor) coda.cursor_goto_record_field_by_name(cursor, 'nStaticIds') coda.cursor_goto_root(cursor) coda.cursor_goto(cursor, 'tpTropQCD') coda.cursor_goto_parent(cursor) coda.cursor_goto(cursor, 'tpTropQCD') shape = coda.cursor_get_array_dim(cursor) print('shape:', shape) type_ = coda.cursor_get_type(cursor) print('numdims:', coda.type_get_array_num_dims(type_)) print('dims:', coda.type_get_array_dim(type_)) #print('attrs:', coda.type_get_attributes(type_)) print('bitsize:', coda.type_get_bit_size(type_)) print('class:', coda.type_get_class_name(coda.type_get_class(type_))) print('fixed:', coda.type_get_fixed_value(type_)) print('format:', coda.type_get_format(type_)) print('formatname:', coda.type_get_format_name(coda.type_get_format(type_))) print('name:', coda.type_get_name(type_)) array = coda.cursor_read_double_array(cursor) print(array) #get specific element coda.cursor_goto_array_element(cursor, [0, 1, 7]) print(coda.cursor_read_double(cursor)) # read string coda.cursor_goto_root(cursor) coda.cursor_goto(cursor, 'staName') type_ = coda.cursor_get_type(cursor) print(coda.type_get_name(type_)) print('dims:', coda.type_get_array_dim(type_)) coda.cursor_goto_first_array_element(cursor) print(coda.cursor_get_string_length(cursor)) print(repr(coda.cursor_read_string(cursor))) # read double partial array coda.cursor_goto_root(cursor) coda.cursor_goto(cursor, 'tpTropQCD') array = coda.cursor_read_double_partial_array(cursor, 10, 22) print(array.shape) print(array) try: coda.cursor_goto_available_union_field(cursor) except coda.CodacError as e: print(str(e)) # exceptions coda.cursor_goto_root(cursor) try: coda.cursor_goto(cursor, 'zzz') except coda.CodacError as e: print(str(e)) try: coda.cursor_read_int32(cursor) except coda.CodacError as e: print(str(e)) try: coda.open('pipo') except coda.CodacError as e: print(str(e)) # version print(coda.version()) # node expr coda.cursor_goto_root(cursor) print('root depth:', coda.cursor_get_depth(cursor)) expr = coda.expression_from_string('/globalInventory') coda.expression_eval_node(expr, cursor) print('expr depth:', coda.cursor_get_depth(cursor)) coda.expression_delete(expr) # product class etc what = coda.recognize_file( 'AE_TEST_ALD_U_N_1B_20190105T011602023_008364010_002143_0001.DBL') print('what:', what) # close coda.close(product) product = coda.open_as( 'AE_TEST_ALD_U_N_1B_20190105T011602023_008364010_002143_0001.DBL', 'AEOLUS', 'ALD_U_N_1B', 9) print('class', coda.get_product_class(product)) print('type', coda.get_product_type(product)) print('version', coda.get_product_version(product)) print('description', coda.get_description(product)) print('attrs', coda.get_attributes(product)) try: coda.get_product_variable_value(product, 'geolocation', 0) except coda.CodacError as e: print(str(e)) # product/cursor methods cursor = coda.Cursor() coda.cursor_set_product(cursor, product) print('description', coda.get_description(product)) print('description', coda.get_description(cursor)) coda.cursor_goto(cursor, 'geolocation') coda.cursor_goto_array_element_by_index(cursor, 0) coda.cursor_goto(cursor, 'start_of_observation_time') type_ = coda.cursor_get_type(cursor) print('T', coda.type_get_special_type(type_)) print('N', coda.type_get_special_type_name(2)) print( 'B', coda.type_get_native_type_name( coda.type_get_read_type(coda.type_get_special_base_type(type_)))) coda.cursor_use_base_type_of_special_type(cursor) print('bitsize:', coda.cursor_get_bit_size(cursor)) print('bytesize:', coda.cursor_get_byte_size(cursor)) print('bitoff', coda.cursor_get_file_bit_offset(cursor)) print('byteoff', coda.cursor_get_file_byte_offset(cursor)) print('format', coda.cursor_get_format(cursor)) data = coda.cursor_read_bytes(cursor, 0, 4) print(type(data), data.shape, data.dtype, data) data = coda.cursor_read_bits(cursor, 8, 40) print(type(data), data.shape, data.dtype, data) # expressions expr = coda.expression_from_string('1+2') print(coda.expression_is_constant(expr)) print(coda.expression_is_equal(expr, expr)) result = coda.expression_eval_integer(expr) print(result) type_ = coda.expression_get_type(expr) name = coda.expression_get_type_name(type_) print('type', type_, name) coda.expression_delete(expr) expr = coda.expression_from_string('4.5') print(coda.expression_eval_float(expr, cursor)) coda.expression_delete(expr) expr = coda.expression_from_string('true') print(coda.expression_eval_bool(expr)) coda.expression_delete(expr) expr = coda.expression_from_string('"bananen" + "vla"') print(coda.expression_eval_string(expr)) coda.expression_delete(expr) # time parts = coda.time_double_to_parts(12345.67890) print(parts) parts_utc = coda.time_double_to_parts_utc(12345.67890) print(parts_utc) s = coda.time_double_to_string(12345.67890, 'yyyy-mm-dd') print(s) s_utc = coda.time_double_to_string_utc(12345.67890, 'yyyy-mm-dd') print(s_utc) d = coda.time_parts_to_double(*parts) print(d) d = coda.time_parts_to_double_utc(*parts_utc) print(d) s = coda.time_parts_to_string(*parts + ['yyyy-mm-dd']) print(s) d = coda.time_string_to_double('yyyy-mm-dd', s) print(d) d = coda.time_string_to_double_utc('yyyy-mm-dd', s) print(d) parts = coda.time_string_to_parts('yyyy-mm-dd', s) print(parts) #callback def findhelper(filepath, status, error): print('match?', filepath, status, error) #broken on swig side? #coda.match_filefilter('', ['/home/srepmub/coda/python/cffi/blup'], findhelper) print('index', coda.cursor_get_index(cursor)) print('has_ascii', coda.cursor_has_ascii_content(cursor)) #close coda.close(product) #test self-fabricated product product = coda.open('woef.nc') cursor = coda.Cursor() coda.cursor_set_product(cursor, product) # scalar char coda.cursor_goto(cursor, 'mychar') coda.cursor_goto_first_array_element(cursor) type_ = coda.cursor_get_type(cursor) print('len', coda.type_get_string_length(type_)) print(repr(coda.cursor_read_string(cursor))) print(coda.fetch(product, 'mychar')) coda.close(product) #complex numbers product = coda.open( "MIP_NL__1PYDSI20120401_012202_000060153113_00161_52761_0000.N1") cursor = coda.Cursor() coda.cursor_set_product(cursor, product) print(coda.cursor_get_num_elements(cursor)) type_ = coda.cursor_get_type(cursor) print(coda.type_get_class_name(coda.type_get_class(type_))) for i in range(14): print(i, coda.type_get_record_field_name(type_, i)) coda.cursor_goto(cursor, 'mipas_level_1b_mds') coda.cursor_goto_array_element_by_index(cursor, 3) coda.cursor_goto_record_field_by_name(cursor, 'spike_amp') array = coda.cursor_read_complex_array(cursor) print(type(array), array.dtype, array.shape, array[50], type(array[50])) array = coda.cursor_read_complex_double_pairs_array(cursor) print(type(array), array.dtype, array.shape, array[50]) array = coda.cursor_read_complex_double_split_array(cursor) print(type(array), len(array), len(array[0]), type(array[0]), array[0].dtype, array[0][50], array[1][50]) coda.cursor_goto_array_element_by_index(cursor, 50) scalar = coda.cursor_read_complex(cursor) print(type(scalar), scalar) scalar = coda.cursor_read_complex_double_pair(cursor) print(type(scalar), scalar.dtype, scalar) scalar = coda.cursor_read_complex_double_split(cursor) print(type(scalar), scalar) coda.close(product)
def serve_rpc_request(request, url_name="root", **kwargs): ''' This method handles rpc calls based on the content type of the request ''' dispatcher = get_dispatcher(request.path, url_name) if request.method == "POST" and len(request.POST) > 0: # Handle POST request with RPC payload if LOG_REQUESTS_RESPONSES: logger.debug('Incoming request: %s' % str(request.raw_post_data)) if _is_xmlrpc_request(request): if RESTRICT_XML: raise Http404 if not _check_request_permission(request, 'xml', url_name=url_name): return HttpResponseForbidden() resp = dispatcher.xmldispatch(request.raw_post_data, request=request, **kwargs) response_type = 'text/xml' else: if RESTRICT_JSON: raise Http404 if not _check_request_permission(request, 'json',url_name=url_name): return HttpResponseForbidden() resp = dispatcher.jsondispatch(request.raw_post_data, request=request) response_type = 'application/json' if LOG_REQUESTS_RESPONSES: logger.debug('Outgoing %s response: %s' %(response_type, resp)) return HttpResponse(resp, response_type) elif request.method == 'OPTIONS': # Handle OPTIONS request for "preflighted" requests # see https://developer.mozilla.org/en/HTTP_access_control response = HttpResponse('', 'text/plain') origin = request.META.get('HTTP_ORIGIN', 'unknown origin') response['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' response['Access-Control-Max-Age'] = 0 response['Access-Control-Allow-Credentials'] = \ str(HTTP_ACCESS_CREDENTIALS).lower() response['Access-Control-Allow-Origin']= HTTP_ACCESS_ALLOW_ORIGIN response['Access-Control-Allow-Headers'] = \ request.META.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS', '') if LOG_REQUESTS_RESPONSES: logger.debug('Outgoing HTTP access response to: %s' %(origin)) return response else: # Handle GET request if RESTRICT_METHOD_SUMMARY: # hide the documentation by raising 404 raise Http404 # show documentation methods = dispatcher.list_methods() template_data = { 'methods': methods, 'url': request.path, # rpc4django version 'version': version(), # restricts the ability to test the rpc server from the docs 'restrict_rpctest': RESTRICT_RPCTEST, } return render_to_response('rpc4django/rpcmethod_summary.html', \ template_data)
def __init__(self, parent, fl): QDialog.__init__(self, parent, fl) self.parent = parent self.flags = fl self.setupUi(self) self.setWindowTitle('QGIS WPS-Client ' + version())