def _finished(p, successes, failures): msg = (f"<b>{successes}</b> " + _("successful") + f"\n<b>{failures}</b> " + _("failed")) print_d(msg.replace("\n", "; ")) warning = Message(Gtk.MessageType.INFO, app.window, _("Downloads complete"), msg, escape_desc=False) warning.run()
def plugin_playlist(self, playlist): size = 0 for s in playlist.songs: size += s['~#filesize'] sizeInMB = str(int(size / 1024 / 1024)) dialog = Message(Gtk.MessageType.INFO, app.window, playlist.name, _('The total size in MB is: ') + sizeInMB) dialog.run() return False
def do_import(parent, library): db_path = expanduser(BansheeImport.USR_PATH) importer = BansheeDBImporter(library) try: db = sqlite3.connect(db_path) importer.read(db) db.close() except sqlite3.OperationalError: msg = _("Specified Banshee database is malformed or missing") WarningMessage(parent, BansheeImport.PLUGIN_NAME, msg).run() except Exception: util.print_exc() importer.finish() msg = _("Import Failed") # FIXME: don't depend on the plugin class here ErrorMessage(parent, BansheeImport.PLUGIN_NAME, msg).run() else: count = importer.finish() msg = ngettext( "Successfully imported ratings and statistics for %d song", "Successfully imported ratings and statistics for %d songs", count) % count Message(Gtk.MessageType.INFO, parent, BansheeImport.PLUGIN_NAME, msg).run()
def quick_dialog_helper(self, dialog_type, msg): dialog = Message(dialog_type, app.window, "QLScrobbler", msg) dialog.connect('response', lambda dia, resp: dia.destroy()) dialog.show()
def _show_dialog(dialog_type, msg): dialog = Message(dialog_type, app.window, "Squeezebox", msg) dialog.connect('response', lambda dia, resp: dia.destroy()) dialog.show()