threads implementiert
This commit is contained in:
parent
6b5a8467ca
commit
40172e25e0
5 changed files with 25 additions and 5 deletions
|
@ -1,7 +1,18 @@
|
||||||
|
##TODO fuer WKNcharts 02006-06
|
||||||
|
|
||||||
[ ] intervallcheckboxen auswerten
|
[ ] intervallcheckboxen auswerten
|
||||||
[ ] zielverzeichnis auswerten
|
[ ] zielverzeichnis auswerten
|
||||||
[ ] dateinamen besser vergeben
|
[ ] dateinamen besser vergeben
|
||||||
[ ] datum einbringen
|
[ ] datum einbringen
|
||||||
[ ] bilder im programm anzeigen
|
[ ] bilder im programm anzeigen
|
||||||
[ ] download in threads laufen lassen
|
[!] loggen in threads erzeugt Speicherzugriffsfehler
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-----
|
||||||
|
[ ] offen
|
||||||
|
[.] in Arbeit
|
||||||
|
[*] done
|
||||||
|
[!] Bugfix notwendig
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ class WknCharts:
|
||||||
|
|
||||||
import wknGUI
|
import wknGUI
|
||||||
wg = wknGUI.WknGUI(gtk)
|
wg = wknGUI.WknGUI(gtk)
|
||||||
|
gtk.gdk.threads_init()
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -53,8 +53,8 @@ class WKNCharts:
|
||||||
png.write(f.read())
|
png.write(f.read())
|
||||||
png.close()
|
png.close()
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
self.gui.add_log(e)
|
#self.gui.add_log(e)
|
||||||
#print e
|
print e
|
||||||
|
|
||||||
def set_times(self, times):
|
def set_times(self, times):
|
||||||
self.times = times
|
self.times = times
|
||||||
|
@ -63,8 +63,12 @@ class WKNCharts:
|
||||||
self.gui = gui
|
self.gui = gui
|
||||||
for wkn in self.wkn_dict.keys():
|
for wkn in self.wkn_dict.keys():
|
||||||
for time in self.times:
|
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)
|
self.getchart(wkn, time)
|
||||||
|
#gui.gtk.gdk.threads_leave()
|
||||||
|
print "Download fertig"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,17 @@ class WknGUI:
|
||||||
|
|
||||||
def clicked_wget_charts(self, widget):
|
def clicked_wget_charts(self, widget):
|
||||||
import getWKNcharts
|
import getWKNcharts
|
||||||
|
from threading import Thread
|
||||||
'''the real download logic lies in getWKNcharts
|
'''the real download logic lies in getWKNcharts
|
||||||
that's why, we let it read in the wkn file'''
|
that's why, we let it read in the wkn file'''
|
||||||
charts = getWKNcharts.WKNCharts()
|
charts = getWKNcharts.WKNCharts()
|
||||||
charts.readwkndictfromstring(self.wkns)
|
charts.readwkndictfromstring(self.wkns)
|
||||||
charts.set_times([30, 300])
|
charts.set_times([30, 300])
|
||||||
self.add_log("beginne Download der WKNS")
|
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")
|
self.add_log("Download abgeschlossen")
|
||||||
|
|
||||||
def clicked_read_settings(self, widget):
|
def clicked_read_settings(self, widget):
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue