Package user_functions :: Module sys_info
[hide private]
[frames] | no frames]

Source Code for Module user_functions.sys_info

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2011-2012,2014 Edward d'Auvergne                              # 
  4  # Copyright (C) 2016 Troels Schwarz-Linnet                                    # 
  5  #                                                                             # 
  6  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  7  #                                                                             # 
  8  # This program is free software: you can redistribute it and/or modify        # 
  9  # it under the terms of the GNU General Public License as published by        # 
 10  # the Free Software Foundation, either version 3 of the License, or           # 
 11  # (at your option) any later version.                                         # 
 12  #                                                                             # 
 13  # This program is distributed in the hope that it will be useful,             # 
 14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 16  # GNU General Public License for more details.                                # 
 17  #                                                                             # 
 18  # You should have received a copy of the GNU General Public License           # 
 19  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Module docstring. 
 24  """The sys_info user function definitions.""" 
 25   
 26  # Python module imports. 
 27  from os import sep 
 28   
 29  # relax module imports. 
 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  # The user function class. 
 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  # The cd user function. 
 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  # Description. 
 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  # The system.pwd user function. 
 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  # Description. 
 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  # The sys_info user function. 
 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  # Description. 
 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  # The time user function. 
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  # Description. 
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