From e660b94ca52a7b270acf64640af031e49bac3ac4 Mon Sep 17 00:00:00 2001 From: Kristian Rumberg Date: Sun, 10 Aug 2008 20:07:27 +0200 Subject: [PATCH] we now have a progressbar written in Gtk --- gui.py | 23 ++++++++++++++++++++++- progresswin.glade | 3 ++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/gui.py b/gui.py index 6c11013..052ed02 100644 --- a/gui.py +++ b/gui.py @@ -38,6 +38,26 @@ class CommandExecuterConsoleView(CommandExecuterView): def finished_all(self): print "All convertings done" +class CommandExecuterGtkView(CommandExecuterView): + def __init__(self): + CommandExecuterView.__init__(self) + self.widgets = gtk.glade.XML("progresswin.glade") + self.progresswindow = self.widgets.get_widget("progresswindow") + self.progresslabel = self.widgets.get_widget("progresslabel") + self.progresswindow.show_all() + + def starting_conversion(self, infile, outfile): + self.progresswindow.set_title("Converting " + os.path.basename(infile)) + + def update_progress(self, logline): + self.progresslabel.set_text(logline) + + def finished_conversion(self, infile, outfile): + pass + + def finished_all(self): + pass + class MyGui: def _enable_or_disable_convertbutton(self): if len(self.file_list) > 0 and len(self.widgets.get_widget("outdirentry").get_text()) > 0: @@ -103,7 +123,8 @@ class MyGui: command = self.commands[self.combobox.get_active_text()] outdir = self.widgets.get_widget("outdirentry").get_text() - CommandExecuter(CommandExecuterConsoleView(), command, self.file_list, outdir) + self.widgets.get_widget("convertbutton").set_sensitive(False) + CommandExecuter(CommandExecuterGtkView(), command, self.file_list, outdir) def __init__(self, commands): self.widgets = gtk.glade.XML("mainwin.glade") diff --git a/progresswin.glade b/progresswin.glade index e3e15a3..368bbad 100644 --- a/progresswin.glade +++ b/progresswin.glade @@ -1,12 +1,13 @@ - + Converting True + 10 True -- 2.11.4.GIT