vi.widgets
¶
Submodules¶
vi.widgets.accordion
vi.widgets.appnavigation
vi.widgets.code
vi.widgets.csvexport
vi.widgets.edit
vi.widgets.file
vi.widgets.hierarchy
vi.widgets.htmleditor
vi.widgets.internaledit
vi.widgets.list
vi.widgets.preview
vi.widgets.repeatdate
vi.widgets.search
vi.widgets.sidebar
vi.widgets.table
vi.widgets.task
vi.widgets.tooltip
vi.widgets.topbar
vi.widgets.tree
vi.widgets.userlogoutmsg
Package Contents¶
Classes¶
Provides the top-bar of VI |
|
Provides the interface to list-applications. |
|
Small utility class for providing tooltips |
|
Provides kind of MVC on top of SelectTable. |
|
Base Widget that renders a tree. |
|
Base Widget that renders a tree. |
|
A Hierarchy is a Tree without leaf distiction! |
|
Base Widget that renders a tree. |
- class vi.widgets.Accordion¶
Bases:
flare.html5.Form
- addSegment(self, ident, title=None, directAdd=False, *args)¶
- clear(self)¶
- buildAccordion(self, 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(self)¶
- setTitle(self, title=None)¶
- onClick(self, event)¶
- setCurrentModulDescr(self, 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(self, callback, multi=True, allow=None)¶
Configures the widget as selector for a relationalBone and shows it.
- selectorReturn(self)¶
Returns the current selection to the callback configured with setSelector.
- tableInitialization(self, *args, **kwargs)¶
Instantiates the table :param args: ListWidget Parameter :param kwargs: ListWidget Parameter :return:
- setAmount(self, amount)¶
- setPage(self, page=0)¶
sets targetpage. if not enougth loadedpages this pages will be requested :param page: sets targetpage :return:
- onRequestingFinished(self, *args, **kwargs)¶
- onClick(self, event)¶
- setTableActionBar(self)¶
- getDefaultEntryActions(self)¶
Returns the list of actions available in our actionBar
- getActions(self)¶
Returns the list of actions available in our actionBar
- getAllActions(self, view=None)¶
Returns the list of actions available in the action bar.
- showErrorMsg(self, req=None, code=None)¶
Removes all currently visible elements and displayes an error message
- onNextBatchNeeded(self)¶
Requests the next rows from the server and feed them to the table.
- onAttach(self)¶
- onDetach(self)¶
- onDataChanged(self, module, *args, **kwargs)¶
Refresh our view if element(s) in this module have changed
- requestStructure(self)¶
- receivedStructure(self, resp)¶
- reloadData(self)¶
Removes all currently displayed data and refetches the first batch from the server.
- setFilter(self, filter, filterID=None, filterDescr=None)¶
Applies a new filter.
- setContext(self, context)¶
Applies a new context.
- getFilter(self)¶
- updateEmptyNotification(self)¶
- onCompletion(self, req)¶
Pass the rows received to the datatable. :param req: The network request that succeed.
- setFields(self, fields)¶
- getFields(self)¶
- onSelectionActivated(self, table, selection)¶
- activateSelection(self)¶
- 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(self)¶
- onAttach(self)¶
- onChange(self, event)¶
- onBoneChange(self, bone)¶
- showErrorMsg(self, req=None, code=None)¶
Removes all currently visible elements and displays an error message
- reloadData(self)¶
- _save(self, 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(self)¶
Removes all visible bones/forms/fieldsets.
- closeOrContinue(self, sender=None)¶
- doCloneHierarchy(self, sender=None)¶
- cloneComplete(self, req)¶
- setData(self, 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(self, 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(self, event)¶
- _setDisabled(self, disabled)¶
- _getDisabled(self)¶
- class vi.widgets.DataTable(_loadOnDisplay=False, *args, **kwargs)¶
Bases:
flare.html5.Div
Provides kind of MVC on top of SelectTable.
- recalcHeight(self, *args, **kwargs)¶
- setDataProvider(self, 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(self, table, row)¶
Ensure the table scrolls according to the position of its cursor
- getRowCount(self)¶
Returns the total amount of rows currently known. :returns: int
- add(self, obj)¶
Adds an row to the model :param obj: Dictionary of values for this row :type obj: dict
- extend(self, objList)¶
Adds multiple rows at once. Much faster than calling add() multiple times.
- testIfNextBatchNeededImmediately(self)¶
Test if we display enough entries so that our contents are scrollable. Otherwise, we’ll never request a second batch
- remove(self, 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(self, keepModel=False)¶
Flushes the whole table.
- _renderObject(self, 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(self)¶
Rebuilds the entire table. Useful if something fundamental changed (ie. the cell renderer or the list of visible fields)
- setShownFields(self, 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(self, event)¶
Check if we got a scroll event and need to fetch another set of rows from our dataProvider
- onSelectionChanged(self, table, rows, *args, **kwargs)¶
Re-emit the event. Maps row-numbers to actual models.
- onSelectionActivated(self, table, rows)¶
Re-emit the event. Maps row-numbers to actual models.
- onTableChanged(self, table, rowCount, *args, **kwargs)¶
Re-emit the event.
- getCurrentSelection(self)¶
Override the getCurrentSelection method to yield actual models, not row-numbers.
- setCellRender(self, 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(self, renders)¶
Like setCellRender, but sets multiple renders at one. Much faster than calling setCellRender repeatedly.
- activateSelection(self)¶
Emits the selectionActivated event if there’s currently a selection
- class vi.widgets.Search(*args, **kwargs)¶
Bases:
flare.html5.Div
- doSearch(self, *args, **kwargs)¶
- resetSearch(self)¶
- onKeyDown(self, event)¶
- resetLoadingState(self)¶
- reevaluate(self)¶
- focus(self)¶
- class vi.widgets.SideBar(*args, **kwargs)¶
Bases:
flare.html5.Div
- onAttach(self)¶
- onDetach(self)¶
- setWidget(self, widget)¶
- getWidget(self)¶
- close(self, *args, **kwargs)¶
- class vi.widgets.UserLogoutMsg(*args, **kwargs)¶
Bases:
flare.popup.Popup
- pollInterval = 120¶
- checkIntervall¶
- visibilityChanged(self, e)¶
- stopInterval(self)¶
- hideMessage(self)¶
Make this popup invisible
- showMessage(self)¶
Show this popup
- showLoginWindow(self, *args, **kwargs)¶
Return to the login window.
- checkForSuspendResume(self, *args, **kwargs)¶
Test if at least self.pollIntervall seconds have passed and query the server if
- startPolling(self, *args, **kwargs)¶
Start querying the server
- onUserTestSuccess(self, req)¶
We received a response from the server
- onUserTestFail(self, 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(self)¶
- setActiveTask(self)¶
- onChange(self, event)¶
- invokeTask(self, *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(self, readOnly=False)¶
- serializeForPost(self, validityCheck=False)¶
- serializeForDocument(self)¶
- doSave(self, closeOnSuccess=False, *args, **kwargs)¶
Starts serializing and transmitting our values to the server.
- unserialize(self, data=None)¶
Applies the actual data to the bones.
- onChange(self, event)¶
- onKeyDown(self, event)¶
- performLogics(self)¶
- class vi.widgets.HtmlEditor(*args, **kwargs)¶
Bases:
flare.html5.Textarea
- initSources = False¶
- _attachSummernote(self, retry=0)¶
- onAttach(self)¶
- onDetach(self)¶
- onEditorChange(self, e, *args, **kwargs)¶
- _getValue(self)¶
- _setValue(self, val)¶
- enable(self)¶
- disable(self)¶
- class vi.widgets.ExportCsv(widget, selection, encoding=None, language=None, separator=None, lineSeparator=None, *args, **kwargs)¶
Bases:
flare.html5.Progress
- nextChunk(self, cursor=None)¶
- nextChunkComplete(self, req)¶
- exportToFile(self)¶
- nextChunkFailure(self, req, code)¶
- replaceWithMessage(self, message, logClass='success')¶
- class vi.widgets.ExportCsvStarter(widget, *args, **kwargs)¶
Bases:
flare.popup.Popup
- onExportBtnClick(self, *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(self)¶
- receivedStructure(self, resp)¶
- setSelector(self, callback, multi=True, allow=None)¶
Configures the widget as selector for a relationalBone and shows it.
- selectorReturn(self)¶
Returns the current selection to the callback configured with setSelector.
- onKeyDown(self, event)¶
- onKeyUp(self, event)¶
- getActions(self)¶
Returns a list of actions that are being set for the ActionBar. Override this to provide additional actions.
- clearSelection(self)¶
Empties the current selection.
- extendSelection(self, element)¶
Extends the current selection to element.
This is normally done by clicking or tabbing on an element.
- activateSelection(self, 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(self, element)¶
- showErrorMsg(self, req=None, code=None)¶
Removes all currently visible elements and displayes an error message
- onDataChanged(self, module, *args, **kwargs)¶
- onAttach(self)¶
- onDetach(self)¶
- itemForKey(self, 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(self, 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(self, 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(self)¶
Reload the data were displaying.
- loadNode(self, node, cursor=None, reqType=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(self, req)¶
The NetworkRequest for a (sub)node finished. Create a new HierarchyItem for each entry received and add them to our view
- onDrop(self, event)¶
We got a drop event. Make that item a direct child of our rootNode
- onDragOver(self, event)¶
Allow dropping children on the rootNode
- getChildKey(self, 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(self)¶
Reload the data were displaying.
- rebuildPath(self)¶
Rebuild the displayed path-list.
- onPathRequestSucceded(self, req)¶
Rebuild the displayed path-list according to request data
- activateSelection(self, 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 distiction!
- leafWidget¶
- reloadData(self)¶
Reload the data were displaying.
- reloadListWidget(self)¶
- toggleListView(self)¶
- setListView(self, visible=False)¶
- showListView(self)¶
- hideListView(self)¶
- onSelectionChanged(self, 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(self)¶
- onStartSearch(self, searchStr, *args, **kwargs)¶
- getChildKey(self, widget)¶
Derives a string used to sort the entries on each level
- onDrop(self, event)¶
We got a drop event. Make that item a direct child of our rootNode
- static canHandle(module, moduleInfo)¶