Changeset 4393 for palm


Ignore:
Timestamp:
Feb 4, 2020 9:24:48 PM (18 months ago)
Author:
maronga
Message:

removed PALM_BIN dependencies in GUI tools

Location:
palm/trunk/SCRIPTS
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_gf

    r2825 r4393  
    2525# -----------------
    2626# $Id$
     27# Removed PALM_BIN dependency
     28#
     29# 2825 2018-02-20 21:48:27Z maronga
    2730# Modified header
    2831#
     
    6770
    6871# Determine PALM directories
     72# Determine PALM directories
    6973try:
    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
    7582except:   
    76    print "Error. $PALM_BIN is not set."
     83   print ('Error. palm_gf probably called in wrong directory.')
    7784   raise SystemExit
    7885
  • 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
    142import sys
    243import os
     
    647import palm_gf_conf as configwr
    748   
    8 out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
    9 palm_bin = out.rstrip()
     49palm_dir = os.getcwd()
     50palm_bin = palm_dir + '/trunk/SCRIPTS'
    1051
    1152qtCreatorFile = palm_bin + '/palm_gf_files/palm_gf_table.ui'
  • palm/trunk/SCRIPTS/palm_jm

    r2825 r4393  
    2525# -----------------
    2626# $Id$
     27# Removed PALM_BIN dependency
     28#
     29# 2825 2018-02-20 21:48:27Z maronga
    2730# Modified header
    2831#
     
    7780
    7881
     82
    7983# Determine PALM directories
    8084try:
    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'
    8788   job_dir = palm_dir + '/JOBS'
    8889   user_dir = palm_dir + '/USER_CODE'
    89    
     90   with open(palm_bin + '/palm_jm', 'r') as fh:
     91      # file found
     92      out = None
    9093except:   
    91    print "Error. $PALM_BIN is not set."
     94   print ('Error. palm_jm probably called in wrong directory.')
    9295   raise SystemExit
    93 
    9496
    9597
    9698# MainWindow class
    9799class JobManager(QtGui.QMainWindow):
    98    
     100
     101       
    99102    def __init__(self):
     103
    100104        super(JobManager, self).__init__()
    101        
    102         self.InitUi()   
    103        
     105             
     106        self.InitUi()        
     107
    104108   
    105109    # Initialized MainWindow UI
    106110    def InitUi(self):
    107111
     112        print(palm_bin + '/palm_jm_files/palm_jm.ui')
     113
    108114        # Load predefined mainwindow
    109115        uic.loadUi(palm_bin + '/palm_jm_files/palm_jm.ui', self)
    110116
    111117        self.palm_logo.setPixmap(QtGui.QPixmap(palm_dir  + "/trunk/SCRIPTS/palmrungui_files/logo.png"))
    112 
    113118
    114119   
    115120        # Display MainWindow
    116121        self.show()
     122       
    117123        QtGui.QApplication.processEvents()
    118124
     125       
    119126        self.load_jobs()
    120127
    121    
    122128    def update_all(self):
    123129 
  • palm/trunk/SCRIPTS/palm_wd

    r3943 r4393  
    2525# -----------------
    2626# $Id$
     27# Removed PALM_BIN dependency
     28#
     29# 3943 2019-05-02 09:50:41Z maronga
    2730# Adjustments and bugfixes
    2831#
     
    99102
    100103for i in range(0,len(sys.argv)):
    101    out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
    102104   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'
    105107       
    106108config = configparser.RawConfigParser(allow_no_value=True)
  • palm/trunk/SCRIPTS/palmrungui

    r3487 r4393  
    2525# -----------------
    2626# $Id$
     27# Removed PALM_BIN dependency and os calls
     28#
     29# 3487 2018-11-05 07:18:02Z maronga
    2730# Renamed options -d and -h to -r and -c.
    2831#
     
    7578# Determine PALM directories
    7679try:
    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
    8288except:   
    83    print "Error. $PALM_BIN is not set."
     89   print "Error. palmrungui probably called in wrong directory."
    8490   raise SystemExit
    8591
    8692
    8793palmrunline = ""
    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]
    9294
    9395Ui_MainWindow = uic.loadUiType("%s/palmrungui_files/mainwindow.ui" % (palm_bin))[0]
     
    119121       
    120122       
    121         filename = "%s/.palmrun.gui.default" % (version_path
     123        filename = "%s/.palmrun.gui.default" % (palm_dir
    122124        if os.path.exists(filename):
    123125            pass
     
    165167        palmrun = QProcess()
    166168        palmrun.setProcessChannelMode(QProcess.MergedChannels) # mergedChannels
    167         palmrun.setWorkingDirectory(version_path)
     169        palmrun.setWorkingDirectory(palm_dir)
    168170   
    169171        geomet = self.frameGeometry()
     
    186188        # Jobs has been submitted or aborted. Continuing...
    187189        # Save the palmrun command to history file
    188         filename = "%s/.palm.history" % (version_path)
     190        filename = "%s/.palm.history" % (palm_dir)
    189191        tmstamp = strftime("%Y/%m/%d %H:%M")
    190192   
     
    207209    ######################################
    208210    def recent_jobs(self, number):
    209         fileDir = "%s/.palm.history" % (version_path)
     211        fileDir = "%s/.palm.history" % (palm_dir)
    210212        if os.path.exists(fileDir):
    211213            pass
     
    268270    ################################
    269271    def choosejob(self):
    270         jobDir = "%s/JOBS" % (version_path)       
     272        jobDir = "%s/JOBS" % (palm_dir)       
    271273
    272274        # Pick a job from dialog
     
    305307        jobname = filename[:len(filename) - 19];
    306308   
    307         fileDir = "%s/.palm.history" % (version_path)
     309        fileDir = "%s/.palm.history" % (palm_dir)
    308310        file = open(fileDir,"r")
    309311        history = file.readlines()
     
    400402            else:
    401403                # 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])
    403405                               
    404406                if (os.path.exists(usercode) is True):
     
    415417
    416418                    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)
    418420
    419421                    if (os.path.exists(restartfile) == True):                 
     
    422424
    423425                        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)
    425427                            if (os.path.exists(restartfileo) == True):                 
    426428                                self.group_execution.findChild(QtGui.QLabel,"label_restart").setText("hooo")
     
    480482                # Check if _p3dr file is available, otherwise notice user
    481483                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)
    484486                   
    485487                    if (os.path.exists(restartfile) == True):                   
     
    759761            string_to_file = "%s%s" % (string_to_file,user_string)
    760762       
    761         filename ="%s/.palmgui.default" % (version_path)
     763        filename ="%s/.palmgui.default" % (palm_dir)
    762764        tmstamp = strftime("%Y/%m/%d %H:%M")
    763765       
     
    949951                        self.group_execution.findChild(QtGui.QCheckBox,"check_restarts").setChecked(True)
    950952                        # 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/"):]
    952954                       
    953                         restartfile = "%sJOBS/%s/INPUT/%s_p3dr" % (version_path,jobname,jobname)
     955                        restartfile = "%sJOBS/%s/INPUT/%s_p3dr" % (palm_dir,jobname,jobname)
    954956                        if (os.path.exists(restartfile) == True):   
    955957                            self.group_execution.findChild(QtGui.QLabel,"label_restart").setText("")
     
    10241026    def open_last(self):
    10251027        # Select filename and open it
    1026         filename = "%s/.palm.history" % (version_path)
     1028        filename = "%s/.palm.history" % (palm_dir)
    10271029       
    10281030        if os.path.exists(filename):
Note: See TracChangeset for help on using the changeset viewer.