本文整理汇总了Python中ui.UI.ui方法的典型用法代码示例。如果您正苦于以下问题:Python UI.ui方法的具体用法?Python UI.ui怎么用?Python UI.ui使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui.UI
的用法示例。
在下文中一共展示了UI.ui方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ui
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import ui [as 别名]
def ui ( self, context, parent = None,
kind = None,
view_elements = None,
handler = None ):
""" Creates a UI user interface object.
"""
if type( context ) is not dict:
context = { 'object': context }
ui = UI( view = self,
context = context,
handler = handler or self.handler or default_handler(),
view_elements = view_elements )
if kind is None:
kind = self.kind
ui.ui( parent, kind )
return ui
示例2: ui
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import ui [as 别名]
def ui(self, context, parent=None, kind=None, view_elements=None, handler=None, id="", scrollable=None, args=None):
""" Creates a **UI** object, which generates the actual GUI window or
panel from a set of view elements.
Parameters
----------
context : object or dictionary
A single object or a dictionary of string/object pairs, whose
facet attributes are to be edited. If not specified, the current
object is used.
parent : window component
The window parent of the View object's window
kind : string
The kind of window to create. See the **AKind** facet for
details. If *kind* is unspecified or None, the **kind**
attribute of the View object is used.
view_elements : ViewElements object
The set of Group, Item, and Include objects contained in the
view. Do not use this parameter when calling this method
directly.
handler : Handler object
A handler object used for event handling in the dialog box. If
None, the default handler for Facets UI is used.
id : string
A unique ID for persisting preferences about this user
interface, such as size and position. If not specified, no user
preferences are saved.
scrollable : Boolean
Indicates whether the dialog box should be scrollable. When set
to True, scroll bars appear on the dialog box if it is not large
enough to display all of the items in the view at one time.
"""
handler = handler or self.handler or default_handler()
if not isinstance(handler, Handler):
handler = handler()
if args is not None:
handler.set(**args)
if not isinstance(context, dict):
context = context.facet_context()
context.setdefault("handler", handler)
handler = context["handler"]
if self.model_view is not None:
context["object"] = self.model_view(context["object"])
self_id = self.id
if self_id != "":
if id != "":
id = "%s:%s" % (self_id, id)
else:
id = self_id
if scrollable is None:
scrollable = self.scrollable
if kind is None:
kind = self.kind
ui = UI(
view=self,
context=context,
handler=handler,
view_elements=view_elements,
title=self.title,
id=id,
kind=kind,
scrollable=scrollable,
)
ui.ui(parent)
return ui