diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-06-01 00:29:26 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-06-01 00:29:26 +0200 |
commit | 021d063776f1b71b37bca190d965ce478bdafd69 (patch) | |
tree | 55a5d2c6aa2c73ddca436270149d69cd746b5310 /pyMainGui.py | |
parent | merged (diff) | |
download | pyload-021d063776f1b71b37bca190d965ce478bdafd69.tar.xz |
working event approach for socket transmission
Diffstat (limited to 'pyMainGui.py')
-rwxr-xr-x | pyMainGui.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/pyMainGui.py b/pyMainGui.py index 86bfbe274..e672575d9 100755 --- a/pyMainGui.py +++ b/pyMainGui.py @@ -24,8 +24,11 @@ from os.path import dirname import wx import wx.lib.sized_controls as sized_control +import wx.lib.newevent from module.remote.ClientSocket import SocketThread +(DataArrived, EVT_DATA_ARRIVED) = wx.lib.newevent.NewEvent() + class _Download_Dialog(sized_control.SizedDialog): def __init__(self, parent, id): sized_control.SizedDialog.__init__(self, parent, id, "Downloads hinzufügen", @@ -103,25 +106,35 @@ class Pyload_Main_Gui(wx.Frame): # Binds self.Bind(wx.EVT_MENU, self.exit_button_clicked, submenu_exit) self.Bind(wx.EVT_TOOL, self.add_button_clicked, add) - + self.Bind(EVT_DATA_ARRIVED, self.onUpdate) + self.Centre() self.Show(True) - #test - - self.thread.push_exec("get_downloads") def exit_button_clicked(self, event): self.Close() def add_button_clicked(self, event): + #test + self.thread.push_exec("get_downloads") + adddownload = _Download_Dialog(None, -1) result = adddownload.ShowModal() adddownload.Destroy() def show_links(self, links): for link in links: - wx.MessageDialog(None, str(link), 'info', style=wx.OK).ShowModal() + wx.CallAfter(wx.MessageDialog(self, str(link), 'info', style=wx.OK).ShowModal()) + + def data_arrived(self, rep): + evt = DataArrived(obj = rep) + wx.PostEvent(self, evt) + + def onUpdate(self, data): + + if data.obj.function == "get_downloads": + self.show_links(data.obj.response) app = wx.App() Pyload_Main_Gui(None,-1) |