PyGobject(三十九)布局容器之PlacesSidebar

Gtk.PlacesSidebar

Gtk.PlacesSidebar是一个部件。用来显示位于文件系统中的如用户的主目录,用户的书签,和卷和驱动器等。这个widget用作Gtk.FileChooser一个工具,并且可以通过文件管理器和类似的程序中使用

继承关系

Gtk.PlacesSidebar是Gtk.ScrolledWindow的直接子类
这里写图片描述

Methods

方法修饰词方法名及参数
staticnew ()
add_shortcut (location)
get_local_only ()
get_location ()
get_nth_bookmark (n)
get_open_flags ()
get_show_connect_to_server ()
get_show_desktop ()
get_show_enter_location ()
get_show_other_locations ()
get_show_recent ()
get_show_trash ()
list_shortcuts ()
remove_shortcut (location)
set_drop_targets_visible (visible, context)
set_local_only (local_only)
set_location (location)
set_open_flags (flags)
set_show_connect_to_server (show_connect_to_server)
set_show_desktop (show_desktop)
set_show_enter_location (show_enter_location)
set_show_other_locations (show_other_locations)
set_show_recent (show_recent)
set_show_trash (show_trash)

Virtual Methods

Properties

NameTypeFlagsShort Description
local-onlyboolr/wWhether the sidebar only includes local files
locationGio.Filer/wThe location to highlight in the sidebar
open-flagsGtk.PlacesOpenFlagsr/wModes in which the calling application can open locations selected in the sidebar
populate-allboolr/wWhether to emit ::populate-popup for popups that are not menus
show-connect-to-serverboold/r/wWhether the sidebar includes a builtin shortcut to a ‘Connect to server’ dialog deprecated
show-desktopboolr/wWhether the sidebar includes a builtin shortcut to the Desktop folder
show-enter-locationboolr/wWhether the sidebar includes a builtin shortcut to manually enter a location
show-other-locationsboolr/wWhether the sidebar includes an item to show external locations
show-recentboolr/wWhether the sidebar includes a builtin shortcut for recent files
show-trashboolr/wWhether the sidebar includes a builtin shortcut to the Trash location

Signals

NameShort Description
drag-action-askThe places sidebar emits this signal when it needs to ask the application to pop up a menu to ask the user for which drag action to perform.
drag-action-requestedWhen the user starts a drag-and-drop operation and the sidebar needs to ask the application for which drag action to perform, then the sidebar will emit this signal.
drag-perform-dropThe places sidebar emits this signal when the user completes a drag-and-drop operation and one of the sidebar’s items is the destination.
mountThe places sidebar emits this signal when it starts a new operation because the user clicked on some location that needs mounting.
open-locationThe places sidebar emits this signal when the user selects a location in it.
populate-popupThe places sidebar emits this signal when the user invokes a contextual popup on one of its items.
show-connect-to-serverThe places sidebar emits this signal when it needs the calling application to present an way to connect directly to a network server. deprecated
show-enter-locationThe places sidebar emits this signal when it needs the calling application to present an way to directly enter a location.
show-error-messageThe places sidebar emits this signal when it needs the calling application to present an error message.
show-other-locationsThe places sidebar emits this signal when it needs the calling application to present a way to show other locations e.g. deprecated
show-other-locations-with-flagsThe places sidebar emits this signal when it needs the calling application to present a way to show other locations e.g.
unmountThe places sidebar emits this signal when it starts a new operation because the user for example ejected some drive or unmounted a mount.

例子

这里写图片描述
代码:

#!/usr/bin/env python3
# Created by xiaosanyu at 16/7/11
# section 056
# 
# author: xiaosanyu
# website: yuxiaosan.tk \
#          http://blog.youkuaiyun.com/a87b01c14
# created: 16/7/11

TITLE = "PlacesSidebar"
DESCRIPTION = """
Gtk.PlacesSidebar is a widget that displays a list of frequently-used places in the file system:
the user’s home directory, the user’s bookmarks, and volumes and drives.
This widget is used as a sidebar in Gtk.FileChooser and may be used by file managers and similar programs
"""

import gi

gi.require_version('Gtk', '3.0')
from gi.repository import Gtk


class PlacesSidebarWindow(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self, title="PlacesSidebar Demo")
        self.set_size_request(200, 200)
        widget = Gtk.PlacesSidebar()
        widget.props.show_enter_location = True
        widget.props.show_other_locations = True
        widget.props.populate_all = True
        self.add(widget)


def main():
    win = PlacesSidebarWindow()
    win.connect("delete-event", Gtk.main_quit)
    win.show_all()
    Gtk.main()


if __name__ == "__main__":
    main()

代码解析





代码下载地址:http://download.youkuaiyun.com/detail/a87b01c14/9594728

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sanxiaochengyu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值