Ignore:
Timestamp:
Sep 20, 2017 2:22:42 PM (4 years ago)
Author:
maronga
Message:

updates in palm_jm and palmrungui

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_jm

    r2068 r2484  
    1616#
    1717# Copyright 1997-2016  Leibniz Universitaet Hannover
    18 #--------------------------------------------------------------------------------#
     18##--------------------------------------------------------------------------------#
    1919#
    2020# Current revisions:
     
    2525# -----------------
    2626# $Id$
     27# Adapted for palmrun with USER_CODE always stored under /JOBS/name/USER_CODE/.
     28# Added PALM logo
     29#
     30# 2068 2016-11-11 21:59:39Z maronga
    2731#
    2832# 2067 2016-11-11 21:55:49Z maronga
     
    6872   palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]
    6973   out = None
    70    
    71    # remove this line on release
    72 #   palm_dir = '/home/maronga/PUB/thinktank/maronga/job_manager'
    73    
     74     
    7475   job_dir = palm_dir + '/JOBS'
    7576   user_dir = palm_dir + '/USER_CODE'
     
    9596        # Load predefined mainwindow
    9697        uic.loadUi(palm_bin + '/palm_jm_files/palm_jm.ui', self)
     98
     99        self.palm_logo.setPixmap(QtGui.QPixmap(palm_dir  + "/trunk/SCRIPTS/palmrungui_files/logo.png"))
     100
     101
    97102   
    98103        # Display MainWindow
     
    100105        QtGui.QApplication.processEvents()
    101106
    102         self.load_jobs()
     107        #self.load_jobs()
    103108
    104109   
     
    149154                self.list_input.addItem(str(list_of_files[i]))
    150155 
    151        job_to_show = user_dir + "/" + self.list_jobs.currentItem().text()
     156       job_to_show = job_dir + "/" + self.list_jobs.currentItem().text() + "/USER_CODE"
    152157       
    153158       if ( os.path.isdir(job_to_show) ):
     
    199204             shutil.copy(tmp_file, new_file)
    200205
    201 #      copy and rename user code (if present)
    202        user_code_to_copy = user_dir + "/" + old_job_name
    203        new_user_code_dir = user_dir + "/" + new_job_name
    204 
    205 #      check if a job exists with the new job name 
    206        if ( os.path.isdir(new_user_code_dir) ):
    207            notify = QtGui.QMessageBox.warning(self,'Create new user code directory',"Error. Could not create user code directory. A user code directory with the new name already exists.")
     206
     207
     208
     209       new_user_dir  = job_dir + "/" + new_job_name + "/USER_CODE"
     210       
     211#      check if user code exists in the new job directory
     212       if ( os.path.isdir(new_user_dir) ):
     213           notify = QtGui.QMessageBox.warning(self,'Create new user code directory',"Error. Could not create user code directory. A user code directiory with the new name already exists.")
    208214           self.setEnabled(True)
    209215           return
    210216       else:
    211            os.makedirs(new_user_code_dir)
    212 
    213        if ( os.path.isdir(user_code_to_copy) ):
    214 
    215           list_of_files = os.listdir(user_code_to_copy)
     217           os.makedirs(new_user_dir)
     218
     219
     220#      copy user code files (if present)       
     221       user_to_copy = job_dir + "/" + old_job_name + "/USER_CODE"
     222
     223       if ( os.path.isdir(user_to_copy) ):
     224
     225          list_of_files = os.listdir(user_to_copy)
    216226         
    217227          for i in range(0,len(list_of_files)):
    218228
    219              tmp_file = user_code_to_copy + "/" + list_of_files[i]       
    220              new_file = new_user_code_dir + "/" + list_of_files[i]
     229             tmp_file = user_to_copy + "/" + list_of_files[i]         
     230             new_file = new_user_dir + "/" + list_of_files[i]
    221231             shutil.copy(tmp_file, new_file)
    222232
     
    269279                shutil.copy(tmp_file, new_file)
    270280
    271 #         copy and rename user code (if present)
    272           user_code_to_copy = user_dir + "/" + old_job_name
    273           new_user_code_dir = user_dir + "/" + new_job_name
    274 
    275 #         check if a job exists with the new job name 
    276           if ( os.path.isdir(new_user_code_dir) ):
    277              notify = QtGui.QMessageBox.warning(self,'Create new user code directory',"Error. Could not create user code directory. A user code directory with the new name already exists.")
    278              self.setEnabled(True)
    279              return
     281
     282          new_user_dir  = job_dir + "/" + new_job_name + "/USER_CODE"
     283       
     284#         check if user code exists in the new job directory
     285          if ( os.path.isdir(new_user_dir) ):
     286              notify = QtGui.QMessageBox.warning(self,'Create new user code directory',"Error. Could not create user code directory. A user code directiory with the new name already exists.")
     287              self.setEnabled(True)
     288              return
    280289          else:
    281              os.makedirs(new_user_code_dir)
    282 
    283           if ( os.path.isdir(user_code_to_copy) ):
    284 
    285              list_of_files = os.listdir(user_code_to_copy)
     290              os.makedirs(new_user_dir)
     291
     292
     293#         copy user code files (if present)       
     294          user_to_copy = job_dir + "/" + old_job_name + "/USER_CODE"
     295
     296          if ( os.path.isdir(user_to_copy) ):
     297
     298             list_of_files = os.listdir(user_to_copy)
    286299         
    287300             for i in range(0,len(list_of_files)):
    288301
    289                 tmp_file = user_code_to_copy + "/" + list_of_files[i]       
    290                 new_file = new_user_code_dir + "/" + list_of_files[i]
     302                tmp_file = user_to_copy + "/" + list_of_files[i]         
     303                new_file = new_user_dir + "/" + list_of_files[i]
    291304                shutil.copy(tmp_file, new_file)
    292305
     
    345358       sel_files = self.list_user.selectedItems()
    346359       
    347        input_dir = user_dir + "/" + sel_job + "/"
     360       input_dir = job_dir + "/" + sel_job + "/USER_CODE/"
    348361       
    349362       open_files = ""
Note: See TracChangeset for help on using the changeset viewer.