本文整理匯總了Python中gio.File.get_uri_scheme方法的典型用法代碼示例。如果您正苦於以下問題:Python File.get_uri_scheme方法的具體用法?Python File.get_uri_scheme怎麽用?Python File.get_uri_scheme使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gio.File
的用法示例。
在下文中一共展示了File.get_uri_scheme方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _get_g_file
# 需要導入模塊: from gio import File [as 別名]
# 或者: from gio.File import get_uri_scheme [as 別名]
def _get_g_file(self, uri):
if type(uri) is not str:
raise TypeError, 'unexpected "%s"' % repr(uri)
# Resolve or not ?
# Your folder is None => new File
if self._folder is None:
g_file = File(uri)
else:
# Split the uri
scheme, authority, path, query, fragment = urlsplit(uri)
# A scheme or an authority => new File
# XXX This is not truly exact:
# we can have a scheme and a relative path.
if scheme or authority:
g_file = File(uri)
else:
# Else we resolve the path
g_file = self._folder.resolve_relative_path(uri)
# Automount a ftp server ?
if g_file.get_uri_scheme () == 'ftp':
# Mount the server
AnonymousConnection(g_file)
return g_file