py4sci

Luban

Table Of Contents

This Page

API

UI elements

Common Interface

This section explains the common interface of UI elements.

All ui elements can be instantiated by

>>> from luban.content.<Element> import <Element>
>>> element = <Element>( prop1=value1, prop2 = value2, ...)

where <Element> should be replaced by whatever element type you are trying to instantiate from.

For example, to create a form:

>>> from luban.content.Form import Form
>>> element = Form( prop1=value1, prop2 = value2, ...)

Each UI element type has some properties, and those properties can be either set using the constructor as shown above, or just using normal python attribute-setting syntax:

>>> element.prop1 = value1

The common properties that every element type has are

  • id: the unique id of the element.
  • name: the name of the element. it should be unique among siblings.
  • hidden: if true, the element is hidden
  • Class: class of the element. useful for styling

A luban user interface is a hierarchy of UI elements. This hierarchy can be created step by step by creating the elements higher in the hierarchy and adding children elements using the parent’s “add” method. For example, the following code create a “document” element and a “paragraph” element and add the “paragraph” element as a child:

>>> from luban.content.Document import Document
>>> doc = Document()
>>> from luban.content.Paragraph import Paragraph
>>> p =Paragraph()
>>> doc.add(p)

For convenience, some element containers might have member methods to create subelements directly. For example, the above code piece is equivalent to:

>>> from luban.content.Document import Document
>>> doc = Document()
>>> p = doc.paragraph()

The convention for these member methods is that the signature of the member method to create a subelement is the same as that of the constructor of that subelement type. For example, to create a Paragraph instance, the constructor is:

>>> p = Paragraph(id=..., text=...)

The ‘paragraph’ method of the Document type has the same signature, and you can create a paragraph of a document by

>>> p =doc.paragraph(id=..., title=...)

Please note that elements created from factory methods of element container are automatically added into the container, and you should not use add method to add the new element to the container again.

A common method of any element is “credential”:

>>> element.credential(username=..., ticket=...)

It creates a credential and attach it to the UI element. You should only create one credential for the UI element tree you are creating. Otherwise, which of the multiple credentials you created is used is undetermined.

To sum it up, the common properties of all elements are:

  • id: unique id of the element
  • name: name of the element. it should be unique among siblings
  • Class: class of the element. most useful for styling
  • hidden: if true, the element is hidden

The common methods are:

  • add (for element container to add an element)
  • credential (creates a credential)

The common event handlers are:

  • onclick: event handler that triggers when a mouse click happens on this element
  • oncreate (experimental): event handler that triggers when the widget is created on the interface
  • onkeypress (experimental): event handler that triggers when user stroke a key and this element is on focus’

In the following, UI elements are grouped into several categories. For each element type, description of what it is and its properties are presented.

Root node

Frame: root node of a luban user interface hierarchy

Frame element is the root element of a luban user interface.When a luban application starts up, an instance of Frame elementneeds to be established.

Properties:

  • title: Title of the frame
    • type: str

Factory methods for creating sub-elements:

  • document

Class information for Frame:

Inheritance diagram of luban.content.Frame

Simple containers

Simple containers can have normal elements as their contents.

Document: A simple element container with a title

Document is a simple element container. Instances of most widget types can be children of a document. A document widget has a title which can be empty.

Properties:

  • dockable: If true, the document will have a “dock” control. By clicking the “dock” control, a user can minimize the document to the dock. For this option to work, a “dock” widget must have already existed in your application frame.
    • type: bool
  • closable: If true, the document will have a “close” control which, when clicked, will close (destroy) the document
    • type: bool
  • collapsed: If true, the document is collapsed initially. “collapsable” must be true for this option to work
    • type: bool
  • title: Title of the document
    • type: str
  • collapsable: If true, the document will have a collapse/expand control and it will be collapsable
    • type: bool

Event handlers:

  • oncollapse:event handler for event “collapse”. The “collapse” event happens when a user collapse the document. Only valid if the document is collapsable

    • Example:

      >>> documentinstance.oncollapse = some_action
      
  • onexpand:event handler for event “expand”. The “expand” event happens when a user expand the document. Only valid if the document is collapsable

    • Example:

      >>> documentinstance.onexpand = some_action
      

Factory methods for creating sub-elements:

  • document
  • paragraph

Class information for Document:

Inheritance diagram of luban.content.Document

Dialog: A dialog that is a container of luban elements

A dialog is a simple element container that floats. In luban, all dialogs are modal; you can create non-modal windows by ‘dockable documents’, please refer to the ‘document’ element for more details. Instances of most widget types can be children of a dialog. A dialog usually has a title, and you should usually add an ‘OK’ or ‘Close’ button to close it.

Properties:

  • title: Title of the dialog
    • type: str
  • autoopen: If true, the dialog is opened when created
    • type: bool

Factory methods for creating sub-elements:

  • document
  • paragraph

Class information for Dialog:

Inheritance diagram of luban.content.Dialog

Form

Form is a container of form fields and a submit button.

Note: A form cannot have another form as its descendent.

Properties

  • title: title of the form
  • onsubmit: The action or a list of actions to be taken when this form is submitted

Factory methods for creating sub-elements

  • paragraph
  • text: creates a text field
  • password: creates a password field
  • selector: creates a selector field
  • radio: creates a radio box
  • textarea: creates a text area
  • checkbox: creates a check box
  • submitbutton: creates a submit button

Class information of Form:

Inheritance diagram of luban.content.Form

Common interface for form fields

Properties

  • name: name of the field
  • label: label of the field
  • help: help of the field
  • error: error of the field
  • value: value of the field
  • tip: tip of the field
  • onchange: event handler when input changes for this field
  • onfocus: event handler when this field gets focus
  • onblur: event handler when this field losts focus

Note that all form fields must have an ancestor that is a form for the form-submit action to work. Otherwise you need to use “onclick” handler to construct your own form-serialization and submission actions.

Class information of FormField, their common ancestor:

Inheritance diagram of luban.content.FormField

FormTextField

Properties: see Common interface for form fields

FormPasswordField

Properties: see Common interface for form fields

FormTextArea

Properties: see Common interface for form fields

FormCheckBox

Properties: see Common interface for form fields

  • checked: boolean to indicate whether the check box is checked
FormSelectorField

Properties: see Common interface for form fields

  • entries: enumerated list of 2-tuples. Each 2-tuple is (value, text). For example:

    [(0, 'Tiger'), (1, 'Monkey'), (2, 'Lion')]
    
  • selection: int – default selection index

FormRadioBox

FormRadioBox is a group of radio buttons.

Properties: see Common interface for form fields

  • entries: enumerated list of strings – choices to select from
  • selection: int – default selection’s index
FormSubmitButton`

Properties:

  • label: label of the field
  • help: help of the field

An example of using some of these Form Fields is:

import luban.content
form = luban.content.form()
textarea = form.textarea(label='text area')
textfield = form.text(label='text field')
passwordfield = form.password(label='password')
selectorfield = form.selector(entries=enumerate(['first choice', 'second choice']),
                              selection=0)
submitbutton = form.submitbutton(label='submit')

Basic widgets

This section contains some other basic widgets.

Paragraph: a paragraph of texts

Example 1:

import luban.content
sometext = luban.content.paragraph(text=['text here'])

Properties:

  • text: a list of sentences in the paragraph
    • type: list

Class information for Paragraph:

Inheritance diagram of luban.content.Paragraph

Button: A clickable button

A button is clickable. When clicked, an action will be triggered. It can have a label and an icon.

Properties:

  • label: label of the button
    • type: str
  • icon: icon of the button
    • type: str
  • tip: tip for the button that shows up when hovered
    • type: str

Class information for Button:

Inheritance diagram of luban.content.Button

Image: An image

An image widget displays an image

Properties:

  • path: path to the image
    • type: str

Class information for Image:

Inheritance diagram of luban.content.Image

Portlet: provides users access to dynamic content

A portlet usually is a small window. It contains items that, when clicked, lead to loading of dynamic content of UI. A portlet has a title which can be empty, and its children are of type PortletItem.

Properties:

  • title: Title of the portlet
    • type: str

Class information for Portlet:

Inheritance diagram of luban.content.Portlet

PortletItem: An item in a portlet

Properties:

  • selected: if True, this item is selected
    • type: bool
  • tip(experimental): tip for this portlet item that shows up when hovered
    • type: str
  • label: label of the portlet item
    • type: str
  • icon: icon of the portlet item
    • type: str

Event handlers:

  • onselect:event handler that triggers when this portlet item is selected. usually this event handler is preferred over “onclick” event handler for this widget

    • Example:

      >>> portletiteminstance.onselect = some_action
      

Class information for PortletItem:

Inheritance diagram of luban.content.PortletItem

Organizers:

Accordion: An accordion widget that shows one selected AccordionSection and collapse others

An accordion can be used to view some mutually exclusive items. Each item (section) has a title. An accordion item (section) can be parent of luban elements such as documents, which will show up when this item was selected.

Event handlers:

  • onchange:event handler that triggers when a different section was selected

    • Example:

      >>> accordioninstance.onchange = some_action
      

Factory methods for creating sub-elements:

  • section

Class information for Accordion:

Inheritance diagram of luban.content.Accordion

AccordionSection: one of the panes that can expand or collapse in an accordion

Properties:

  • label: label of the accordion section
    • type: str

Factory methods for creating sub-elements:

  • document
  • paragraph

Class information for AccordionSection:

Tabs: A container of tabs

A ‘tabs’ element is a container of ‘tab’ elements. The widget shows one tab at a time. Usually, when a tab is clicked, it shows up.

Example 1:

import luban.content
tabs = luban.content.tabs()
tabs.tab('tab1').paragraph(text=['tab1 text'])
tabs.tab('tab2').document(title='tab2')

Factory methods for creating sub-elements:

  • tab

Class information for Tabs:

Inheritance diagram of luban.content.Tabs

Tab: A tab in tabs

Properties:

  • label: label of this tab
    • type: str

Event handlers:

  • onselect:event handler that triggers when this tab is selected

    • Example:

      >>> tabinstance.onselect = some_action
      

Factory methods for creating sub-elements:

  • document
  • paragraph

Class information for Tab:

Splitter: A container of vertically or horizontally aligned sections

A ‘splitter’ splits a space into sections vertically or horizontally. The orientation of the splitter is defined by its attribute ‘orientation’.

Example 1:

# the follwoing code creates a splitter that is oriented horizontally and has 3 sections
import luban.content
splitter = luban.content.splitter(orientation='horizontal')
left = splitter.section()
middle = splitter.section()
right = splitter.section()
left.paragraph(text=['left'])
middle.paragraph(text=['middle'])
right.paragraph(text=['right'])

Properties:

  • orientation: Orientation of the splitter
    • type: str
    • allowed values: [‘vertical’, ‘horizontal’]

Factory methods for creating sub-elements:

  • section

Class information for Splitter:

Inheritance diagram of luban.content.Splitter

SplitSection: A section in a splitter

Properties:

  • size: deprecated
    • type: str

Factory methods for creating sub-elements:

  • document
  • paragraph

Class information for SplitSection:

Grid: In essence, a table used for positioning objects in rows and columns

A grid divides a space into cells. Widgets can be placed into a grid to achieve better control the positioning.

Example 1:

grid = luban.content.grid()

row0 = grid.row()
row0.cell().document(title='row 0, col 0: a document')
row0.cell().add(luban.content.form(title='row 0, col 1: a form'))

row1 = grid.row()
row1.cell().document(title='row 1, col 0')
row1.cell().add('row 1, col 1')
row1.cell().document(title='row 1, col 2')
row1.cell().add(luban.content.paragraph(text=['row1, col3']))

Class information for Grid:

Inheritance diagram of luban.content.Grid

Text-based documents:

HtmlDocument: A simple container of html text

A htmldocument widget can be used to display simple html-based content. It cannot handle complex html document with javascript, etc.

Properties:

  • text: Content of the html document
    • type: list
  • title: Please give a tip of property title
    • type: str

Class information for HtmlDocument:

Inheritance diagram of luban.content.HtmlDocument

ReStructuredTextDocument: A simple container of text in ReStructuredText format

A ReStructuredTextDocument widget can be used to display textin ReStructuredText format.

Properties:

  • text: Content of the document
    • type: list

Class information for ReStructuredTextDocument:

Inheritance diagram of luban.content.ReStructuredTextDocument

Graphics

Plot2D(experimental): Plot x-y curve(s)

A Plot2D widget displays a plot of x-y curve(s).

Example 1:

import luban.content
plot = luban.content.plot2d()
x = range(10)
y1 = x; y2 = [xi*xi for xi in x]
plot.curve(x=x, y=y1, label='curve1')
plot.curve(x=x, y=y2, label='curve2')

Properties:

  • curves: The x-y curves to display
    • type: referenceset
  • xticks: ticks for x axis
    • type: list
  • caption: caption of the plot
    • type: str
  • yticks: ticks for y axis
    • type: list

Class information for Plot2D:

Inheritance diagram of luban.content.Plot2D

Miscellaneous widgets

CodeEditor(experimental): A widget for editing a piece of code

A CodeEditor widget can be used to edit a piece of code.

Properties:

  • text: Text of the code
    • type: str
  • syntax: Syntax of the code. python, c++, etc
    • type: str

Event handlers:

  • onsave:event handler that triggers when user clicks the save button of the widget

    • Example:

      >>> codeeditorinstance.onsave = some_action
      
  • onchange:event handler that triggers when user changes the text in the widget and the widget lost focus

    • Example:

      >>> codeeditorinstance.onchange = some_action
      

Class information for CodeEditor:

Inheritance diagram of luban.content.CodeEditor

ProgressBar: An indicator of the progress of some work

A ProgressBar widget is an indicator of the progress of some work. Every few seconds (defined by attribute ‘skip’), a ‘checking’ event will trigger and the event handler for the ‘checking’ event has toload the progress status and percentage from the controller, in order to update the progress bar. When the progress is 100%, a ‘finished’ event will trigger and the ‘checking’ event will not fire anymore. Before a progressbar is ‘finished’, it can be canceled and, when canceled, a ‘canceled’ event will trigger.

Properties:

  • status: Please give a tip of property status
    • type: str
  • skip: Please give a tip of property skip
    • type: int
  • percentage: Please give a tip of property percentage
    • type: int

Event handlers:

  • onchecking:Please give a tip of property onchecking

    • Example:

      >>> progressbarinstance.onchecking = some_action
      
  • oncanceled:Please give a tip of property oncanceled

    • Example:

      >>> progressbarinstance.oncanceled = some_action
      
  • onfinished:Please give a tip of property onfinished

    • Example:

      >>> progressbarinstance.onfinished = some_action
      

Class information for ProgressBar:

Inheritance diagram of luban.content.ProgressBar

Toolbar: A simple container of buttons

A toolbar is a simple, horizontal container. Mostly it contains buttons.

Example 1:

import luban.content
toolbar = luban.content.toolbar()
b1 = toolbar.button(label='button1')
b2 = toolbar.button(label='button2')
toolbar.spacer()
b3 = toolbar.button(label='button3')

Factory methods for creating sub-elements:

  • button
  • spacer

Class information for Toolbar:

Inheritance diagram of luban.content.Toolbar

NewsTicker(experimental): Displays news headers periodically

A newsticker widget rotates headers of news items. A news item will stay a few seconds (defined by attribute ‘delay’). A newsticker will triggers ‘refresh’ event every few moments (defined by attribute ‘refreshtime’), which can be used to retrieve a new set of news items, for example.

Properties:

  • title: Title of the widget
    • type: str
  • refreshtime: time elapsed before the refresh event fires. unit: seconds
    • type: int
  • delay: idle time before the next news item shows up. unit: seconds
    • type: int

Event handlers:

  • onrefresh:event handler that triggers at refresh event

    • Example:

      >>> newstickerinstance.onrefresh = some_action
      

Class information for NewsTicker:

Inheritance diagram of luban.content.NewsTicker

AppMenuBar: Application menu bar

Factory methods for creating sub-elements:

  • menu
  • item

Class information for AppMenuBar:

Inheritance diagram of luban.content.AppMenuBar

AppMenu: a menu in the application menu bar or a submenu in a menu in the application menu bar

Properties:

  • tip(experimental): tip for the menu that shows up when hovered
    • type: str
  • label: label of the menu
    • type: str
  • icon(experimental): icon of the menu
    • type: str

Factory methods for creating sub-elements:

  • menu
  • item

Class information for AppMenu:

AppMenuItem(experimental): A menu item in a menu in the application menu bar

Properties:

  • label: label of the menu item
    • type: str
  • icon(experimental): icon of the menu item
    • type: str
  • tip(experimental): tip for the menu item that shows up when hovered
    • type: str

Class information for AppMenuItem:

TreeView (experimental)

A TreeView is an expandable/collapsible tree containing TreeViewBranch and TreeViewLeaf objects.

Properties

  • label: label of the treeview
  • root: a TreeViewBranch – the root branch
  • draggable: boolean – whether the leaves/branches are draggable
  • onclick: The action or a list of actions to be taken when this item is clicked

Factory methods for creating sub-elements

  • setRoot: creates a new TreeViewBranch and sets that as the root branch

Note: a treeview only has one root. All further branches and leaves must be under this root branch.

TreeViewBranch

TreeViewBranch is a branch in a TreeView and can only be added to TreeViews or other TreeViewBranch objects.

Properties

  • label: text label of this branch
  • icon: icon of this branch
  • tip: tip of this branch
  • onclick: The action or a list of actions to be taken when this item is clicked

Factory methods for creating sub-elements

  • branch: create a new branch under this branch
  • leaf: create a new leaf under this branch
TreeViewLeaf

TreeViewLeaf is a leaf on a TreeViewBranch. It must be added to a TreeViewBranch.

Properties: See properties of TreeViewBranch

Example usage of TreeView, TreeViewBranch, and TreeViewLeaf:

import luban.content
treeview = luban.content.treeview()
root = treeview.setRoot(label='root')
branch1 = root.branch(label='branch 1')
leaf = branch1.leaf(label='leaf')

Class information for TreeView, TreeViewBranch TreeViewLeaf:

Inheritance diagram of luban.content.TreeView

Table

A Table is a grid with columns of cells.

Properties:

  • model: a Model class (see below)
  • view: a View instance (see below)
  • data: a list of lists – contains the data in the table’s cells
  • oncellchanged: The action or a list of actions to be performed when a cell is edited
Model

Model describes the data model this table is used to represent. In the model you describe the available “measures” of the model by specifying their names and types and other properties using descriptors (see example below).

Properties:

  • row_identifiers: list of strings – names of the columns that are needed to uniquely identify entries in the table. For example, if entries in both columns named ‘a’ and ‘b’ are needed before a certain row can be identified, row_identifiers would be [‘a’, ‘b’]
View

A View contains several columns.

Properties:

  • editable: boolean – whether this table is editable or not (default=False)
  • columns: list of Column instances
Column

A Column describes a column in a table, and is contained in columns in View.

Properties:

  • editable: boolean – whether this column is editable or not (default=False)
  • label: label of the column
  • measure: string – matches the name property of the measure descriptors in Model
  • hidden: boolean – whether this column is hidden or not

Example usage of Table:

from luban.content.table import Table, Model, View

# create a model class
class model(Model):

    firstname = Model.descriptors.str(name='firstname')
    lastname = Model.descriptors.str(name='lastname')

# create a view
view = View( columns =  [ View.Column(label='First Name', measure='firstname'),
                          View.Column(label='Last Name', measure='lastname',
                                      editable=True) ],
            editable=True)

# enter data
data = [('John', 'Smith'),
        ('Jane', 'Doe')]

# create the table
table = Table(model=model, data=data, view=view)

MatterBuilder(experimental): widget to show a atomic structure

MatterBuilder can be used to show configurations of atomic sytems such as crystals, molecules, or complex disordered materials.

Properties:

  • atoms: Please give a tip of property atoms
    • type: lists
  • lattice: Please give a tip of property lattice
    • type: lists

Class information for MatterBuilder:

Special elements

Credential

Properties:

  • username
  • ticket

Class information for Credential:

Inheritance diagram of luban.content.Credential

Actions

Accessing controller

Calling the methods described below returns an Action instance. This Action instance can be assigned to the ‘onclick’ attribute of an element, for example.

load: load actions

>>> load(actor=..., routine=..., **kwds)

actor is a string that is the name of the actor. routine is a string that is the name of the method to call in the actor.

notify: notify controller that an event happens to an element

This method must be called by a selector that selects an UI element.

>>> selector.notify(event, actor=..., routine=..., **kwds)

event is a string that is the name of the event. actor is a string that is the name of the actor. routine is a string that is the name of the method in that actor to call.

submit: submit form and load actions

>>> formselector.submit(actor=..., routine=..., **kwds)

formselector should be a selector to select a form. actor should be a string that is the name of the actor. routine is a string that is the name of the method to call in that actor.

Selector

select: select a ui element

>>> select(id=...)
>>> select(element=...)

select returns the element instance as a selector, finding it by either its id, a property of the element, or the element instance (if the element python instance is available in local namespace). You can use this to select a certain element to then perform actions on it.

For example, if you had a document with name document and id ‘document1’:

import luban.content
document = luban.content.document(title='title', id='document1')

You could select this document by calling either:

select(id='document1')

or:

select(element=document)

You can then call the actions described below on the selected element (below, called ‘selector’).

find: find a descendent element

>>> select(id=...).find(name=...)

“find” can find a descendent of an ancestor element given the name of the descendent. The ancestor element itself must be specified by using a selector method. The name of the descendent must be unique among all the descendents.

Common actions for elements

In the below samples, selector refers to the selected element. Calling each of the methods described below returns an Action instance. This Action instance can be assigned to the ‘onclick’ attribute of an element, for example.

show/hide: show/hide this element

enable/disable: enable/disable this element

This only has effects on form fields at this moment. You can enable/disable any individual form field. You can also enable/disable any element container, which will enable/disable all form fields inside the container.

empty: empty my content

>>> selector.empty()

This removes all children of the selected element.

replaceContent: replace my content with new content

>>> selector.replaceContent(newcontent)

newcontent is some element that you wish to replace the selected element with.

This replaces the selected content with newcontent.

append: append an element (hierarchy) to my content

>>> selector.append(newelement)

Add a child element, newelement, to the selected element. For example, add another text field to a form, or add another button to a document.

destroy: destroy me

>>> selector.destroy()

This removes the selected element.

focus: set focus

>>> selector.focus()

This action switch the focus to the selected element.

setAttr: set attribute of me

>>> selector.setAttr(attr1=value1, attr2=value2)

Use this to set the properties of an element. This method works for most attributes (NOT include event handlers such as onclick) of most element types. But the following are exceptions

  • TreeView and its node types
  • ProgressBar
  • ReSTDocument (obsolete)
  • ReStructuredTextDocument
  • AppMenuBar

getAttr: get attribute of me

>>> selector.getAttr(attrname)

Use this to get the value of an attribute of an element.

Currently, this action is only implemented for form field types (FormTextField, etc).

addClass: add a class

>>> selector.addClass(newclass)

removeClass: remove a class

>>> selector.removeClass(klass)

Credential manipulation

createCredential

>>> from luban.content import createCredential
>>> action = createCredential(username=..., ticket=...)

updateCredential

>>> from luban.content import updateCredential
>>> action = updateCredential(username=..., ticket=...)

removeCredential

>>> from luban.content import removeCredential
>>> action = removeCredential()

Special actions of gui elements

All actions of this kind have a similar signature:

>>> selector.<elementtype>(<actiontype>, **parameters)

For example, to call “showError” on a formfield, do:

>>> selector.formfield('showError', message=...)

Here, the method name “formfield” indicates that the action is done to a form field, and the first argument “showError” indicates what action to take, and the keyword “message” specifies the argument for the action.

In the following, each section is for one element type, and actions for that element type are listed.

form

The actions here are good for forms.

  • clearErrors: remove all error alerts in the form.

formfield

The actions here are good for form fields.

  • showError: Displays an error message. Takes a string parameter that is the message, and should be called on a selected FormField element.

    Example usage:

    >>> action = select(id='passwordfield').formfield('showError', message='error!')
    

    where passwordfield is the id of a FormPasswordField, for example.

The following are good for formselectorfield.

  • addOption: add a new option to the selector

treeview

The actions here are good for TreeView.

  • setRoot: set the root node.

    Example usage:

    >>> action = select(id='treeview').treeview('setRoot', root=...)
    
  • addBranch: add a new branch

    Example usage:

    >>> action = select(id='treeview').treeview('addBranch', referencenode=..., newnode=..., position=...)
    
  • referencenode: selector of reference node
  • newnode: new node
  • position: options are “before”, “after”, or <index> (an integer)
  • before/after: meaning the new node is before or after the reference node
  • <index>: This option means that the reference node will be the parent node into which the new node will be added. The number given would be the index of the insert position among the children of the reference node
  • removeNode: remove a node

    Example usage:

    >>> action = select(id='treeview').treeview('removeNode', node=...)
    
  • node: the node to be removed. If not given, means to remove the current selected node
  • selectNode: select a node

    Example usage:

    >>> action = select(id='treeview').treeview('selectNode', node=...)
    
  • node: the node to be selected.

table

  • getIdentifiersForCheckedRows: get identifiers for checked rows.

    Example usage:

    >>> action = select(id='table').table('getIdentifiersForCheckedRows', colname='selected')
    

accordion

dialog

  • open: open the dialog

    Example usage:

    >>> action = select(id='dialog').open()
    
  • close: close the dialog

    Example usage:

    >>> action = select(id='dialog').close()
    

tab

  • select: select this tab

portletitem

  • select: select this portletitem

Other actions

Here are some addtional actions.

  • alert: Displays a warning message. Takes a string parameter that is the message.

Example usage:

from luban.content import alert
warning = alert('Warning!')
button.onclick = warning

where button is a luban.content.Button, for example.

director

You can think of director as the “controller” in the MVC.

retrieveVisual

director.retrieveVisual(name)

loads the odb file <luban_project>/content/components/visuals/<name>.odb, and calls the method “visual” using “director” itself as the argument, and returns the result of the method call.