def on_add_station(self): name, url = two_line_dialog("Add New Radio Station", "Enter Name and URL", "", "http://") with open(CACHE_RADIO_FILE, 'a') as f: f.write('#' + name + '\n' + url + '\n') bean = FModel(name, url).add_is_file(True) bean.type=FTYPE_RADIO self.append(bean)
def on_edit_radio(self): bean = self.get_selected_bean() text = two_line_dialog(_("Change Radio Station name and path"), _("Url"), bean.text, bean.path) if not text[0] or not text[1]: return bean.add_text(text[0]) bean.add_path(text[1]) self.update_bean(bean)
def on_add_station(self): name, url = two_line_dialog("Add New Radio Station", "Enter Name and URL", "", "http://") with open(CACHE_RADIO_FILE, 'a') as f: f.write('#' + name + '\n' + url + '\n') bean = FModel(name, url).add_is_file(True) bean.type = FTYPE_RADIO self.append(bean)
def on_add_station(self): name, url = two_line_dialog(_("Add New Radio Station"), parent = self.controls.main_window, message_text1 = _("Enter station name and URL"), message_text2 = None, entry_text1 = None, entry_text2 = "http://") if not name or not url: return bean = self.get_selected_bean() new_bean = FModel(name, url).add_type(FTYPE_RADIO).add_is_file(True) if bean: if bean.is_file: new_bean.add_parent(bean.parent_level) else: new_bean.add_parent(bean.level) self.append(new_bean)
def on_edit_radio(self): bean = self.get_selected_bean() name, url = two_line_dialog(_("Edit Radio"), parent = self.controls.main_window, message_text1 = _("Enter new name and URL"), message_text2 = None, entry_text1=bean.text, entry_text2 = bean.path) if not name or not url: return bean.add_text(name) bean.add_path(url) rows = self.find_rows_by_element(self.UUID, bean.UUID) if rows: rows[0][self.text[0]] = name rows[0][self.path[0]] = url
def on_edit_radio(self): bean = self.get_selected_bean() name, url = two_line_dialog(_("Edit Radio"), parent=self.controls.main_window, message_text1=_("Enter new name and URL"), message_text2=None, entry_text1=bean.text, entry_text2=bean.path) if not name or not url: return bean.add_text(name) bean.add_path(url) rows = self.find_rows_by_element(self.UUID, bean.UUID) if rows: rows[0][self.text[0]] = name rows[0][self.path[0]] = url
def on_add_station(self): name, url = two_line_dialog( _("Add New Radio Station"), parent=self.controls.main_window, message_text1=_("Enter station name and URL"), message_text2=None, entry_text1=None, entry_text2="http://") if not name or not url: return bean = self.get_selected_bean() new_bean = FModel(name, url).add_type(FTYPE_RADIO).add_is_file(True) if bean: if bean.is_file: new_bean.add_parent(bean.parent_level) else: new_bean.add_parent(bean.level) self.append(new_bean)
def on_edit_radio(self): bean = self.get_selected_bean() name, url = two_line_dialog(_("Change Radio Station name and path"), _("Url"), bean.text, bean.path) if not name or not url: return if os.path.isfile(CACHE_RADIO_FILE) and os.path.getsize(CACHE_RADIO_FILE)>0: with open(CACHE_RADIO_FILE, 'r') as f: list = f.readlines() for i, line in enumerate(list): if line == "#" + bean.text + '\n' and list[i+1] == bean.path + '\n': list[i] = "#" + name + '\n' list[i+1] = url + '\n' with open(CACHE_RADIO_FILE, 'w') as f: f.writelines(list) bean.add_text(name) bean.add_path(url) self.update_bean(bean)
def on_edit_radio(self): bean = self.get_selected_bean() name, url = two_line_dialog(_("Change Radio Station name and path"), _("Url"), bean.text, bean.path) if not name or not url: return if os.path.isfile( CACHE_RADIO_FILE) and os.path.getsize(CACHE_RADIO_FILE) > 0: with open(CACHE_RADIO_FILE, 'r') as f: list = f.readlines() for i, line in enumerate(list): if line == "#" + bean.text + '\n' and list[ i + 1] == bean.path + '\n': list[i] = "#" + name + '\n' list[i + 1] = url + '\n' with open(CACHE_RADIO_FILE, 'w') as f: f.writelines(list) bean.add_text(name) bean.add_path(url) self.update_bean(bean)
def on_add_station(self): name, url = two_line_dialog("Add New Radio Station", "Enter Name and URL", "", "http://") bean = FModel(name, url).add_is_file(True) self.append(bean)