本文整理汇总了Python中gio.File.replace方法的典型用法代码示例。如果您正苦于以下问题:Python File.replace方法的具体用法?Python File.replace怎么用?Python File.replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gio.File
的用法示例。
在下文中一共展示了File.replace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __get_search_path_from
# 需要导入模块: from gio import File [as 别名]
# 或者: from gio.File import replace [as 别名]
def __get_search_path_from(self, uri):
self.__manager.response()
from gio import File
path = File(uri).get_parse_name()
path = path.replace(self.__home_folder, "").strip("/\\")
self.__manager.response()
return path
示例2: __set_label
# 需要导入模块: from gio import File [as 别名]
# 或者: from gio.File import replace [as 别名]
def __set_label(self):
from gio import File
uri = self.__editor.uri
if uri: folder = File(uri).get_parent().get_parse_name()
if not uri: folder = self.__editor.desktop_folder
folder = folder.replace(self.__editor.home_folder.rstrip("/"), "~")
self.__label.set_label(message % folder)
return False
示例3: __get_display_path_from
# 需要导入模块: from gio import File [as 别名]
# 或者: from gio.File import replace [as 别名]
def __get_display_path_from(self, uri):
self.__manager.response()
from gio import File
path = File(uri).get_parent().get_parse_name()
path = path.replace(self.__home_folder, "").strip("/\\")
from os.path import split
self.__manager.response()
if not path: return split(self.__home_folder)[-1].strip("/\\")
return path
示例4: __set_label
# 需要导入模块: from gio import File [as 别名]
# 或者: from gio.File import replace [as 别名]
def __set_label(self, fileinfo):
try:
if not self.__editor.uri: raise AssertionError
from gio import File
path = File(self.__editor.uri).get_parent().get_parse_name()
folder = path.replace(self.__editor.home_folder.rstrip("/"), "~")
self.__label.set_text(folder)
except AssertionError:
self.__label.set_text("Unknown")
return False
示例5: __get_dictionary
# 需要导入模块: from gio import File [as 别名]
# 或者: from gio.File import replace [as 别名]
def __get_dictionary(self, uri):
from gio import File
title = File(uri).get_basename() if uri else _("Unnamed Document")
ellipsize = self.__ellipsize
if uri: parent_path = File(uri).get_parent().get_parse_name()
if uri: parent_path = ellipsize(parent_path.replace(self.__editor.home_folder, "~").strip("/\\"))
fulltitle = "%s - (%s)" % (title, parent_path) if uri else title
fulltitle = title if len(title) > 30 else fulltitle
dictionary = {
"normal": fulltitle,
"modified": "*" + fulltitle,
"readonly": fulltitle + _(" [READONLY]"),
"loading": _("Loading %s ...") % title,
}
return dictionary
示例6: __replace
# 需要导入模块: from gio import File [as 别名]
# 或者: from gio.File import replace [as 别名]
def __replace(self, _file):
from gio import File
__file = File(_file).get_path()
return __file.replace(self.__path, "").lstrip("/"), File(_file).get_uri()
示例7: __update_names
# 需要导入模块: from gio import File [as 别名]
# 或者: from gio.File import replace [as 别名]
def __update_names(self, uri):
from gio import File
filename = File(uri).get_parse_name()
filename = filename.replace(self.__editor.home_folder.rstrip("/"), "~")
self.__default_name = filename
return False