当前位置: 首页>>代码示例>>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;未经允许,请勿转载。