Ignore:
Timestamp:
Sep 9, 2020 5:27:45 PM (4 years ago)
Author:
maronga
Message:

ported palmrungui to pyqt5; several minor bugfixes in palmrungui

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmrungui

    r4482 r4670  
    1 #!/usr/bin/env python
     1#!/usr/bin/env python3
    22# -*- coding: utf-8 -*-
    33#--------------------------------------------------------------------------------#
     
    2525# -----------------
    2626# $Id$
     27# Ported to PyQt5, removed support for user parameters. Added support for Option
     28# "-V" (do not re-build pre-built source code). Changed activation strings
     29# according to default .palm.iofiles (svfin/svfout/rec)
     30#
     31# 4482 2020-04-01 13:17:50Z maronga
    2732# Added possibility to delete all files in a directory and option to create
    2833# blank new jobs
     
    98103#
    99104#------------------------------------------------------------------------------!
    100 
    101105import sys
    102106import subprocess
    103 from PyQt4 import QtCore, QtGui, uic
    104 from PyQt4.QtCore import QProcess,pyqtSlot,SIGNAL,SLOT
     107from PyQt5 import QtCore, QtGui, uic, QtWidgets
     108from PyQt5.QtWidgets import QMainWindow, QApplication
     109from PyQt5.QtCore import QProcess, pyqtSlot, QTimer
    105110from time import strftime
    106111import os
     
    118123   job_dir = palm_dir + '/JOBS'
    119124   user_dir = palm_dir + '/USER_CODE'
    120    with open(palm_bin + '/palmrungui', 'r') as fh:
     125   with open(palm_bin + '/palmrungui', 'r', encoding='utf8') as fh:
    121126      # file found
    122127      out = None
    123128except:   
    124    print "Error. palmrungui probably called in wrong directory."
     129   print ("Error. palmrungui probably called in wrong directory.")
    125130   raise SystemExit
    126131
     
    135140   return "%.1f%s%s" % (num, 'Y', suffix)
    136141
    137 
     142def ilen(iterable):
     143    return reduce(lambda sum, element: sum + 1, iterable, 0)
    138144
    139145palmrunline = ""
     
    144150Ui_aboutDialog = uic.loadUiType("%s/palmrungui_files/about.ui" % (palm_bin))[0]
    145151
    146 class HelpDialog(QtGui.QDialog,Ui_helpDialog):
     152class HelpDialog(QtWidgets.QDialog,Ui_helpDialog):
    147153    def __init__(self, parent=None):
    148154        super(HelpDialog,self).__init__()
    149155        self.setupUi(self)
    150156       
    151 class AboutDialog(QtGui.QDialog,Ui_aboutDialog):
     157class AboutDialog(QtWidgets.QDialog,Ui_aboutDialog):
    152158    def __init__(self, parent=None):
    153159        super(AboutDialog,self).__init__()
    154160        self.setupUi(self)       
    155161
    156 class Mainwindow(QtGui.QMainWindow, Ui_MainWindow):
     162class Mainwindow(QtWidgets.QMainWindow, Ui_MainWindow):
    157163    def __init__(self, parent=None):
    158164        super(Mainwindow, self).__init__()
    159165        self.setupUi(self)
    160    
    161         self.palm_logo.setPixmap(QtGui.QPixmap(palm_bin + "/palmrungui_files/logo.png"))       
    162        
    163         with open(palm_bin + "/palmrungui") as search:
     166
     167        self.palm_logo.setPixmap(QtGui.QPixmap(palm_bin + "/palmrungui_files/logo.png"))
     168        with open(palm_bin + "/palmrungui", encoding='utf8') as search:
    164169           for line in search:
    165170              line = line.rstrip()
    166171              if "$Id" in line:
    167172                 version = "Version: r" + line.split(" ")[3] + " (" + line.split(" ")[4] + ")"
    168                  self.groupBox.findChild(QtGui.QLabel,"label_version").setText(version)
     173                 self.groupBox.findChild(QtWidgets.QLabel,"label_version").setText(version)
    169174                 break
    170        
    171175        self.recent_jobs(50)
    172176        self.load_jobs()
    173177
     178
     179
    174180        # look up configuration files and add to combo box
    175181       
    176         self.group_execution.findChild(QtGui.QComboBox,"combo_configuration").addItem("")
     182        self.group_execution.findChild(QtWidgets.QComboBox,"combo_configuration").addItem("")
    177183       
    178184        for files in os.listdir(palm_dir):
    179185           if files.startswith(".palm.config"):
    180               tmpstring = filter(None,files.split(".palm.config."))[0]
    181               self.group_execution.findChild(QtGui.QComboBox,"combo_configuration").addItem(tmpstring)
    182 
    183         commandline = self.groupBox.findChild(QtGui.QLineEdit,"commandline")
     186              tmpstring = list(filter(None,files.split(".palm.config.")))[0]
     187              self.group_execution.findChild(QtWidgets.QComboBox,"combo_configuration").addItem(tmpstring)
     188
     189        commandline = self.groupBox.findChild(QtWidgets.QLineEdit,"commandline")
    184190        commandline.setText("")
    185191       
    186192        self.tabWidget.setCurrentIndex(0) 
    187193       
    188        
     194
    189195        filename = "%s/.palmrungui.default" % (palm_dir) 
    190196        if os.path.exists(filename):
    191             pass
    192         else:
    193             return
    194        
    195         file = open(filename, "r")
    196         if ( file is not None ):
    197             # File opened successfully
    198             palmrunline = file.readline()
    199             #if neue zeile zeichen
    200             palmrunline = palmrunline[:len(palmrunline)-1]
    201             file.close()
    202 
    203         # In case a palmrunline was found, load it to mainwindow
    204         if ( palmrunline != ""):
    205             palmrunline = palmrunline[17:]
    206             commandline.setText(palmrunline)
    207             self.setup_gui(palmrunline)
    208 
    209 
    210         QtGui.QApplication.processEvents()
    211 
     197           file = open(filename, "r")
     198           if ( file is not None ):
     199              # File opened successfully
     200              palmrunline = file.readline()
     201              #if neue zeile zeichen
     202              palmrunline = palmrunline[:len(palmrunline)-1]
     203              file.close()
     204
     205           # In case a palmrunline was found, load it to mainwindow
     206           if ( palmrunline != ""):
     207              palmrunline = palmrunline[17:]
     208              commandline.setText(palmrunline)
     209              self.setup_gui(palmrunline)
     210
     211        QtWidgets.QApplication.processEvents()
    212212
    213213        # Start refresh timer. On timeout perform update
     214
    214215        self.timer = QtCore.QTimer(self)
    215216        self.timer.timeout.connect(self.update_all)
     
    222223
    223224        # The labeltimer induces the update of the remaining time in the UI
     225
    224226        self.labeltimer = QtCore.QTimer(self)
    225227        self.labeltimer.timeout.connect(self.UpdatePush)
     
    233235    #######################################
    234236    def startpalmrun(self):
    235         palmrunline = str(self.groupBox.findChild(QtGui.QLineEdit,"commandline").text())
    236         userline    = str(self.group_advanced.findChild(QtGui.QLineEdit,"line_user").text())
    237        
    238         # Check for empty line
     237        palmrunline = str(self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").text())
    239238        palmrunline_save = palmrunline
    240         if (userline != ""):
    241             palmrunline = "%s %s" % (palmrunline,userline)
    242         history_line = palmrunline       
    243        
     239
    244240        # Disable the main window
    245241        self.tabWidget.setEnabled(False)
    246         self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(False)
    247         self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False)
    248         self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("wait...")     
    249         self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText("Executing palmrun in xterm...")       
     242        self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setEnabled(False)
     243        self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(False)
     244        self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setText("wait...")
     245        self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText("Executing palmrun in xterm...")
    250246
    251247        # Wait until all commands have been executed (ugly) ?
     
    282278        filename = "%s/.palmrungui.history" % (palm_dir)
    283279        tmstamp = strftime("%Y/%m/%d %H:%M")
    284         tag = str(self.groupBox.findChild(QtGui.QLineEdit,"line_tag").text())
     280        tag = str(self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").text())
    285281   
    286282        file = open(filename,"a")
    287         s = "%s %s (%s)\n" % (tmstamp,history_line,tag)
     283        s = "%s %s (%s)\n" % (tmstamp,palmrunline_save,tag)
    288284        file.write(s)
    289285        file.close()             
     
    291287        # Enable main window again
    292288        self.tabWidget.setEnabled(True)
    293         self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True)
    294         self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("palmrun")
    295         self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline_save)
    296         self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
     289        self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setEnabled(True)
     290        self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setText("palmrun")
     291        self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(palmrunline_save)
     292        self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True)
    297293       
    298294        # Reload recent jobs
     
    303299    # Update the label
    304300    def UpdatePush(self):
    305         remaining_time = (update_frequency - self.timetimer.elapsed()) / 1000 / 60
     301        remaining_time = int((update_frequency - self.timetimer.elapsed()) / 1000 / 60)
    306302        self.push_update.setText("Update (" + str(remaining_time) + " min)")
    307303
     
    310306    #######################################
    311307    def startpalmbuild(self):
    312         palmbuildline = 'palmbuild -c ' + str(self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").currentText())
    313 
    314         full_build = self.group_execution.findChild(QtGui.QCheckBox,"check_rebuild").checkState()
     308        palmbuildline = 'palmbuild -c ' + str(self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").currentText())
     309
     310        full_build = self.group_execution.findChild(QtWidgets.QCheckBox,"check_rebuild").checkState()
    315311
    316312        if ( full_build == 2 ):
     
    318314              os.utime(palm_source + "/" + filename, None)
    319315
    320         palmrunline_save = str(self.groupBox.findChild(QtGui.QLineEdit,"commandline").text())
     316        palmrunline_save = str(self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").text())
    321317
    322318        # Disable the main window
    323319        palmbuildline_save = palmbuildline
    324320        self.tabWidget.setEnabled(False)
    325         self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(False)
    326         self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False) 
    327         self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("wait...") 
    328         self.group_execution.findChild(QtGui.QPushButton,"button_palmbuild").setText("wait...")
    329         self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText("Executing palmbuild in xterm...")       
     321        self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setEnabled(False)
     322        self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(False)
     323        self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setText("wait...")
     324        self.group_execution.findChild(QtWidgets.QPushButton,"button_palmbuild").setText("wait...")
     325        self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText("Executing palmbuild in xterm...")
    330326       
    331327        # Wait until all commands have been executed (ugly) ?
     
    359355        # Enable main window again
    360356        self.tabWidget.setEnabled(True)
    361         self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True)
    362         self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
    363         self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("palmrun")
    364         self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline_save)
    365         self.group_execution.findChild(QtGui.QPushButton,"button_palmbuild").setText("(re-)build")     
     357        self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setEnabled(True)
     358        self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True)
     359        self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setText("palmrun")
     360        self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(palmrunline_save)
     361        self.group_execution.findChild(QtWidgets.QPushButton,"button_palmbuild").setText("(re-)build")
    366362        # Reload recent jobs
    367363        self.recent_jobs(50)
     
    383379        j = 0
    384380
    385         list_jobname = self.group_history.findChild(QtGui.QListWidget,"list_jobname")
     381        list_jobname = self.group_history.findChild(QtWidgets.QListWidget,"list_jobname")
    386382        list_jobname.clear()
    387383
     
    397393
    398394            if ( len(matchitems) == 0 ):
    399                 listitem = filter(None,listitem.split(" -r"))[1]
     395                listitem = list(filter(None,listitem.split(" -r")))[1]
    400396                listitem = listitem.strip()
    401                 listitem = filter(None,listitem.split(" "))[0]
     397                listitem = list(filter(None,listitem.split(" ")))[0]
    402398                listitem = listitem.replace("\"","")
    403399                list_jobname.addItem(listitem)
    404400               
    405                 configitem = filter(None,configitem.split(" -c"))[1]
    406                 configitem = configitem.strip()
    407                 configitem = filter(None,configitem.split(" "))[0]
     401                configitem = list(filter(None,configitem.split(" -c")))
     402                if ( len(configitem) < 2):
     403                   count = count +1
     404                   continue
     405                else:
     406                   configitem = configitem[1].strip()
     407                configitem = list(filter(None,configitem.split(" ")))[0]
    408408                configitem = configitem.replace("\"","")
    409409
     
    412412               
    413413               
    414                 tagitem = filter(None,tagitem.split(" ("))[1]
     414                tagitem = list(filter(None,tagitem.split(" (")))[1]
    415415                tagitem = tagitem.replace(")","") 
    416416                if ( len(tagitem) == 0 ):
     
    440440    ###############################
    441441    def enable_coupled(self):
    442         coupledState = self.group_execution.findChild(QtGui.QComboBox, "drop_job").currentText()
    443         group = self.group_execution.findChild(QtGui.QGroupBox, "group_coupled")
     442        coupledState = self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").currentText()
     443        group = self.group_execution.findChild(QtWidgets.QGroupBox, "group_coupled")
    444444       
    445445        if (coupledState == "Restart run (coupled atmosphere ocean)" or coupledState == "Initial run (coupled atmosphere ocean)"):
     
    453453    def choosejob_list(self):
    454454        #  Get selected item from list
    455         list_jobname = self.group_history.findChild(QtGui.QListWidget,"list_jobname")
     455        list_jobname = self.group_history.findChild(QtWidgets.QListWidget,"list_jobname")
    456456        filename = str(list_jobname.currentItem().text())
    457457
     
    485485        while i>=1:
    486486            listitem = history[i-1][17:len(history[i-1])-1]
    487             listitem = filter(None,listitem.split(" -r"))[1]
     487            listitem = list(filter(None,listitem.split(" -r")))[1]
    488488            listitem = listitem.strip()
    489             listitem = filter(None,listitem.split(" "))[0]
     489            listitem = list(filter(None,listitem.split(" ")))[0]
    490490            listitem = listitem.replace("\"","")
    491491
     
    495495                palmrunline = palmrunline[17:]
    496496                palmrunline = palmrunline[:len(palmrunline)-1]
    497                 palmrunline = filter(None,palmrunline.split("("))[0]
    498                 self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline)
     497                palmrunline = list(filter(None,palmrunline.split("(")))[0]
     498                self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(palmrunline)
    499499               
    500500             
    501501                tag = history[i-1].split('\n')[0]
    502                 tag = filter(None,tag.split("("))[1]
     502                tag = list(filter(None,tag.split("(")))[1]
    503503                tag = tag.replace(")","")
    504504
    505                 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setText(tag)
     505                self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setText(tag)
    506506                self.setup_gui(palmrunline)
    507507                self.list_jobname.item(itemint).setSelected(True)   
     
    513513    ######################################################
    514514    def change_rc_list(self):
    515         drop_job = self.group_execution.findChild(QtGui.QComboBox,"drop_job").currentText()   
     515        drop_job = self.group_execution.findChild(QtWidgets.QComboBox,"drop_job").currentText()
    516516        self.change_commandline("a","")
    517517   
    518518        # Enable PE distribution for atmosphere/ocean
    519519        if ( drop_job == "Restart run (coupled atmosphere ocean)" or drop_job == "Initial run (coupled atmosphere ocean)"):
    520             drop_atmos = self.group_coupled.findChild(QtGui.QLineEdit,"line_PE_atmos").text()
    521             drop_ocean = self.group_coupled.findChild(QtGui.QLineEdit,"line_PE_ocean").text()
     520            drop_atmos = self.group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_atmos").text()
     521            drop_ocean = self.group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_ocean").text()
    522522            s = "%s %s" % (drop_atmos,drop_ocean)
    523523            self.change_commandline("Y",s)
     
    540540        fwt_str = str(fwt_str)
    541541        initialize = False
    542         palmrunline = str(self.groupBox.findChild(QtGui.QLineEdit,"commandline").text())   
     542        palmrunline = str(self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").text())
    543543        s = " -%s " % (id_str)
    544         splitline = filter(None,palmrunline.split(s))
     544        splitline = list(filter(None,palmrunline.split(s)))
    545545
    546546        if ( len(splitline) == 0 ):
     
    556556        # Change in parameter "r" (jobname)
    557557        if (id_str == "r"):
    558             filename = str(self.group_execution.findChild(QtGui.QLineEdit,"line_jobname").text())
     558            filename = str(self.group_execution.findChild(QtWidgets.QLineEdit,"line_jobname").text())
    559559            s = filename.split("JOBS/")
    560560            param[0] = s[len(s)-1]
     
    562562            if ( initialize == True ):#and self.group_runcontrol.isEnabled() == True ):
    563563                self.group_execution.setEnabled(True)
    564                 self.group_execution.findChild(QtGui.QComboBox,"drop_job").setEnabled(True)
     564                self.group_execution.findChild(QtWidgets.QComboBox,"drop_job").setEnabled(True)
    565565                self.group_advanced.setEnabled(True)
    566                 self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True)
    567                 self.menuBar.findChild(QtGui.QMenu,"menuStart").actions()[3].setEnabled(True)
    568                 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
     566                self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setEnabled(True)
     567                self.menuBar.findChild(QtWidgets.QMenu,"menuStart").actions()[3].setEnabled(True)
     568                self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True)
    569569           
    570570            elif ( param[0] == ""):           
    571571                self.group_execution.setEnabled(False)
    572                 self.group_execution.findChild(QtGui.QComboBox,"drop_job").setEnabled(False)
    573                 self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(False)
    574                 self.menuBar.findChild(QtGui.QMenu,"menuStart").actions()[3].setEnabled(False)
     572                self.group_execution.findChild(QtWidgets.QComboBox,"drop_job").setEnabled(False)
     573                self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setEnabled(False)
     574                self.menuBar.findChild(QtWidgets.QMenu,"menuStart").actions()[3].setEnabled(False)
    575575                self.group_advanced.setEnabled(False)
    576                 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
     576                self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True)
    577577                self.delete_commandline("r")
    578578                self.change_commandline("a","remove")
     
    588588        elif (id_str == "a"):
    589589   
    590             drop_job = self.group_execution.findChild(QtGui.QComboBox,"drop_job").currentText()
     590            drop_job = self.group_execution.findChild(QtWidgets.QComboBox,"drop_job").currentText()
    591591            rc_flag = "#"
    592592   
     
    620620                param[0] = "%s d3%s" % (param[0],rc_flag)
    621621   
    622             status_restarts = self.group_execution.findChild(QtGui.QCheckBox,"check_restarts").checkState()
     622            status_restarts = self.group_execution.findChild(QtWidgets.QCheckBox,"check_restarts").checkState()
    623623
    624624            if (status_restarts == 2):
     
    626626
    627627
    628             status_cycfill = self.group_execution.findChild(QtGui.QCheckBox,"check_cycfill").checkState()
     628            status_cycfill = self.group_execution.findChild(QtWidgets.QCheckBox,"check_cycfill").checkState()
    629629   
    630630            if (status_cycfill == 2):           
    631                 param[0]="%s fill" % (param[0])
    632            
    633             status_svf = self.group_execution.findChild(QtGui.QCheckBox,"check_svf").checkState()
    634    
     631                param[0]="%s rec" % (param[0])
     632
     633            status_svf = self.group_execution.findChild(QtWidgets.QCheckBox,"check_svf").checkState()
     634
    635635            if (status_svf == 2):           
    636                 param[0]="%s svf" % (param[0])
     636               param[0]="%s svfin" % (param[0])
     637 
     638            status_svf_2 = self.group_execution.findChild(QtWidgets.QCheckBox,"check_svf_2").checkState()
     639
     640            if (status_svf_2 == 2):
     641               param[0]="%s svfout" % (param[0])
    637642
    638643            param[0]="%s\"" % (param[0])
    639  
    640  
     644
    641645            if ( fwt_str == "remove"):           
    642646                self.delete_commandline(id_str)
     
    646650                self.button_start.setEnabled(True)
    647651                self.action_save.setEnabled(True)
    648                 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
     652                self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True)
    649653
    650654        # Change in any other parameter
     
    664668        newpalmrunline = s.join(splitline)
    665669   
    666         # Pr the new palmrunline to mainwindow
     670        # Print the new palmrunline to mainwindow
    667671        newpalmrunline = newpalmrunline.replace("  "," ")
    668         self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(newpalmrunline)
     672        self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(newpalmrunline)
    669673
    670674    # change lineinput depending on sender
    671675    ###################################################################################
    672676    def change_lineinput(self):
    673         if ( self.sender() == self.group_execution.findChild(QtGui.QComboBox, "combo_configuration") ):
    674             tmptext = self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").currentText()
    675             if tmptext.isEmpty():
     677        if ( self.sender() == self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration") ):
     678            tmptext = self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").currentText()
     679            if not tmptext:
    676680               self.change_commandline("c"," ")
    677                self.group_execution.findChild(QtGui.QPushButton,'button_palmbuild').setEnabled(False)
     681               self.group_execution.findChild(QtWidgets.QPushButton,'button_palmbuild').setEnabled(False)
    678682            else:
    679683               self.change_commandline("c",tmptext)
    680                self.group_execution.findChild(QtGui.QPushButton,'button_palmbuild').setEnabled(True)         
    681 
    682         elif ( self.sender() == self.group_execution.findChild(QtGui.QLineEdit,"line_q")):
    683             tmptext = self.group_execution.findChild(QtGui.QLineEdit,"line_q").text()
     684               self.group_execution.findChild(QtWidgets.QPushButton,'button_palmbuild').setEnabled(True)
     685
     686        elif ( self.sender() == self.group_execution.findChild(QtWidgets.QLineEdit,"line_q")):
     687            tmptext = self.group_execution.findChild(QtWidgets.QLineEdit,"line_q").text()
    684688            self.change_commandline("q",tmptext)
    685689       
    686         elif ( self.sender() == self.group_execution.findChild(QtGui.QLineEdit,"line_account")):
    687             tmptext = self.group_execution.findChild(QtGui.QLineEdit,"line_account").text()
     690        elif ( self.sender() == self.group_execution.findChild(QtWidgets.QLineEdit,"line_account")):
     691            tmptext = self.group_execution.findChild(QtWidgets.QLineEdit,"line_account").text()
    688692            self.change_commandline("A",tmptext)
    689693       
    690         elif ( self.sender() ==  self.group_execution.findChild(QtGui.QLineEdit,"line_pe")):
    691             tmptext = self.group_execution.findChild(QtGui.QLineEdit,"line_pe").text()
     694        elif ( self.sender() ==  self.group_execution.findChild(QtWidgets.QLineEdit,"line_pe")):
     695            tmptext = self.group_execution.findChild(QtWidgets.QLineEdit,"line_pe").text()
    692696            self.change_commandline("X",tmptext)
    693697       
    694         elif ( self.sender() == self.group_execution.findChild(QtGui.QLineEdit,"line_tpn")):
    695             tmptext = self.group_execution.findChild(QtGui.QLineEdit,"line_tpn").text()
     698        elif ( self.sender() == self.group_execution.findChild(QtWidgets.QLineEdit,"line_tpn")):
     699            tmptext = self.group_execution.findChild(QtWidgets.QLineEdit,"line_tpn").text()
    696700            self.change_commandline("T",tmptext)
    697701               
    698         elif ( self.sender() == self.group_execution.findChild(QtGui.QLineEdit,"line_time")):
    699             tmptext = self.group_execution.findChild(QtGui.QLineEdit,"line_time").text()
     702        elif ( self.sender() == self.group_execution.findChild(QtWidgets.QLineEdit,"line_time")):
     703            tmptext = self.group_execution.findChild(QtWidgets.QLineEdit,"line_time").text()
    700704            self.change_commandline("t",tmptext)
    701705       
    702         elif ( self.sender() == self.group_advanced.findChild(QtGui.QLineEdit,"line_M")):
    703             tmptext = self.group_advanced.findChild(QtGui.QLineEdit,"line_M").text()
     706        elif ( self.sender() == self.group_advanced.findChild(QtWidgets.QLineEdit,"line_M")):
     707            tmptext = self.group_advanced.findChild(QtWidgets.QLineEdit,"line_M").text()
    704708            self.change_commandline("M",tmptext)
    705709       
    706         elif ( self.sender() == self.group_advanced.findChild(QtGui.QLineEdit,"line_m")):
    707             tmptext = self.group_advanced.findChild(QtGui.QLineEdit,"line_m").text()
     710        elif ( self.sender() == self.group_advanced.findChild(QtWidgets.QLineEdit,"line_m")):
     711            tmptext = self.group_advanced.findChild(QtWidgets.QLineEdit,"line_m").text()
    708712            self.change_commandline("m",tmptext)
    709713       
    710         elif ( self.sender() == self.group_advanced.findChild(QtGui.QLineEdit,"line_D")):
    711             tmptext = self.group_advanced.findChild(QtGui.QLineEdit,"line_D").text()
     714        elif ( self.sender() == self.group_advanced.findChild(QtWidgets.QLineEdit,"line_D")):
     715            tmptext = self.group_advanced.findChild(QtWidgets.QLineEdit,"line_D").text()
    712716            self.change_commandline("D",tmptext)
    713717       
    714         elif ( self.sender() == self.group_advanced.findChild(QtGui.QLineEdit,"line_c")):
    715             tmptext = self.group_advanced.findChild(QtGui.QLineEdit,"line_c").text()
     718        elif ( self.sender() == self.group_advanced.findChild(QtWidgets.QLineEdit,"line_c")):
     719            tmptext = self.group_advanced.findChild(QtWidgets.QLineEdit,"line_c").text()
    716720            if ( tmptext == ".palmrungui.config"):
    717721                tmptext = ""
    718722            self.change_commandline("c",tmptext)
    719723       
    720         elif ( self.sender() == self.group_advanced.findChild(QtGui.QLineEdit,"line_s")):
    721             tmptext = self.group_advanced.findChild(QtGui.QLineEdit,"line_s").text()
     724        elif ( self.sender() == self.group_advanced.findChild(QtWidgets.QLineEdit,"line_s")):
     725            tmptext = self.group_advanced.findChild(QtWidgets.QLineEdit,"line_s").text()
    722726            self.change_commandline("s",tmptext)
    723727               
    724         elif ( self.sender() == self.group_advanced.findChild(QtGui.QLineEdit,"line_w")):
    725             tmptext = self.group_advanced.findChild(QtGui.QLineEdit,"line_w").text()
     728        elif ( self.sender() == self.group_advanced.findChild(QtWidgets.QLineEdit,"line_w")):
     729            tmptext = self.group_advanced.findChild(QtWidgets.QLineEdit,"line_w").text()
    726730            self.change_commandline("w",tmptext)
    727731       
    728         elif ( self.sender() == self.group_coupled.findChild(QtGui.QLineEdit,"line_PE_atmos") or
    729                self.sender() == self.group_coupled.findChild(QtGui.QLineEdit,"line_PE_ocean")):
    730             t1 = self.group_coupled.findChild(QtGui.QLineEdit,"line_PE_atmos").text()
    731             t2 = self.group_coupled.findChild(QtGui.QLineEdit,"line_PE_ocean").text()           
     732        elif ( self.sender() == self.group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_atmos") or
     733               self.sender() == self.group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_ocean")):
     734            t1 = self.group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_atmos").text()
     735            t2 = self.group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_ocean").text()
    732736            tmptext = "%s %s" % (t1,t2)
    733737           
     
    742746            except ValueError:           
    743747                pass
    744                
     748
    745749            try:
    746750                pe2 = int(t2)
    747751            except ValueError:
    748752                pass
    749                
     753
    750754            PE_total = pe1+pe2   
    751             self.group_execution.findChild(QtGui.QLineEdit,"line_pe").setText(str(PE_total))
     755            self.group_execution.findChild(QtWidgets.QLineEdit,"line_pe").setText(str(PE_total))
    752756            self.change_commandline("X",str(PE_total))
    753          
     757
    754758    # deletes parameter from commandline
    755759    #####################################################################################
    756760    def delete_commandline(self, id_str):   
    757761        # Read palmrunline
    758         commandline = self.groupBox.findChild(QtGui.QLineEdit,"commandline")
     762        commandline = self.groupBox.findChild(QtWidgets.QLineEdit,"commandline")
    759763        palmrunline = str(commandline.text())
    760764        s = " -%s" % (id_str)
    761         splitline = filter(None,palmrunline.split(s))
     765        splitline = list(filter(None,palmrunline.split(s)))
    762766       
    763767        if ( len(splitline) == 1):
     
    776780    ###################################################################################
    777781    def check_flags(self):
    778         status = self.group_execution.findChild(QtGui.QCheckBox,"check_delete_tmp_files" ).checkState()
     782        status = self.group_execution.findChild(QtWidgets.QCheckBox,"check_delete_tmp_files" ).checkState()
    779783        if (status == 2):     
    780784            self.activate_flag("B")
     
    782786            self.deactivate_flag("B")
    783787   
    784         status = self.group_execution.findChild(QtGui.QCheckBox,"check_verbose" ).checkState()
     788        status = self.group_execution.findChild(QtWidgets.QCheckBox,"check_verbose" ).checkState()
    785789        if (status == 2):
    786790            self.activate_flag("v")
     
    788792            self.deactivate_flag("v")
    789793       
    790         status = self.group_advanced.findChild(QtGui.QCheckBox,"check_b" ).checkState()
     794        status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_b" ).checkState()
    791795        if (status == 2):
    792796            self.activate_flag("b")
     
    794798            self.deactivate_flag("b")
    795799   
    796         status = self.group_advanced.findChild(QtGui.QCheckBox,"check_F" ).checkState()   
     800        status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_F" ).checkState()
    797801        if (status == 2):
    798802            self.activate_flag("F")
     
    800804            self.deactivate_flag("F")
    801805           
    802         status = self.group_advanced.findChild(QtGui.QCheckBox,"check_I" ).checkState()
     806        status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_I" ).checkState()
    803807        if (status == 2):
    804808            self.activate_flag("I")
     
    806810            self.deactivate_flag("I")
    807811
    808         status = self.group_advanced.findChild(QtGui.QCheckBox,"check_k" ).checkState()
     812        status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_k" ).checkState()
    809813        if (status == 2):
    810814            self.activate_flag("k")
     
    812816            self.deactivate_flag("k")
    813817
    814         status = self.group_advanced.findChild(QtGui.QCheckBox,"check_O" ).checkState()
     818        status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_O" ).checkState()
    815819        if (status == 2):
    816820            self.activate_flag("O")
     
    818822            self.deactivate_flag("O")
    819823
    820         status = self.group_advanced.findChild(QtGui.QCheckBox,"check_x" ).checkState()
     824        status = self.group_execution.findChild(QtWidgets.QCheckBox,"check_prebuilt" ).checkState()
     825        if (status == 2):
     826            self.activate_flag("V")
     827        else:
     828            self.deactivate_flag("V")
     829
     830        status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_x" ).checkState()
    821831        if (status == 2):
    822832            self.activate_flag("x")
     
    824834            self.deactivate_flag("x")
    825835       
    826         status = self.group_advanced.findChild(QtGui.QCheckBox,"check_Z" ).checkState()
     836        status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_Z" ).checkState()
    827837        if (status == 2):
    828838            self.activate_flag("Z")
     
    833843    ##################################################################################   
    834844    def activate_flag(self, id_str):
    835         commandline = self.groupBox.findChild(QtGui.QLineEdit,"commandline")
     845        commandline = self.groupBox.findChild(QtWidgets.QLineEdit,"commandline")
    836846        palmrunline = str(commandline.text())
    837847        s = " -%s" % (id_str)
    838         splitline = filter(None,palmrunline.split(s))
     848        splitline = list(filter(None,palmrunline.split(s)))
    839849       
    840850        if ( len(splitline) == 1):
     
    848858    ####################################################################################   
    849859    def deactivate_flag(self, id_str):
    850         commandline = self.groupBox.findChild(QtGui.QLineEdit,"commandline")
     860        commandline = self.groupBox.findChild(QtWidgets.QLineEdit,"commandline")
    851861        palmrunline = str(commandline.text())
    852862        s = " -%s" % (id_str)
    853         splitline = filter(None,palmrunline.split(s))
     863        splitline = list(filter(None,palmrunline.split(s)))
    854864 
    855865        newpalmrunline = "".join(splitline)
     
    862872        self.setupUi(self)
    863873        self.tabWidget.setCurrentIndex(0)
    864         self.palm_logo.setPixmap(QtGui.QPixmap(palm_dir + "/trunk/SCRIPTS/palmrungui_files/logo.png"))   
     874        self.palm_logo.setPixmap(QtGui.QPixmap(palm_dir + "/trunk/SCRIPTS/palmrungui_files/logo.png"))
    865875        self.recent_jobs(50)
    866876        self.load_jobs()
     
    870880    ################################################################################
    871881    def save_default(self):
    872         user_string = self.group_advanced.findChild(QtGui.QLineEdit,"line_user").text()
    873         cmd_string = self.groupBox.findChild(QtGui.QLineEdit,"commandline").text()
    874        
    875         string_to_file = cmd_string
    876         if (user_string != ""):
    877             string_to_file = "%s%s" % (string_to_file,user_string)
    878        
     882        string_to_file = self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").text()
     883
    879884        filename ="%s/.palmrungui.default" % (palm_dir)
    880885        tmstamp = strftime("%Y/%m/%d %H:%M")
    881        
     886
    882887        file = open(filename,"w")
    883888        s = "%s %s" % (tmstamp, string_to_file)
     
    907912    def setup_gui(self, palmrun_str): 
    908913     
    909         #self.palm_logo.setPixmap(QtGui.QPixmap(palm_dir + "/trunk/SCRIPTS/palmrungui_files/logo.png"))   
     914        #self.palm_logo.setPixmap(QtWidgets.QPixmap(palm_dir + "/trunk/SCRIPTS/palmrungui_files/logo.png"))
    910915     
    911916        #  Some initial settings
    912         user = ""
    913917        coupled_run = False
    914918        ocean_run   = False
     
    940944             
    941945                if ( options != ""):
    942                     self.group_execution.findChild(QtGui.QLineEdit,"line_jobname").setText(options)
     946                    self.group_execution.findChild(QtWidgets.QLineEdit,"line_jobname").setText(options)
    943947                    nojob = False
    944948               
     
    947951               
    948952            elif ( parameter == "c"):
    949                 tmpindex = self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").findText(options.strip(),QtCore.Qt.MatchExactly)
     953                tmpindex = self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").findText(options.strip(),QtCore.Qt.MatchExactly)
    950954                if tmpindex != -1:
    951                    self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").setCurrentIndex(tmpindex)
     955                   self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").setCurrentIndex(tmpindex)
    952956                else:
    953                    self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").setCurrentIndex(0)
     957                   self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").setCurrentIndex(0)
    954958            elif ( parameter == "q"):
    955                 self.group_execution.findChild(QtGui.QLineEdit,"line_q").setText(options)
     959                self.group_execution.findChild(QtWidgets.QLineEdit,"line_q").setText(options)
    956960             
    957961            elif ( parameter == "A"):
    958                 self.group_execution.findChild(QtGui.QLineEdit,"line_account").setText(options)
     962                self.group_execution.findChild(QtWidgets.QLineEdit,"line_account").setText(options)
    959963             
    960964            elif ( parameter == "X"):
    961                 self.group_execution.findChild(QtGui.QLineEdit,"line_pe").setText(options)
     965                self.group_execution.findChild(QtWidgets.QLineEdit,"line_pe").setText(options)
    962966             
    963967            elif ( parameter == "T"):
    964                 self.group_execution.findChild(QtGui.QLineEdit,"line_tpn").setText(options)
     968                self.group_execution.findChild(QtWidgets.QLineEdit,"line_tpn").setText(options)
    965969             
    966970            elif ( parameter == "t"):
    967                 self.group_execution.findChild(QtGui.QLineEdit,"line_time").setText(options)
     971                self.group_execution.findChild(QtWidgets.QLineEdit,"line_time").setText(options)
    968972             
    969973            elif ( parameter == "B"):
    970                 self.group_execution.findChild(QtGui.QCheckBox,"check_delete_tmp_files").setChecked(True)
     974                self.group_execution.findChild(QtWidgets.QCheckBox,"check_delete_tmp_files").setChecked(True)
    971975             
    972976            elif ( parameter == "v"):
    973                 self.group_execution.findChild(QtGui.QCheckBox,"check_verbose").setChecked(True)
     977                self.group_execution.findChild(QtWidgets.QCheckBox,"check_verbose").setChecked(True)
    974978                         
    975979            elif ( parameter == "b"):
    976                 self.group_advanced.findChild(QtGui.QCheckBox,"check_b").setChecked(True) 
     980                self.group_advanced.findChild(QtWidgets.QCheckBox,"check_b").setChecked(True)
    977981             
    978982            elif ( parameter == "F"):
    979                 self.group_advanced.findChild(QtGui.QCheckBox,"check_F").setChecked(True)
     983                self.group_advanced.findChild(QtWidgets.QCheckBox,"check_F").setChecked(True)
    980984             
    981985            elif ( parameter == "I"):
    982                 self.group_advanced.findChild(QtGui.QCheckBox,"check_I").setChecked(True)
     986                self.group_advanced.findChild(QtWidgets.QCheckBox,"check_I").setChecked(True)
    983987             
    984988            elif ( parameter == "k"):
    985                 self.group_advanced.findChild(QtGui.QCheckBox,"check_k").setChecked(True)
     989                self.group_advanced.findChild(QtWidgets.QCheckBox,"check_k").setChecked(True)
    986990             
    987991            elif ( parameter == "O"):
    988                 self.group_advanced.findChild(QtGui.QCheckBox,"check_O").setChecked(True)
    989              
     992                self.group_advanced.findChild(QtWidgets.QCheckBox,"check_O").setChecked(True)
     993
     994            elif ( parameter == "V"):
     995                self.group_execution.findChild(QtWidgets.QCheckBox,"check_prebuilt").setChecked(True)
     996
    990997            elif ( parameter == "x"):             
    991                 self.group_advanced.findChild(QtGui.QCheckBox,"check_x").setChecked(True)
    992              
     998                self.group_advanced.findChild(QtWidgets.QCheckBox,"check_x").setChecked(True)
     999
    9931000            elif ( parameter == "Z"):
    994                 self.group_advanced.findChild(QtGui.QCheckBox,"check_Z").setChecked(True)
     1001                self.group_advanced.findChild(QtWidgets.QCheckBox,"check_Z").setChecked(True)
    9951002               
    9961003            elif ( parameter == "m"):
    997                 self.group_advanced.findChild(QtGui.QLineEdit,"line_m").setText(options)
     1004                self.group_advanced.findChild(QtWidgets.QLineEdit,"line_m").setText(options)
    9981005             
    9991006            elif ( parameter == "M"):
    1000                 self.group_advanced.findChild(QtGui.QLineEdit,"line_M").setText(options)
     1007                self.group_advanced.findChild(QtWidgets.QLineEdit,"line_M").setText(options)
    10011008                         
    10021009            elif ( parameter == "D"):
    1003                 self.group_advanced.findChild(QtGui.QLineEdit,"line_D").setText(options)
     1010                self.group_advanced.findChild(QtWidgets.QLineEdit,"line_D").setText(options)
    10041011             
    10051012            elif ( parameter == "c"):
    1006                 self.group_advanced.findChild(QtGui.QLineEdit,"line_c").setText(options)
     1013                self.group_advanced.findChild(QtWidgets.QLineEdit,"line_c").setText(options)
    10071014                         
    10081015            elif ( parameter == "s"):
    1009                 self.group_advanced.findChild(QtGui.QLineEdit,"line_s").setText(options)
     1016                self.group_advanced.findChild(QtWidgets.QLineEdit,"line_s").setText(options)
    10101017             
    10111018            elif ( parameter == "w"):
    1012                 self.group_advanced.findChild(QtGui.QLineEdit,"line_w").setText(options)
     1019                self.group_advanced.findChild(QtWidgets.QLineEdit,"line_w").setText(options)
    10131020             
    10141021
     
    10171024                optionssplit = options.split(" ")
    10181025               
    1019                 group_coupled = self.group_execution.findChild(QtGui.QGroupBox,"group_coupled")
    1020                 group_coupled.findChild(QtGui.QLineEdit,"line_PE_atmos").setEnabled(True)
    1021                 group_coupled.findChild(QtGui.QLineEdit,"line_PE_ocean").setEnabled(True)
    1022                 group_coupled.findChild(QtGui.QLabel,"label_coupled1").setEnabled(True)
    1023                 group_coupled.findChild(QtGui.QLabel,"label_coupled2").setEnabled(True)
    1024                 group_coupled.findChild(QtGui.QLabel,"label_coupled3").setEnabled(True)
    1025                 group_coupled.findChild(QtGui.QLabel,"label_coupling").setEnabled(True)
     1026                group_coupled = self.group_execution.findChild(QtWidgets.QGroupBox,"group_coupled")
     1027                group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_atmos").setEnabled(True)
     1028                group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_ocean").setEnabled(True)
     1029                group_coupled.findChild(QtWidgets.QLabel,"label_coupled1").setEnabled(True)
     1030                group_coupled.findChild(QtWidgets.QLabel,"label_coupled2").setEnabled(True)
     1031                group_coupled.findChild(QtWidgets.QLabel,"label_coupled3").setEnabled(True)
     1032                group_coupled.findChild(QtWidgets.QLabel,"label_coupling").setEnabled(True)
    10261033
    10271034                if (optionssplit.count() == 2):
    1028                     group_coupled.findChild(QtGui.QLineEdit,"line_PE_atmos").setEnabled(optionssplit[0])
    1029                     group_coupled.findChild(QtGui.QLineEdit,"line_PE_ocean").setEnabled(optionssplit[1])
     1035                    group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_atmos").setEnabled(optionssplit[0])
     1036                    group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_ocean").setEnabled(optionssplit[1])
    10301037                 
    10311038                else:                 
    1032                     group_coupled.findChild(QtGui.QLineEdit,"line_PE_atmos").setText("")
    1033                     group_coupled.findChild(QtGui.QLineEdit,"line_PE_ocean").setText("")
     1039                    group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_atmos").setText("")
     1040                    group_coupled.findChild(QtWidgets.QLineEdit,"line_PE_ocean").setText("")
    10341041 
    10351042                 
     
    10371044           
    10381045            elif ( parameter == "y"):             
    1039                 self.group_execution.findChild(QtGui.QComboBox, "drop_job").setCurrentIndex(3)
     1046                self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(3)
    10401047             
    10411048
     
    10561063                    if (options_2 == "d3"):     
    10571064                        if (options_all[:3][-1] == "#"):
    1058                             self.group_execution.findChild(QtGui.QComboBox, "drop_job").setCurrentIndex(0)
     1065                            self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(0)
    10591066                        elif (options_all[:3][-1] == "r"):
    1060                             self.group_execution.findChild(QtGui.QComboBox, "drop_job").setCurrentIndex(1)
     1067                            self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(1)
    10611068                       
    10621069                        elif (options_all[:3][-1] == "o"):
     
    10641071                       
    10651072                    if (options_all == "restart"):
    1066                         self.group_execution.findChild(QtGui.QCheckBox,"check_restarts").setChecked(True)
     1073                        self.group_execution.findChild(QtWidgets.QCheckBox,"check_restarts").setChecked(True)
    10671074
    10681075                    j = j+1
    1069 
    1070             # All unknown parameters are set as extra user parameters
    1071             else:
    1072                 print parameter
    1073                 user = "%s-%s \"%s\" " % (user,parameter,options)
    1074                 splitline.removeAt(i)
    1075 
    10761076            i = i-1
    10771077        # Change drop box state in case of ocean precursor or coupled restart runs
    10781078        if ( ocean_run == True ):
    10791079            if ( coupled_run == True ):
    1080                 self.group_execution.findChild(QtGui.QComboBox, "drop_job").setCurrentIndex(4)
     1080                self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(4)
    10811081           
    10821082            else:
    1083                 self.group_execution.findChild(QtGui.QComboBox, "drop_job").setCurrentIndex(3)
    1084 
    1085         if ( user != ""):
    1086             self.group_advanced.findChild(QtGui.QLineEdit,"line_user").setText(user)
     1083                self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(3)
    10871084
    10881085        # Join palmrunline and post it to mainwindow
    10891086        palmrunline = " -".join(splitline)
    1090         self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline)         
     1087        self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(palmrunline)
    10911088
    10921089        # Disable mainwindow if no job was found, otherwise enable
    10931090        if ( nojob == True ):
    10941091            self.group_execution.setEnabled(False)
    1095             self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(False)
    1096             self.menuBar.findChild(QtGui.QMenu,"menuStart").actions()[3].setEnabled(False)
    1097             self.group_execution.findChild(QtGui.QComboBox, "drop_job").setEnabled(False)
     1092            self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setEnabled(False)
     1093            self.menuBar.findChild(QtWidgets.QMenu,"menuStart").actions()[3].setEnabled(False)
     1094            self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setEnabled(False)
    10981095            self.group_advanced.setEnabled(False)
    10991096            self.check_advanced.setEnabled(False)
    1100             self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False)
     1097            self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(False)
    11011098         
    11021099        else:
    11031100            self.group_execution.setEnabled(True)
    1104             self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True)
    1105             self.menuBar.findChild(QtGui.QMenu,"menuStart").actions()[3].setEnabled(True)
    1106             self.group_execution.findChild(QtGui.QComboBox, "drop_job").setEnabled(True)
     1101            self.groupBox.findChild(QtWidgets.QPushButton,"button_start").setEnabled(True)
     1102            self.menuBar.findChild(QtWidgets.QMenu,"menuStart").actions()[3].setEnabled(True)
     1103            self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setEnabled(True)
    11071104            self.group_advanced.setEnabled(True)
    1108             self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True)
     1105            self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True)
    11091106
    11101107
     
    11241121          palmrunline = palmrunline[17:]
    11251122          palmrunline = palmrunline[:len(palmrunline)-1]
    1126           palmrunline = filter(None,palmrunline.split("("))[0]
    1127           self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline)
     1123          palmrunline = list(filter(None,palmrunline.split("(")))[0]
     1124          self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(palmrunline)
    11281125
    11291126#         Set selected item to jobname in "available jobs" list
    11301127          jobname = str(history_entry[17:])
    1131           jobname = filter(None,jobname.split(" -r"))[1]
     1128          jobname = list(filter(None,jobname.split(" -r")))[1]
    11321129          jobname = jobname.strip()
    1133           jobname = filter(None,jobname.split(" "))[0]
     1130          jobname = list(filter(None,jobname.split(" ")))[0]
    11341131          jobname = jobname.replace("\"","")
    11351132          item2int = self.list_jobs.findItems(jobname,QtCore.Qt.MatchCaseSensitive)
     
    11411138#         Add tooltip tag
    11421139          tag = str(history_entry).split('\n')[0]
    1143           tag = filter(None,tag.split("("))[1]
     1140          tag = list(filter(None,tag.split("(")))[1]
    11441141          tag = tag.replace(")","")
    1145           self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setText(tag)
     1142          self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setText(tag)
    11461143 
    11471144#         Process palmrungui to set up gui controls
     
    12541251                   self.list_output.addItem(str(list_of_files[i]) + " (" + file_size(tmp_file) + ")")
    12551252 
    1256           self.group_execution.findChild(QtGui.QLineEdit,"line_jobname").setText(jobitem.text())
    1257        self.group_history.findChild(QtGui.QListWidget,"list_jobname").clearSelection()
     1253          self.group_execution.findChild(QtWidgets.QLineEdit,"line_jobname").setText(jobitem.text())
     1254       self.group_history.findChild(QtWidgets.QListWidget,"list_jobname").clearSelection()
    12581255
    12591256       self.timetimer.start()
     
    12611258       self.labeltimer.start(update_frequency/10)
    12621259       self.push_update.setText("Update (" + str(int(update_frequency/1000/60)) + " min)")
    1263        QtGui.QApplication.processEvents()
     1260       QtWidgets.QApplication.processEvents()
    12641261
    12651262       # Change palmrunline accordingly
     
    12721269       self.setEnabled(False)
    12731270
    1274        text, ret = QtGui.QInputDialog.getText(self, "Create new job", "Enter new job name:", mode = QtGui.QLineEdit.Normal, text = '')
     1271       text, ret = QtWidgets.QInputDialog.getText(self, "Create new job", "Enter new job name:", QtWidgets.QLineEdit.Normal, text = '')
    12751272
    12761273       if ( ret ):
     
    12841281#      check if a job exists with the new job name. If not, the new job is created and an empty _p3d file is created.
    12851282       if ( os.path.isdir(new_input_dir) ):
    1286           notify = QtGui.QMessageBox.warning(self,'Create new job directory',"Error. Could not create job directory. A job with the new name already exists.")
     1283          notify = QtWidgets.QMessageBox.warning(self,'Create new job directory',"Error. Could not create job directory. A job with the new name already exists.")
    12871284          self.setEnabled(True)
    12881285          return
     
    13131310    # Make a copy of a job
    13141311    def copy_job(self):
    1315  
     1312
    13161313       self.setEnabled(False)
    13171314       old_job_name = self.list_jobs.currentItem().text()
    13181315       
    1319        text, ret = QtGui.QInputDialog.getText(self, "Copy job", "Enter new job name:", mode = QtGui.QLineEdit.Normal, text = old_job_name)
    1320        
     1316       text, ret = QtWidgets.QInputDialog.getText(self, "Copy job", "Enter new job name:", QtWidgets.QLineEdit.Normal, text = old_job_name)
    13211317       if ( ret ):
    13221318          new_job_name = str(text)
    13231319       else:
    1324            self.setEnabled(True)
    1325            return
    1326          
     1320          self.setEnabled(True)
     1321          return
     1322
    13271323       new_input_dir  = job_dir + "/" + new_job_name + "/INPUT"
    13281324
    13291325#      check if a job exists with the new job name 
    13301326       if ( os.path.isdir(new_input_dir) ):
    1331            notify = QtGui.QMessageBox.warning(self,'Create new job directory',"Error. Could not create job directory. A job with the new name already exists.")
    1332            self.setEnabled(True)
    1333            return
     1327          notify = QtWidgets.QMessageBox.warning(self,'Create new job directory',"Error. Could not create job directory. A job with the new name already exists.")
     1328          self.setEnabled(True)
     1329          return
    13341330       else:
    1335            os.makedirs(new_input_dir)
     1331          os.makedirs(new_input_dir)
    13361332
    13371333#      copy and rename input files (if present)       
     
    13551351#      check if user code exists in the new job directory
    13561352       if ( os.path.isdir(new_user_dir) ):
    1357            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.")
    1358            self.setEnabled(True)
    1359            return
     1353          notify = QtWidgets.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.")
     1354          self.setEnabled(True)
     1355          return
    13601356       else:
    1361            os.makedirs(new_user_dir)
     1357          os.makedirs(new_user_dir)
    13621358
    13631359
     
    14061402#         check if a job exists with the new job name 
    14071403          if ( os.path.isdir(new_input_dir) ):
    1408              notify = QtGui.QMessageBox.warning(self,'Create new job directory',"Error. Could not create job directory. A job with the new name already exists.")
     1404             notify = QtWidgets.QMessageBox.warning(self,'Create new job directory',"Error. Could not create job directory. A job with the new name already exists.")
    14091405             self.setEnabled(True)
    14101406             return
     
    14271423
    14281424          new_user_dir  = job_dir + "/" + new_job_name + "/USER_CODE"
    1429        
     1425
    14301426#         check if user code exists in the new job directory
    14311427          if ( os.path.isdir(new_user_dir) ):
    1432               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.")
    1433               self.setEnabled(True)
    1434               return
     1428             notify = QtWidgets.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.")
     1429             self.setEnabled(True)
     1430             return
    14351431          else:
    1436               os.makedirs(new_user_dir)
     1432             os.makedirs(new_user_dir)
    14371433
    14381434
     
    14631459    def openmenujob(self, position):
    14641460
    1465         menu = QtGui.QMenu()
    1466 
    1467 
    1468         newAction = QtGui.QAction('Create new job', self)
     1461        menu = QtWidgets.QMenu()
     1462
     1463
     1464        newAction = QtWidgets.QAction('Create new job', self)
    14691465        newAction.triggered.connect(self.create_new_job)
    14701466        menu.addAction(newAction)
     
    14741470
    14751471
    1476            copyAction = QtGui.QAction('Copy job', self)
     1472           copyAction = QtWidgets.QAction('Copy job', self)
    14771473           copyAction.triggered.connect(self.copy_job)
    1478            createAction = QtGui.QAction('Create set from job', self)
     1474           createAction = QtWidgets.QAction('Create set from job', self)
    14791475           createAction.triggered.connect(self.create_set)
    1480            delAction = QtGui.QAction('Delete job', self)
     1476           delAction = QtWidgets.QAction('Delete job', self)
    14811477           delAction.triggered.connect(self.DeleteJob)
    14821478
     
    14901486    def openmenuinput(self, position):
    14911487
    1492         menu = QtGui.QMenu()
     1488        menu = QtWidgets.QMenu()
    14931489
    14941490        selection = self.list_input.selectedItems()
     
    14971493
    14981494
    1499            openAction = QtGui.QAction('Open file(s)', self)
     1495           openAction = QtWidgets.QAction('Open file(s)', self)
    15001496           openAction.setStatusTip('Open file(s) in your favorite editor')
    15011497           openAction.triggered.connect(self.OpenFilesInput)
    15021498
    15031499
    1504            delAction = QtGui.QAction('Delete selected file(s)', self)
     1500           delAction = QtWidgets.QAction('Delete selected file(s)', self)
    15051501           delAction.triggered.connect(self.DeleteFilesInput)
    15061502
     
    15081504           menu.addAction(delAction)
    15091505
    1510         delallAction = QtGui.QAction('Delete all files', self)
     1506        delallAction = QtWidgets.QAction('Delete all files', self)
    15111507        delallAction.triggered.connect(self.DeleteAllFilesInput)
    15121508        menu.addAction(delallAction)
     
    15171513    def openmenuuser(self, position):
    15181514
    1519         menu = QtGui.QMenu()
     1515        menu = QtWidgets.QMenu()
    15201516
    15211517        selection = self.list_user.selectedItems()
     
    15231519        if ( len(selection) != 0 ):
    15241520
    1525            openAction = QtGui.QAction('Open file(s)', self)
     1521           openAction = QtWidgets.QAction('Open file(s)', self)
    15261522           openAction.setStatusTip('Open file(s) in your favorite editor')
    15271523           openAction.triggered.connect(self.OpenFilesUser)
    15281524
    15291525
    1530            delAction = QtGui.QAction('Delete file(s)', self)
     1526           delAction = QtWidgets.QAction('Delete file(s)', self)
    15311527           delAction.triggered.connect(self.DeleteFilesUser)
    15321528
     
    15341530           menu.addAction(delAction)
    15351531
    1536         delallAction = QtGui.QAction('Delete all files', self)
     1532        delallAction = QtWidgets.QAction('Delete all files', self)
    15371533        delallAction.triggered.connect(self.DeleteAllFilesUser)
    15381534        menu.addAction(delallAction)
     
    15431539    def openmenuoutput(self, position):
    15441540
    1545         menu = QtGui.QMenu()
     1541        menu = QtWidgets.QMenu()
    15461542
    15471543        selection = self.list_output.selectedItems()
     
    15491545        if ( len(selection) != 0 ):
    15501546
    1551            openAction = QtGui.QAction('Open file(s)', self)
     1547           openAction = QtWidgets.QAction('Open file(s)', self)
    15521548           openAction.setStatusTip('Open file(s) in your favorite editor')
    15531549           openAction.triggered.connect(self.OpenFilesOutput)
    15541550
    1555            delAction = QtGui.QAction('Delete file(s)', self)
     1551           delAction = QtWidgets.QAction('Delete file(s)', self)
    15561552           delAction.triggered.connect(self.DeleteFilesOutput)
    15571553
     
    15611557           menu.addAction(delAction)
    15621558
    1563         delallAction = QtGui.QAction('Delete all files', self)
     1559        delallAction = QtWidgets.QAction('Delete all files', self)
    15641560        delallAction.triggered.connect(self.DeleteAllFilesOutput)
    15651561        menu.addAction(delallAction)
     
    15701566    def openmenumonitoring(self, position):
    15711567
    1572         menu = QtGui.QMenu()
     1568        menu = QtWidgets.QMenu()
    15731569
    15741570        selection = self.list_monitoring.selectedItems()
     
    15761572        if ( len(selection) != 0 ):
    15771573
    1578            openAction = QtGui.QAction('Open file(s)', self)
     1574           openAction = QtWidgets.QAction('Open file(s)', self)
    15791575           openAction.setStatusTip('Open file(s) in your favorite editor')
    15801576           openAction.triggered.connect(self.OpenFilesMonitoring)
    15811577
    1582            delAction = QtGui.QAction('Delete file(s)', self)
     1578           delAction = QtWidgets.QAction('Delete file(s)', self)
    15831579           delAction.triggered.connect(self.DeleteFilesMonitoring)
    15841580
     
    15881584           menu.addAction(delAction)
    15891585
    1590         delallAction = QtGui.QAction('Delete all files', self)
     1586        delallAction = QtWidgets.QAction('Delete all files', self)
    15911587        delallAction.triggered.connect(self.DeleteAllFilesMonitoring)
    15921588        menu.addAction(delallAction)
     
    15961592    def OpenConfig(self):
    15971593
    1598        config = str(self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").currentText())
     1594       config = str(self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").currentText())
    15991595       if ( config != "" ):
    16001596          filename = ".palm.config." + config
     
    16591655    def DeleteFilesInput(self):
    16601656
    1661        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1662 
    1663        if status == QtGui.QMessageBox.Yes:
     1657       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1658
     1659       if status == QtWidgets.QMessageBox.Yes:
    16641660
    16651661          sel_job = self.list_jobs.currentItem().text()
     
    16691665
    16701666          for i in range(0,len(sel_files)):
    1671              filename = input_dir +  sel_files[i].text().split("(")[0].trimmed()
     1667             filename = input_dir +  sel_files[i].text().split("(")[0].strip()
    16721668             os.remove(filename)
    16731669
     
    16771673    def DeleteFilesUser(self):
    16781674
    1679        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1680 
    1681        if status == QtGui.QMessageBox.Yes:
     1675       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1676
     1677       if status == QtWidgets.QMessageBox.Yes:
    16821678
    16831679          sel_job = self.list_jobs.currentItem().text()
     
    16871683
    16881684          for i in range(0,len(sel_files)):
    1689              filename = input_dir +  sel_files[i].text().split("(")[0].trimmed()
     1685             filename = input_dir +  sel_files[i].text().split("(")[0].strip()
    16901686             os.remove(filename)
    16911687
     
    16951691    def DeleteFilesMonitoring(self):
    16961692
    1697        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1698 
    1699        if status == QtGui.QMessageBox.Yes:
     1693       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1694
     1695       if status == QtWidgets.QMessageBox.Yes:
    17001696
    17011697          sel_job = self.list_jobs.currentItem().text()
     
    17051701
    17061702          for i in range(0,len(sel_files)):
    1707              filename = input_dir +  sel_files[i].text().split("(")[0].trimmed()
     1703             filename = input_dir +  sel_files[i].text().split("(")[0].strip()
    17081704             os.remove(filename)
    17091705
     
    17131709    def DeleteFilesOutput(self):
    17141710
    1715        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1716 
    1717        if status == QtGui.QMessageBox.Yes:
     1711       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1712
     1713       if status == QtWidgets.QMessageBox.Yes:
    17181714
    17191715          sel_job = self.list_jobs.currentItem().text()
     
    17231719
    17241720          for i in range(0,len(sel_files)):
    1725              filename = input_dir +  sel_files[i].text().split("(")[0].trimmed()
     1721             filename = input_dir +  sel_files[i].text().split("(")[0].strip()
    17261722             os.remove(filename)
    17271723
     
    17311727    def DeleteAllFilesInput(self):
    17321728
    1733        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1734 
    1735        if status == QtGui.QMessageBox.Yes:
     1729       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1730
     1731       if status == QtWidgets.QMessageBox.Yes:
    17361732
    17371733          check = self.list_jobs.currentItem()
     
    17511747    def DeleteAllFilesUser(self):
    17521748
    1753        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1754 
    1755        if status == QtGui.QMessageBox.Yes:
     1749       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1750
     1751       if status == QtWidgets.QMessageBox.Yes:
    17561752
    17571753          check = self.list_jobs.currentItem()
     
    17721768    def DeleteAllFilesOutput(self):
    17731769
    1774        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1775 
    1776        if status == QtGui.QMessageBox.Yes:
     1770       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1771
     1772       if status == QtWidgets.QMessageBox.Yes:
    17771773
    17781774          check = self.list_jobs.currentItem()
     
    17931789    def DeleteAllFilesMonitoring(self):
    17941790
    1795        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1796 
    1797        if status == QtGui.QMessageBox.Yes:
     1791       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1792
     1793       if status == QtWidgets.QMessageBox.Yes:
    17981794
    17991795          check = self.list_jobs.currentItem()
     
    18141810    def DeleteJob(self):
    18151811
    1816        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete this job?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1817 
    1818        if status == QtGui.QMessageBox.Yes:
     1812       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete this job?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1813
     1814       if status == QtWidgets.QMessageBox.Yes:
    18191815
    18201816          sel_job = self.list_jobs.currentItem().text()
     
    18261822
    18271823# Message box for showing RUN_CONTROL output
    1828 class CreateSetBox(QtGui.QDialog):
     1824class CreateSetBox(QtWidgets.QDialog):
    18291825    def __init__(self):
    18301826
     
    18561852
    18571853# Message box for showing RUN_CONTROL output
    1858 class OpenHistoryBox(QtGui.QDialog):
     1854class OpenHistoryBox(QtWidgets.QDialog):
    18591855    def __init__(self):
    18601856
     
    18731869
    18741870
    1875         list_jobname = self.findChild(QtGui.QListWidget,"list_history")
     1871        list_jobname = self.findChild(QtWidgets.QListWidget,"list_history")
    18761872
    18771873        # Read history entries and append to recent job list
     
    19161912    def ClearHistory(self):
    19171913
    1918        status = QtGui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete your history?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
    1919 
    1920        if status == QtGui.QMessageBox.Yes:
     1914       status = QtWidgets.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete your history?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     1915
     1916       if status == QtWidgets.QMessageBox.Yes:
    19211917
    19221918          if os.path.exists(palm_dir + "/.palmrungui.history"):
     
    19271923
    19281924if __name__ == "__main__":
    1929     app = QtGui.QApplication(sys.argv)
     1925    app = QtWidgets.QApplication(sys.argv)
    19301926    window = Mainwindow()
    19311927    window.show()
Note: See TracChangeset for help on using the changeset viewer.