3 # This file is part of Jamaendo.
4 # Copyright (c) 2010 Kristoffer Gronlund
6 # Jamaendo is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Jamaendo is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Jamaendo. If not, see <http://www.gnu.org/licenses/>.
19 # Player code heavily based on http://thpinfo.com/2008/panucci/:
20 # A resuming media player for Podcasts and Audiobooks
21 # Copyright (c) 2008-05-26 Thomas Perl <thpinfo.com>
22 # (based on http://pygstdocs.berlios.de/pygst-tutorial/seeking.html)
25 class RefreshDialog(object):
27 self.notebook = gtk.Notebook()
29 info.pack_start(gtk.Label("Downloading complete DB from jamendo.com."), True, False)
30 info.pack_start(gtk.Label("This will download approximately 8 MB."), True, False)
31 self.force = hildon.GtkToggleButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
32 self.force.set_label("Force refresh")
34 info.pack_start(self.force, True, False)
35 self.notebook.append_page(info)
38 self.progress = gtk.ProgressBar()
39 pcont.pack_start(self.progress, True, False)
40 self.notebook.append_page(pcont,
41 gtk.Label("Updating Database"))
42 self.progress.set_fraction(0)
43 self.progress.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT)
44 self.progress.set_text("Downloading...")
46 self.notebook.append_page(gtk.Label("Database refreshed."))
48 self.dialog = hildon.WizardDialog(None, "Refresh", self.notebook)
49 self.notebook.connect("switch-page", self.on_switch)
50 self.dialog.set_forward_page_func(self.forward_func)
54 def on_complete(self, status):
55 hildon.hildon_gtk_window_set_progress_indicator(self.dialog, 0)
57 self.progress.set_fraction(1)
58 self.progress.set_text("DB up to date.")
60 self.progress.set_fraction(0)
61 self.progress.set_text("Download failed.")
63 def on_progress(self, percent):
65 self.progress.set_text("Downloading...")
66 self.progress.set_fraction(percent/100.0)
68 def on_switch(self, notebook, page, num):
70 hildon.hildon_gtk_window_set_progress_indicator(self.dialog, 1)
71 refresh_dump(self.on_complete, self.on_progress, force=self.force.get_active())
77 def forward_func(self, notebook, current, userdata):
78 #page = notebook.get_nth_page(current)
85 self.dialog.show_all()