def new_listen_list(self): def create_list(name): if name.strip(): item = MusicListItem(name, list_type=MusicListItem.LOCAL_TYPE) self.category_list.add_items([item], insert_pos=1) input_dialog = InputDialog("新建试听列表", "", 300, 100, create_list) input_dialog.show_all()
def new_list(self, items=[], name=None): index = len(self.category_list.get_items()) if name is None: name = "%s%d" % (_("New List"), index) input_dialog = InputDialog( _("New List"), name, 300, 100, lambda name: self.create_new_playlist(name, items)) input_dialog.show_all()
def new_online_list(self): def bplayer_new_list(name): self.new_list_thread_id += 1 thread_id = copy.deepcopy(self.new_list_thread_id) utils.ThreadFetch(fetch_funcs=(bplayer.new_list, (name, )), success_funcs=(self.render_new_online_list, (thread_id, ))).start() input_dialog = InputDialog("新建歌单", "", 300, 100, bplayer_new_list) input_dialog.show_all()
def new_online_list(self): def bplayer_new_list(name): self.new_list_thread_id += 1 thread_id = copy.deepcopy(self.new_list_thread_id) utils.ThreadFetch( fetch_funcs=(bplayer.new_list, (name,)), success_funcs=(self.render_new_online_list, (thread_id,)) ).start() input_dialog = InputDialog("新建歌单", "", 300, 100, bplayer_new_list) input_dialog.show_all()
def add_unknow_uri(self, uri=None): def play_or_add_uri(uri): # MediaDB.get_or_create_song({"uri": uri}, "unknown") self.play_uris([uri]) if not uri: input_dialog = InputDialog(_("Add URL"), "", 300, 100, lambda name : play_or_add_uri(name)) input_dialog.show_all() else: play_or_add_uri(uri)
def rename_online_list(self, item, is_online=True): def nplayer_rename_list(name): if name.strip(): item.set_title(name) if is_online: nplayer.rename_list(item.list_id, name) else: self.save() input_dialog = InputDialog("重命名歌单", item.title, 300, 100, nplayer_rename_list) input_dialog.show_all()
def rename_online_list(self, item, is_online=True): def bplayer_rename_list(name): if name.strip(): item.set_title(name) if is_online: bplayer.rename_list(item.list_id, name) else: self.save() input_dialog = InputDialog("重命名歌单", item.title, 300, 100, bplayer_rename_list) input_dialog.show_all()
def on_theme_sava_as(self, item): input_dialog = InputDialog(_("Save Theme As"), "", 300, 100, lambda name: self.create_new_theme(name, item)) input_dialog.show_all()
def on_theme_rename(self, item): input_dialog = InputDialog(_("Rename Theme"), "", 300, 100, lambda name: self.rename_theme(name, item), None, True) input_dialog.show_all()
def rename_item_list(self, item): input_dialog = InputDialog(_("Rename"), item.get_title(), 300, 100, lambda name: item.set_title(name)) input_dialog.show_all()
def new_list(self, items=[], name=None): index = len(self.category_list.get_items()) if name is None: name = "%s%d" % (_("New List"), index) input_dialog = InputDialog(_("New List"), name, 300, 100, lambda name : self.create_new_playlist(name, items)) input_dialog.show_all()
def __init__(self, title, init_text="", cancel_callback=None, confirm_callback=None): InputDialog.__init__(self, title, init_text, cancel_callback=cancel_callback, confirm_callback=confirm_callback)