diff --git a/WKNcharts/TODO b/WKNcharts/TODO index 8de70f8..e6393ba 100644 --- a/WKNcharts/TODO +++ b/WKNcharts/TODO @@ -8,6 +8,7 @@ [ ] einstellungen rueckgaengig machen = DONE = +[*] progress bar [*] loggen in threads erzeugt Speicherzugriffsfehler [*] wkn datei auswaehlen [*] zielverzeichnis auswaehlen diff --git a/WKNcharts/getWKNcharts.py b/WKNcharts/getWKNcharts.py index d4e0dc3..7961f30 100755 --- a/WKNcharts/getWKNcharts.py +++ b/WKNcharts/getWKNcharts.py @@ -57,7 +57,8 @@ class WKNCharts: png.write(f.read()) png.close() import time - time.sleep(2) + ### bei einigen modem verbindungen war eine pause notwendig + #time.sleep(2) except IOError, e: print e @@ -83,10 +84,15 @@ class WKNCharts: return gui.add_log("Beginne Download nach: %s" % self.dstdir, 2) + alldownloads = len(self.wkn_dict.keys()) * len(self.times) + downloaded = 0 for wkn in self.wkn_dict.keys(): self.gui.add_log(" hole gerade: %s (%s) %s" % (self.wkn_dict[wkn], wkn, str(self.times)),2) for time in self.times: + self.gui.set_progress("Speichern von: %s" % self.wkn_dict[wkn], int(downloaded), int(alldownloads)) self.getchart(wkn, time) + downloaded += 1 + self.gui.set_progress("Download beendet!", int(downloaded), int(alldownloads)) gui.add_log("Download Ende",2) return diff --git a/WKNcharts/wknGUI.py b/WKNcharts/wknGUI.py index b234671..b3f0ac6 100644 --- a/WKNcharts/wknGUI.py +++ b/WKNcharts/wknGUI.py @@ -147,6 +147,13 @@ class WknGUI: self.log += text self.buffer.set_text(self.log) + def set_progress(self, text, actual, max): + self.progressbar = self.wkngui.get_widget("progressbar1") + self.progressbar.set_text(str(text)) + self.gtk.threads_enter() + self.progressbar.set_fraction(float(actual)/int(max)) + self.gtk.threads_leave() + def clicked_show_pics(self, widget): '''this is just for a rapid prototype''' ## set an image to display diff --git a/WKNcharts/wkncharts.glade b/WKNcharts/wkncharts.glade index 401340d..4fd8c28 100644 --- a/WKNcharts/wkncharts.glade +++ b/WKNcharts/wkncharts.glade @@ -20,6 +20,8 @@ False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST + True + False @@ -58,6 +60,10 @@ 0.5 0 4 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -110,6 +116,22 @@ + + + True + GTK_PROGRESS_LEFT_TO_RIGHT + 0 + 0 + Fortschritt + PANGO_ELLIPSIZE_NONE + + + 0 + False + False + + + True @@ -173,6 +195,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -248,6 +274,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -323,6 +353,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -369,6 +403,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 tab @@ -404,6 +442,10 @@ 0 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -428,6 +470,10 @@ 0 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -573,6 +619,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -651,6 +701,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -823,6 +877,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -935,6 +993,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1010,6 +1072,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -1055,6 +1121,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 tab @@ -1122,6 +1192,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 tab