Changeset 4670 for palm/trunk/SCRIPTS/palmrungui
- Timestamp:
- Sep 9, 2020 5:27:45 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palmrungui
r4482 r4670 1 #!/usr/bin/env python 1 #!/usr/bin/env python3 2 2 # -*- coding: utf-8 -*- 3 3 #--------------------------------------------------------------------------------# … … 25 25 # ----------------- 26 26 # $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 27 32 # Added possibility to delete all files in a directory and option to create 28 33 # blank new jobs … … 98 103 # 99 104 #------------------------------------------------------------------------------! 100 101 105 import sys 102 106 import subprocess 103 from PyQt4 import QtCore, QtGui, uic 104 from PyQt4.QtCore import QProcess,pyqtSlot,SIGNAL,SLOT 107 from PyQt5 import QtCore, QtGui, uic, QtWidgets 108 from PyQt5.QtWidgets import QMainWindow, QApplication 109 from PyQt5.QtCore import QProcess, pyqtSlot, QTimer 105 110 from time import strftime 106 111 import os … … 118 123 job_dir = palm_dir + '/JOBS' 119 124 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: 121 126 # file found 122 127 out = None 123 128 except: 124 print "Error. palmrungui probably called in wrong directory."129 print ("Error. palmrungui probably called in wrong directory.") 125 130 raise SystemExit 126 131 … … 135 140 return "%.1f%s%s" % (num, 'Y', suffix) 136 141 137 142 def ilen(iterable): 143 return reduce(lambda sum, element: sum + 1, iterable, 0) 138 144 139 145 palmrunline = "" … … 144 150 Ui_aboutDialog = uic.loadUiType("%s/palmrungui_files/about.ui" % (palm_bin))[0] 145 151 146 class HelpDialog(Qt Gui.QDialog,Ui_helpDialog):152 class HelpDialog(QtWidgets.QDialog,Ui_helpDialog): 147 153 def __init__(self, parent=None): 148 154 super(HelpDialog,self).__init__() 149 155 self.setupUi(self) 150 156 151 class AboutDialog(Qt Gui.QDialog,Ui_aboutDialog):157 class AboutDialog(QtWidgets.QDialog,Ui_aboutDialog): 152 158 def __init__(self, parent=None): 153 159 super(AboutDialog,self).__init__() 154 160 self.setupUi(self) 155 161 156 class Mainwindow(Qt Gui.QMainWindow, Ui_MainWindow):162 class Mainwindow(QtWidgets.QMainWindow, Ui_MainWindow): 157 163 def __init__(self, parent=None): 158 164 super(Mainwindow, self).__init__() 159 165 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: 164 169 for line in search: 165 170 line = line.rstrip() 166 171 if "$Id" in line: 167 172 version = "Version: r" + line.split(" ")[3] + " (" + line.split(" ")[4] + ")" 168 self.groupBox.findChild(Qt Gui.QLabel,"label_version").setText(version)173 self.groupBox.findChild(QtWidgets.QLabel,"label_version").setText(version) 169 174 break 170 171 175 self.recent_jobs(50) 172 176 self.load_jobs() 173 177 178 179 174 180 # look up configuration files and add to combo box 175 181 176 self.group_execution.findChild(Qt Gui.QComboBox,"combo_configuration").addItem("")182 self.group_execution.findChild(QtWidgets.QComboBox,"combo_configuration").addItem("") 177 183 178 184 for files in os.listdir(palm_dir): 179 185 if files.startswith(".palm.config"): 180 tmpstring = filter(None,files.split(".palm.config."))[0]181 self.group_execution.findChild(Qt Gui.QComboBox,"combo_configuration").addItem(tmpstring)182 183 commandline = self.groupBox.findChild(Qt Gui.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") 184 190 commandline.setText("") 185 191 186 192 self.tabWidget.setCurrentIndex(0) 187 193 188 194 189 195 filename = "%s/.palmrungui.default" % (palm_dir) 190 196 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() 212 212 213 213 # Start refresh timer. On timeout perform update 214 214 215 self.timer = QtCore.QTimer(self) 215 216 self.timer.timeout.connect(self.update_all) … … 222 223 223 224 # The labeltimer induces the update of the remaining time in the UI 225 224 226 self.labeltimer = QtCore.QTimer(self) 225 227 self.labeltimer.timeout.connect(self.UpdatePush) … … 233 235 ####################################### 234 236 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()) 239 238 palmrunline_save = palmrunline 240 if (userline != ""): 241 palmrunline = "%s %s" % (palmrunline,userline) 242 history_line = palmrunline 243 239 244 240 # Disable the main window 245 241 self.tabWidget.setEnabled(False) 246 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setEnabled(False)247 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setEnabled(False)248 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setText("wait...")249 self.groupBox.findChild(Qt Gui.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...") 250 246 251 247 # Wait until all commands have been executed (ugly) ? … … 282 278 filename = "%s/.palmrungui.history" % (palm_dir) 283 279 tmstamp = strftime("%Y/%m/%d %H:%M") 284 tag = str(self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").text())280 tag = str(self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").text()) 285 281 286 282 file = open(filename,"a") 287 s = "%s %s (%s)\n" % (tmstamp, history_line,tag)283 s = "%s %s (%s)\n" % (tmstamp,palmrunline_save,tag) 288 284 file.write(s) 289 285 file.close() … … 291 287 # Enable main window again 292 288 self.tabWidget.setEnabled(True) 293 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setEnabled(True)294 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setText("palmrun")295 self.groupBox.findChild(Qt Gui.QLineEdit,"commandline").setText(palmrunline_save)296 self.groupBox.findChild(Qt Gui.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) 297 293 298 294 # Reload recent jobs … … 303 299 # Update the label 304 300 def UpdatePush(self): 305 remaining_time = (update_frequency - self.timetimer.elapsed()) / 1000 / 60301 remaining_time = int((update_frequency - self.timetimer.elapsed()) / 1000 / 60) 306 302 self.push_update.setText("Update (" + str(remaining_time) + " min)") 307 303 … … 310 306 ####################################### 311 307 def startpalmbuild(self): 312 palmbuildline = 'palmbuild -c ' + str(self.group_execution.findChild(Qt Gui.QComboBox, "combo_configuration").currentText())313 314 full_build = self.group_execution.findChild(Qt Gui.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() 315 311 316 312 if ( full_build == 2 ): … … 318 314 os.utime(palm_source + "/" + filename, None) 319 315 320 palmrunline_save = str(self.groupBox.findChild(Qt Gui.QLineEdit,"commandline").text())316 palmrunline_save = str(self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").text()) 321 317 322 318 # Disable the main window 323 319 palmbuildline_save = palmbuildline 324 320 self.tabWidget.setEnabled(False) 325 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setEnabled(False)326 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setEnabled(False)327 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setText("wait...")328 self.group_execution.findChild(Qt Gui.QPushButton,"button_palmbuild").setText("wait...")329 self.groupBox.findChild(Qt Gui.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...") 330 326 331 327 # Wait until all commands have been executed (ugly) ? … … 359 355 # Enable main window again 360 356 self.tabWidget.setEnabled(True) 361 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setEnabled(True)362 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setEnabled(True)363 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setText("palmrun")364 self.groupBox.findChild(Qt Gui.QLineEdit,"commandline").setText(palmrunline_save)365 self.group_execution.findChild(Qt Gui.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") 366 362 # Reload recent jobs 367 363 self.recent_jobs(50) … … 383 379 j = 0 384 380 385 list_jobname = self.group_history.findChild(Qt Gui.QListWidget,"list_jobname")381 list_jobname = self.group_history.findChild(QtWidgets.QListWidget,"list_jobname") 386 382 list_jobname.clear() 387 383 … … 397 393 398 394 if ( len(matchitems) == 0 ): 399 listitem = filter(None,listitem.split(" -r"))[1]395 listitem = list(filter(None,listitem.split(" -r")))[1] 400 396 listitem = listitem.strip() 401 listitem = filter(None,listitem.split(" "))[0]397 listitem = list(filter(None,listitem.split(" ")))[0] 402 398 listitem = listitem.replace("\"","") 403 399 list_jobname.addItem(listitem) 404 400 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] 408 408 configitem = configitem.replace("\"","") 409 409 … … 412 412 413 413 414 tagitem = filter(None,tagitem.split(" ("))[1]414 tagitem = list(filter(None,tagitem.split(" (")))[1] 415 415 tagitem = tagitem.replace(")","") 416 416 if ( len(tagitem) == 0 ): … … 440 440 ############################### 441 441 def enable_coupled(self): 442 coupledState = self.group_execution.findChild(Qt Gui.QComboBox, "drop_job").currentText()443 group = self.group_execution.findChild(Qt Gui.QGroupBox, "group_coupled")442 coupledState = self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").currentText() 443 group = self.group_execution.findChild(QtWidgets.QGroupBox, "group_coupled") 444 444 445 445 if (coupledState == "Restart run (coupled atmosphere ocean)" or coupledState == "Initial run (coupled atmosphere ocean)"): … … 453 453 def choosejob_list(self): 454 454 # Get selected item from list 455 list_jobname = self.group_history.findChild(Qt Gui.QListWidget,"list_jobname")455 list_jobname = self.group_history.findChild(QtWidgets.QListWidget,"list_jobname") 456 456 filename = str(list_jobname.currentItem().text()) 457 457 … … 485 485 while i>=1: 486 486 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] 488 488 listitem = listitem.strip() 489 listitem = filter(None,listitem.split(" "))[0]489 listitem = list(filter(None,listitem.split(" ")))[0] 490 490 listitem = listitem.replace("\"","") 491 491 … … 495 495 palmrunline = palmrunline[17:] 496 496 palmrunline = palmrunline[:len(palmrunline)-1] 497 palmrunline = filter(None,palmrunline.split("("))[0]498 self.groupBox.findChild(Qt Gui.QLineEdit,"commandline").setText(palmrunline)497 palmrunline = list(filter(None,palmrunline.split("(")))[0] 498 self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(palmrunline) 499 499 500 500 501 501 tag = history[i-1].split('\n')[0] 502 tag = filter(None,tag.split("("))[1]502 tag = list(filter(None,tag.split("(")))[1] 503 503 tag = tag.replace(")","") 504 504 505 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setText(tag)505 self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setText(tag) 506 506 self.setup_gui(palmrunline) 507 507 self.list_jobname.item(itemint).setSelected(True) … … 513 513 ###################################################### 514 514 def change_rc_list(self): 515 drop_job = self.group_execution.findChild(Qt Gui.QComboBox,"drop_job").currentText()515 drop_job = self.group_execution.findChild(QtWidgets.QComboBox,"drop_job").currentText() 516 516 self.change_commandline("a","") 517 517 518 518 # Enable PE distribution for atmosphere/ocean 519 519 if ( drop_job == "Restart run (coupled atmosphere ocean)" or drop_job == "Initial run (coupled atmosphere ocean)"): 520 drop_atmos = self.group_coupled.findChild(Qt Gui.QLineEdit,"line_PE_atmos").text()521 drop_ocean = self.group_coupled.findChild(Qt Gui.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() 522 522 s = "%s %s" % (drop_atmos,drop_ocean) 523 523 self.change_commandline("Y",s) … … 540 540 fwt_str = str(fwt_str) 541 541 initialize = False 542 palmrunline = str(self.groupBox.findChild(Qt Gui.QLineEdit,"commandline").text())542 palmrunline = str(self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").text()) 543 543 s = " -%s " % (id_str) 544 splitline = filter(None,palmrunline.split(s))544 splitline = list(filter(None,palmrunline.split(s))) 545 545 546 546 if ( len(splitline) == 0 ): … … 556 556 # Change in parameter "r" (jobname) 557 557 if (id_str == "r"): 558 filename = str(self.group_execution.findChild(Qt Gui.QLineEdit,"line_jobname").text())558 filename = str(self.group_execution.findChild(QtWidgets.QLineEdit,"line_jobname").text()) 559 559 s = filename.split("JOBS/") 560 560 param[0] = s[len(s)-1] … … 562 562 if ( initialize == True ):#and self.group_runcontrol.isEnabled() == True ): 563 563 self.group_execution.setEnabled(True) 564 self.group_execution.findChild(Qt Gui.QComboBox,"drop_job").setEnabled(True)564 self.group_execution.findChild(QtWidgets.QComboBox,"drop_job").setEnabled(True) 565 565 self.group_advanced.setEnabled(True) 566 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setEnabled(True)567 self.menuBar.findChild(Qt Gui.QMenu,"menuStart").actions()[3].setEnabled(True)568 self.groupBox.findChild(Qt Gui.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) 569 569 570 570 elif ( param[0] == ""): 571 571 self.group_execution.setEnabled(False) 572 self.group_execution.findChild(Qt Gui.QComboBox,"drop_job").setEnabled(False)573 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setEnabled(False)574 self.menuBar.findChild(Qt Gui.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) 575 575 self.group_advanced.setEnabled(False) 576 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setEnabled(True)576 self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True) 577 577 self.delete_commandline("r") 578 578 self.change_commandline("a","remove") … … 588 588 elif (id_str == "a"): 589 589 590 drop_job = self.group_execution.findChild(Qt Gui.QComboBox,"drop_job").currentText()590 drop_job = self.group_execution.findChild(QtWidgets.QComboBox,"drop_job").currentText() 591 591 rc_flag = "#" 592 592 … … 620 620 param[0] = "%s d3%s" % (param[0],rc_flag) 621 621 622 status_restarts = self.group_execution.findChild(Qt Gui.QCheckBox,"check_restarts").checkState()622 status_restarts = self.group_execution.findChild(QtWidgets.QCheckBox,"check_restarts").checkState() 623 623 624 624 if (status_restarts == 2): … … 626 626 627 627 628 status_cycfill = self.group_execution.findChild(Qt Gui.QCheckBox,"check_cycfill").checkState()628 status_cycfill = self.group_execution.findChild(QtWidgets.QCheckBox,"check_cycfill").checkState() 629 629 630 630 if (status_cycfill == 2): 631 param[0]="%s fill" % (param[0])632 633 status_svf = self.group_execution.findChild(Qt Gui.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 635 635 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]) 637 642 638 643 param[0]="%s\"" % (param[0]) 639 640 644 641 645 if ( fwt_str == "remove"): 642 646 self.delete_commandline(id_str) … … 646 650 self.button_start.setEnabled(True) 647 651 self.action_save.setEnabled(True) 648 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setEnabled(True)652 self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True) 649 653 650 654 # Change in any other parameter … … 664 668 newpalmrunline = s.join(splitline) 665 669 666 # Pr the new palmrunline to mainwindow670 # Print the new palmrunline to mainwindow 667 671 newpalmrunline = newpalmrunline.replace(" "," ") 668 self.groupBox.findChild(Qt Gui.QLineEdit,"commandline").setText(newpalmrunline)672 self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(newpalmrunline) 669 673 670 674 # change lineinput depending on sender 671 675 ################################################################################### 672 676 def change_lineinput(self): 673 if ( self.sender() == self.group_execution.findChild(Qt Gui.QComboBox, "combo_configuration") ):674 tmptext = self.group_execution.findChild(Qt Gui.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: 676 680 self.change_commandline("c"," ") 677 self.group_execution.findChild(Qt Gui.QPushButton,'button_palmbuild').setEnabled(False)681 self.group_execution.findChild(QtWidgets.QPushButton,'button_palmbuild').setEnabled(False) 678 682 else: 679 683 self.change_commandline("c",tmptext) 680 self.group_execution.findChild(Qt Gui.QPushButton,'button_palmbuild').setEnabled(True)681 682 elif ( self.sender() == self.group_execution.findChild(Qt Gui.QLineEdit,"line_q")):683 tmptext = self.group_execution.findChild(Qt Gui.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() 684 688 self.change_commandline("q",tmptext) 685 689 686 elif ( self.sender() == self.group_execution.findChild(Qt Gui.QLineEdit,"line_account")):687 tmptext = self.group_execution.findChild(Qt Gui.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() 688 692 self.change_commandline("A",tmptext) 689 693 690 elif ( self.sender() == self.group_execution.findChild(Qt Gui.QLineEdit,"line_pe")):691 tmptext = self.group_execution.findChild(Qt Gui.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() 692 696 self.change_commandline("X",tmptext) 693 697 694 elif ( self.sender() == self.group_execution.findChild(Qt Gui.QLineEdit,"line_tpn")):695 tmptext = self.group_execution.findChild(Qt Gui.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() 696 700 self.change_commandline("T",tmptext) 697 701 698 elif ( self.sender() == self.group_execution.findChild(Qt Gui.QLineEdit,"line_time")):699 tmptext = self.group_execution.findChild(Qt Gui.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() 700 704 self.change_commandline("t",tmptext) 701 705 702 elif ( self.sender() == self.group_advanced.findChild(Qt Gui.QLineEdit,"line_M")):703 tmptext = self.group_advanced.findChild(Qt Gui.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() 704 708 self.change_commandline("M",tmptext) 705 709 706 elif ( self.sender() == self.group_advanced.findChild(Qt Gui.QLineEdit,"line_m")):707 tmptext = self.group_advanced.findChild(Qt Gui.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() 708 712 self.change_commandline("m",tmptext) 709 713 710 elif ( self.sender() == self.group_advanced.findChild(Qt Gui.QLineEdit,"line_D")):711 tmptext = self.group_advanced.findChild(Qt Gui.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() 712 716 self.change_commandline("D",tmptext) 713 717 714 elif ( self.sender() == self.group_advanced.findChild(Qt Gui.QLineEdit,"line_c")):715 tmptext = self.group_advanced.findChild(Qt Gui.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() 716 720 if ( tmptext == ".palmrungui.config"): 717 721 tmptext = "" 718 722 self.change_commandline("c",tmptext) 719 723 720 elif ( self.sender() == self.group_advanced.findChild(Qt Gui.QLineEdit,"line_s")):721 tmptext = self.group_advanced.findChild(Qt Gui.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() 722 726 self.change_commandline("s",tmptext) 723 727 724 elif ( self.sender() == self.group_advanced.findChild(Qt Gui.QLineEdit,"line_w")):725 tmptext = self.group_advanced.findChild(Qt Gui.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() 726 730 self.change_commandline("w",tmptext) 727 731 728 elif ( self.sender() == self.group_coupled.findChild(Qt Gui.QLineEdit,"line_PE_atmos") or729 self.sender() == self.group_coupled.findChild(Qt Gui.QLineEdit,"line_PE_ocean")):730 t1 = self.group_coupled.findChild(Qt Gui.QLineEdit,"line_PE_atmos").text()731 t2 = self.group_coupled.findChild(Qt Gui.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() 732 736 tmptext = "%s %s" % (t1,t2) 733 737 … … 742 746 except ValueError: 743 747 pass 744 748 745 749 try: 746 750 pe2 = int(t2) 747 751 except ValueError: 748 752 pass 749 753 750 754 PE_total = pe1+pe2 751 self.group_execution.findChild(Qt Gui.QLineEdit,"line_pe").setText(str(PE_total))755 self.group_execution.findChild(QtWidgets.QLineEdit,"line_pe").setText(str(PE_total)) 752 756 self.change_commandline("X",str(PE_total)) 753 757 754 758 # deletes parameter from commandline 755 759 ##################################################################################### 756 760 def delete_commandline(self, id_str): 757 761 # Read palmrunline 758 commandline = self.groupBox.findChild(Qt Gui.QLineEdit,"commandline")762 commandline = self.groupBox.findChild(QtWidgets.QLineEdit,"commandline") 759 763 palmrunline = str(commandline.text()) 760 764 s = " -%s" % (id_str) 761 splitline = filter(None,palmrunline.split(s))765 splitline = list(filter(None,palmrunline.split(s))) 762 766 763 767 if ( len(splitline) == 1): … … 776 780 ################################################################################### 777 781 def check_flags(self): 778 status = self.group_execution.findChild(Qt Gui.QCheckBox,"check_delete_tmp_files" ).checkState()782 status = self.group_execution.findChild(QtWidgets.QCheckBox,"check_delete_tmp_files" ).checkState() 779 783 if (status == 2): 780 784 self.activate_flag("B") … … 782 786 self.deactivate_flag("B") 783 787 784 status = self.group_execution.findChild(Qt Gui.QCheckBox,"check_verbose" ).checkState()788 status = self.group_execution.findChild(QtWidgets.QCheckBox,"check_verbose" ).checkState() 785 789 if (status == 2): 786 790 self.activate_flag("v") … … 788 792 self.deactivate_flag("v") 789 793 790 status = self.group_advanced.findChild(Qt Gui.QCheckBox,"check_b" ).checkState()794 status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_b" ).checkState() 791 795 if (status == 2): 792 796 self.activate_flag("b") … … 794 798 self.deactivate_flag("b") 795 799 796 status = self.group_advanced.findChild(Qt Gui.QCheckBox,"check_F" ).checkState()800 status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_F" ).checkState() 797 801 if (status == 2): 798 802 self.activate_flag("F") … … 800 804 self.deactivate_flag("F") 801 805 802 status = self.group_advanced.findChild(Qt Gui.QCheckBox,"check_I" ).checkState()806 status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_I" ).checkState() 803 807 if (status == 2): 804 808 self.activate_flag("I") … … 806 810 self.deactivate_flag("I") 807 811 808 status = self.group_advanced.findChild(Qt Gui.QCheckBox,"check_k" ).checkState()812 status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_k" ).checkState() 809 813 if (status == 2): 810 814 self.activate_flag("k") … … 812 816 self.deactivate_flag("k") 813 817 814 status = self.group_advanced.findChild(Qt Gui.QCheckBox,"check_O" ).checkState()818 status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_O" ).checkState() 815 819 if (status == 2): 816 820 self.activate_flag("O") … … 818 822 self.deactivate_flag("O") 819 823 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() 821 831 if (status == 2): 822 832 self.activate_flag("x") … … 824 834 self.deactivate_flag("x") 825 835 826 status = self.group_advanced.findChild(Qt Gui.QCheckBox,"check_Z" ).checkState()836 status = self.group_advanced.findChild(QtWidgets.QCheckBox,"check_Z" ).checkState() 827 837 if (status == 2): 828 838 self.activate_flag("Z") … … 833 843 ################################################################################## 834 844 def activate_flag(self, id_str): 835 commandline = self.groupBox.findChild(Qt Gui.QLineEdit,"commandline")845 commandline = self.groupBox.findChild(QtWidgets.QLineEdit,"commandline") 836 846 palmrunline = str(commandline.text()) 837 847 s = " -%s" % (id_str) 838 splitline = filter(None,palmrunline.split(s))848 splitline = list(filter(None,palmrunline.split(s))) 839 849 840 850 if ( len(splitline) == 1): … … 848 858 #################################################################################### 849 859 def deactivate_flag(self, id_str): 850 commandline = self.groupBox.findChild(Qt Gui.QLineEdit,"commandline")860 commandline = self.groupBox.findChild(QtWidgets.QLineEdit,"commandline") 851 861 palmrunline = str(commandline.text()) 852 862 s = " -%s" % (id_str) 853 splitline = filter(None,palmrunline.split(s))863 splitline = list(filter(None,palmrunline.split(s))) 854 864 855 865 newpalmrunline = "".join(splitline) … … 862 872 self.setupUi(self) 863 873 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")) 865 875 self.recent_jobs(50) 866 876 self.load_jobs() … … 870 880 ################################################################################ 871 881 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 879 884 filename ="%s/.palmrungui.default" % (palm_dir) 880 885 tmstamp = strftime("%Y/%m/%d %H:%M") 881 886 882 887 file = open(filename,"w") 883 888 s = "%s %s" % (tmstamp, string_to_file) … … 907 912 def setup_gui(self, palmrun_str): 908 913 909 #self.palm_logo.setPixmap(Qt Gui.QPixmap(palm_dir + "/trunk/SCRIPTS/palmrungui_files/logo.png"))914 #self.palm_logo.setPixmap(QtWidgets.QPixmap(palm_dir + "/trunk/SCRIPTS/palmrungui_files/logo.png")) 910 915 911 916 # Some initial settings 912 user = ""913 917 coupled_run = False 914 918 ocean_run = False … … 940 944 941 945 if ( options != ""): 942 self.group_execution.findChild(Qt Gui.QLineEdit,"line_jobname").setText(options)946 self.group_execution.findChild(QtWidgets.QLineEdit,"line_jobname").setText(options) 943 947 nojob = False 944 948 … … 947 951 948 952 elif ( parameter == "c"): 949 tmpindex = self.group_execution.findChild(Qt Gui.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) 950 954 if tmpindex != -1: 951 self.group_execution.findChild(Qt Gui.QComboBox, "combo_configuration").setCurrentIndex(tmpindex)955 self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").setCurrentIndex(tmpindex) 952 956 else: 953 self.group_execution.findChild(Qt Gui.QComboBox, "combo_configuration").setCurrentIndex(0)957 self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").setCurrentIndex(0) 954 958 elif ( parameter == "q"): 955 self.group_execution.findChild(Qt Gui.QLineEdit,"line_q").setText(options)959 self.group_execution.findChild(QtWidgets.QLineEdit,"line_q").setText(options) 956 960 957 961 elif ( parameter == "A"): 958 self.group_execution.findChild(Qt Gui.QLineEdit,"line_account").setText(options)962 self.group_execution.findChild(QtWidgets.QLineEdit,"line_account").setText(options) 959 963 960 964 elif ( parameter == "X"): 961 self.group_execution.findChild(Qt Gui.QLineEdit,"line_pe").setText(options)965 self.group_execution.findChild(QtWidgets.QLineEdit,"line_pe").setText(options) 962 966 963 967 elif ( parameter == "T"): 964 self.group_execution.findChild(Qt Gui.QLineEdit,"line_tpn").setText(options)968 self.group_execution.findChild(QtWidgets.QLineEdit,"line_tpn").setText(options) 965 969 966 970 elif ( parameter == "t"): 967 self.group_execution.findChild(Qt Gui.QLineEdit,"line_time").setText(options)971 self.group_execution.findChild(QtWidgets.QLineEdit,"line_time").setText(options) 968 972 969 973 elif ( parameter == "B"): 970 self.group_execution.findChild(Qt Gui.QCheckBox,"check_delete_tmp_files").setChecked(True)974 self.group_execution.findChild(QtWidgets.QCheckBox,"check_delete_tmp_files").setChecked(True) 971 975 972 976 elif ( parameter == "v"): 973 self.group_execution.findChild(Qt Gui.QCheckBox,"check_verbose").setChecked(True)977 self.group_execution.findChild(QtWidgets.QCheckBox,"check_verbose").setChecked(True) 974 978 975 979 elif ( parameter == "b"): 976 self.group_advanced.findChild(Qt Gui.QCheckBox,"check_b").setChecked(True)980 self.group_advanced.findChild(QtWidgets.QCheckBox,"check_b").setChecked(True) 977 981 978 982 elif ( parameter == "F"): 979 self.group_advanced.findChild(Qt Gui.QCheckBox,"check_F").setChecked(True)983 self.group_advanced.findChild(QtWidgets.QCheckBox,"check_F").setChecked(True) 980 984 981 985 elif ( parameter == "I"): 982 self.group_advanced.findChild(Qt Gui.QCheckBox,"check_I").setChecked(True)986 self.group_advanced.findChild(QtWidgets.QCheckBox,"check_I").setChecked(True) 983 987 984 988 elif ( parameter == "k"): 985 self.group_advanced.findChild(Qt Gui.QCheckBox,"check_k").setChecked(True)989 self.group_advanced.findChild(QtWidgets.QCheckBox,"check_k").setChecked(True) 986 990 987 991 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 990 997 elif ( parameter == "x"): 991 self.group_advanced.findChild(Qt Gui.QCheckBox,"check_x").setChecked(True)992 998 self.group_advanced.findChild(QtWidgets.QCheckBox,"check_x").setChecked(True) 999 993 1000 elif ( parameter == "Z"): 994 self.group_advanced.findChild(Qt Gui.QCheckBox,"check_Z").setChecked(True)1001 self.group_advanced.findChild(QtWidgets.QCheckBox,"check_Z").setChecked(True) 995 1002 996 1003 elif ( parameter == "m"): 997 self.group_advanced.findChild(Qt Gui.QLineEdit,"line_m").setText(options)1004 self.group_advanced.findChild(QtWidgets.QLineEdit,"line_m").setText(options) 998 1005 999 1006 elif ( parameter == "M"): 1000 self.group_advanced.findChild(Qt Gui.QLineEdit,"line_M").setText(options)1007 self.group_advanced.findChild(QtWidgets.QLineEdit,"line_M").setText(options) 1001 1008 1002 1009 elif ( parameter == "D"): 1003 self.group_advanced.findChild(Qt Gui.QLineEdit,"line_D").setText(options)1010 self.group_advanced.findChild(QtWidgets.QLineEdit,"line_D").setText(options) 1004 1011 1005 1012 elif ( parameter == "c"): 1006 self.group_advanced.findChild(Qt Gui.QLineEdit,"line_c").setText(options)1013 self.group_advanced.findChild(QtWidgets.QLineEdit,"line_c").setText(options) 1007 1014 1008 1015 elif ( parameter == "s"): 1009 self.group_advanced.findChild(Qt Gui.QLineEdit,"line_s").setText(options)1016 self.group_advanced.findChild(QtWidgets.QLineEdit,"line_s").setText(options) 1010 1017 1011 1018 elif ( parameter == "w"): 1012 self.group_advanced.findChild(Qt Gui.QLineEdit,"line_w").setText(options)1019 self.group_advanced.findChild(QtWidgets.QLineEdit,"line_w").setText(options) 1013 1020 1014 1021 … … 1017 1024 optionssplit = options.split(" ") 1018 1025 1019 group_coupled = self.group_execution.findChild(Qt Gui.QGroupBox,"group_coupled")1020 group_coupled.findChild(Qt Gui.QLineEdit,"line_PE_atmos").setEnabled(True)1021 group_coupled.findChild(Qt Gui.QLineEdit,"line_PE_ocean").setEnabled(True)1022 group_coupled.findChild(Qt Gui.QLabel,"label_coupled1").setEnabled(True)1023 group_coupled.findChild(Qt Gui.QLabel,"label_coupled2").setEnabled(True)1024 group_coupled.findChild(Qt Gui.QLabel,"label_coupled3").setEnabled(True)1025 group_coupled.findChild(Qt Gui.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) 1026 1033 1027 1034 if (optionssplit.count() == 2): 1028 group_coupled.findChild(Qt Gui.QLineEdit,"line_PE_atmos").setEnabled(optionssplit[0])1029 group_coupled.findChild(Qt Gui.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]) 1030 1037 1031 1038 else: 1032 group_coupled.findChild(Qt Gui.QLineEdit,"line_PE_atmos").setText("")1033 group_coupled.findChild(Qt Gui.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("") 1034 1041 1035 1042 … … 1037 1044 1038 1045 elif ( parameter == "y"): 1039 self.group_execution.findChild(Qt Gui.QComboBox, "drop_job").setCurrentIndex(3)1046 self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(3) 1040 1047 1041 1048 … … 1056 1063 if (options_2 == "d3"): 1057 1064 if (options_all[:3][-1] == "#"): 1058 self.group_execution.findChild(Qt Gui.QComboBox, "drop_job").setCurrentIndex(0)1065 self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(0) 1059 1066 elif (options_all[:3][-1] == "r"): 1060 self.group_execution.findChild(Qt Gui.QComboBox, "drop_job").setCurrentIndex(1)1067 self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(1) 1061 1068 1062 1069 elif (options_all[:3][-1] == "o"): … … 1064 1071 1065 1072 if (options_all == "restart"): 1066 self.group_execution.findChild(Qt Gui.QCheckBox,"check_restarts").setChecked(True)1073 self.group_execution.findChild(QtWidgets.QCheckBox,"check_restarts").setChecked(True) 1067 1074 1068 1075 j = j+1 1069 1070 # All unknown parameters are set as extra user parameters1071 else:1072 print parameter1073 user = "%s-%s \"%s\" " % (user,parameter,options)1074 splitline.removeAt(i)1075 1076 1076 i = i-1 1077 1077 # Change drop box state in case of ocean precursor or coupled restart runs 1078 1078 if ( ocean_run == True ): 1079 1079 if ( coupled_run == True ): 1080 self.group_execution.findChild(Qt Gui.QComboBox, "drop_job").setCurrentIndex(4)1080 self.group_execution.findChild(QtWidgets.QComboBox, "drop_job").setCurrentIndex(4) 1081 1081 1082 1082 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) 1087 1084 1088 1085 # Join palmrunline and post it to mainwindow 1089 1086 palmrunline = " -".join(splitline) 1090 self.groupBox.findChild(Qt Gui.QLineEdit,"commandline").setText(palmrunline)1087 self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(palmrunline) 1091 1088 1092 1089 # Disable mainwindow if no job was found, otherwise enable 1093 1090 if ( nojob == True ): 1094 1091 self.group_execution.setEnabled(False) 1095 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setEnabled(False)1096 self.menuBar.findChild(Qt Gui.QMenu,"menuStart").actions()[3].setEnabled(False)1097 self.group_execution.findChild(Qt Gui.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) 1098 1095 self.group_advanced.setEnabled(False) 1099 1096 self.check_advanced.setEnabled(False) 1100 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setEnabled(False)1097 self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(False) 1101 1098 1102 1099 else: 1103 1100 self.group_execution.setEnabled(True) 1104 self.groupBox.findChild(Qt Gui.QPushButton,"button_start").setEnabled(True)1105 self.menuBar.findChild(Qt Gui.QMenu,"menuStart").actions()[3].setEnabled(True)1106 self.group_execution.findChild(Qt Gui.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) 1107 1104 self.group_advanced.setEnabled(True) 1108 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setEnabled(True)1105 self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setEnabled(True) 1109 1106 1110 1107 … … 1124 1121 palmrunline = palmrunline[17:] 1125 1122 palmrunline = palmrunline[:len(palmrunline)-1] 1126 palmrunline = filter(None,palmrunline.split("("))[0]1127 self.groupBox.findChild(Qt Gui.QLineEdit,"commandline").setText(palmrunline)1123 palmrunline = list(filter(None,palmrunline.split("(")))[0] 1124 self.groupBox.findChild(QtWidgets.QLineEdit,"commandline").setText(palmrunline) 1128 1125 1129 1126 # Set selected item to jobname in "available jobs" list 1130 1127 jobname = str(history_entry[17:]) 1131 jobname = filter(None,jobname.split(" -r"))[1]1128 jobname = list(filter(None,jobname.split(" -r")))[1] 1132 1129 jobname = jobname.strip() 1133 jobname = filter(None,jobname.split(" "))[0]1130 jobname = list(filter(None,jobname.split(" ")))[0] 1134 1131 jobname = jobname.replace("\"","") 1135 1132 item2int = self.list_jobs.findItems(jobname,QtCore.Qt.MatchCaseSensitive) … … 1141 1138 # Add tooltip tag 1142 1139 tag = str(history_entry).split('\n')[0] 1143 tag = filter(None,tag.split("("))[1]1140 tag = list(filter(None,tag.split("(")))[1] 1144 1141 tag = tag.replace(")","") 1145 self.groupBox.findChild(Qt Gui.QLineEdit,"line_tag").setText(tag)1142 self.groupBox.findChild(QtWidgets.QLineEdit,"line_tag").setText(tag) 1146 1143 1147 1144 # Process palmrungui to set up gui controls … … 1254 1251 self.list_output.addItem(str(list_of_files[i]) + " (" + file_size(tmp_file) + ")") 1255 1252 1256 self.group_execution.findChild(Qt Gui.QLineEdit,"line_jobname").setText(jobitem.text())1257 self.group_history.findChild(Qt Gui.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() 1258 1255 1259 1256 self.timetimer.start() … … 1261 1258 self.labeltimer.start(update_frequency/10) 1262 1259 self.push_update.setText("Update (" + str(int(update_frequency/1000/60)) + " min)") 1263 Qt Gui.QApplication.processEvents()1260 QtWidgets.QApplication.processEvents() 1264 1261 1265 1262 # Change palmrunline accordingly … … 1272 1269 self.setEnabled(False) 1273 1270 1274 text, ret = Qt Gui.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 = '') 1275 1272 1276 1273 if ( ret ): … … 1284 1281 # check if a job exists with the new job name. If not, the new job is created and an empty _p3d file is created. 1285 1282 if ( os.path.isdir(new_input_dir) ): 1286 notify = Qt Gui.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.") 1287 1284 self.setEnabled(True) 1288 1285 return … … 1313 1310 # Make a copy of a job 1314 1311 def copy_job(self): 1315 1312 1316 1313 self.setEnabled(False) 1317 1314 old_job_name = self.list_jobs.currentItem().text() 1318 1315 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) 1321 1317 if ( ret ): 1322 1318 new_job_name = str(text) 1323 1319 else: 1324 1325 1326 1320 self.setEnabled(True) 1321 return 1322 1327 1323 new_input_dir = job_dir + "/" + new_job_name + "/INPUT" 1328 1324 1329 1325 # check if a job exists with the new job name 1330 1326 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 1333 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 1334 1330 else: 1335 1331 os.makedirs(new_input_dir) 1336 1332 1337 1333 # copy and rename input files (if present) … … 1355 1351 # check if user code exists in the new job directory 1356 1352 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 1359 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 1360 1356 else: 1361 1357 os.makedirs(new_user_dir) 1362 1358 1363 1359 … … 1406 1402 # check if a job exists with the new job name 1407 1403 if ( os.path.isdir(new_input_dir) ): 1408 notify = Qt Gui.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.") 1409 1405 self.setEnabled(True) 1410 1406 return … … 1427 1423 1428 1424 new_user_dir = job_dir + "/" + new_job_name + "/USER_CODE" 1429 1425 1430 1426 # check if user code exists in the new job directory 1431 1427 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 1434 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 1435 1431 else: 1436 1432 os.makedirs(new_user_dir) 1437 1433 1438 1434 … … 1463 1459 def openmenujob(self, position): 1464 1460 1465 menu = Qt Gui.QMenu()1466 1467 1468 newAction = Qt Gui.QAction('Create new job', self)1461 menu = QtWidgets.QMenu() 1462 1463 1464 newAction = QtWidgets.QAction('Create new job', self) 1469 1465 newAction.triggered.connect(self.create_new_job) 1470 1466 menu.addAction(newAction) … … 1474 1470 1475 1471 1476 copyAction = Qt Gui.QAction('Copy job', self)1472 copyAction = QtWidgets.QAction('Copy job', self) 1477 1473 copyAction.triggered.connect(self.copy_job) 1478 createAction = Qt Gui.QAction('Create set from job', self)1474 createAction = QtWidgets.QAction('Create set from job', self) 1479 1475 createAction.triggered.connect(self.create_set) 1480 delAction = Qt Gui.QAction('Delete job', self)1476 delAction = QtWidgets.QAction('Delete job', self) 1481 1477 delAction.triggered.connect(self.DeleteJob) 1482 1478 … … 1490 1486 def openmenuinput(self, position): 1491 1487 1492 menu = Qt Gui.QMenu()1488 menu = QtWidgets.QMenu() 1493 1489 1494 1490 selection = self.list_input.selectedItems() … … 1497 1493 1498 1494 1499 openAction = Qt Gui.QAction('Open file(s)', self)1495 openAction = QtWidgets.QAction('Open file(s)', self) 1500 1496 openAction.setStatusTip('Open file(s) in your favorite editor') 1501 1497 openAction.triggered.connect(self.OpenFilesInput) 1502 1498 1503 1499 1504 delAction = Qt Gui.QAction('Delete selected file(s)', self)1500 delAction = QtWidgets.QAction('Delete selected file(s)', self) 1505 1501 delAction.triggered.connect(self.DeleteFilesInput) 1506 1502 … … 1508 1504 menu.addAction(delAction) 1509 1505 1510 delallAction = Qt Gui.QAction('Delete all files', self)1506 delallAction = QtWidgets.QAction('Delete all files', self) 1511 1507 delallAction.triggered.connect(self.DeleteAllFilesInput) 1512 1508 menu.addAction(delallAction) … … 1517 1513 def openmenuuser(self, position): 1518 1514 1519 menu = Qt Gui.QMenu()1515 menu = QtWidgets.QMenu() 1520 1516 1521 1517 selection = self.list_user.selectedItems() … … 1523 1519 if ( len(selection) != 0 ): 1524 1520 1525 openAction = Qt Gui.QAction('Open file(s)', self)1521 openAction = QtWidgets.QAction('Open file(s)', self) 1526 1522 openAction.setStatusTip('Open file(s) in your favorite editor') 1527 1523 openAction.triggered.connect(self.OpenFilesUser) 1528 1524 1529 1525 1530 delAction = Qt Gui.QAction('Delete file(s)', self)1526 delAction = QtWidgets.QAction('Delete file(s)', self) 1531 1527 delAction.triggered.connect(self.DeleteFilesUser) 1532 1528 … … 1534 1530 menu.addAction(delAction) 1535 1531 1536 delallAction = Qt Gui.QAction('Delete all files', self)1532 delallAction = QtWidgets.QAction('Delete all files', self) 1537 1533 delallAction.triggered.connect(self.DeleteAllFilesUser) 1538 1534 menu.addAction(delallAction) … … 1543 1539 def openmenuoutput(self, position): 1544 1540 1545 menu = Qt Gui.QMenu()1541 menu = QtWidgets.QMenu() 1546 1542 1547 1543 selection = self.list_output.selectedItems() … … 1549 1545 if ( len(selection) != 0 ): 1550 1546 1551 openAction = Qt Gui.QAction('Open file(s)', self)1547 openAction = QtWidgets.QAction('Open file(s)', self) 1552 1548 openAction.setStatusTip('Open file(s) in your favorite editor') 1553 1549 openAction.triggered.connect(self.OpenFilesOutput) 1554 1550 1555 delAction = Qt Gui.QAction('Delete file(s)', self)1551 delAction = QtWidgets.QAction('Delete file(s)', self) 1556 1552 delAction.triggered.connect(self.DeleteFilesOutput) 1557 1553 … … 1561 1557 menu.addAction(delAction) 1562 1558 1563 delallAction = Qt Gui.QAction('Delete all files', self)1559 delallAction = QtWidgets.QAction('Delete all files', self) 1564 1560 delallAction.triggered.connect(self.DeleteAllFilesOutput) 1565 1561 menu.addAction(delallAction) … … 1570 1566 def openmenumonitoring(self, position): 1571 1567 1572 menu = Qt Gui.QMenu()1568 menu = QtWidgets.QMenu() 1573 1569 1574 1570 selection = self.list_monitoring.selectedItems() … … 1576 1572 if ( len(selection) != 0 ): 1577 1573 1578 openAction = Qt Gui.QAction('Open file(s)', self)1574 openAction = QtWidgets.QAction('Open file(s)', self) 1579 1575 openAction.setStatusTip('Open file(s) in your favorite editor') 1580 1576 openAction.triggered.connect(self.OpenFilesMonitoring) 1581 1577 1582 delAction = Qt Gui.QAction('Delete file(s)', self)1578 delAction = QtWidgets.QAction('Delete file(s)', self) 1583 1579 delAction.triggered.connect(self.DeleteFilesMonitoring) 1584 1580 … … 1588 1584 menu.addAction(delAction) 1589 1585 1590 delallAction = Qt Gui.QAction('Delete all files', self)1586 delallAction = QtWidgets.QAction('Delete all files', self) 1591 1587 delallAction.triggered.connect(self.DeleteAllFilesMonitoring) 1592 1588 menu.addAction(delallAction) … … 1596 1592 def OpenConfig(self): 1597 1593 1598 config = str(self.group_execution.findChild(Qt Gui.QComboBox, "combo_configuration").currentText())1594 config = str(self.group_execution.findChild(QtWidgets.QComboBox, "combo_configuration").currentText()) 1599 1595 if ( config != "" ): 1600 1596 filename = ".palm.config." + config … … 1659 1655 def DeleteFilesInput(self): 1660 1656 1661 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1662 1663 if status == Qt Gui.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: 1664 1660 1665 1661 sel_job = self.list_jobs.currentItem().text() … … 1669 1665 1670 1666 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() 1672 1668 os.remove(filename) 1673 1669 … … 1677 1673 def DeleteFilesUser(self): 1678 1674 1679 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1680 1681 if status == Qt Gui.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: 1682 1678 1683 1679 sel_job = self.list_jobs.currentItem().text() … … 1687 1683 1688 1684 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() 1690 1686 os.remove(filename) 1691 1687 … … 1695 1691 def DeleteFilesMonitoring(self): 1696 1692 1697 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1698 1699 if status == Qt Gui.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: 1700 1696 1701 1697 sel_job = self.list_jobs.currentItem().text() … … 1705 1701 1706 1702 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() 1708 1704 os.remove(filename) 1709 1705 … … 1713 1709 def DeleteFilesOutput(self): 1714 1710 1715 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete these files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1716 1717 if status == Qt Gui.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: 1718 1714 1719 1715 sel_job = self.list_jobs.currentItem().text() … … 1723 1719 1724 1720 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() 1726 1722 os.remove(filename) 1727 1723 … … 1731 1727 def DeleteAllFilesInput(self): 1732 1728 1733 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1734 1735 if status == Qt Gui.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: 1736 1732 1737 1733 check = self.list_jobs.currentItem() … … 1751 1747 def DeleteAllFilesUser(self): 1752 1748 1753 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1754 1755 if status == Qt Gui.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: 1756 1752 1757 1753 check = self.list_jobs.currentItem() … … 1772 1768 def DeleteAllFilesOutput(self): 1773 1769 1774 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1775 1776 if status == Qt Gui.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: 1777 1773 1778 1774 check = self.list_jobs.currentItem() … … 1793 1789 def DeleteAllFilesMonitoring(self): 1794 1790 1795 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete all files?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1796 1797 if status == Qt Gui.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: 1798 1794 1799 1795 check = self.list_jobs.currentItem() … … 1814 1810 def DeleteJob(self): 1815 1811 1816 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete this job?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1817 1818 if status == Qt Gui.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: 1819 1815 1820 1816 sel_job = self.list_jobs.currentItem().text() … … 1826 1822 1827 1823 # Message box for showing RUN_CONTROL output 1828 class CreateSetBox(Qt Gui.QDialog):1824 class CreateSetBox(QtWidgets.QDialog): 1829 1825 def __init__(self): 1830 1826 … … 1856 1852 1857 1853 # Message box for showing RUN_CONTROL output 1858 class OpenHistoryBox(Qt Gui.QDialog):1854 class OpenHistoryBox(QtWidgets.QDialog): 1859 1855 def __init__(self): 1860 1856 … … 1873 1869 1874 1870 1875 list_jobname = self.findChild(Qt Gui.QListWidget,"list_history")1871 list_jobname = self.findChild(QtWidgets.QListWidget,"list_history") 1876 1872 1877 1873 # Read history entries and append to recent job list … … 1916 1912 def ClearHistory(self): 1917 1913 1918 status = Qt Gui.QMessageBox.question(self,'Delete Confirmation', "Are you sure you want to delete your history?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)1919 1920 if status == Qt Gui.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: 1921 1917 1922 1918 if os.path.exists(palm_dir + "/.palmrungui.history"): … … 1927 1923 1928 1924 if __name__ == "__main__": 1929 app = Qt Gui.QApplication(sys.argv)1925 app = QtWidgets.QApplication(sys.argv) 1930 1926 window = Mainwindow() 1931 1927 window.show()
Note: See TracChangeset
for help on using the changeset viewer.