Salome HOME
Merge branch 'V8_4_BR'
[modules/gui.git] / doc / salome / gui / input / text_user_interface.doc
1 /*!
2
3 \page tui_page Using SALOME GUI python interface
4
5
6 The extended salome.py Python module provides \b sg variable, which gives access to some GUI functions.
7
8 \b Note, that this variable is not available if you use salome.py
9 Python module outside of the GUI desktop, i.e. without the embedded Python
10 console (since SWIG library is linked directly to the GUI library).
11
12 The example of usage:
13 \code
14 # update Object browser contents
15 salome.sg.updateObjBrowser(True)
16
17 # get the active study ID
18 studyId = salome.sg.getActiveStudyId() 
19
20 # get the active study name
21 studyName = salome.sg.getActiveStudyName()
22
23 # get the selected objects
24 selCount = salome.sg.SelectedCount() # the number of selected items
25 for i in range(selCount):
26     print salome.sg.getSelected(i) # print the entry ID of i-th selected item
27 \endcode
28
29 \code
30 # get the list of IDs of all selected objects
31 selected = salome.sg.getAllSelected()
32
33 # add an object to the selection
34 salome.sg.AddIObject("0:1:1:1") # "0:1:1:1" is an object ID 
35
36 # remove an object from the selection (make it unselected)
37 salome.sg.RemoveIObject("0:1:1:1") # "0:1:1:1" is an object ID 
38
39 # clear the selection (set all objects unselected)
40 salome.sg.ClearIObjects()
41
42 # display an object in the current view (if possible)
43 salome.sg.Display("0:1:1:1") # "0:1:1:1" is an object ID 
44 salome.sg.UpdateView() # update view
45
46 # erase an object from the current view
47 salome.sg.Erase("0:1:1:1") # "0:1:1:1" is an object ID 
48 salome.sg.UpdateView() # update view
49
50 # display all objects in the current view (if possible)
51 salome.sg.DisplayAll()
52 salome.sg.UpdateView() # update view
53
54 # erase all objects from the current view
55 salome.sg.EraseAll()
56 salome.sg.UpdateView() # update view
57
58 # set top, bottom, front, rear, left, right view
59 salome.sg.ViewTop() # top view
60 salome.sg.ViewBottom() # bottom view
61 salome.sg.ViewFront() # front view
62 salome.sg.ViewTop() #  back view
63 salome.sg.ViewLeft() # left view
64 salome.sg.ViewRight() # right view
65
66 # reset the current view
67 salome.sg.ResetView()
68
69 # get the component symbolic name by its user name
70 compName = salome.sg.getComponentName("Geometry") # compoName = "GEOM"
71
72 # get the component user name by its symbolic name
73 compName = salome.sg.getComponentUserName("SMESH") # compoName = "Mesh"
74
75 # ...
76 \endcode
77
78 */