remi package¶
Submodules¶
remi.gui module¶
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class remi.gui.AsciiContainer(*args, **kwargs)[source]¶
Bases:
Container
- append(widget, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- set_from_asciiart(asciipattern, gap_horizontal=0, gap_vertical=0)[source]¶
- asciipattern (str): a multiline string representing the layout
- widget1 |widget1 |widget2 | widget3 |
gap_horizontal (int): a percent value gap_vertical (int): a percent value
- widget_layout_map = None¶
- class remi.gui.BODY(*args, **kwargs)[source]¶
Bases:
Container
- EVENT_ONERROR = 'onerror'¶
- EVENT_ONLOAD = 'onload'¶
- EVENT_ONONLINE = 'ononline'¶
- EVENT_ONPAGEHIDE = 'onpagehide'¶
- EVENT_ONPAGESHOW = 'onpageshow'¶
- EVENT_ONRESIZE = 'onresize'¶
- class remi.gui.Button(text='', *args, **kwargs)[source]¶
Bases:
Widget
,_MixinTextualWidget
The Button widget. Have to be used in conjunction with its event onclick. Use Widget.onclick.connect in order to register the listener.
- class remi.gui.CheckBox(checked=False, user_data='', **kwargs)[source]¶
Bases:
Input
check box widget useful as numeric input field implements the onchange event.
- class remi.gui.CheckBoxLabel(label='checkbox', checked=False, user_data='', **kwargs)[source]¶
Bases:
HBox
- property text¶
- class remi.gui.ClassEventConnector(event_source_instance, event_name, event_method_bound)[source]¶
Bases:
object
This class allows to manage the events. Decorating a method with decorate_event decorator The method gets the __is_event flag. At runtime, the methods that has this flag gets replaced by a ClassEventConnector. This class overloads the __call__ method, where the event method is called, and after that the listener method is called too.
- callback = None¶
- do(callback, *userdata, **kwuserdata)[source]¶
The callback and userdata gets stored, and if there is some javascript to add the js code is appended as attribute for the event source
- kwuserdata = None¶
- userdata = None¶
- class remi.gui.Container(children=None, *args, **kwargs)[source]¶
Bases:
Widget
Container can be used as generic container. You can add children by the append(value, key) function. Container can be arranged in absolute positioning (assigning style[‘top’] and style[‘left’] attributes to the children or in a simple auto-alignment. You can decide the horizontal or vertical arrangement by the function set_layout_orientation(layout_orientation) passing as parameter Container.LAYOUT_HORIZONTAL or Container.LAYOUT_VERTICAL.
Tips: In html, it is a DIV tag The self.type attribute specifies the HTML tag representation The self.attributes[] attribute specifies the HTML attributes like ‘style’ ‘class’ ‘id’ The self.style[] attribute specifies the CSS style content like ‘font’ ‘color’. It will be packed together with ‘self.attributes’.
- LAYOUT_HORIZONTAL = True¶
- LAYOUT_VERTICAL = False¶
- append(value, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- exception remi.gui.CssStyleError[source]¶
Bases:
Exception
Raised when (a combination of) settings will result in invalid/improper CSS
- class remi.gui.Datalist(options=None, *args, **kwargs)[source]¶
Bases:
Container
- append(options, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- class remi.gui.DatalistItem(text='', *args, **kwargs)[source]¶
Bases:
Widget
,_MixinTextualWidget
item widget for the DropDown
- class remi.gui.DropDown(*args, **kwargs)[source]¶
Bases:
Container
Drop down selection widget. Implements the onchange(value) event. Register a listener for its selection change by means of the function DropDown.onchange.connect.
- append(value, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- get_key()[source]¶
- Returns:
The unique string identifier of the selected item or None.
- Return type:
str
- select_by_key(key)[source]¶
Selects an item by its unique string identifier.
- Parameters:
key (str) – Unique string identifier of the DropDownItem that have to be selected.
- class remi.gui.DropDownItem(text='', *args, **kwargs)[source]¶
Bases:
Widget
,_MixinTextualWidget
item widget for the DropDown
- get_text()[source]¶
- Returns:
The text content of the Widget. You can set the text content with set_text(text).
- Return type:
str
- set_text(text)[source]¶
Sets the text label for the Widget.
- Parameters:
text (str) – The string label of the Widget.
- property value¶
- class remi.gui.FileDownloader(text, filename, path_separator='/', *args, **kwargs)[source]¶
Bases:
Container
,_MixinTextualWidget
FileDownloader widget. Allows to start a file download.
- class remi.gui.FileFolderItem(path_and_filename, text, is_folder=False, *args, **kwargs)[source]¶
Bases:
Container
FileFolderItem widget for the FileFolderNavigator
- onclick(widget)[source]¶
Called when the Widget gets clicked by the user with the left mouse button.
- path_and_filename = None¶
Bases:
GridBox
FileFolderNavigator widget.
This event occurs when a folder element is clicked. Returns the clicked element of type FileFolderItem.
This event occurs when an element in the list is selected Returns the newly selected element of type FileFolderItem(or None if it was not selectable)
and the list of selected elements of type str.
- class remi.gui.FileSelectionDialog(title='File dialog', message='Select files and folders', multiple_selection=True, selection_folder='.', allow_file_selection=True, allow_folder_selection=True, **kwargs)[source]¶
Bases:
GenericDialog
file selection dialog, it opens a new webpage allows the OK/CANCEL functionality implementing the “confirm_value” and “cancel_dialog” events.
- class remi.gui.FileUploader(savepath='./', multiple_selection_allowed=False, accepted_files='*.*', *args, **kwargs)[source]¶
Bases:
Container
- FileUploader widget:
allows to upload multiple files to a specified folder. implements the onsuccess and onfailed events.
- property multiple_selection_allowed¶
- property savepath¶
- class remi.gui.GenericDialog(title='', message='', *args, **kwargs)[source]¶
Bases:
Container
Generic Dialog widget. It can be customized to create personalized dialog windows. You can setup the content adding content widgets with the functions add_field or add_field_with_label. The user can confirm or dismiss the dialog with the common buttons Cancel/Ok. Each field added to the dialog can be retrieved by its key, in order to get back the edited value. Use the function
get_field(key) to retrieve the field.
The Ok button emits the ‘confirm_dialog’ event. Register the listener to it with set_on_confirm_dialog_listener. The Cancel button emits the ‘cancel_dialog’ event. Register the listener to it with set_on_cancel_dialog_listener.
- add_field(key, field)[source]¶
Adds a field to the dialog with a unique identifier.
Note: You can access to the fields content calling the function GenericDialog.get_field(key).
- Parameters:
key (str) – The unique identifier for the field.
field (Widget) – The widget to be added to the dialog, TextInput or any Widget for example.
- add_field_with_label(key, label_description, field)[source]¶
Adds a field to the dialog together with a descriptive label and a unique identifier.
Note: You can access to the fields content calling the function GenericDialog.get_field(key).
- Parameters:
key (str) – The unique identifier for the field.
label_description (str) – The string content of the description label.
field (Widget) – The instance of the field Widget. It can be for example a TextInput or maybe
widget. (a custom) –
- class remi.gui.GenericObject(filename, **kwargs)[source]¶
Bases:
Widget
GenericObject widget - allows to show embedded object like pdf,swf..
- class remi.gui.GridBox(*args, **kwargs)[source]¶
Bases:
Container
It contains widgets automatically aligning them to the grid. Does not permit children absolute positioning.
In order to add children to this container, use the append(child, key) function. The key have to be string and determines the children positioning in the layout.
Note: If you would absolute positioning, use the Container instead.
- append(value, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param. The key have to correspond to a an element provided in the ‘define_grid’ method param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- property css_grid_gap¶
- property css_grid_template_areas¶
- property css_grid_template_columns¶
- property css_grid_template_rows¶
- define_grid(matrix)[source]¶
Populates the Table with a list of tuples of strings.
- Parameters:
matrix (list) – list of iterables of strings (lists or something else). Items in the matrix have to correspond to a key for the children.
- remove_child(child)[source]¶
Removes a child instance from the Tag’s children.
- Parameters:
child (Tag) – The child to be removed.
- set_column_gap(value)[source]¶
Sets the gap value between columns
- Parameters:
value (int or str) – gap value (i.e. 10 or “10px”)
- set_column_sizes(values)[source]¶
Sets the size value for each column
- Parameters:
values (iterable of int or str) – values are treated as percentage.
- set_from_asciiart(asciipattern, column_gap=0, row_gap=0)[source]¶
Defines the GridBox layout from a simple and intuitive ascii art table
Pipe “|” is the column separator. Rows are separated by
- .
Identical rows are considered as unique bigger rows. Single table cells must contain the ‘key’ string value of the contained widgets. Column sizes are proportionally applied to the defined grid. Columns must be alligned between rows. The gap values eventually defined by set_column_gap and set_row_gap are overwritten.
- class remi.gui.HBox(*args, **kwargs)[source]¶
Bases:
Container
- The purpose of this widget is to automatically horizontally aligning
the widgets that are appended to it.
Does not permit children absolute positioning.
In order to add children to this container, use the append(child, key) function. The key have to be numeric and determines the children order in the layout.
Note: If you would absolute positioning, use the Container instead.
- append(value, key='')[source]¶
It allows to add child widgets to this. The key allows to access the specific child in this way container.children[key]. The key have to be numeric and determines the children order in the layout.
- Parameters:
value (Widget) – Child instance to be appended.
key (str) – Unique identifier for the child. If key.isdigit()==True ‘0’ ‘1’.. the value determines the order
layout (in the) –
- class remi.gui.HEAD(title, *args, **kwargs)[source]¶
Bases:
Tag
- repr(changed_widgets=None)[source]¶
It is used to automatically represent the object to HTML format packs all the attributes, children and so on.
- Parameters:
changed_widgets (dict) – A dictionary containing a collection of tags that have to be updated. The tag that have to be updated is the key, and the value is its textual repr.
- set_icon_data(base64_data, mimetype='image/png', rel='icon')[source]¶
Allows to define an icon for the App
- Parameters:
base64_data (str) – base64 encoded image data (ie. “data:image/x-icon;base64,AAABAAEAEBA….”)
mimetype (str) – mimetype of the image (“image/png” or “image/x-icon”…)
rel (str) – leave it unchanged (standard “icon”)
- set_icon_file(filename, rel='icon')[source]¶
Allows to define an icon for the App
- Parameters:
filename (str) – the resource file name (ie. “/res:myicon.png”)
rel (str) – leave it unchanged (standard “icon”)
- class remi.gui.HTML(*args, **kwargs)[source]¶
Bases:
Tag
- repr(changed_widgets=None)[source]¶
It is used to automatically represent the object to HTML format packs all the attributes, children and so on.
- Parameters:
changed_widgets (dict) – A dictionary containing a collection of tags that have to be updated. The tag that have to be updated is the key, and the value is its textual repr.
- class remi.gui.Image(image='', *args, **kwargs)[source]¶
Bases:
Widget
image widget.
- property attr_src¶
- class remi.gui.InputDialog(title='Title', message='Message', initial_value='', *args, **kwargs)[source]¶
Bases:
GenericDialog
Input Dialog widget. It can be used to query simple and short textual input to the user. The user can confirm or dismiss the dialog with the common buttons Cancel/Ok. The Ok button click or the ENTER key pression emits the ‘confirm_dialog’ event. Register the listener to it with set_on_confirm_dialog_listener. The Cancel button emits the ‘cancel_dialog’ event. Register the listener to it with set_on_cancel_dialog_listener.
- class remi.gui.Label(text='', *args, **kwargs)[source]¶
Bases:
Widget
,_MixinTextualWidget
Non editable text label widget. Set its content by means of set_text function, and retrieve its content with the function get_text.
- class remi.gui.Link(url='', text='', open_new_window=True, *args, **kwargs)[source]¶
Bases:
Container
,_MixinTextualWidget
- property attr_href¶
- class remi.gui.ListItem(text='', *args, **kwargs)[source]¶
Bases:
Widget
,_MixinTextualWidget
List item widget for the ListView.
ListItems are characterized by a textual content. They can be selected from the ListView. Do NOT manage directly its selection by registering set_on_click_listener, use instead the events of the ListView.
- class remi.gui.ListView(selectable=True, *args, **kwargs)[source]¶
Bases:
Container
List widget it can contain ListItems. Add items to it by using the standard append(item, key) function or generate a filled list from a string list by means of the function new_from_list. Use the list in conjunction of its onselection event. Register a listener with ListView.onselection.connect.
- append(value, key='')[source]¶
Appends child items to the ListView. The items are accessible by list.children[key].
- Parameters:
value (ListItem, or iterable of ListItems) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- get_key()[source]¶
- Returns:
The key of the selected item or None if no item is selected.
- Return type:
str
- classmethod new_from_list(items, **kwargs)[source]¶
Populates the ListView with a string list.
- Parameters:
items (list) – list of strings to fill the widget with.
- select_by_key(key)[source]¶
Selects an item by its key.
- Parameters:
key (str) – The unique string identifier of the item that have to be selected.
- class remi.gui.MenuItem(text='', *args, **kwargs)[source]¶
Bases:
Container
,_MixinTextualWidget
MenuItem widget can contain other MenuItem.
- append(value, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- class remi.gui.Progress(value=0, _max=100, *args, **kwargs)[source]¶
Bases:
Widget
Progress bar widget.
- property attr_max¶
- property attr_value¶
- class remi.gui.SelectionInput(default_value='', input_type='text', *args, **kwargs)[source]¶
Bases:
Input
selection input widget useful list selection field implements the oninput event. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist
- property attr_datalist_identifier¶
- property attr_input_type¶
- property attr_value¶
- class remi.gui.SelectionInputWidget(iterable_of_str=None, default_value='', input_type='text', *args, **kwargs)[source]¶
Bases:
Container
- property attr_input_type¶
- property attr_value¶
- datalist = None¶
- oninput(emitter, value)[source]¶
This event occurs when user inputs a new value :returns: the string value :rtype: value (str)
- selection_input = None¶
- class remi.gui.Slider(default_value=0, min=0, max=65535, step=1, **kwargs)[source]¶
Bases:
Input
- property attr_max¶
- property attr_min¶
- property attr_step¶
- property attr_value¶
- class remi.gui.SpinBox(default_value=0, min_value=0, max_value=65535, step=1, allow_editing=True, **kwargs)[source]¶
Bases:
Input
spin box widget useful as numeric input field implements the onchange event.
- property attr_max¶
- property attr_min¶
- property attr_step¶
- property attr_value¶
- class remi.gui.Svg(*args, **kwargs)[source]¶
Bases:
Container
svg widget - is a container for graphic widgets such as SvgCircle, SvgLine and so on.
- property attr_preserveAspectRatio¶
- property attr_viewBox¶
- class remi.gui.SvgCircle(x=0, y=0, radius=50, *args, **kwargs)[source]¶
Bases:
Widget
,_MixinSvgStroke
,_MixinSvgFill
,_MixinTransformable
- property attr_cx¶
- property attr_cy¶
- property attr_r¶
- class remi.gui.SvgEllipse(x=0, y=0, rx=50, ry=30, *args, **kwargs)[source]¶
Bases:
Widget
,_MixinSvgStroke
,_MixinSvgFill
,_MixinTransformable
- property attr_cx¶
- property attr_cy¶
- property attr_rx¶
- property attr_ry¶
- class remi.gui.SvgGradientLinear(x1, y1, x2, y2, *args, **kwargs)[source]¶
Bases:
Tag
- property attr_x1¶
- property attr_x2¶
- property attr_y1¶
- property attr_y2¶
- class remi.gui.SvgGradientRadial(cx='20%', cy='30%', r='30%', fx='50%', fy='50%', *args, **kwargs)[source]¶
Bases:
Tag
- property attr_cx¶
- property attr_cy¶
- property attr_fx¶
- property attr_fy¶
- property attr_r¶
- class remi.gui.SvgGroup(*args, **kwargs)[source]¶
Bases:
Container
,_MixinSvgStroke
,_MixinSvgFill
,_MixinTransformable
svg group - a non visible container for svg widgets, this have to be appended into Svg elements.
- class remi.gui.SvgImage(image_data='', x=0, y=0, w=100, h=100, *args, **kwargs)[source]¶
Bases:
Widget
,_MixinSvgPosition
,_MixinSvgSize
,_MixinTransformable
svg image - a raster image element for svg graphics, this have to be appended into Svg elements.
- property attr_preserveAspectRatio¶
- property image_data¶
- class remi.gui.SvgLine(x1=0, y1=0, x2=50, y2=50, *args, **kwargs)[source]¶
Bases:
Widget
,_MixinSvgStroke
,_MixinTransformable
- property attr_x1¶
- property attr_x2¶
- property attr_y1¶
- property attr_y2¶
- class remi.gui.SvgPath(path_value='', *args, **kwargs)[source]¶
Bases:
Widget
,_MixinSvgStroke
,_MixinSvgFill
,_MixinTransformable
- property attr_d¶
- class remi.gui.SvgPolygon(_maxlen=1000, *args, **kwargs)[source]¶
Bases:
SvgPolyline
,_MixinSvgStroke
,_MixinSvgFill
,_MixinTransformable
- class remi.gui.SvgPolyline(_maxlen=1000, *args, **kwargs)[source]¶
Bases:
Widget
,_MixinSvgStroke
,_MixinSvgFill
,_MixinTransformable
- property maxlen¶
- class remi.gui.SvgRectangle(x=0, y=0, w=100, h=100, *args, **kwargs)[source]¶
Bases:
Widget
,_MixinSvgPosition
,_MixinSvgSize
,_MixinSvgStroke
,_MixinSvgFill
,_MixinTransformable
- property attr_round_corners_h¶
- property attr_round_corners_y¶
- class remi.gui.SvgStop(offset='0%', color='rgb(255,255,0)', opacity=1.0, *args, **kwargs)[source]¶
Bases:
Tag
- property attr_offset¶
- property css_stop_color¶
- property css_stop_opactity¶
- class remi.gui.SvgSubcontainer(x=0, y=0, width=100, height=100, *args, **kwargs)[source]¶
Bases:
Svg
,_MixinSvgPosition
,_MixinSvgSize
svg widget to nest within another Svg element- is a container for graphic widgets such as SvgCircle, SvgLine and so on.
- class remi.gui.SvgText(x=10, y=10, text='svg text', *args, **kwargs)[source]¶
Bases:
Widget
,_MixinSvgPosition
,_MixinSvgStroke
,_MixinSvgFill
,_MixinTextualWidget
,_MixinTransformable
- property attr_dominant_baseline¶
- property attr_lengthAdjust¶
- property attr_rotate¶
- property attr_textLength¶
- property attr_text_anchor¶
- class remi.gui.TabBox(*args, **kwargs)[source]¶
Bases:
Container
A multipage container. Add a tab by doing an append. ie. tabbox.append( widget, “Tab Name” ) The widget can be a container with other child widgets.
- add_tab(widget, key, callback=None)[source]¶
This function is deprecated. Is here for compatibility reasons. The callback is ignored. Use append instead.
- append(widget, key='')[source]¶
Adds a new tab. The widget is the content of the tab. The key is the tab title.
- remove_child(widget)[source]¶
Removes a child instance from the Tag’s children.
- Parameters:
child (Tag) – The child to be removed.
- class remi.gui.Table(*args, **kwargs)[source]¶
Bases:
Container
table widget - it will contains TableRow
- append(value, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- append_from_list(content, fill_title=False)[source]¶
Appends rows created from the data contained in the provided list of tuples of strings. The first tuple of the list can be set as table title.
- Parameters:
content (list) – list of tuples of strings. Each tuple is a row.
fill_title (bool) – if true, the first tuple in the list will be set as title.
- class remi.gui.TableEditableItem(text='', *args, **kwargs)[source]¶
Bases:
Container
,_MixinTextualWidget
item widget for the TableRow.
- class remi.gui.TableItem(text='', *args, **kwargs)[source]¶
Bases:
Container
,_MixinTextualWidget
item widget for the TableRow.
- class remi.gui.TableRow(*args, **kwargs)[source]¶
Bases:
Container
row widget for the Table - it will contains TableItem
- append(value, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- class remi.gui.TableTitle(text='', *args, **kwargs)[source]¶
Bases:
TableItem
,_MixinTextualWidget
title widget for the table.
- class remi.gui.TableWidget(n_rows=2, n_columns=2, use_title=True, editable=False, *args, **kwargs)[source]¶
Bases:
Table
Basic table model widget. Each item is addressed by stringified integer key in the children dictionary.
- property column_count¶
- item_at(row, column)[source]¶
Returns the TableItem instance at row, column cordinates
- Parameters:
row (int) – zero based index
column (int) – zero based index
- item_coords(table_item)[source]¶
Returns table_item’s (row, column) cordinates. Returns None in case of item not found.
- Parameters:
table_item (TableItem) – an item instance
- on_item_changed(item, new_value, row, column)[source]¶
Event for the item change.
- Parameters:
emitter (TableWidget) – The emitter of the event.
item (TableItem) – The TableItem instance.
new_value (str) – New text content.
row (int) – row index.
column (int) – column index.
- property row_count¶
- set_column_count(count)[source]¶
Sets the table column count.
- Parameters:
count (int) – column of rows
- set_use_title(use_title)[source]¶
Returns the TableItem instance at row, column cordinates
- Parameters:
use_title (bool) – enable title bar.
- property use_title¶
- class remi.gui.Tag(attributes=None, _type='', _class=None, **kwargs)[source]¶
Bases:
object
Tag is the base class of the framework. It represents an element that can be added to the GUI, but it is not necessarily graphically representable.
- add_child(key, value)[source]¶
Adds a child to the Tag
To retrieve the child call get_child or access to the Tag.children[key] dictionary.
- Parameters:
key (str) – Unique child’s identifier, or iterable of keys
value (Tag, str) – can be a Tag, an iterable of Tag or a str. In case of iterable of Tag is a dict, each item’s key is set as ‘key’ param
- disable_refresh()[source]¶
Prevents the parent widgets to be notified about an update. This is required to improve performances in case of widgets updated
multiple times in a procedure.
- disable_update()[source]¶
Prevents clients updates. Remi will not send websockets update messages. The widgets are however iternally updated. So if the user updates the
webpage, the update is shown.
- get_child(key)[source]¶
Returns the child identified by ‘key’
- Parameters:
key (str) – Unique identifier of the child.
- property identifier¶
- remove_child(child)[source]¶
Removes a child instance from the Tag’s children.
- Parameters:
child (Tag) – The child to be removed.
- repr(changed_widgets=None)[source]¶
It is used to automatically represent the object to HTML format packs all the attributes, children and so on.
- Parameters:
changed_widgets (dict) – A dictionary containing a collection of tags that have to be updated. The tag that have to be updated is the key, and the value is its textual repr.
- class remi.gui.TextInput(single_line=True, hint='', *args, **kwargs)[source]¶
Bases:
Widget
,_MixinTextualWidget
Editable multiline/single_line text area widget. You can set the content by means of the function set_text or retrieve its content with get_text.
- property attr_maxlength¶
- get_value()[source]¶
- Returns:
The text content of the TextInput. You can set the text content with set_text(text).
- Return type:
str
- onchange(new_value)[source]¶
Called when the user changes the TextInput content. With single_line=True it fires in case of focus lost and Enter key pressed. With single_line=False it fires at each key released.
- Parameters:
new_value (str) – the new string content of the TextInput.
- onkeydown(new_value, keycode)[source]¶
Called when the user types a key into the TextInput.
Note: This event can’t be registered together with Widget.onchange.
- Parameters:
new_value (str) – the new string content of the TextInput.
keycode (str) – the numeric char code
- class remi.gui.TreeItem(text='', *args, **kwargs)[source]¶
Bases:
Container
,_MixinTextualWidget
TreeItem widget can contain other TreeItem.
- append(value, key='')[source]¶
Adds a child widget, generating and returning a key if not provided
In order to access to the specific child in this way container.children[key].
- Parameters:
value (Widget, or iterable of Widgets) – The child to be appended. In case of a dictionary, each item’s key is used as ‘key’ param for the single append.
key (str) – The unique string identifier for the child. Ignored in case of iterable ‘value’ param.
- Returns:
- a key used to refer to the child for all future interaction, or a list of keys in case
of an iterable ‘value’ param
- Return type:
str
- class remi.gui.TreeView(*args, **kwargs)[source]¶
Bases:
Container
TreeView widget can contain TreeItem.
- class remi.gui.VBox(*args, **kwargs)[source]¶
Bases:
HBox
- The purpose of this widget is to automatically vertically aligning
the widgets that are appended to it.
Does not permit children absolute positioning.
In order to add children to this container, use the append(child, key) function. The key have to be numeric and determines the children order in the layout.
Note: If you would absolute positioning, use the Container instead.
- class remi.gui.VideoPlayer(video='', poster=None, autoplay=False, loop=False, *args, **kwargs)[source]¶
Bases:
Widget
- property attr_autoplay¶
- property attr_loop¶
- property attr_poster¶
- property attr_src¶
- property attr_type¶
- class remi.gui.Widget(style=None, *args, **kwargs)[source]¶
Bases:
Tag
,EventSource
Base class for graphical gui widgets. A widget has a graphical css style and receives events from the webpage
- EVENT_ONBLUR = 'onblur'¶
- EVENT_ONCHANGE = 'onchange'¶
- EVENT_ONCLICK = 'onclick'¶
- EVENT_ONCONTEXTMENU = 'oncontextmenu'¶
- EVENT_ONDBLCLICK = 'ondblclick'¶
- EVENT_ONFOCUS = 'onfocus'¶
- EVENT_ONINPUT = 'oninput'¶
- EVENT_ONKEYDOWN = 'onkeydown'¶
- EVENT_ONKEYPRESS = 'onkeypress'¶
- EVENT_ONKEYUP = 'onkeyup'¶
- EVENT_ONMOUSEDOWN = 'onmousedown'¶
- EVENT_ONMOUSELEAVE = 'onmouseleave'¶
- EVENT_ONMOUSEMOVE = 'onmousemove'¶
- EVENT_ONMOUSEOUT = 'onmouseout'¶
- EVENT_ONMOUSEOVER = 'onmouseover'¶
- EVENT_ONMOUSEUP = 'onmouseup'¶
- EVENT_ONTOUCHCANCEL = 'ontouchcancel'¶
- EVENT_ONTOUCHEND = 'ontouchend'¶
- EVENT_ONTOUCHENTER = 'ontouchenter'¶
- EVENT_ONTOUCHLEAVE = 'ontouchleave'¶
- EVENT_ONTOUCHMOVE = 'ontouchmove'¶
- EVENT_ONTOUCHSTART = 'ontouchstart'¶
- EVENT_ONUPDATE = 'onupdate'¶
- property attr_class¶
- property attr_editor_newclass¶
- property attr_title¶
- property css_align_content¶
- property css_align_items¶
- property css_align_self¶
- property css_background_color¶
- property css_background_image¶
- property css_background_position¶
- property css_background_repeat¶
- property css_border_color¶
- property css_border_radius¶
- property css_border_style¶
- property css_border_width¶
- property css_bottom¶
- property css_color¶
- property css_display¶
- property css_flex¶
- property css_flex_direction¶
- property css_flex_flow¶
- property css_flex_wrap¶
- property css_float¶
- property css_font_family¶
- property css_font_size¶
- property css_font_style¶
- property css_font_weight¶
- property css_height¶
- property css_justify_content¶
- property css_left¶
- property css_letter_spacing¶
- property css_line_height¶
- property css_margin¶
- property css_opacity¶
- property css_order¶
- property css_overflow¶
- property css_position¶
- property css_right¶
- property css_top¶
- property css_visibility¶
- property css_white_space¶
- property css_width¶
Called when the Widget gets clicked by the user with the right mouse button.
- ondblclick()[source]¶
Called when the Widget gets double clicked by the user with the left mouse button.
- onkeydown(key, keycode, ctrl, shift, alt)[source]¶
Called when user types and releases a key. The widget should be able to receive the focus in order to emit the event. Assign a ‘tabindex’ attribute to make it focusable.
- Parameters:
key (str) – the character value
keycode (str) – the numeric char code
- onkeyup(key, keycode, ctrl, shift, alt)[source]¶
Called when user types and releases a key. The widget should be able to receive the focus in order to emit the event. Assign a ‘tabindex’ attribute to make it focusable.
- Parameters:
key (str) – the character value
keycode (str) – the numeric char code
- onmousedown(x, y)[source]¶
Called when the user presses left or right mouse button over a Widget.
- Parameters:
x (float) – position of the mouse inside the widget
y (float) – position of the mouse inside the widget
- onmouseleave()[source]¶
Called when the mouse cursor moves outside a Widget.
- Note: This event is often used together with the Widget.onmouseenter event, which occurs when the mouse pointer
is moved onto a Widget.
- Note: The Widget.onmouseleave event is similar to the Widget.onmouseout event. The only difference is that the
onmouseleave event does not bubble (does not propagate up the Widgets tree).
- onmousemove(x, y)[source]¶
Called when the mouse cursor moves inside the Widget.
- Parameters:
x (float) – position of the mouse inside the widget
y (float) – position of the mouse inside the widget
- onmouseout()[source]¶
Called when the mouse cursor moves outside a Widget.
- Note: This event is often used together with the Widget.onmouseover event, which occurs when the pointer is
moved onto a Widget, or onto one of its children.
- onmouseover()[source]¶
Called when the mouse cursor moves onto a Widget.
Note: This event is often used together with the Widget.onmouseout event.
- onmouseup(x, y)[source]¶
Called when the user releases left or right mouse button over a Widget.
- Parameters:
x (float) – position of the mouse inside the widget
y (float) – position of the mouse inside the widget
- onquery_client_result(**kwargs)[source]¶
WARNING: this is a new feature, subject to changes. This event allows to get back the values fetched by ‘query’ method. :returns: a dictionary containing name:value of all the requested parameters :rtype: values_dictionary (dict)
- ontouchcancel()[source]¶
Called when a touch point has been disrupted in an implementation-specific manner (for example, too many touch points are created).
- ontouchend(x, y)[source]¶
Called when a finger is released from the widget.
- Parameters:
x (float) – position of the finger inside the widget
y (float) – position of the finger inside the widget
- ontouchenter(x, y)[source]¶
Called when a finger touches from outside to inside the widget.
- Parameters:
x (float) – position of the finger inside the widget
y (float) – position of the finger inside the widget
- ontouchmove(x, y)[source]¶
Called continuously while a finger is dragged across the screen, over a Widget.
- Parameters:
x (float) – position of the finger inside the widget
y (float) – position of the finger inside the widget
- ontouchstart(x, y)[source]¶
Called when a finger touches the widget.
- Parameters:
x (float) – position of the finger inside the widget
y (float) – position of the finger inside the widget
- query_client(app_instance, attribute_list, style_property_list)[source]¶
WARNING: this is a new feature, subject to changes. This method allows to query client rendering attributes and style properties of a widget. The user, in order to get back the values must register a listener for the event ‘onquery_client_result’. :param app_instance: the app instance :type app_instance: App :param attribute_list: list of attributes names :type attribute_list: list :param style_property_list: list of style property names :type style_property_list: list
- repr(changed_widgets=None)[source]¶
Represents the widget as HTML format, packs all the attributes, children and so on.
- Parameters:
changed_widgets (dict) – A dictionary containing a collection of widgets that have to be updated. The Widget that have to be updated is the key, and the value is its textual repr.
- set_enabled(enabled)[source]¶
Sets the enabled status. If a widget is disabled the user iteraction is not allowed
- Parameters:
enabled (bool) – the enabling flag
- set_size(width, height)[source]¶
Set the widget size.
- Parameters:
width (int or str) – An optional width for the widget (es. width=10 or width=’10px’ or width=’10%’).
height (int or str) – An optional height for the widget (es. height=10 or height=’10px’ or height=’10%’).
- set_style(style)[source]¶
Allows to set style properties for the widget. :param style: The style property dictionary or json string. :type style: str or dict
- property variable_name¶
- remi.gui.decorate_event_js(js_code)[source]¶
setup a method as an event, adding also javascript code to generate
- Parameters:
js_code (str) – javascript code to generate the event client-side. js_code is added to the widget html as widget.attributes[‘onclick’] = js_code%{‘emitter_identifier’:widget.identifier, ‘event_name’:’onclick’}
- remi.gui.decorate_set_on_listener(prototype)[source]¶
Private decorator for use in the editor. Allows the Editor to create listener methods.
- Parameters:
params (str) – The list of parameters for the listener method (es. “(self, new_value)”)
- remi.gui.load_resource(filename)[source]¶
Convenient function. Given a local path and filename (not in standard remi resource format), loads the content and returns a base64 encoded data. This method allows to bypass the remi resource file management, accessing directly local disk files.
- Parameters:
filename (str) – path and filename of a local file (ie. “/home/mydirectory/image.png”)
- Returns:
the encoded base64 data together with mimetype packed to be displayed immediately.
- Return type:
str
- remi.gui.to_uri(uri_data)[source]¶
Convenient function to encase the resource filename or data in url(‘’) keyword
- Parameters:
uri_data (str) – filename or base64 data of the resource file
- Returns:
the input string encased in url(‘’) ie. url(‘/res:image.png’)
- Return type:
str
remi.server module¶
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class remi.server.App(request, client_address, server, **app_args)[source]¶
Bases:
BaseHTTPRequestHandler
,object
This class will handles any incoming request from the browser The main application class can subclass this In the do_POST and do_GET methods it is expected to receive requests such as:
function calls with parameters
file requests
- do_gui_update()[source]¶
This method gets called also by Timer, a new thread, and so needs to lock the update
- idle()[source]¶
Idle function called every UPDATE_INTERVAL before the gui update. Useful to schedule tasks.
- main(*_)[source]¶
Subclasses of App class must declare a main function that will be the entry point of the application. Inside the main function you have to declare the GUI structure and return the root widget.
- notification_message(title, content, icon='')[source]¶
This function sends “javascript” message to the client, that executes its content. In this particular code, a notification message is shown
- re_attr_call = re.compile('^/*(\\w+)\\/(\\w+)\\?{0,1}(\\w*\\={1}([^&])+\\&{0,1})*$')¶
- re_static_file = re.compile("^([\\/]*[\\w\\d]+:[-_. $@?#£'%=()\\/\\[\\]!+°§^,\\w\\d]+)")¶
- class remi.server.Server(gui_class, title='', start=True, address='127.0.0.1', port=0, username=None, password=None, multiple_instance=False, enable_file_cache=True, update_interval=0.1, start_browser=True, websocket_timeout_timer_ms=1000, pending_messages_queue_length=1000, certfile=None, keyfile=None, ssl_version=None, userdata=())[source]¶
Bases:
object
- property address¶
- property title¶
- class remi.server.StandaloneServer(gui_class, title='', width=800, height=600, resizable=True, fullscreen=False, start=True, userdata=())[source]¶
Bases:
Server
- class remi.server.ThreadedHTTPServer(server_address, RequestHandlerClass, auth, multiple_instance, enable_file_cache, update_interval, websocket_timeout_timer_ms, pending_messages_queue_length, title, server_starter_instance, certfile, keyfile, ssl_version, *userdata)[source]¶
Bases:
ThreadingMixIn
,HTTPServer
- daemon_threads = False¶
- class remi.server.WebSocketsHandler(headers, request, client_address, server, *args, **kwargs)[source]¶
Bases:
StreamRequestHandler
- magic = b'258EAFA5-E914-47DA-95CA-C5AB0DC85B11'¶
- remi.server.parse_parametrs(p)[source]¶
Parses the parameters given from POST or websocket reqs expecting the parameters as: “11|par1=’asd’|6|par2=1” returns a dict like {par1:’asd’,par2:1}