Changeset 4393 for palm/trunk/SCRIPTS/palmrungui
- Timestamp:
- Feb 4, 2020 9:24:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.