threads implementiert

This commit is contained in:
age 2006-06-09 12:05:30 +00:00
parent 6b5a8467ca
commit 40172e25e0
5 changed files with 25 additions and 5 deletions

View file

@ -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

View file

@ -18,6 +18,7 @@ class WknCharts:
import wknGUI
wg = wknGUI.WknGUI(gtk)
gtk.gdk.threads_init()
gtk.main()
if __name__ == "__main__":

View file

@ -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

View file

@ -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):

Binary file not shown.