def show_files_cb(menu_item): print_d("Trying to show files...") if not show_songs(songs): msg = ErrorMessage( self.plugin_window, _("Unable to show files"), _("Error showing files, " "or no program available to show them.")) msg.run()
def show_files_cb(menu_item): print_d("Trying to show files...") if not show_songs(songs): msg = ErrorMessage(self.plugin_window, _("Unable to show files"), _("Error showing files, " "or no program available to show them.")) msg.run()
def show_files_cb(menu_item): print_d("Trying to show files...") if not show_songs(songs): parent = get_menu_item_top_parent(menu_item) msg = ErrorMessage( parent, _("Unable to show files"), _("Error showing files, " "or no program available to show them.")) msg.run()
def open_chooser(self, action): if not os.path.exists(self.last_dir): self.last_dir = const.HOME if action.get_name() == "AddFolders": chooser = FolderChooser(self, _("Add Music"), self.last_dir) cb = gtk.CheckButton(_("Watch this folder for new songs")) cb.set_active(not config.get("settings", "scan")) cb.show() chooser.set_extra_widget(cb) else: chooser = FileChooser( self, _("Add Music"), formats.filter, self.last_dir) cb = None fns = chooser.run() chooser.destroy() if fns: if action.get_name() == "AddFolders": self.last_dir = fns[0] copool.add(self.__library.scan, fns, funcid="library") else: self.last_dir = os.path.basename(fns[0]) for filename in map(os.path.realpath, map(util.fsnative, fns)): if filename in self.__library: continue song = self.__library.add_filename(filename) if not song: from traceback import format_exception_only as feo tb = feo(sys.last_type, sys.last_value) msg = _("%s could not be added to your library.\n\n") msg %= util.escape(util.fsdecode( os.path.basename(filename))) msg += util.escape("".join(tb).decode( const.ENCODING, "replace")) d = ErrorMessage(self, _("Unable to add song"), msg) d.label.set_selectable(True) d.run() continue if cb and cb.get_active(): dirs = util.split_scan_dirs(config.get("settings", "scan")) for fn in fns: if fn not in dirs: dirs.append(fn) dirs = ":".join(dirs) config.set("settings", "scan", dirs)