1.1.7.7. gnr.web.gnrwebstruct – Web structures

Last page update: November 23, 2011

Classes:

External methods:

Complete reference:

1.1.7.7.5. External methods

These methods don’t belong to any class.

1.1.7.7.6. gnr.web.gnrwebstruct - The complete reference list

class gnr.web.gnrwebstruct.GnrDomSrc(source=None, **kwargs)

GnrDomSrc class

checkNodeId(nodeId)

Check if the nodeId is already existing or not

Parameters:nodeId – the nodeId
child(tag, childname=None, childcontent=None, envelope=None, **kwargs)

Set a new item of the tag type into the current structure through the child() and return it

Parameters:
  • tag – the html tag
  • childname – the childname
  • childcontent – the html content
  • envelope – TODO
connect(event='', pars='', funcbody=None, **kwargs)

TODO

Parameters:
  • event – TODO
  • pars – TODO
  • funcbody – TODO
css(rule, styleRule='')

Handle the CSS rules

Parameters:
  • rule – dict or list of CSS rules
  • styleRule – TODO
cssrule(selector=None, **kwargs)

TODO

data(*args, **kwargs)

Create a data and returns it. data allows to define variables from server to client

Parameters:
  • *args – args[0] includes the path of the value, args[1] includes the value
  • **kwargs – in the kwargs you can insert the _serverpath attribute. For more information, check the _serverpath example
formbuilder(cols=1, table=None, tblclass='formbuilder', lblclass='gnrfieldlabel', lblpos='L', _class='', fieldclass='gnrfield', lblalign=None, lblvalign='middle', fldalign=None, fldvalign='middle', disabled=False, rowdatapath=None, head_rows=None, **kwargs)

In formbuilder you can put dom and widget elements; its most classic usage is to create a form made by fields and layers, and that’s because formbuilder can manage automatically fields and their positioning

Parameters:
  • cols – set the number of columns
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • tblclass – the standard class for the formbuilder. Default value is 'formbuilder', that actually it is the unique defined class
  • lblclass – set label style
  • lblpos – set label position: L: set label on the left side of text field T: set label on top of text field
  • _class – for CSS style
  • fieldclass – CSS class appended to every formbuilder’s child
  • lblalign – Set horizontal label alignment (It seems broken... TODO)
  • lblvalign – set vertical label alignment
  • fldalign – set field horizontal align
  • fldvalign – set field vertical align
  • disabled – If True, user can’t act on the object (write, drag...)
  • rowdatapath – TODO
  • head_rows – TODO
  • **kwargs – for the complete list of the **kwargs, check the kwargs list section
formstore(handler='recordCluster', nodeId=None, table=None, storeType=None, parentStore=None, **kwargs)

TODO

Parameters:
  • storepath – TODO
  • handler – TODO
  • nodeId – the page nodeId. For more information, check the nodeId documentation page
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • storeType – TODO
  • parentStore – TODO
formstore_handler(action, handler_type=None, **kwargs)

TODO Return the formstore handler

Parameters:
  • action – TODO
  • handler_type – TODO
formstore_handler_addcallback(cb, **kwargs)

TODO

Parameters:cb – TODO
frameform(*args, **kwargs)

TODO

Parameters:
  • formId – TODO
  • frameCode – TODO
  • store – TODO
  • storeCode – TODO
  • slots – TODO
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • store_kwargs – TODO
framepane(frameCode=None, centerCb=None, **kwargs)

Create a framePane and return it. A framePane is a BorderContainer with five sides added: these sides follow the Dojo borderContainer suddivision: top, bottom, left, right, center

Parameters:
  • frameCode – the framepane code
  • centerCb – TODO
func(name, pars='', funcbody=None, **kwargs)

TODO

Parameters:
  • name – TODO
  • pars – TODO
  • funcbody – TODO
getAttach(*args, **kwargs)

Warning

deprecated since version 0.7

getField(fld)

TODO

Parameters:fld – TODO
htmlChild(tag, childcontent, value=None, **kwargs)

Create an html child and return it

Parameters:
  • tag – the html tag
  • childcontent – the html content
  • value – TODO
iframe(childcontent=None, main=None, **kwargs)

Create an iframe and returns it

Parameters:
  • childcontent – the html content
  • main – TODO
js_domNode

TODO

js_form

TODO

js_widget

TODO

macro(name='', source='', **kwargs)

TODO

Parameters:
  • name – TODO
  • source – TODO
classmethod makeRoot(page, source=None)

Build the root through the makeRoot() method and return it

Parameters:
  • cls – the structure class
  • page – the webpage instance
  • source – the filepath of the xml file
nodeById(id)

TODO

Parameters:id – the nodeId
place(fields)

TODO

Parameters:fields – TODO
record

TODO

register_nodeId

TODO

remote(method, lazy=True, **kwargs)

Build a remote and return it

Parameters:
  • method – the name of the remote method (without the remote_ prefix)
  • lazy – boolean. TODO
script(content='', **kwargs)

Handle the <script> html tag and return it

Parameters:content – the <script> content
styleSheet(cssText=None, cssTitle=None, href=None)

Create the styleSheet

Parameters:
  • cssText – TODO
  • cssTitle – TODO
  • href – TODO
subscribe(what, event, func=None, **kwargs)

TODO

Parameters:
  • what – TODO
  • event – TODO
  • func – TODO
tooltip(label='', **kwargs)

Create a tooltip and return it

Parameters:label – the tooltip text
class gnr.web.gnrwebstruct.GnrDomSrc_dojo_11(source=None, **kwargs)

TODO

button(label=None, **kwargs)

The button is a dojo-improved form widget: through the action attribute you can add Javascript callbacks

Parameters:
  • label – the label of the widget
  • kwargs
    • action: allow to execute a javascript callback. For more information, check the action section
    • iconClass: the button icon. For more information, check the iconClass section
    • showLabel: boolean. If True, show the button label
checkbox(label=None, value=None, **kwargs)

Return a CheckBox: setting the value to true will check the box while false will uncheck it

Parameters:
  • label – the checkbox label
  • value – the checkbox path for value. For more information, check the datapath section
checkboxtext(labels, value=None, separator=', ', **kwargs)

A group of checkboxes that allow to compose a string with checkbox labels.

Parameters:
  • labels – a string separated by comma set of words. For every words there will be created a single checkbox
  • value – the path of the checkboxtext value
  • separator – the characters that separate the checkbox text
dataController(script=None, **kwargs)

Create a dataController and returns it. dataController allows to execute Javascript code

Parameters:
  • script – the Javascript code that datacontroller has to execute.
  • **kwargs_init, _onStart, _timing. For more information, check the controllers’ common attributes section
dataFormula(path, formula, **kwargs)

Create a dataFormula and returns it. dataFormula allows to calculate a value through a formula.

Parameters:
  • path – the dataFormula’s path
  • formula – the dataFormula’s formula
  • **kwargs – formula parameters and other ones (CSS, etc)
dataRecord(path, table, pkey=None, method='app.getRecord', **kwargs)

Create a dataRecord and returns it. dataRecord allows... TODO

Parameters:
  • path – TODO
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • pkey – the record primary key
  • method – TODO
  • **kwargs_onCalling, _onResult, sync. For more information, check the rpc commons attributes section
dataRemote(path, method, **kwargs)

Create a dataRemote and returns it. dataRemote is a synchronous dataRpc: it calls a (specified) dataRspc as its resolver. When dataRemote is brought to the client, it will be changed in a Javascript resolver that at the desired path perform the rpc (indicated with the remote attribute).

Parameters:
  • path – the path where the dataRemote will save the result of the rpc
  • method – the rpc name that has to be executed
  • **kwargscacheTime=NUMBER: The cache stores the retrieved value and keeps it for a number of seconds equal to NUMBER
dataResource(path, resource=None, ext=None, pkg=None)

Create a dataResource and returns it. dataResource is a dataRemote that allows... TODO

Parameters:
  • path – TODO
  • resource – TODO
  • ext – TODO
  • pkg – the package object
dataRpc(path, method, **kwargs)

Create a dataRpc and returns it. dataRpc allows the client to make a call to the server to perform an action and returns it.

Parameters:
  • path – MANDATORY - it contains the folder path of the result of the dataRpc action; you have to write it even if you don’t return any value in the dataRpc (in this situation it will become a “mandatory but dummy” parameter)
  • method – the name of your dataRpc method
  • **kwargs_onCalling, _onResult, sync. For more information, check the rpc commons attributes section
dataScript(path, script, **kwargs)

Warning

deprecated since version 0.7. It has been substituted by dataController and dataFormula

dataSelection(path, table=None, method='app.getSelection', columns=None, distinct=None, where=None, order_by=None, group_by=None, having=None, columnsFromView=None, **kwargs)

Create a dataSelection and returns it. dataSelection allows... TODO

Parameters:
  • path – TODO
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • method – TODO
  • columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
  • distinct – boolean, True for getting a “SELECT DISTINCT”
  • where – the sql “WHERE” clause. For more information check the where section.
  • order_by – corresponding to the sql “ORDER BY” operator. For more information check the order_by section
  • group_by – the sql “GROUP BY” clause. For more information check the group_by section
  • having – the sql “HAVING” clause. For more information check the having
  • columnsFromView – TODO
  • **kwargs_onCalling, _onResult, sync. For more information, check the rpc commons attributes section
datarpc_addcallback(cb, **kwargs)

TODO

Parameters:
  • cb – TODO
  • **kwargs – TODO
datarpc_adderrback(cb, **kwargs)

TODO

Parameters:cb – TODO
directoryStore(rootpath=None, storepath='.store', **kwargs)

TODO

Parameters:
  • rootpath – TODO
  • storepath – TODO
dropdownbutton(label=None, **kwargs)

The DropDownButton can be used to build a menu

Parameters:
  • label – the button label
  • kwargs
    • iconClass: the button icon. For more information, check the iconClass section
    • showLabel: boolean. If True, show the button label
field(field=None, **kwargs)

TODO

Parameters:field – TODO
gridStruct(struct=None, columns=None)

TODO

Parameters:
  • struct – the struct object
  • columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
includedview(*args, **kwargs)

The includedView component

includedview_inframe(frameCode=None, struct=None, columns=None, storepath=None, structpath=None, datapath=None, nodeId=None, configurable=True, _newGrid=False, childname=None, **kwargs)

TODO

Parameters:
  • frameCode – TODO
  • struct – the struct object
  • columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
  • storepath – TODO
  • structpath – the struct path
  • datapath – allow to create a hierarchy of your data’s addresses into the datastore. For more information, check the datapath and the datastore pages
  • nodeId – the page nodeId. For more information, check the nodeId documentation page
  • configurable – boolean. TODO
  • _newGrid – boolean. TODO
  • childname – the childname
includedview_legacy(storepath=None, structpath=None, struct=None, columns=None, table=None, nodeId=None, relativeWorkspace=None, **kwargs)

TODO

Parameters:
  • storepath – TODO
  • structpath – the struct path
  • struct – the struct object
  • columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • nodeId – the nodeId
  • relativeWorkspace – TODO
menuline(label=None, **kwargs)

A line of a menu

Parameters:
  • label – the menuline label. Set it to “-” to create a dividing line in the menu: menuline('-')
  • kwargs
    • action: allow to execute a javascript callback. For more information, check the action page
    • checked: boolean (by default is False). If True, allow to set a “V” mark on the left side of the menuline
onDbChanges(action=None, table=None, **kwargs)

TODO

Parameters:
paletteGrid(paletteCode=None, struct=None, columns=None, structpath=None, datapath=None, **kwargs)

Return a paletteGrid

Parameters:
  • paletteCode – create the paletteGrid nodeId (if no gridId is defined) and create the paletteGrid datapath (if no datapath is defined)
  • struct – the name of the method that defines the struct
  • columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
  • structpath – TODO
  • datapath – allow to create a hierarchy of your data’s addresses into the datastore. For more information, check the datapath and the datastore pages
  • kwargs

    in the kwargs you find:

    • dockButton: boolean. if True, TODO
    • grid_filteringGrid: the path of the grid that handle the struct. For example, in the TableHandler component the standard path for a grid is th.view.grid
    • grid_filteringColumn: allow the sincronization between the choosen columns and the not choosen ones (so, if user drag a column in a grid, then this column doesn’t appear anymore in the palette)

      The syntax is:

      grid_filteringColumn='id:COLUMN'
      

      Where COLUMN is the name of a column TODO

    • title: the title of the paletteGrid
paletteGroup(groupCode, **kwargs)

Return a paletteGroup

Parameters:groupCode – TODO
palettePane(paletteCode, datapath=None, **kwargs)

Return a palettePane

Parameters:
  • paletteCode – TODO. If no datapath is specified, the paletteCode will be used as datapath
  • datapath – allow to create a hierarchy of your data’s addresses into the datastore. For more information, check the datapath and the datastore pages
paletteTree(paletteCode, datapath=None, **kwargs)

Return a paletteTree

Parameters:
  • paletteCode – TODO. If no datapath is specified, the paletteCode will be used as datapath
  • datapath – allow to create a hierarchy of your data’s addresses into the datastore. For more information, check the datapath and the datastore pages
radiobutton(label=None, **kwargs)

Radiobuttons are used when you want to let the user select one - and just one - option from a set of choices (if more options are to be allowed at the same time you should use checkboxes instead)

Parameters:
  • label – the radiobutton label
  • kwargs
    • group: allow to create a radiobutton group. To create a group, give the same string to the group attribute of many radiobuttons. You can obviously create more than a group giving a different string to the group attribute (for more information, check the group example)
radiogroup(labels, group, cols=1, datapath=None, **kwargs)

Warning

deprecated since version 0.7

selectionStore(table=None, storeCode=None, storepath=None, columns=None, **kwargs)

TODO

Parameters:
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • storeCode – TODO
  • storepath – TODO
  • columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
selectionstore_addcallback(*args, **kwargs)

TODO

slotBar(slots=None, slotbarCode=None, namespace=None, childname='bar', **kwargs)

Create a slotBar (a Genro toolbar) and returns it

Note

The slotBar (and the slotToolbar) are the Genro way to easily create a toolbar

Parameters:
  • slots – MANDATORY. Allow to attach every widget of the toolbar through a shortcut. For more information, check the slots section
  • slotbarCode – autocreate a nodeId for the slotToolbar AND autocreate hierarchic nodeIds for every slotToolbar child
  • namespace – private attribute. For more information, check the namespace section
  • childname – the slotBar childname
slotButton(label=None, **kwargs)

Return a slotButton. A slotbutton is a button with some preset attributes to create rapidly a button with an icon (set through the iconClass attribute) and with a label that works only as a tooltip: for example you can use a slotButton when you handle a toolbar or a palette

Parameters:
  • label – the button’s tooltip (or its label, if no iconClass is set)
  • kwargs
    • action: allow to execute a javascript callback. For more information, check the action section
    • iconClass: the button icon. For more information, check the iconClass section
    • showLabel: boolean. If True, show the button label
    • value: specify the path of the widget’s value. For more information, check the datapath page
slotFooter(*args, **kwargs)

TODO

slotToolbar(*args, **kwargs)

Create a slotToolbar and return it

Note

The slotToolbar is a slotBar with some preset CSS features

slotbar_replaceslots(toReplace, replaceStr, **kwargs)

Allow to redefine the preset bars of the slotBars and the slotToolbars

Parameters:
  • toReplace – MANDATORY. A string with the list of the slots to be replaced. Use # to replace all the slots
  • replaceStr – MANDATORY. A string with the list of the slots to add
tableAnalyzeStore(table=None, where=None, group_by=None, storepath='.store', **kwargs)

TODO

Parameters:
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • where – the sql “WHERE” clause. For more information check the where section
  • group_by – the sql “GROUP BY” clause. For more information check the group_by section
  • storepath – TODO
togglebutton(label=None, **kwargs)

A toggle button is a button that represents a setting with two states: True and False. Use the iconClass attribute to allow the user to know (see) the current status

Parameters:
  • label – the button’s label
  • kwargs
    • iconClass: the button icon. For more information, check the iconClass section
    • showLabel: boolean. If True, show the button label
virtualSelectionStore(table=None, storeCode=None, storepath=None, columns=None, **kwargs)

TODO

Parameters:
  • table – the database table name on which the query will be executed, in the form packageName.tableName (packageName is the name of the package to which the table belongs to)
  • storeCode – TODO
  • storepath – TODO
  • columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
wdgAttributesFromColumn(fieldobj, **kwargs)

TODO

Parameters:fieldobj – TODO
class gnr.web.gnrwebstruct.GnrFormBuilder(tbl, cols=None, dbtable=None, fieldclass=None, lblclass='gnrfieldlabel', lblpos='L', lblalign=None, fldalign=None, lblvalign='middle', fldvalign='middle', rowdatapath=None, head_rows=None, commonKwargs=None)

TODO

getRow(r)

TODO

Parameters:r – the row to get
getRowNode(r)

TODO

Parameters:r – the row from which to get node
nextCell(r, c)

Get the current row (r attribute) and the current cell (c attribute) of the struct and return the correct next row and cell

Parameters:
  • r – a row
  • c – a cell
place(**fieldpars)

TODO

setField(field, row=None, col=None)

TODO

Parameters:
  • field – TODO
  • row – TODO
  • col – TODO
setFields(fields, rowstart=0, colstart=0)

TODO

Parameters:
  • fields – TODO
  • rowstart – TODO
  • colstart – TODO
setRow(fields, row=None)

TODO

Parameters:
  • fields – TODO
  • row – TODO
setRowAttr(r, attrs)

TODO

Parameters:
  • r – the row to set
  • attrs – TODO
class gnr.web.gnrwebstruct.GnrGridStruct(source=None, **kwargs)

This class handles the creation of a struct

cell(field=None, name=None, width=None, dtype=None, classes=None, cellClasses=None, headerClasses=None, **kwargs)

Return a cell

Parameters:
  • field – TODO
  • name – TODO
  • width – the width of the cell
  • dtype – the dtype
  • classes – TODO
  • cellClasses – TODO
  • headerClasses – TODO
checkboxcell(field=None, falseclass=None, trueclass=None, nullclass=None, classes='row_checker', action=None, name=' ', calculated=False, radioButton=False, threestate=False, **kwargs)

Return a checkboxcell

Parameters:
  • field – TODO
  • falseclass – the css class for the false state
  • trueclass – the css class for the true state
  • nullclass – the css class for the null state, the optional third state that you can specify through the threestate parameter
  • classes – TODO
  • action – allow to execute a javascript callback. For more information, check the action page
  • name – TODO
  • calculated – boolean. TODO
  • radioButton – boolean. TODO
  • threestate – boolean. If True, create a third state (the “null” state) besides the True and the False state
fieldcell(field, _as=None, name=None, width=None, dtype=None, classes=None, cellClasses=None, headerClasses=None, zoom=False, **kwargs)

Return a cell that inherits every attribute from the field widget.

Parameters:
  • field – MANDATORY - it contains the name of the field from which the fieldcell inherits
  • _as – TODO
  • name – with name you can override the name_long of the field form widget
  • width – the fieldcell width
  • dtype – the dtype. You can override the dtype of the field form widget.
  • classes – TODO
  • cellClasses – TODO
  • headerClasses – TODO
  • zoom – a link to the object to which the fieldcell refers to. For more information, check the zoom documentation page.
fieldnames

TODO

Parameters:columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
fields(columns, unit='em', totalWidth=None)

TODO

Parameters:
  • columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
  • unit – the field unit
  • totalWidth – TODO

r.fields(‘name/Name:20,address/My Addr:130px....’)

getFieldNames(columns=None)

TODO

Parameters:columns – it represents the columns to be returned by the “SELECT” clause in the traditional sql query. For more information, check the columns section
classmethod makeRoot(page, maintable=None, source=None)

TODO

Parameters:
  • cls – TODO
  • page – TODO
  • maintable – the database table to which the struct refers to. For more information, check the maintable section
  • source – TODO
rows(classes=None, cellClasses=None, headerClasses=None, **kwargs)

TODO

Parameters:
  • classes – TODO
  • cellClasses – TODO
  • headerClasses – TODO
view(tableobj=None, **kwargs)

TODO

Parameters:tableobj – the database table object
gnr.web.gnrwebstruct.struct_method(func_or_name)

A decorator. Allow to register a new method (in a page or in a component) that will be available in the web structs:

@struct_method
def includedViewBox(self, bc, ...):
    pass
    
def somewhereElse(self, bc):
    bc.includedViewBox(...)

If the method name includes an underscore, only the part that follows the first underscore will be the struct method’s name:

@struct_method
def iv_foo(self, bc, ...):
    pass
    
def somewhereElse(self, bc):
    bc.foo(...)

You can also pass a name explicitly:

@struct_method('bar')
def foo(self, bc, ...):
    pass
    
def somewhereElse(self, bc):
    bc.bar(...)