thread bug gefixt

This commit is contained in:
age 2006-06-10 12:18:28 +00:00
parent 40172e25e0
commit 4ed16744e8
7 changed files with 24 additions and 13 deletions

View file

@ -1,13 +1,13 @@
##TODO fuer WKNcharts 02006-06
= TODO =
[ ] download abbrechenbar machen
[ ] intervallcheckboxen auswerten
[ ] zielverzeichnis auswerten
[ ] dateinamen besser vergeben
[ ] datum einbringen
[ ] bilder im programm anzeigen
[!] loggen in threads erzeugt Speicherzugriffsfehler
= DONE =
[*] loggen in threads erzeugt Speicherzugriffsfehler
-----

View file

@ -18,8 +18,11 @@ class WknCharts:
import wknGUI
wg = wknGUI.WknGUI(gtk)
# this is necessary for using threads later
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()
if __name__ == "__main__":
wc = WknCharts()

View file

@ -46,28 +46,28 @@ class WKNCharts:
})
#print "ich hole jetzt \"%s\" %i:" % (self.wkn_dict[wkn], time)
#print host + params
self.gui.add_log(host + params)
self.gui.add_log("%s %s" % (host, params))
try:
'''
f = urllib.urlopen(host + params)
png = open("images/"+self.wkn_dict[wkn]+str(time)+".png", "w")
png.write(f.read())
png.close()
'''
import time
time.sleep(2)
except IOError, e:
#self.gui.add_log(e)
print e
def set_times(self, times):
self.times = times
def getallcharts(self, gui):
def getallcharts(self, gui) :
self.gui = gui
for wkn in self.wkn_dict.keys():
self.gui.add_log("hole: %s (%s)" % (self.wkn_dict[wkn], wkn))
for time in self.times:
#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

@ -38,6 +38,7 @@ class WknGUI:
charts.set_times([30, 300])
self.add_log("beginne Download der WKNS")
## downlaoding in threads, so the gui won't hang
## giving it 'self', so that it can use the logging window
Thread(target=charts.getallcharts,args=(self,)).start()
## unthreaded version
#charts.getallcharts(self)

Binary file not shown.

View file

@ -4,7 +4,7 @@
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="width_request">300</property>
<property name="width_request">500</property>
<property name="height_request">400</property>
<property name="visible">True</property>
<property name="title" translatable="yes">WKN Charts</property>

View file

@ -1,2 +1,9 @@
881823 samsung
661823 sumsang
621823 sumsang
631823 sumsang
841823 samsung
181823 samsung
851823 samsung
666823 sumsang
663823 sumsang
661323 sumsang