[Inteproxy-commits] r72 - in trunk: . inteproxy
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed May 2 13:01:20 CEST 2007
Author: bh
Date: 2007-05-02 13:01:20 +0200 (Wed, 02 May 2007)
New Revision: 72
Modified:
trunk/ChangeLog
trunk/inteproxy/app.py
trunk/inteproxy/feesdialog.py
trunk/inteproxy/gtkapp.py
Log:
* inteproxy/feesdialog.py (run_fees_dialog): Moved to gtkapp.py.
* inteproxy/gtkapp.py (run_fees_dialog): Copy of
feesdialog.run_fees_dialog, but changed to assume that gtk is
available.
* inteproxy/app.py (InteProxyApplication.run_fees_dialog): Turned
into an abstract method
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-04-30 14:24:12 UTC (rev 71)
+++ trunk/ChangeLog 2007-05-02 11:01:20 UTC (rev 72)
@@ -1,3 +1,14 @@
+2007-05-02 Bernhard Herzog <bh at intevation.de>
+
+ * inteproxy/feesdialog.py (run_fees_dialog): Moved to gtkapp.py.
+
+ * inteproxy/gtkapp.py (run_fees_dialog): Copy of
+ feesdialog.run_fees_dialog, but changed to assume that gtk is
+ available.
+
+ * inteproxy/app.py (InteProxyApplication.run_fees_dialog): Turned
+ into an abstract method
+
2007-04-30 Bernhard Herzog <bh at intevation.de>
* inteproxy/getpassword.py: Remove top-level test code that runs
Modified: trunk/inteproxy/app.py
===================================================================
--- trunk/inteproxy/app.py 2007-04-30 14:24:12 UTC (rev 71)
+++ trunk/inteproxy/app.py 2007-05-02 11:01:20 UTC (rev 72)
@@ -10,9 +10,7 @@
from inteproxy.proxycore import MasterWorkerServer, InteProxyHTTPRequestHandler
from inteproxy.httpserver import ServerThread
-from inteproxy.feesdialog import run_fees_dialog
-
class InteProxyApplication(object):
"""Base Application object
@@ -81,8 +79,11 @@
def run_fees_dialog(self, title, fees, access_constraints):
"""Callback to run the fees dialog.
- The parameters have the same meaning as in the function
- inteproxy.feesdialog.run_fees_dialog. The default
- implementation simply calls that function.
+ The parameters are strings with the title of the dialog and the
+ fees and access constraints information taken from a WMS
+ server's GetCapabilities response.
+
+ This method has to be implemented by derived classes. The
+ default implementation only raises NotImplementedError.
"""
- run_fees_dialog(title, fees, access_constraints)
+ raise NotImplementedError
Modified: trunk/inteproxy/feesdialog.py
===================================================================
--- trunk/inteproxy/feesdialog.py 2007-04-30 14:24:12 UTC (rev 71)
+++ trunk/inteproxy/feesdialog.py 2007-05-02 11:01:20 UTC (rev 72)
@@ -12,66 +12,9 @@
from lxml import etree
-try:
- import gtk
-except ImportError:
- gtk = None
-
-
import inteproxy.main
-def run_fees_dialog(title, fees, access_constraints):
- """Shows fees and access_constraints information in a dialog
-
- The title, fees and access_constraints should be strings taken from
- the corresponding sub-elements of the Service element of the
- GetCapabilities response. Both fees and access_constraints is false
- (e.g. both are empty strings or None), the dialog is not shown and
- this function does nothing. Also, if gtk is not available, the
- function does nothing.
- """
- if gtk is None:
- return
-
- if not fees and not access_constraints:
- return
-
- dialog = gtk.Dialog("Fees and AccessConstraints", None,
- gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
- (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
-
- label_texts = ["Service information for %s" % title]
-
- if fees:
- label_texts.extend([("<b>Fees:</b>", True),
- fees])
- if access_constraints:
- label_texts.extend([("<b>Access Constraints:</b>", True),
- access_constraints])
- for item in label_texts:
- if isinstance(item, tuple):
- text, markup = item
- else:
- text = item
- markup = False
- label = gtk.Label(text)
- label.set_use_markup(markup)
- label.set_alignment(0.0, 0.5)
- label.set_padding(5, 5)
- label.show()
- dialog.vbox.pack_start(label, True, True, 5)
-
- dialog.run()
- dialog.destroy()
-
- # process pending events to make sure the dialog is destroyed and
- # unmapped properly from the screen.
- while gtk.events_pending():
- gtk.main_iteration_do()
-
-
-
# keep track of the URLs for which the dialog was already shown.
dialog_shown_for = dict()
Modified: trunk/inteproxy/gtkapp.py
===================================================================
--- trunk/inteproxy/gtkapp.py 2007-04-30 14:24:12 UTC (rev 71)
+++ trunk/inteproxy/gtkapp.py 2007-05-02 11:01:20 UTC (rev 72)
@@ -67,8 +67,53 @@
return result
+def run_fees_dialog(title, fees, access_constraints):
+ """Shows fees and access_constraints information in a dialog
+ The title, fees and access_constraints should be strings taken from
+ the corresponding sub-elements of the Service element of the
+ GetCapabilities response. Both fees and access_constraints is false
+ (e.g. both are empty strings or None), the dialog is not shown and
+ this function does nothing.
+ """
+ if not fees and not access_constraints:
+ return
+ dialog = gtk.Dialog("Fees and AccessConstraints", None,
+ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+ (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+
+ label_texts = ["Service information for %s" % title]
+
+ if fees:
+ label_texts.extend([("<b>Fees:</b>", True),
+ fees])
+ if access_constraints:
+ label_texts.extend([("<b>Access Constraints:</b>", True),
+ access_constraints])
+ for item in label_texts:
+ if isinstance(item, tuple):
+ text, markup = item
+ else:
+ text = item
+ markup = False
+ label = gtk.Label(text)
+ label.set_use_markup(markup)
+ label.set_alignment(0.0, 0.5)
+ label.set_padding(5, 5)
+ label.show()
+ dialog.vbox.pack_start(label, True, True, 5)
+
+ dialog.run()
+ dialog.destroy()
+
+ # process pending events to make sure the dialog is destroyed and
+ # unmapped properly from the screen.
+ while gtk.events_pending():
+ gtk.main_iteration_do()
+
+
+
# UI definition with the menus used in the InteProxy GUI
ui_definition = """<ui>
<!-- Menubar for the main window -->
@@ -328,6 +373,6 @@
"""
gtk.gdk.threads_enter()
try:
- super(InteProxyApplication, self).run_fees_dialog(*args)
+ run_fees_dialog(*args)
finally:
gtk.gdk.threads_leave()
More information about the Inteproxy-commits
mailing list