[Inteproxy-commits] r67 - in trunk: . inteproxy
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Apr 30 13:14:27 CEST 2007
Author: bh
Date: 2007-04-30 13:14:25 +0200 (Mon, 30 Apr 2007)
New Revision: 67
Added:
trunk/inteproxy/InteProxy-logo.png
Modified:
trunk/ChangeLog
trunk/inteproxy/gtkapp.py
trunk/inteproxy/proxycore.py
Log:
* inteproxy/InteProxy-logo.png: New. InteProxy logo.
* inteproxy/proxycore.py (MasterWorkerServer.get_inteproxy_url):
New method to return the url of the inteproxy
* inteproxy/gtkapp.py (image_filename): New. Determines the
filename of image files bundled with inteproxy.
(InteProxyMainWindow.__init__): Better content for the main
window: the InteProxy logo and a hint about the usage as an HTTP
proxy including the proxy URL.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-04-27 15:43:31 UTC (rev 66)
+++ trunk/ChangeLog 2007-04-30 11:14:25 UTC (rev 67)
@@ -1,3 +1,16 @@
+2007-04-30 Bernhard Herzog <bh at intevation.de>
+
+ * inteproxy/InteProxy-logo.png: New. InteProxy logo.
+
+ * inteproxy/proxycore.py (MasterWorkerServer.get_inteproxy_url):
+ New method to return the url of the inteproxy
+
+ * inteproxy/gtkapp.py (image_filename): New. Determines the
+ filename of image files bundled with inteproxy.
+ (InteProxyMainWindow.__init__): Better content for the main
+ window: the InteProxy logo and a hint about the usage as an HTTP
+ proxy including the proxy URL.
+
2007-04-27 Bernhard Herzog <bh at intevation.de>
* inteproxy/getpassword.py: Remove the code for the non-gtk user
Added: trunk/inteproxy/InteProxy-logo.png
===================================================================
(Binary files differ)
Property changes on: trunk/inteproxy/InteProxy-logo.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
Modified: trunk/inteproxy/gtkapp.py
===================================================================
--- trunk/inteproxy/gtkapp.py 2007-04-27 15:43:31 UTC (rev 66)
+++ trunk/inteproxy/gtkapp.py 2007-04-30 11:14:25 UTC (rev 67)
@@ -42,7 +42,16 @@
</ui>"""
+def image_filename(basename):
+ """Returns the filename of image files bundled with InteProxy.
+ The function assumes that all image files are located in the
+ inteproxy package directory. The parameter basename should be the
+ basename of the image file in that directory.
+ """
+ return os.path.join(os.path.dirname(__file__), basename)
+
+
class StatusIcon(object):
"""Icon for the system tray.
@@ -57,7 +66,7 @@
"""
self.application = application
- iconfile = os.path.join(os.path.dirname(__file__), "InteProxy-icon.png")
+ iconfile = image_filename("InteProxy-icon.png")
self.status_icon = gtk.status_icon_new_from_file(iconfile)
self.status_icon.set_tooltip("InteProxy")
self.status_icon.connect("activate", self.show_window)
@@ -99,14 +108,50 @@
self.set_position(gtk.WIN_POS_CENTER)
self.set_title('InteProxy')
self.connect('delete-event', self.delete_event)
- self.set_size_request(400, 200)
+ self.set_size_request(320, 240)
vbox = gtk.VBox()
self.add(vbox)
vbox.pack_start(self.application.ui.get_widget('/Menubar'),
expand=False)
- vbox.pack_start(gtk.Label("InteProxy Status"))
+ sw = gtk.ScrolledWindow()
+ vbox.pack_start(sw)
+ sw.set_shadow_type(gtk.SHADOW_NONE)
+ sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+
+ # Create a text view with the contents of the mainwindow: The
+ # InteProxy logo, a usage hint and the proxy URL.
+ textview = gtk.TextView();
+ sw.add(textview)
+ textview.set_cursor_visible(False)
+ textview.set_pixels_above_lines(15)
+ textview.set_left_margin(10)
+ textview.set_right_margin(10)
+
+ buf = textview.get_buffer()
+
+ 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)
+
+ bi = buf.get_iter_at_offset(0)
+
+ filename = image_filename("InteProxy-logo.png")
+ pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
+ buf.insert_pixbuf(bi, pixbuf)
+ buf.insert(bi, "\n")
+ buf.apply_tag_by_name("centered", buf.get_iter_at_offset(0), bi)
+
+ buf.insert(bi, "InteProxy can be used as HTTP-proxy"
+ " with the following URL:\n")
+
+ url = self.application.server.get_inteproxy_url()
+ buf.insert_with_tags_by_name(bi, url, "monospace", "centered")
+ start, end = buf.get_bounds()
+ buf.apply_tag_by_name("default", start, end)
+
+ #
vbox.show_all()
def delete_event(self, *args):
Modified: trunk/inteproxy/proxycore.py
===================================================================
--- trunk/inteproxy/proxycore.py 2007-04-27 15:43:31 UTC (rev 66)
+++ trunk/inteproxy/proxycore.py 2007-04-30 11:14:25 UTC (rev 67)
@@ -277,6 +277,10 @@
% (log_date_time_string(), num_workers))
self.thread_pool.start()
+ def get_inteproxy_url(self):
+ """Returns the URL of this InteProxy"""
+ return "http://localhost:%d/" % self.getsockname()[1]
+
def process_request(self, request, client_address):
"""Put the request into the queue to be handled by the worker thread
"""
More information about the Inteproxy-commits
mailing list