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 import dep_check
28 if dep_check.wx_module:
29 from wx import FD_CHANGE_DIR
30 else:
31 FD_CHANGE_DIR = -1
32 from os import sep
33
34
35 from graphics import WIZARD_OXYGEN_PATH
36 from info import print_sys_info
37 from lib.timing import print_time
38 from pipe_control.system import cd, pwd
39 from user_functions.data import Uf_info; uf_info = Uf_info()
40 from user_functions.objects import Desc_container
41
42
43
44 uf_class = uf_info.add_class('system')
45 uf_class.title = "Class containing the OS system related functions."
46 uf_class.menu_text = "&system"
47 uf_class.gui_icon = "oxygen.actions.help-about"
48
49
50
51 uf = uf_info.add_uf('system.cd')
52 uf.title = "Change the current working directory to the specified path."
53 uf.title_short = "Change current working directory."
54 uf.display = True
55 uf.add_keyarg(
56 name = "path",
57 py_type = "str",
58 arg_type = "dir sel",
59 desc_short = "path",
60 desc = "The path to the new current working directory.",
61 can_be_none = False,
62 wiz_filesel_style = FD_CHANGE_DIR
63 )
64
65 uf.desc.append(Desc_container())
66 uf.desc[-1].add_paragraph("The equivalent of python module os.chdir(path). Change the current working directory to the specified path.")
67 uf.desc[-1].add_paragraph("To change the current working directory, type:")
68 uf.desc[-1].add_prompt("relax> system.cd(\"/path/to/dir\")")
69 uf.backend = cd
70 uf.display = False
71 uf.menu_text = "&cd"
72 uf.gui_icon = "oxygen.places.folder-favorites"
73 uf.wizard_size = (700, 400)
74 uf.wizard_image = WIZARD_OXYGEN_PATH + 'places' + sep + 'folder-favorites.png'
75 uf.wizard_apply_button = False
76
77
78
79 uf = uf_info.add_uf('system.pwd')
80 uf.title = "Display the current working directory."
81 uf.title_short = "Display working directory."
82 uf.display = True
83
84 uf.desc.append(Desc_container())
85 uf.desc[-1].add_paragraph("This will display the current working directory.")
86 uf.desc[-1].add_paragraph("The directory can be changed with the system.cd(path) user function.")
87 uf.desc[-1].add_prompt("relax> system.pwd()")
88 uf.desc[-1].add_prompt("relax> system.cd(\"/path/to/dir\")")
89 uf.backend = pwd
90 uf.menu_text = "&pwd"
91 uf.gui_icon = "oxygen.places.folder-development"
92 uf.wizard_size = (700, 400)
93 uf.wizard_image = WIZARD_OXYGEN_PATH + 'places' + sep + 'folder-development.png'
94 uf.wizard_apply_button = False
95
96
97
98 uf = uf_info.add_uf('system.sys_info')
99 uf.title = "Display all system information relating to this version of relax."
100 uf.title_short = "Display system information."
101 uf.display = True
102
103 uf.desc.append(Desc_container())
104 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.")
105 uf.backend = print_sys_info
106 uf.menu_text = "s&ys_info"
107 uf.gui_icon = "oxygen.actions.help-about"
108 uf.wizard_size = (700, 400)
109 uf.wizard_apply_button = False
110
111
112
113 uf = uf_info.add_uf('system.time')
114 uf.title = "Display the current time."
115 uf.title_short = "Current time."
116 uf.display = True
117
118 uf.desc.append(Desc_container())
119 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.")
120 uf.backend = print_time
121 uf.menu_text = "&time"
122 uf.gui_icon = "oxygen.actions.chronometer"
123 uf.wizard_size = (700, 400)
124 uf.wizard_apply_button = False
125