当前位置: 首页>>代码示例>>Python>>正文


Python BaseView.attach_slave方法代码示例

本文整理汇总了Python中kiwi.ui.views.BaseView.attach_slave方法的典型用法代码示例。如果您正苦于以下问题:Python BaseView.attach_slave方法的具体用法?Python BaseView.attach_slave怎么用?Python BaseView.attach_slave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kiwi.ui.views.BaseView的用法示例。


在下文中一共展示了BaseView.attach_slave方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: BaseView

# 需要导入模块: from kiwi.ui.views import BaseView [as 别名]
# 或者: from kiwi.ui.views.BaseView import attach_slave [as 别名]
from kiwi.ui.views import BaseView, SlaveView
from kiwi.ui.objectlist import Column
from kiwi.ui.gadgets import quit_if_last

# Main window
addressbook = BaseView(gladefile="addressbook",
                       widgets=("add", "del"),
                       delete_handler=quit_if_last)

## Slave Components:
# Entry editor GUI component
entry_editor = SlaveView(toplevel=addressbook,
                         widgets=("name", "address", "phone"),
                         gladefile="entry_editor")
# Entries list GUI component
list_entries = SlaveView(toplevel=addressbook,
                         widgets=("table",),
                         gladefile="list_entries")

list_entries.table.set_columns([Column("name", title="Name"),
                                Column("address", title="Address"),
                                Column("phone", title="Phone")])

## Attach slaves to main window
addressbook.attach_slave("entry_editor", entry_editor)
addressbook.attach_slave("list", list_entries)

addressbook.show_all()
addressbook.focus_topmost()
gtk.main()
开发者ID:barbieri,项目名称:barbieri-playground,代码行数:32,代码来源:addressbook.py

示例2: News

# 需要导入模块: from kiwi.ui.views import BaseView [as 别名]
# 或者: from kiwi.ui.views.BaseView import attach_slave [as 别名]
        "Reverend CyberSatan",
        "http://www.pigdog.org/auto/TheCorporateFuck/link/2683.html"),
    ("Those Crazy Dutch Have Resurrected Elvis",
        "Miss Conduct",
        "http://www.pigdog.org/auto/viva_la_musica/link/2678.html")
]

class News(SlaveView):
    def __init__(self):
        model = gtk.ListStore(str, str)
        treeview = gtk.TreeView(model)
        renderer = gtk.CellRendererText()
        col1 = gtk.TreeViewColumn('News', renderer, text=0)
        col2 = gtk.TreeViewColumn('Author', renderer, text=1)
        treeview.append_column(col1)
        treeview.append_column(col2)
        treeview.get_selection().set_mode(gtk.SELECTION_BROWSE)
        for item in news:
            model.append(item[:-1])
        SlaveView.__init__(self, treeview)

news = News()

shell = BaseView(gladefile="news_shell", delete_handler=quit_if_last)
shell.attach_slave("placeholder", news)

news.show_all()
news.focus_toplevel() # explained next section, don't worry
shell.show()
gtk.main()
开发者ID:Schevo,项目名称:kiwi,代码行数:32,代码来源:news.py

示例3: print

# 需要导入模块: from kiwi.ui.views import BaseView [as 别名]
# 或者: from kiwi.ui.views.BaseView import attach_slave [as 别名]
				command = [TERMINAL, "-e", pacman]
			else:
				pacman = "su --command='pacman -S %s && read'" % package.to_install
				command = [TERMINAL, "-e", pacman]
			out, errors = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
			if errors:
				raise errors
		else:
			print("No package to install")
		

shell = BaseView(gladefile="gpacnet", delete_handler=quit_if_last)

local = Local()
category = Category()
package = Package()
install = Install()


shell.attach_slave("category", category)
shell.attach_slave("package", package)



category.show_all()
category.focus_topmost()
package.show_all()
package.focus_topmost()
shell.show()
gtk.main()
开发者ID:trojkat,项目名称:gpacnet,代码行数:32,代码来源:gpacnet.py


注:本文中的kiwi.ui.views.BaseView.attach_slave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。