From 40172e25e0ad463485c7d02fa0bfbf025e2c89e1 Mon Sep 17 00:00:00 2001 From: age Date: Fri, 9 Jun 2006 12:05:30 +0000 Subject: [PATCH] threads implementiert --- WKNcharts/TODO | 13 ++++++++++++- WKNcharts/WknCharts.py | 1 + WKNcharts/getWKNcharts.py | 10 +++++++--- WKNcharts/wknGUI.py | 6 +++++- WKNcharts/wknGUI.pyc | Bin 4462 -> 4561 bytes 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/WKNcharts/TODO b/WKNcharts/TODO index 5a78f63..9295a3a 100644 --- a/WKNcharts/TODO +++ b/WKNcharts/TODO @@ -1,7 +1,18 @@ +##TODO fuer WKNcharts 02006-06 + [ ] intervallcheckboxen auswerten [ ] zielverzeichnis auswerten [ ] dateinamen besser vergeben [ ] datum einbringen [ ] bilder im programm anzeigen -[ ] download in threads laufen lassen +[!] loggen in threads erzeugt Speicherzugriffsfehler + + + + +----- +[ ] offen +[.] in Arbeit +[*] done +[!] Bugfix notwendig diff --git a/WKNcharts/WknCharts.py b/WKNcharts/WknCharts.py index 78b16bc..60032d2 100755 --- a/WKNcharts/WknCharts.py +++ b/WKNcharts/WknCharts.py @@ -18,6 +18,7 @@ class WknCharts: import wknGUI wg = wknGUI.WknGUI(gtk) + gtk.gdk.threads_init() gtk.main() if __name__ == "__main__": diff --git a/WKNcharts/getWKNcharts.py b/WKNcharts/getWKNcharts.py index 235d589..e709e18 100755 --- a/WKNcharts/getWKNcharts.py +++ b/WKNcharts/getWKNcharts.py @@ -53,8 +53,8 @@ class WKNCharts: png.write(f.read()) png.close() except IOError, e: - self.gui.add_log(e) - #print e + #self.gui.add_log(e) + print e def set_times(self, times): self.times = times @@ -63,8 +63,12 @@ class WKNCharts: self.gui = gui for wkn in self.wkn_dict.keys(): for time in self.times: - self.gui.add_log("hole: %s %i" % (wkn, time)) + #gui.gtk.gdk.threads_enter() + ##TODO: logbuch killt den thread + ##gui.add_log("hole: %s %i" % (wkn, time)) self.getchart(wkn, time) + #gui.gtk.gdk.threads_leave() + print "Download fertig" return diff --git a/WKNcharts/wknGUI.py b/WKNcharts/wknGUI.py index 265b6a1..cacfed5 100644 --- a/WKNcharts/wknGUI.py +++ b/WKNcharts/wknGUI.py @@ -30,13 +30,17 @@ class WknGUI: def clicked_wget_charts(self, widget): import getWKNcharts + from threading import Thread '''the real download logic lies in getWKNcharts that's why, we let it read in the wkn file''' charts = getWKNcharts.WKNCharts() charts.readwkndictfromstring(self.wkns) charts.set_times([30, 300]) self.add_log("beginne Download der WKNS") - charts.getallcharts(self) + ## downlaoding in threads, so the gui won't hang + Thread(target=charts.getallcharts,args=(self,)).start() + ## unthreaded version + #charts.getallcharts(self) self.add_log("Download abgeschlossen") def clicked_read_settings(self, widget): diff --git a/WKNcharts/wknGUI.pyc b/WKNcharts/wknGUI.pyc index d2cfd95c7be6c7e743b7fc0fdd24d69556b804bd..add0ca025d7589d092afe82d6784d559847e86ef 100644 GIT binary patch delta 378 zcmYjNyGjF55IuAEVRo}IK_#Gt?;?eYSZX6E+6fW`+ts^nE(wX`uGnl8T(GjcwSQnE z`vrnOu#KN#;ScC6TWB%EnK@_94D+>GthsyN4Zq%fbD!-82S6DI9Qu)y1p2_lh9vX} z1A&PJN^K|$8507jfO3!mY6=-K$8`--Kw5}J)nd|vw5!5`WId~VNVgokCbkl)j%)`! zUx_O-Uf=E1_>Pkfl_$BJ&U)i0lxmTo+90#;tZbL^iz+;a6b3=Em949$!Tj5SOQnQROx zj0`DE3@OYEDJ%@>ED#Bx5_X0ZgendOpf0c$hzuK;lfu9dticX6*)LNLNM`CV0to?i zAYo7nv`!KzmXw;FnU|NU;F4dSmy@5EqL4BibD3z#%mCNJcX;9>*HK}ECJGDQS{Tn0u?CI&_xMgc}i zMqVJ?{F2RznNe%A3KtV2qs?Y@ZXPB^r_Cn3YZw`QCqLx7#u&1B2fsTbBljf1ivayM BK->TT