本文整理汇总了Python中fsgs.FSGSDirectories.FSGSDirectories.get_default_search_path方法的典型用法代码示例。如果您正苦于以下问题:Python FSGSDirectories.get_default_search_path方法的具体用法?Python FSGSDirectories.get_default_search_path怎么用?Python FSGSDirectories.get_default_search_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fsgs.FSGSDirectories.FSGSDirectories
的用法示例。
在下文中一共展示了FSGSDirectories.get_default_search_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_remove_button
# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_default_search_path [as 别名]
def on_remove_button(self):
path = self.list_view.get_item(self.list_view.get_index())
search_path = LauncherSettings.get("search_path")
search_path = [x.strip() for x in search_path.split(";") if x.strip()]
for i in range(len(search_path)):
if search_path[i].startswith("-"):
if path == search_path[i][1:]:
# Already removed.
break
else:
if search_path[i] == path:
search_path.remove(search_path[i])
break
default_paths = FSGSDirectories.get_default_search_path()
if path in default_paths:
search_path.append("-" + path)
LauncherSettings.set("search_path", ";".join(search_path))
示例2: on_add_button
# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_default_search_path [as 别名]
def on_add_button(self):
search_path = LauncherSettings.get("search_path")
search_path = [x.strip() for x in search_path.split(";") if x.strip()]
path = fsui.pick_directory(parent=self.get_window())
if path:
for i in range(len(search_path)):
if search_path[i].startswith("-"):
if path == search_path[i][1:]:
search_path.remove(search_path[i])
break
else:
if search_path[i] == path:
# Already added.
break
else:
default_paths = FSGSDirectories.get_default_search_path()
if path not in default_paths:
search_path.append(path)
LauncherSettings.set("search_path", ";".join(search_path))
示例3: get_search_path
# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_default_search_path [as 别名]
def get_search_path(cls):
paths = FSGSDirectories.get_default_search_path()
search_path = LauncherSettings.get("search_path")
for p in search_path.split(";"):
p = p.strip()
if not p:
continue
elif p[0] == "-":
p = p[1:]
if p in paths:
paths.remove(p)
else:
if p not in paths:
paths.append(p)
# The Configurations dir is always scanned on startup (whenever
# modification time has changed). If we don't include it here too
# always, the result will be that the configs sometimes appear (on
# startup) and disappear (on scan).
if not FSGSDirectories.get_configurations_dir() in paths:
paths.append(FSGSDirectories.get_configurations_dir())
# Likewise, we force the Kickstarts directory to always be scanned.
if not FSGSDirectories.get_kickstarts_dir() in paths:
paths.append(FSGSDirectories.get_kickstarts_dir())
return paths