1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The sys_info user function definitions."""
25
26
27 from os import sep
28
29
30 from graphics import WIZARD_OXYGEN_PATH
31 from info import print_sys_info
32 from lib.timing import print_time
33 from pipe_control.system import cd, pwd
34 from user_functions.data import Uf_info; uf_info = Uf_info()
35 from user_functions.objects import Desc_container
36
37
38
39 uf_class = uf_info.add_class('system')
40 uf_class.title = "Class containing the OS system related functions."
41 uf_class.menu_text = "&system"
42 uf_class.gui_icon = "oxygen.actions.help-about"
43
44
45
46 uf = uf_info.add_uf('system.cd')
47 uf.title = "Change the current working directory to the specified path."
48 uf.title_short = "Change current working directory."
49 uf.display = True
50 uf.add_keyarg(
51 name = "path",
52 arg_type = "dir sel",
53 desc_short = "path",
54 desc = "The path to the new current working directory.",
55 can_be_none = False,
56 )
57
58 uf.desc.append(Desc_container())
59 uf.desc[-1].add_paragraph("The equivalent of python module os.chdir(path). Change the current working directory to the specified path.")
60 uf.desc[-1].add_paragraph("To change the current working directory, type:")
61 uf.desc[-1].add_prompt("relax> system.cd(\"/path/to/dir\")")
62 uf.backend = cd
63 uf.display = False
64 uf.menu_text = "&cd"
65 uf.gui_icon = "oxygen.places.folder-favorites"
66 uf.wizard_size = (700, 400)
67 uf.wizard_image = WIZARD_OXYGEN_PATH + 'places' + sep + 'folder-favorites.png'
68 uf.wizard_apply_button = False
69
70
71
72 uf = uf_info.add_uf('system.pwd')
73 uf.title = "Display the current working directory."
74 uf.title_short = "Display working directory."
75 uf.display = True
76
77 uf.desc.append(Desc_container())
78 uf.desc[-1].add_paragraph("This will display the current working directory.")
79 uf.desc[-1].add_paragraph("The directory can be changed with the system.cd(path) user function.")
80 uf.desc[-1].add_prompt("relax> system.pwd()")
81 uf.desc[-1].add_prompt("relax> system.cd(\"/path/to/dir\")")
82 uf.backend = pwd
83 uf.menu_text = "&pwd"
84 uf.gui_icon = "oxygen.places.folder-development"
85 uf.wizard_size = (700, 400)
86 uf.wizard_image = WIZARD_OXYGEN_PATH + 'places' + sep + 'folder-development.png'
87 uf.wizard_apply_button = False
88
89
90
91 uf = uf_info.add_uf('system.sys_info')
92 uf.title = "Display all system information relating to this version of relax."
93 uf.title_short = "Display system information."
94 uf.display = True
95
96 uf.desc.append(Desc_container())
97 uf.desc[-1].add_paragraph("This will display all of the relax, Python, python package and hardware information currently being used by relax. This is useful for seeing if all packages are up to date and if the correct software versions are being used. It is also very useful information for reporting relax bugs.")
98 uf.backend = print_sys_info
99 uf.menu_text = "s&ys_info"
100 uf.gui_icon = "oxygen.actions.help-about"
101 uf.wizard_size = (700, 400)
102 uf.wizard_apply_button = False
103
104
105
106 uf = uf_info.add_uf('system.time')
107 uf.title = "Display the current time."
108 uf.title_short = "Current time."
109 uf.display = True
110
111 uf.desc.append(Desc_container())
112 uf.desc[-1].add_paragraph("This user function will display the current time which can be useful for timing long calculations by having time information in any saved log files.")
113 uf.backend = print_time
114 uf.menu_text = "&time"
115 uf.gui_icon = "oxygen.actions.chronometer"
116 uf.wizard_size = (700, 400)
117 uf.wizard_apply_button = False
118