opentea.gui_forms package¶
Submodules¶
opentea.gui_forms.constants module¶
Constants definitions.
-
exception
opentea.gui_forms.constants.
GetException
¶ Bases:
Exception
Define an exception on the widget getters.
-
exception
opentea.gui_forms.constants.
SetException
¶ Bases:
Exception
Define an exception on the widget setters.
-
class
opentea.gui_forms.constants.
SwitchForm
(master=None, **kw)¶ Bases:
tkinter.ttk.Frame
Overriden Frame class to mimick notebooks without tabs.
-
add
(name, title=None)¶ Add a tab-like Frame.
-
sf_del
(tab_name)¶ Destroy tab_id tab.
-
sf_raise
(tab_name)¶ Forget current view and repack tab_name tab.
-
-
class
opentea.gui_forms.constants.
TextConsole
(holder, content, height=None, width=None, search=False, disabled=True)¶ Bases:
object
Text widget with search and auto -refresh capabilities.
-
get
()¶ Get the content
-
highlight_pattern
(*args)¶ Highlight the pattern.
-
update
(*args)¶ Update the content
-
-
opentea.gui_forms.constants.
create_scrollable_canvas
(holder_frame)¶ Create a scollable canvas.
-
opentea.gui_forms.constants.
load_icons
()¶ Load icons.
Load all ./otinker_images/*_icon.gif as icons
load_icons : dictionnary of ImageTk objects
-
opentea.gui_forms.constants.
quit_dialog
()¶ Quitting dialog
-
opentea.gui_forms.constants.
set_constants
(tksession, calling_dir, theme)¶ Set top Tk objet
-
opentea.gui_forms.constants.
set_root
(root)¶ Set root objet
-
opentea.gui_forms.constants.
set_tabs
(tabs)¶ Set validate shared meory
-
opentea.gui_forms.constants.
tab_validated
(tabname, value)¶ Set validate shared meory
-
opentea.gui_forms.constants.
waiting_screen
(root)¶ setup a waiting screen
opentea.gui_forms.leaf_widgets module¶
Leaf widgets :¶
Leaves are the lower part to the graph, at the tip of the branches. Most of these widget are entries.
Entries:¶
The generic node EntryNode is the basis for all single line inputs:
numbers
integers
strings
Additionnal content can be shown to give info in the case of validation rules.
Booleans:¶
This is tranlated to a single Checkbox
Choices:¶
The choice widget corresponds to the Schema enum property. This is tranlated to radiobuttons in the form.
FleBrowser:¶
This special entry check that the content is a file, and add a browsing dialog to select the file.
Documentation and Description (DEPRECATED):¶
Kept fo backward compatibility, docuementation and descriptions are wats to display strings in the forms.
Prefer now the documentation and description attributes in the blocks.
Comments:¶
Comments are multiline textfields They can also be usefull for feedbach in disabled mode.
Lists:¶
List corresponds to arrays of parameters, shown aslist of entries. These list cannot take dependency links for the moments.
Without a fixed dimension, specified with “MaxItemns” and “MinItems” attributes in the SCHEMA, a +/- dialog is shown to extend or crop the list.
-
class
opentea.gui_forms.leaf_widgets.
LeafWidget
(schema, root_frame, name)¶ Bases:
object
Factory for OpenTea Widgets.
-
get_status
()¶ Return current attribute self.status.
-
-
class
opentea.gui_forms.leaf_widgets.
OTBoolean
(schema, root_frame, name)¶ Bases:
opentea.gui_forms.leaf_widgets.LeafWidget
OT booleans.
-
get
()¶ Return python boolean.
-
set
(value)¶ Set boolean to widget.
-
-
class
opentea.gui_forms.leaf_widgets.
OTChoice
(schema, root_frame, name, dynamic=False)¶ Bases:
opentea.gui_forms.leaf_widgets.LeafWidget
OT choices widget.
-
get
()¶ Return python string.
-
set
(value)¶ Set choice to widget.
-
-
class
opentea.gui_forms.leaf_widgets.
OTComment
(schema, root_frame, name)¶ Bases:
opentea.gui_forms.leaf_widgets.LeafWidget
OT Comment field.
-
get
()¶ Return data.
-
set
(value)¶ Set content.
-
-
class
opentea.gui_forms.leaf_widgets.
OTDescription
(schema, root_frame, name)¶ Bases:
opentea.gui_forms.leaf_widgets.LeafWidget
OT descriptin field.
-
get
()¶ Return data.
-
set
(value)¶ Set content.
-
-
class
opentea.gui_forms.leaf_widgets.
OTDocu
(schema, root_frame, name)¶ Bases:
opentea.gui_forms.leaf_widgets.LeafWidget
OTinteger variable.
-
get
()¶ Void return.
-
set
(value)¶ Set value to documentation content.
-
-
class
opentea.gui_forms.leaf_widgets.
OTEmpty
(schema, root_frame, name)¶ Bases:
opentea.gui_forms.leaf_widgets.LeafWidget
OT widget for unimplemented types.
-
get
()¶ Return data.
-
set
(value)¶ Set content.
-
-
class
opentea.gui_forms.leaf_widgets.
OTFileBrowser
(schema, root_frame, name)¶ Bases:
opentea.gui_forms.leaf_widgets.LeafWidget
OT file/folder browser widget.
-
get
()¶ Return data.
-
set
(value)¶ Set content.
-
-
class
opentea.gui_forms.leaf_widgets.
OTInteger
(schema, root_frame, name)¶ Bases:
opentea.gui_forms.leaf_widgets._OTEntry
OTinteger variable.
-
get
()¶ Return python integer.
-
set
(value)¶ Set integer to widget.
-
-
class
opentea.gui_forms.leaf_widgets.
OTList
(schema, root_frame, name)¶ Bases:
opentea.gui_forms.leaf_widgets.LeafWidget
Factory for OpenTea Lists.
-
additem
()¶ Add an item at the end of the array.
-
delitem
()¶ Delete item at the end of the array
-
get
()¶ Return data.
-
memory_changed
(event)¶ Trigger virtual event on memory change.
-
set
(value)¶ Set content.
-
opentea.gui_forms.node_widgets module¶
Recursive edicrection according to SCHEMA type¶
This module staets with the recursive redirection according to SCHEMA types.
Module for containers widgets¶
This module take care of all the node elements of the graph, which correspond to containers in the Form. At least the three first level of the SCHEMA must be objects,
and are treated as containers. Oll the containers derive from the generic Node-Widget.
The root level:¶
The inital node, Not treted here, see root_widget.
The Tab level:¶
The second node level. Treated here, see Tabs_widgets. This one can support two types of callbacks, either for editing the memory, or for updating the 3D view.
The Block level :¶
The Thirl level gather parameters into families. This one can support descriptions, images and documentation.
Special container : The Multiple widget :¶
This container correspont to an SCHEMA array of objet items. See it as a list (free or dependent) of similar containers.
Mutliple can be use freely or with a dependency. In the last case, the items of the multiple is linked to the value of a string array somewhere else in the SCHEMA. For exeample, in CFD, This is usefoull for a set of boundary conditions, found by reading a MESH.
Special container : the XOR widget :¶
This is merely a selector between several blocks. This marks a bifurcation in your graph. For example in CFD, this is usefull for the selection between different models taking different parameters.
- warning exception here
XOR is the only node element storing a Value.
The value is implicit : it is the name of the only child of the XOR in the memory.
It could have been designed otherwise, keeping all the children inthe memory, and a real leaf value to know which one must be taken. However, thos is impractical here. For example in CFD, you can have a Multiple of 100 boundary conditions, with a XOR for each selecting between 30 models of BCs. Such a graph would be a hassle to read and hack for humans.
-
class
opentea.gui_forms.node_widgets.
OTContainerWidget
(schema, root_frame, name, tab, n_width=1, relief='ridge')¶ Bases:
opentea.gui_forms.node_widgets.OTNodeWidget
OT container widget.
-
body
¶ Forcing the widget size
-
pack_unpack_body
(event)¶ swtich on or off the packing of the body
-
show_docu
(event)¶ Call the documentation browser
-
-
class
opentea.gui_forms.node_widgets.
OTMultipleItem
(multiple, name, tab)¶ Bases:
opentea.gui_forms.node_widgets.OTContainerWidget
OT multiple widget.
-
class
opentea.gui_forms.node_widgets.
OTMultipleWidget
(schema, root_frame, name, tab)¶ Bases:
object
OT multiple widget.
-
add_item_on_cursel
()¶ Add an item in the multiple.
Item will be added before the current selection.
-
del_item_by_name
(name)¶ Delete a Multiple item by its name.
-
del_item_on_cursel
()¶ Delete a Multiple item from tv selection.
-
get
()¶ Get the data of children widgets.
a list with the get result of childrens
-
get_status
()¶ Compute the minimal status in children.
-
index_of_item
(name)¶ Find index of a Multiple item by its name.
-
load_from_file
()¶ load multiple content from an other file
For multiple without dependencies, replace the content
- For multiple with dependencies,
only items with the same name are updates, others are left
-
refresh_view
(event=None)¶ Refresh items values on tree view.
-
rename_callback
(item_name)¶ Trigger renaming if dialog conditions are met.
-
rename_item
(item_name, new_name)¶ Rename one element of the multiple.
-
set
(list_)¶ Get the data of children widgets.
a list with the value of the childrens
-
-
class
opentea.gui_forms.node_widgets.
OTNodeWidget
(schema)¶ Bases:
object
Factory for OpenTea Widgets Containers.
-
get
()¶ Get the data of children widgets.
a dictionnary with the get result of childrens
-
get_status
()¶ Return the minimal status of children.
-
set
(dict_)¶ Get the data of children widgets.
a dictionnary with the value of the childrens
-
-
class
opentea.gui_forms.node_widgets.
OTTabWidget
(schema, root, name)¶ Bases:
opentea.gui_forms.node_widgets.OTNodeWidget
OT Tab widget container.
Called for the 1st layer of nodes in the global schema
-
get_status
()¶ Return the minimal status of children.
-
on_memory_change
(event)¶ Check if the sender is child of this tab.process. set to unknown if so
-
on_memory_check
(event)¶ Update content upon status of children.
Procees the main tab button.
-
smartpacker
(event=None)¶ Smart grid upon widget size.
Regrid the object according to the width of the window from the inside
-
update_tab_icon
()¶ Update the Tab icon upon status.
-
-
class
opentea.gui_forms.node_widgets.
OTXorWidget
(schema, root_frame, name, tab, n_width=1)¶ Bases:
object
OT Or-exclusive / oneOf widget.
-
get
()¶ Get the data of children widgets.
a dictionnary with the get result of current children
-
get_status
()¶ Proxy to the get_status of the current child.
-
set
(dict_)¶ Get the data of children widgets.
a dictionnary with the value of the childrens
-
show_docu
(event)¶ Call the documentation browser
-
update_xor_content
(name_child, data_in=None)¶ Reconfigure XOR button.
name_child : sting, naming the child object data_in : dictionary used to pre-fill the data
-
xor_callback
(name_child)¶ Event on XOR menu selection.
-
-
opentea.gui_forms.node_widgets.
create_description
(parent, description, size=0.9)¶ Interpret the description to tkae into account font modifiers
-
opentea.gui_forms.node_widgets.
redirect_string
(schema, root_frame, name)¶ Redirect to string widgets.
The schema attributes trigger which string widget will be in use.
schema : a schema object root_frame : a Tk object were the widget will be grafted name : name of the element
none
-
opentea.gui_forms.node_widgets.
redirect_widgets
(schema, root_frame, name, tab)¶ Redirect to widgets.
The schema attributes trigger which widget will be in use.
schema : a schema object root_frame : a Tk object were the widget will be grafted name : name of the element tab: the tab holding this widget
none
opentea.gui_forms.otinker module¶
Generate a Tk from upon a Gui schema.
A GUI schema is a JSON-Schema dictionnary, with tags require and existifs added to declare explicit cyclic depenencies
-
opentea.gui_forms.otinker.
ask_new_file
()¶ Dialog to ask a new file
-
opentea.gui_forms.otinker.
main_otinker
(schema, calling_dir=None, start_mainloop=True, tab_3d=False, theme='clam', data_file=None)¶ Startup the gui generation.
schema : dictionary compatible with json-schema calling_dir : directory from which otinker was called test_only : only for testing
a tkinter GUI
opentea.gui_forms.root_widget module¶
The root widget¶
The root widget is the fisrt called by otinker. It corresponds to the firts node ot the SCHEMA.
At the root widget, the whole window is created. The root host the main Tab-notebook, and if necessary the wiew 3D tab.
Tabs callbacks:¶
As tabs callbacks can change any part of the memory, These callbacks are passed down to the root widget, trigerring two subprocesses.
Execute:¶
Execute is about memory modification. The callback associated shows the following singature:
nested object > callback > nested object
Update_3d_view:¶
Update_3d_view is about 3D feedback. The callback associated shows the following singature:
nested object, 3D scene > callback > 3D scene
-
class
opentea.gui_forms.root_widget.
OTRoot
(schema, tksession, start_mainloop=True, tab_3d=False, data_file=None)¶ Bases:
opentea.gui_forms.node_widgets.OTNodeWidget
OT root widget.
-
clean_tmp_files
()¶ Clean the tempoeray files of gui
-
execute
(script)¶ execute a script
-
save_project
()¶ Save the current data into the project file.
Either called from Save As or at each process/validate
-
update_3d_view
(script)¶ execute a script for 3d view update
-