[Inteproxy-commits] r84 - in trunk: . inteproxy

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 7 15:12:26 CEST 2007


Author: bh
Date: 2007-05-07 15:12:26 +0200 (Mon, 07 May 2007)
New Revision: 84

Modified:
   trunk/ChangeLog
   trunk/inteproxy/gtkapp.py
Log:
* inteproxy/gtkapp.py (InteProxyTextView.__init__): Add two new
default tags: "title" and "heading"
(run_fees_dialog): Replace the label widgets with one
InteProxyTextView instance.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-05-07 12:31:32 UTC (rev 83)
+++ trunk/ChangeLog	2007-05-07 13:12:26 UTC (rev 84)
@@ -1,5 +1,12 @@
 2007-05-07  Bernhard Herzog  <bh at intevation.de>
 
+	* inteproxy/gtkapp.py (InteProxyTextView.__init__): Add two new
+	default tags: "title" and "heading"
+	(run_fees_dialog): Replace the label widgets with one
+	InteProxyTextView instance.
+
+2007-05-07  Bernhard Herzog  <bh at intevation.de>
+
 	* inteproxy/gtkapp.py (InteProxyTextView)
 	(InteProxyMainWindow.__init__): Move some of the TextView
 	initialization into the separate new class InteProxyTextView.

Modified: trunk/inteproxy/gtkapp.py
===================================================================
--- trunk/inteproxy/gtkapp.py	2007-05-07 12:31:32 UTC (rev 83)
+++ trunk/inteproxy/gtkapp.py	2007-05-07 13:12:26 UTC (rev 84)
@@ -11,6 +11,7 @@
 import os
 
 import gtk
+import pango
 
 import inteproxy.app
 import inteproxy.main
@@ -77,6 +78,11 @@
         self.set_cursor_visible(False)
 
         buf = self.get_buffer()
+        buf.create_tag("title", weight=pango.WEIGHT_BOLD,
+                       pixels_above_lines=5, pixels_below_lines=5,
+                       scale=pango.SCALE_LARGE)
+        buf.create_tag("heading", weight=pango.WEIGHT_BOLD,
+                       pixels_above_lines=5)
         buf.create_tag("monospace", family="monospace")
         buf.create_tag("centered", justification=gtk.JUSTIFY_CENTER)
         buf.create_tag("default", wrap_mode=gtk.WRAP_WORD, editable=False)
@@ -98,28 +104,39 @@
     dialog = gtk.Dialog("Fees and AccessConstraints", None,
                         gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                         (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+    dialog.set_size_request(320, 240)
 
-    label_texts = ["Service information for %s" % title]
+    sw = gtk.ScrolledWindow()
+    dialog.vbox.pack_start(sw)
+    sw.set_shadow_type(gtk.SHADOW_NONE)
+    sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+    sw.show()
 
+    textview = InteProxyTextView();
+    sw.add(textview)
+    textview.show()
+    textview.set_left_margin(10)
+    textview.set_right_margin(10)
+
+    buf = textview.get_buffer()
+
+    bi = buf.get_iter_at_offset(0)
+
+    buf.insert_with_tags_by_name(bi, "Service information for '%s'\n" % title,
+                                 "title")
     if fees:
-        label_texts.extend([("<b>Fees:</b>", True),
-                            fees])
+        buf.insert_with_tags_by_name(bi, "Fees:\n", "heading")
+        buf.insert(bi, fees)
+        buf.insert(bi, "\n")
     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)
+        buf.insert_with_tags_by_name(bi, "Access Constraints:\n", "heading")
+        buf.insert(bi, access_constraints)
+        buf.insert(bi, "\n")
 
+    start, end = buf.get_bounds()
+    buf.apply_tag_by_name("default", start, end)
+
+
     dialog.run()
     dialog.destroy()
 



More information about the Inteproxy-commits mailing list