Changeset 4393
- Timestamp:
- Feb 4, 2020 9:24:48 PM (5 years ago)
- Location:
- palm/trunk/SCRIPTS
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palm_gf
r2825 r4393 25 25 # ----------------- 26 26 # $Id$ 27 # Removed PALM_BIN dependency 28 # 29 # 2825 2018-02-20 21:48:27Z maronga 27 30 # Modified header 28 31 # … … 67 70 68 71 # Determine PALM directories 72 # Determine PALM directories 69 73 try: 70 devnull = open(os.devnull, 'w') 71 out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT) 72 palm_bin = out.rstrip() 73 palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1] 74 out = None 74 devnull = open(os.devnull, 'w') 75 palm_dir = os.getcwd() 76 palm_bin = palm_dir + '/trunk/SCRIPTS' 77 job_dir = palm_dir + '/JOBS' 78 user_dir = palm_dir + '/USER_CODE' 79 with open(palm_bin + '/palmrungui', 'r') as fh: 80 # file found 81 out = None 75 82 except: 76 print "Error. $PALM_BIN is not set."83 print ('Error. palm_gf probably called in wrong directory.') 77 84 raise SystemExit 78 85 -
palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py
- Property svn:keywords set to Id
r2309 r4393 1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 #--------------------------------------------------------------------------------# 4 # This file is part of the PALM model system. 5 # 6 # PALM is free software: you can redistribute it and/or modify it under the terms 7 # of the GNU General Public License as published by the Free Software Foundation, 8 # either version 3 of the License, or (at your option) any later version. 9 # 10 # PALM is distributed in the hope that it will be useful, but WITHOUT ANY 11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License along with 15 # PALM. If not, see <http://www.gnu.org/licenses/>. 16 # 17 # Copyright 1997-2018 Leibniz Universitaet Hannover 18 #--------------------------------------------------------------------------------# 19 # 20 # Current revisions: 21 # ----------------- 22 # 23 # 24 # Former revisions: 25 # ----------------- 26 # $Id$ 27 # Initial revision 28 # 29 # 30 # 31 # 32 # 33 # Description: 34 # ------------ 35 # 36 # 37 # Instructions: 38 # ------------- 39 # 40 #------------------------------------------------------------------------------! 41 1 42 import sys 2 43 import os … … 6 47 import palm_gf_conf as configwr 7 48 8 out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)9 palm_bin = out.rstrip()49 palm_dir = os.getcwd() 50 palm_bin = palm_dir + '/trunk/SCRIPTS' 10 51 11 52 qtCreatorFile = palm_bin + '/palm_gf_files/palm_gf_table.ui' -
palm/trunk/SCRIPTS/palm_jm
r2825 r4393 25 25 # ----------------- 26 26 # $Id$ 27 # Removed PALM_BIN dependency 28 # 29 # 2825 2018-02-20 21:48:27Z maronga 27 30 # Modified header 28 31 # … … 77 80 78 81 82 79 83 # Determine PALM directories 80 84 try: 81 devnull = open(os.devnull, 'w') 82 out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT) 83 palm_bin = out.rstrip() 84 palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1] 85 out = None 86 85 devnull = open(os.devnull, 'w') 86 palm_dir = os.getcwd() 87 palm_bin = palm_dir + '/trunk/SCRIPTS' 87 88 job_dir = palm_dir + '/JOBS' 88 89 user_dir = palm_dir + '/USER_CODE' 89 90 with open(palm_bin + '/palm_jm', 'r') as fh: 91 # file found 92 out = None 90 93 except: 91 print "Error. $PALM_BIN is not set."94 print ('Error. palm_jm probably called in wrong directory.') 92 95 raise SystemExit 93 94 96 95 97 96 98 # MainWindow class 97 99 class JobManager(QtGui.QMainWindow): 98 100 101 99 102 def __init__(self): 103 100 104 super(JobManager, self).__init__() 101 102 self.InitUi() 103 105 106 self.InitUi() 107 104 108 105 109 # Initialized MainWindow UI 106 110 def InitUi(self): 107 111 112 print(palm_bin + '/palm_jm_files/palm_jm.ui') 113 108 114 # Load predefined mainwindow 109 115 uic.loadUi(palm_bin + '/palm_jm_files/palm_jm.ui', self) 110 116 111 117 self.palm_logo.setPixmap(QtGui.QPixmap(palm_dir + "/trunk/SCRIPTS/palmrungui_files/logo.png")) 112 113 118 114 119 115 120 # Display MainWindow 116 121 self.show() 122 117 123 QtGui.QApplication.processEvents() 118 124 125 119 126 self.load_jobs() 120 127 121 122 128 def update_all(self): 123 129 -
palm/trunk/SCRIPTS/palm_wd
r3943 r4393 25 25 # ----------------- 26 26 # $Id$ 27 # Removed PALM_BIN dependency 28 # 29 # 3943 2019-05-02 09:50:41Z maronga 27 30 # Adjustments and bugfixes 28 31 # … … 99 102 100 103 for i in range(0,len(sys.argv)): 101 out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)102 104 input_config = str(sys.argv[i]) 103 palm_ bin = out.rstrip()104 palm_ dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]105 palm_dir = os.getcwd() 106 palm_bin = palm_dir + '/trunk/SCRIPTS' 105 107 106 108 config = configparser.RawConfigParser(allow_no_value=True) -
palm/trunk/SCRIPTS/palmrungui
r3487 r4393 25 25 # ----------------- 26 26 # $Id$ 27 # Removed PALM_BIN dependency and os calls 28 # 29 # 3487 2018-11-05 07:18:02Z maronga 27 30 # Renamed options -d and -h to -r and -c. 28 31 # … … 75 78 # Determine PALM directories 76 79 try: 77 devnull = open(os.devnull, 'w') 78 out = subprocess.check_output("echo $PALM_BIN", shell=True, stderr=subprocess.STDOUT) 79 palm_bin = out.rstrip() 80 palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1] 81 out = None 80 devnull = open(os.devnull, 'w') 81 palm_dir = os.getcwd() 82 palm_bin = palm_dir + '/trunk/SCRIPTS' 83 job_dir = palm_dir + '/JOBS' 84 user_dir = palm_dir + '/USER_CODE' 85 with open(palm_bin + '/palmrungui', 'r') as fh: 86 # file found 87 out = None 82 88 except: 83 print "Error. $PALM_BIN is not set."89 print "Error. palmrungui probably called in wrong directory." 84 90 raise SystemExit 85 91 86 92 87 93 palmrunline = "" 88 name_of_file = os.path.basename(__file__)89 90 palmrungui_path = os.path.realpath(__file__)91 version_path = palmrungui_path[:len(palmrungui_path)-14-len(name_of_file)-1]92 94 93 95 Ui_MainWindow = uic.loadUiType("%s/palmrungui_files/mainwindow.ui" % (palm_bin))[0] … … 119 121 120 122 121 filename = "%s/.palmrun.gui.default" % ( version_path)123 filename = "%s/.palmrun.gui.default" % (palm_dir) 122 124 if os.path.exists(filename): 123 125 pass … … 165 167 palmrun = QProcess() 166 168 palmrun.setProcessChannelMode(QProcess.MergedChannels) # mergedChannels 167 palmrun.setWorkingDirectory( version_path)169 palmrun.setWorkingDirectory(palm_dir) 168 170 169 171 geomet = self.frameGeometry() … … 186 188 # Jobs has been submitted or aborted. Continuing... 187 189 # Save the palmrun command to history file 188 filename = "%s/.palm.history" % ( version_path)190 filename = "%s/.palm.history" % (palm_dir) 189 191 tmstamp = strftime("%Y/%m/%d %H:%M") 190 192 … … 207 209 ###################################### 208 210 def recent_jobs(self, number): 209 fileDir = "%s/.palm.history" % ( version_path)211 fileDir = "%s/.palm.history" % (palm_dir) 210 212 if os.path.exists(fileDir): 211 213 pass … … 268 270 ################################ 269 271 def choosejob(self): 270 jobDir = "%s/JOBS" % ( version_path)272 jobDir = "%s/JOBS" % (palm_dir) 271 273 272 274 # Pick a job from dialog … … 305 307 jobname = filename[:len(filename) - 19]; 306 308 307 fileDir = "%s/.palm.history" % ( version_path)309 fileDir = "%s/.palm.history" % (palm_dir) 308 310 file = open(fileDir,"r") 309 311 history = file.readlines() … … 400 402 else: 401 403 # Check if user code is available 402 usercode = "%s/JOBS/%s/USER_CODE" % ( version_path,param[0])404 usercode = "%s/JOBS/%s/USER_CODE" % (palm_dir,param[0]) 403 405 404 406 if (os.path.exists(usercode) is True): … … 415 417 416 418 jobname = self.group_job.findChild(QtGui.QLineEdit, "line_jobname").text() 417 restartfile = "%s/JOBS/%s/INPUT/%s_p3dr" % ( version_path,jobname,jobname)419 restartfile = "%s/JOBS/%s/INPUT/%s_p3dr" % (palm_dir,jobname,jobname) 418 420 419 421 if (os.path.exists(restartfile) == True): … … 422 424 423 425 if ( drop_job == "Restart run (coupled atmosphere ocean)" ): 424 restartfileo = "%s/JOBS/%s/INPUT/%s_p3dor" % ( version_path,jobname,jobname)426 restartfileo = "%s/JOBS/%s/INPUT/%s_p3dor" % (palm_dir,jobname,jobname) 425 427 if (os.path.exists(restartfileo) == True): 426 428 self.group_execution.findChild(QtGui.QLabel,"label_restart").setText("hooo") … … 480 482 # Check if _p3dr file is available, otherwise notice user 481 483 if (status_restarts == 2): 482 jobname = str(self.group_job.findChild(QtGui.QLineEdit, "line_jobname").text())[len( version_path)+len("/JOBS/"):]483 restartfile = "%s/JOBS/%s/INPUT/%s_p3dr" % ( version_path,jobname,jobname)484 jobname = str(self.group_job.findChild(QtGui.QLineEdit, "line_jobname").text())[len(palm_dir)+len("/JOBS/"):] 485 restartfile = "%s/JOBS/%s/INPUT/%s_p3dr" % (palm_dir,jobname,jobname) 484 486 485 487 if (os.path.exists(restartfile) == True): … … 759 761 string_to_file = "%s%s" % (string_to_file,user_string) 760 762 761 filename ="%s/.palmgui.default" % ( version_path)763 filename ="%s/.palmgui.default" % (palm_dir) 762 764 tmstamp = strftime("%Y/%m/%d %H:%M") 763 765 … … 949 951 self.group_execution.findChild(QtGui.QCheckBox,"check_restarts").setChecked(True) 950 952 # Check if _pdf file is available, otherwise notice user 951 jobname = str(self.group_job.findChild(QtGui.QLineEdit,"line_jobname").text())[len( version_path)+len("/JOBS/"):]953 jobname = str(self.group_job.findChild(QtGui.QLineEdit,"line_jobname").text())[len(palm_dir)+len("/JOBS/"):] 952 954 953 restartfile = "%sJOBS/%s/INPUT/%s_p3dr" % ( version_path,jobname,jobname)955 restartfile = "%sJOBS/%s/INPUT/%s_p3dr" % (palm_dir,jobname,jobname) 954 956 if (os.path.exists(restartfile) == True): 955 957 self.group_execution.findChild(QtGui.QLabel,"label_restart").setText("") … … 1024 1026 def open_last(self): 1025 1027 # Select filename and open it 1026 filename = "%s/.palm.history" % ( version_path)1028 filename = "%s/.palm.history" % (palm_dir) 1027 1029 1028 1030 if os.path.exists(filename):
Note: See TracChangeset
for help on using the changeset viewer.