本文整理匯總了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