vi.widgets

Submodules

Package Contents

Classes

Accordion

TopBarWidget

Provides the top-bar of VI

ListWidget

Provides the interface to list-applications.

EditWidget

ToolTip

Small utility class for providing tooltips

DataTable

Provides kind of MVC on top of SelectTable.

Search

SideBar

UserLogoutMsg

TaskWidget

TaskSelectWidget

InternalEdit

ExportCsv

ExportCsvStarter

TreeWidget

Base Widget that renders a tree.

TreeBrowserWidget

Base Widget that renders a tree.

HierarchyWidget

A Hierarchy is a Tree without leaf distinction!

FileWidget

Base Widget that renders a tree.

class vi.widgets.Accordion

Bases: flare.html5.Form

addSegment(ident, title=None, directAdd=False, *args)
clear()
buildAccordion(order=None)
Parameters:

sort – None: sorted by Bones, “asc”:ascending, “desc”:descending, dict: {“category”:index,…}

Returns:

class vi.widgets.TopBarWidget

Bases: flare.html5.Header

Provides the top-bar of VI

invoke()
setTitle(title=None)
onClick(event)
setCurrentModulDescr(descr='', iconURL=None, iconClasses=None, path=None)
class vi.widgets.ListWidget(module, filter=None, columns=None, filterID=None, filterDescr=None, batchSize=None, context=None, autoload=True, *args, **kwargs)

Bases: flare.html5.Div

Provides the interface to list-applications. It acts as a data-provider for a DataTable and binds an action-bar to this table.

setSelector(callback, multi=True, allow=None)

Configures the widget as selector for a relationalBone and shows it.

selectorReturn()

Returns the current selection to the callback configured with setSelector.

tableInitialization(*args, **kwargs)

Instantiates the table :param args: ListWidget Parameter :param kwargs: ListWidget Parameter :return:

setAmount(amount)
setPage(page=0)

sets targetpage. if not enougth loadedpages this pages will be requested :param page: sets targetpage :return:

onRequestingFinished(*args, **kwargs)
onClick(event)
setTableActionBar()
getDefaultEntryActions()

Returns the list of actions available in our actionBar

getActions()

Returns the list of actions available in our actionBar

getAllActions(view=None)

Returns the list of actions available in the action bar.

showErrorMsg(req=None, code=None)

Removes all currently visible elements and displayes an error message

onNextBatchNeeded()

Requests the next rows from the server and feed them to the table.

onAttach()
onDetach()
onDataChanged(module, *args, **kwargs)

Refresh our view if element(s) in this module have changed

requestStructure()
receivedStructure(resp)
reloadData()

Removes all currently displayed data and refetches the first batch from the server.

setFilter(filter, filterID=None, filterDescr=None)

Applies a new filter.

setContext(context)

Applies a new context.

getFilter()
updateEmptyNotification()
onCompletion(req)

Pass the rows received to the datatable. :param req: The network request that succeed.

setFields(fields)
getFields()
onSelectionActivated(table, selection)
activateSelection()
static canHandle(moduleName, moduleInfo)
class vi.widgets.EditWidget(module, applicationType, key=0, node=None, skelType=None, clone=False, hashArgs=None, context=None, logAction='Entry saved!', skel=None, *args, **kwargs)

Bases: flare.html5.Div

appList = 'list'
appHierarchy = 'hierarchy'
appTree = 'tree'
appSingleton = 'singleton'
__editIdx_ = 0
onDetach()
onAttach()
onChange(event)
onBoneChange(bone)
showErrorMsg(req=None, code=None)

Removes all currently visible elements and displays an error message

reloadData()
_save(data)

Creates the actual NetworkService request used to transmit our data. If data is None, it fetches a clean add/edit form.

Parameters:

data (dict or None) – The values to transmit or None to fetch a new, clean add/edit form.

clear()

Removes all visible bones/forms/fieldsets.

closeOrContinue(sender=None)
doCloneHierarchy(sender=None)
cloneComplete(req)
setData(request=None, data=None, askHierarchyCloning=True)

Rebuilds the UI according to the skeleton received from server

Parameters:
  • request (NetworkService) – A finished NetworkService request

  • data (dict) – The data received

doSave(closeOnSuccess=False, *args, **kwargs)

Starts serializing and transmitting values to the server.

class vi.widgets.ToolTip(shortText='', longText='', *args, **kwargs)

Bases: flare.html5.Div

Small utility class for providing tooltips

onClick(event)
_setDisabled(disabled)
_getDisabled()
class vi.widgets.DataTable(_loadOnDisplay=False, *args, **kwargs)

Bases: flare.html5.Div

Provides kind of MVC on top of SelectTable.

recalcHeight(*args, **kwargs)
setDataProvider(obj)

Register’s ‘obj’ as the provider for this table. It must provide a onNextBatchNeeded function, which must fetch and feed new rows using add() or reset the dataProvider to None if no more rows are available. Notice: If the bottom of the table is reached, onNextBatchNeeded will only be called once. No further calls will be made until add() or setDataProvider() has been called afterwards.

onCursorMoved(table, row)

Ensure the table scrolls according to the position of its cursor

getRowCount()

Returns the total amount of rows currently known. :returns: int

add(obj)

Adds an row to the model :param obj: Dictionary of values for this row :type obj: dict

extend(objList)

Adds multiple rows at once. Much faster than calling add() multiple times.

testIfNextBatchNeededImmediately()

Test if we display enough entries so that our contents are scrollable. Otherwise, we’ll never request a second batch

remove(objOrIndex)

Removes ‘obj’ from the table. ‘obj’ may be an row-index or an object recieved by any eventListener. It _cannot_ be any original object passed to ‘add’ - it _must_ be recived by an eventListener!

clear(keepModel=False)

Flushes the whole table.

_renderObject(obj, tableIsPrepared=False)

Renders the object to into the table. Does nothing if the list of _shownFields is empty. :param obj: Dictionary of values for this row :type obj: dict

rebuildTable()

Rebuilds the entire table. Useful if something fundamental changed (ie. the cell renderer or the list of visible fields)

setShownFields(fields)

Sets the list of _shownFields. This causes the whole table to be rebuild. Be careful if calling this function often on a large table! :param fields: List of model-keys which will be displayed. :type fields: list

onScroll(event)

Check if we got a scroll event and need to fetch another set of rows from our dataProvider

onSelectionChanged(table, rows, *args, **kwargs)

Re-emit the event. Maps row-numbers to actual models.

onSelectionActivated(table, rows)

Re-emit the event. Maps row-numbers to actual models.

onTableChanged(table, rowCount, *args, **kwargs)

Re-emit the event.

getCurrentSelection()

Override the getCurrentSelection method to yield actual models, not row-numbers.

setCellRender(field, render)

Sets the render for cells of ‘field’ to render. A cell render receives the data for a given cell and returns the appropriate widget to display that data for the table.

setCellRenders(renders)

Like setCellRender, but sets multiple renders at one. Much faster than calling setCellRender repeatedly.

activateSelection()

Emits the selectionActivated event if there’s currently a selection

class vi.widgets.Search(*args, **kwargs)

Bases: flare.html5.Div

doSearch(*args, **kwargs)
resetSearch()
onKeyDown(event)
resetLoadingState()
reevaluate()
focus()
class vi.widgets.SideBar(*args, **kwargs)

Bases: flare.html5.Div

onAttach()
onDetach()
setWidget(widget)
getWidget()
close(*args, **kwargs)
class vi.widgets.UserLogoutMsg(*args, **kwargs)

Bases: flare.popup.Popup

pollInterval = 120
checkInterval
visibilityChanged(e)
stopInterval()
hideMessage()

Make this popup invisible

showMessage()

Show this popup

showLoginWindow(*args, **kwargs)

Return to the login window.

checkForSuspendResume(*args, **kwargs)

Test if at least self.pollIntervall seconds have passed and query the server if

startPolling(*args, **kwargs)

Start querying the server

onUserTestSuccess(req)

We received a response from the server

onUserTestFail(text, ns)

Error retrieving the current user response from the server

class vi.widgets.TaskWidget(title)

Bases: flare.popup.Popup

class vi.widgets.TaskSelectWidget

Bases: TaskWidget

getSelectedTask()
setActiveTask()
onChange(event)
invokeTask(*args, **kwargs)
class vi.widgets.InternalEdit(skelStructure, values=None, errorInformation=None, readOnly=False, context=None, defaultCat='', module=None, boneparams=None, errorQueue=None, prefix=None)

Bases: flare.html5.Div

renderStructure(readOnly=False)
serializeForPost(validityCheck=False)
serializeForDocument()
doSave(closeOnSuccess=False, *args, **kwargs)

Starts serializing and transmitting our values to the server.

unserialize(data=None)

Applies the actual data to the bones.

onChange(event)
onKeyDown(event)
performLogics()
class vi.widgets.ExportCsv(widget, selection, encoding=None, language=None, separator=None, lineSeparator=None, *args, **kwargs)

Bases: flare.html5.Progress

nextChunk(cursor=None)
nextChunkComplete(req)
exportToFile()
nextChunkFailure(req, code)
replaceWithMessage(message, logClass='success')
class vi.widgets.ExportCsvStarter(widget, *args, **kwargs)

Bases: flare.popup.Popup

onExportBtnClick(*args, **kwargs)
class vi.widgets.TreeWidget(module, rootNode=None, node=None, context=None, *args, **kwargs)

Bases: flare.html5.Div

Base Widget that renders a tree.

nodeWidget
leafWidget
requestStructure()
receivedStructure(resp)
setSelector(callback, multi=True, allow=None)

Configures the widget as selector for a relationalBone and shows it.

setContext(context)
selectorReturn()

Returns the current selection to the callback configured with setSelector.

onKeyDown(event)
onKeyUp(event)
getActions()

Returns a list of actions that are being set for the ActionBar. Override this to provide additional actions.

clearSelection()

Empties the current selection.

extendSelection(element)

Extends the current selection to element.

This is normally done by clicking or tabbing on an element.

activateSelection(element)

Activates the current selection or element.

An activation mostly is an action like selecting or editing an item. This is normally done by double-clicking an element.

requestChildren(element)
_showErrorMsg(req=None, code=None)

Removes all currently visible elements and displayes an error message

onDataChanged(module, *args, **kwargs)
onAttach()
onDetach()
itemForKey(key, elem=None)

Returns the HierarchyWidget displaying the entry with the given key. :param key: The key (id) of the item. :type key: str :returns: HierarchyItem

onSetDefaultRootNode(req)

We requested the list of rootNodes for that module and that request just finished. Parse the respone and set our rootNode to the first rootNode received.

setRootNode(rootNode, node=None)

Set the currently displayed hierarchy to ‘rootNode’. :param rootNode: Key of the rootNode which children we shall display :type rootNode: str

reloadData()

Reload the data were displaying.

loadNode(node, skelType=None, cursor=None, overrideParams=None)

Fetch the (direct) children of the given node. Once the list is received, append them to their parent node. :param node: Key of the node to fetch :type node: str

_onRequestSucceded(req)

The NetworkRequest for a (sub)node finished. Create a new HierarchyItem for each entry received and add them to our view

onDrop(event)

We got a drop event. Make that item a direct child of our rootNode

onDragOver(event)

Allow dropping children on the rootNode

getChildKey(widget)

Order by sortindex

static canHandle(moduleName, moduleInfo)
class vi.widgets.TreeBrowserWidget(module, rootNode=None, node=None, context=None, *args, **kwargs)

Bases: TreeWidget

Base Widget that renders a tree.

leafWidget
nodeWidget
reloadData()

Reload the data were displaying.

rebuildPath()

Rebuild the displayed path-list.

onPathRequestSucceded(req)

Rebuild the displayed path-list according to request data

activateSelection(element)

Activates the current selection or element.

An activation mostly is an action like selecting or editing an item. This is normally done by double-clicking an element.

static canHandle(module, moduleInfo)
class vi.widgets.HierarchyWidget(*args, **kwargs)

Bases: vi.widgets.tree.TreeWidget

A Hierarchy is a Tree without leaf distinction!

leafWidget
getActions()

Returns a list of actions that are being set for the ActionBar. Override this to provide additional actions.

reloadData()

Reload the data were displaying.

reloadListWidget()
toggleListView()
setListView(visible=False)
showListView()
hideListView()
onSelectionChanged(widget, selection, *args, **kwargs)
static canHandle(moduleName, moduleInfo)
class vi.widgets.FileWidget(module, rootNode=None, selectMode=None, node=None, context=None, *args, **kwargs)

Bases: vi.widgets.tree.TreeBrowserWidget

Base Widget that renders a tree.

leafWidget
nodeWidget
searchWidget()
onStartSearch(searchStr, *args, **kwargs)
getChildKey(widget)

Derives a string used to sort the entries on each level

onDrop(event)

We got a drop event. Make that item a direct child of our rootNode

static canHandle(module, moduleInfo)