當前位置: 首頁>>代碼示例>>Python>>正文


Python File.query_info方法代碼示例

本文整理匯總了Python中gio.File.query_info方法的典型用法代碼示例。如果您正苦於以下問題:Python File.query_info方法的具體用法?Python File.query_info怎麽用?Python File.query_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gio.File的用法示例。


在下文中一共展示了File.query_info方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __select

# 需要導入模塊: from gio import File [as 別名]
# 或者: from gio.File import query_info [as 別名]
	def __select(self):
		try:
			if not self.__editor.uri: raise ValueError
			from gio import File 
			gfile = File(self.__editor.uri)
			folder_uri = gfile.get_parent().get_uri()
			if folder_uri != self.__chooser.get_current_folder_uri():
				self.__chooser.set_current_folder_uri(folder_uri)
			fileinfo = gfile.query_info("standard::display-name")
			self.__chooser.set_current_name(fileinfo.get_display_name())
		except ValueError:
			self.__chooser.set_current_name(_("Unsaved Document"))
			self.__chooser.set_current_folder(self.__editor.desktop_folder)
		return False
開發者ID:mystilleef,項目名稱:scribes,代碼行數:16,代碼來源:URISelector.py

示例2: get_gicon_for_file

# 需要導入模塊: from gio import File [as 別名]
# 或者: from gio.File import query_info [as 別名]
def get_gicon_for_file(uri):
	"""
	Return a GIcon representing the file at
	the @uri, which can be *either* and uri or a path

	return None if not found
	"""

	gfile = File(uri)
	if not gfile.query_exists():
		return None

	finfo = gfile.query_info(FILE_ATTRIBUTE_STANDARD_ICON)
	gicon = finfo.get_attribute_object(FILE_ATTRIBUTE_STANDARD_ICON)
	return gicon
開發者ID:cjparsons74,項目名稱:kupfer,代碼行數:17,代碼來源:icons.py

示例3: get_thumbnail_for_file

# 需要導入模塊: from gio import File [as 別名]
# 或者: from gio.File import query_info [as 別名]
def get_thumbnail_for_file(uri, width=-1, height=-1):
	"""
	Return a Pixbuf thumbnail for the file at
	the @uri, which can be *either* and uri or a path
	size is @width x @height

	return None if not found
	"""

	gfile = File(uri)
	if not gfile.query_exists():
		return None
	finfo = gfile.query_info(FILE_ATTRIBUTE_THUMBNAIL_PATH)
	thumb_path = finfo.get_attribute_byte_string(FILE_ATTRIBUTE_THUMBNAIL_PATH)

	return get_pixbuf_from_file(thumb_path, width, height)
開發者ID:cjparsons74,項目名稱:kupfer,代碼行數:18,代碼來源:icons.py

示例4: get_gicon_for_file

# 需要導入模塊: from gio import File [as 別名]
# 或者: from gio.File import query_info [as 別名]
def get_gicon_for_file(uri):
    """
    Return a GIcon representing the file at
    the @uri, which can be *either* and uri or a path

    return None if not found
    """

    gfile = File(uri)
    if not gfile.query_exists():
        return None

    finfo = gfile.query_info(FILE_ATTRIBUTE_STANDARD_ICON)
    gicon = finfo.get_attribute_object(FILE_ATTRIBUTE_STANDARD_ICON)
    # very manually override generic folder icon name
    if isinstance(gicon, ThemedIcon):
        if gicon.get_names()[0] == "inode-directory":
            return ThemedIcon("folder")
    return gicon
開發者ID:pbx,項目名稱:kupfer,代碼行數:21,代碼來源:icons.py


注:本文中的gio.File.query_info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。