当前位置: 首页>>代码示例>>Python>>正文


Python FModel.add_parent方法代码示例

本文整理汇总了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)
开发者ID:zablotski,项目名称:foobnix,代码行数:14,代码来源:virtual_tree.py

示例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()
开发者ID:strogo,项目名称:foobnix,代码行数:15,代码来源:navigation_tree.py

示例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)
开发者ID:Andresteve07,项目名称:foobnix,代码行数:19,代码来源:radio_tree.py

示例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}
开发者ID:Andresteve07,项目名称:foobnix,代码行数:30,代码来源:radio_tree.py


注:本文中的foobnix.gui.model.FModel.add_parent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。