本文整理匯總了Python中foobnix.gui.model.FModel.add_parent方法的典型用法代碼示例。如果您正苦於以下問題:Python FModel.add_parent方法的具體用法?Python FModel.add_parent怎麽用?Python FModel.add_parent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類foobnix.gui.model.FModel
的用法示例。
在下文中一共展示了FModel.add_parent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_playlist
# 需要導入模塊: from foobnix.gui.model import FModel [as 別名]
# 或者: from foobnix.gui.model.FModel import add_parent [as 別名]
def create_playlist(self):
name = one_line_dialog(_("Create new playlist"), self.controls.main_window, message_text1=_("Enter playlist name"))
if not name:
return
bean = self.get_selected_bean()
folder_bean = FModel(name)
if bean:
if bean.is_file:
folder_bean.add_parent(bean.parent_level)
else:
folder_bean.add_parent(bean.level)
self.append(folder_bean)
示例2: create_folder
# 需要導入模塊: from foobnix.gui.model import FModel [as 別名]
# 或者: from foobnix.gui.model.FModel import add_parent [as 別名]
def create_folder(self, a):
model, tree_path, row = a # @UnusedVariable
file_path = row[self.path[0]]
new_folder_path = create_folder_dialog(file_path)
bean = FModel(os.path.basename(new_folder_path), new_folder_path).add_is_file(False)
if os.path.isfile(file_path):
bean.add_parent(row[self.parent_level[0]])
elif os.path.isdir(file_path):
bean.add_parent(row[self.level[0]])
else:
logging.error("So path doesn't exist")
self.tree_append(bean)
self.save_tree()
示例3: on_add_station
# 需要導入模塊: from foobnix.gui.model import FModel [as 別名]
# 或者: from foobnix.gui.model.FModel import add_parent [as 別名]
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)
示例4: auto_add_user_station
# 需要導入模塊: from foobnix.gui.model import FModel [as 別名]
# 或者: from foobnix.gui.model.FModel import add_parent [as 別名]
def auto_add_user_station(self):
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()
parent_level_for_depth = {}
previous = {"bean": None, "depth": 0, "name": '', "url": ''}
for line in list:
depth = self.simbol_counter(line, '-')
try:
name = line[depth : line.index('#')]
except ValueError, e:
logging.warning('\'#\' ' + str(e) + ' in line \"' + line + '\"')
continue
url = line[line.index('#') + 1 : -1]
bean = FModel(name)
if url:
bean.add_is_file(True).add_path(url).add_type(FTYPE_RADIO)
if previous["depth"] < depth:
bean.add_parent(previous["bean"].level)
elif previous["depth"] > depth:
bean.add_parent(parent_level_for_depth[depth])
else:
if previous["bean"]:
bean.add_parent(previous["bean"].parent_level)
self.append(bean)
parent_level_for_depth[depth] = bean.parent_level
previous = {"bean": bean, "depth": depth, "name": name, "url": url}