From 94e33924fad7b7a38d6d1e848d01b5e830a45360 Mon Sep 17 00:00:00 2001 From: Thomas Keck Date: Sat, 13 Mar 2010 16:19:20 +0100 Subject: First setting implemented --- gui.py | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'gui.py') diff --git a/gui.py b/gui.py index 8c82434..423d1e3 100644 --- a/gui.py +++ b/gui.py @@ -4,6 +4,36 @@ import gtk, sys, proxy, time gtk.gdk.threads_init() +class Settings(gtk.Window): + def __init__(self): + super(Settings, self).__init__(gtk.WINDOW_TOPLEVEL) + + self.set_border_width(8) + self.set_title("Magicproxy GUI client settings") + self.set_resizable(False) + + table = gtk.Table(rows=3, columns=3, homogeneous=True); + + b_quit = gtk.Button("Quit") + b_quit.connect("clicked", self.on_quit) + label = gtk.Label("Time Slice") + self.time_slice = gtk.HScale() + self.time_slice.set_range(1,100) + self.time_slice.set_increments(1,1) + self.time_slice.set_value(proxy.TIME_SLICE) + + table.attach(label,0,1,0,1) + table.attach(self.time_slice,2,3,0,1,xoptions=gtk.FILL) + table.attach(b_quit,0,3,2,3) + + self.add(table) + self.show_all() + + def on_quit(self, widget): + proxy.TIME_SLICE = self.time_slice.get_value() + self.destroy() + + class ProxyGUI(gtk.Window): def __init__(self): super(ProxyGUI, self).__init__(gtk.WINDOW_TOPLEVEL) @@ -31,7 +61,6 @@ class ProxyGUI(gtk.Window): table.attach(b_settings, 0, 1, 1, 2) table.attach(b_quit, 1, 2, 1, 2) - self.add(table) self.show_all() @@ -39,13 +68,15 @@ class ProxyGUI(gtk.Window): def on_endpoints(self, widget): pass + def on_start(self, widget): if not self.proxy: self.proxy = proxy.HTTPProxyServer() Thread(target=proxy.asyncore.loop).start() def on_settings(self, widget): - pass + Settings() + def on_quit(self, widget): if self.proxy: self.proxy.shutdown() -- cgit v1.2.1 From 9b0ffb71e5b47fff2095c24551b9e0fce4c0650e Mon Sep 17 00:00:00 2001 From: Thomas Keck Date: Sat, 13 Mar 2010 17:35:28 +0100 Subject: Min/Max mistake at blocksize calculation --- gui.py | 1 + 1 file changed, 1 insertion(+) (limited to 'gui.py') diff --git a/gui.py b/gui.py index 423d1e3..441a1f2 100644 --- a/gui.py +++ b/gui.py @@ -30,6 +30,7 @@ class Settings(gtk.Window): self.show_all() def on_quit(self, widget): + print self.time_slice.get_value() proxy.TIME_SLICE = self.time_slice.get_value() self.destroy() -- cgit v1.2.1 From c18e0ab17a23ddef42768151c6905818ad1d40d3 Mon Sep 17 00:00:00 2001 From: Yves Date: Fri, 2 Apr 2010 20:48:13 +0200 Subject: lays a egg --- gui.py | 88 ------------------------------------------------------------------ 1 file changed, 88 deletions(-) delete mode 100644 gui.py (limited to 'gui.py') diff --git a/gui.py b/gui.py deleted file mode 100644 index 441a1f2..0000000 --- a/gui.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/python -t -from threading import Thread -import gtk, sys, proxy, time - -gtk.gdk.threads_init() - -class Settings(gtk.Window): - def __init__(self): - super(Settings, self).__init__(gtk.WINDOW_TOPLEVEL) - - self.set_border_width(8) - self.set_title("Magicproxy GUI client settings") - self.set_resizable(False) - - table = gtk.Table(rows=3, columns=3, homogeneous=True); - - b_quit = gtk.Button("Quit") - b_quit.connect("clicked", self.on_quit) - label = gtk.Label("Time Slice") - self.time_slice = gtk.HScale() - self.time_slice.set_range(1,100) - self.time_slice.set_increments(1,1) - self.time_slice.set_value(proxy.TIME_SLICE) - - table.attach(label,0,1,0,1) - table.attach(self.time_slice,2,3,0,1,xoptions=gtk.FILL) - table.attach(b_quit,0,3,2,3) - - self.add(table) - self.show_all() - - def on_quit(self, widget): - print self.time_slice.get_value() - proxy.TIME_SLICE = self.time_slice.get_value() - self.destroy() - - -class ProxyGUI(gtk.Window): - def __init__(self): - super(ProxyGUI, self).__init__(gtk.WINDOW_TOPLEVEL) - - self.set_border_width(8) - self.set_title("Magicproxy GUI client") - self.set_resizable(False) - - table = gtk.Table(rows=2, columns=2, homogeneous=False); - - b_endpoints = gtk.Button("Configure Endpoints") - b_start = gtk.Button("Start") - b_stop = gtk.Button("Stop") - b_settings = gtk.Button("Configure Settings") - b_quit = gtk.Button("Quit") - - b_endpoints.connect("clicked", self.on_endpoints) - b_start.connect("clicked", self.on_start) - b_settings.connect("clicked", self.on_settings) - b_quit.connect("clicked", self.on_quit) - self.connect("destroy", self.on_quit) - - table.attach(b_endpoints, 0, 1, 0, 1) - table.attach(b_start, 1, 2, 0, 1) - table.attach(b_settings, 0, 1, 1, 2) - table.attach(b_quit, 1, 2, 1, 2) - - self.add(table) - self.show_all() - - self.proxy = None - - def on_endpoints(self, widget): - pass - - def on_start(self, widget): - if not self.proxy: - self.proxy = proxy.HTTPProxyServer() - Thread(target=proxy.asyncore.loop).start() - - def on_settings(self, widget): - Settings() - - def on_quit(self, widget): - if self.proxy: - self.proxy.shutdown() - gtk.main_quit(widget) - -ProxyGUI() -gtk.main() - -- cgit v1.2.1