Changeset 4411 for palm/trunk/SCRIPTS/palmrungui
- Timestamp:
- Feb 18, 2020 2:28:02 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palmrungui
r4405 r4411 25 25 # ----------------- 26 26 # $Id$ 27 # Added new features: individual tag for submitted runs, automatic finding of 28 # configuration, start of palmbuild from GUI 29 # 30 # 4405 2020-02-12 19:11:11Z maronga 27 31 # Major revisions: New layout. Merged with palm job manager (palm_jm). 28 32 # Minor revisions: Misc. bugs fixed. … … 127 131 self.load_jobs() 128 132 133 # look up configuration files and add to combo box 134 135 self.group_execution.findChild(QtGui.QComboBox,"combo_configuration").addItem("") 136 137 for files in os.listdir(palm_dir): 138 if files.startswith(".palm.config"): 139 tmpstring = filter(None,files.split(".palm.config."))[0] 140 self.group_execution.findChild(QtGui.QComboBox,"combo_configuration").addItem(tmpstring) 141 129 142 commandline = self.groupBox.findChild(QtGui.QLineEdit,"commandline") 130 143 commandline.setText("") … … 154 167 155 168 169 156 170 157 171 QtGui.QApplication.processEvents() … … 166 180 167 181 # Check for empty line 168 palmrunline_save = palmrunline ;182 palmrunline_save = palmrunline 169 183 if (userline != ""): 170 184 palmrunline = "%s %s" % (palmrunline,userline) … … 174 188 self.tabWidget.setEnabled(False) 175 189 self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(False) 190 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False) 176 191 self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("wait...") 177 192 self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText("Executing palmrun in xterm...") … … 195 210 196 211 mString = "xterm %s" % (palmrunline) 197 palmrun.start(mString) ;212 palmrun.start(mString) 198 213 199 214 if( palmrun.waitForStarted() is False ): … … 201 216 202 217 # Wait until palmrun has finished or wait for 200 minutes 203 palmrun.waitForFinished(3600000) ;218 palmrun.waitForFinished(3600000) 204 219 205 220 # Jobs has been submitted or aborted. Continuing... … … 207 222 filename = "%s/.palmrungui.history" % (palm_dir) 208 223 tmstamp = strftime("%Y/%m/%d %H:%M") 224 tag = str(self.groupBox.findChild(QtGui.QLineEdit,"line_tag").text()) 209 225 210 226 file = open(filename,"a") 211 s = "%s %s \n" % (tmstamp,history_line)227 s = "%s %s (%s)\n" % (tmstamp,history_line,tag) 212 228 file.write(s) 213 229 file.close() … … 216 232 self.tabWidget.setEnabled(True) 217 233 self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True) 218 self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("Start palmrun") 219 self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline_save); 234 self.groupBox.findChild(QtGui.QPushButton,"button_start").setText("palmrun") 235 self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline_save) 236 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True) 220 237 221 238 # Reload recent jobs … … 223 240 224 241 242 243 # starts xterm with palmbuild commandline 244 ####################################### 245 def startpalmbuild(self): 246 palmbuildline = 'palmbuild -c ' + str(self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").currentText()) 247 248 # Disable the main window 249 self.tabWidget.setEnabled(False) 250 self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(False) 251 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False) 252 self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText("Executing palmbuild in xterm...") 253 254 # Wait until all commands have been executed (ugly) ? 255 #for i in range(0,21): 256 # qApp->processEvents() 257 258 # Start xterm as QProcess 259 palmbuild = QProcess() 260 palmbuild.setProcessChannelMode(QProcess.MergedChannels) # mergedChannels 261 palmbuild.setWorkingDirectory(palm_dir) 262 263 geomet = self.frameGeometry() 264 265 posx = geomet.x()+geomet.width() 266 posy = geomet.y() 267 268 s = " -title \"Executing palmbuild...\" -fa \"Monospace\" -fs 11 -geometry \"80x38+%d+%d\" -e \"" % (posx,posy) 269 palmbuildline = "%s%s;echo -n '--> Press enter to continue...';read yesno\"</dev/stdin" % (s, palmbuildline.replace("\"","\'")) 270 271 mString = "xterm %s" % (palmbuildline) 272 palmbuild.start(mString) 273 274 if( palmbuild.waitForStarted() is False ): 275 return 276 277 # Wait until palmbuild has finished or wait for 200 minutes 278 palmbuild.waitForFinished(3600000) 279 280 281 282 # Enable main window again 283 self.tabWidget.setEnabled(True) 284 self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True) 285 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True) 286 287 # Reload recent jobs 288 self.recent_jobs(50) 289 225 290 # loads recent jobs 226 291 ###################################### … … 235 300 history = file.readlines() 236 301 tmphistory = list() 237 file.close(); 238 j = 0; 302 tmptag = list() 303 file.close() 304 j = 0 239 305 240 306 list_jobname = self.group_history.findChild(QtGui.QListWidget,"list_jobname") … … 247 313 timestamp = history[i][:16] 248 314 listitem = history[i][17:len(history[i])-1] 315 tagitem = listitem 249 316 matchitems = list_jobname.findItems(listitem, QtCore.Qt.MatchExactly) 250 317 … … 252 319 listitem = filter(None,listitem.split(" -r"))[1] 253 320 listitem = filter(None,listitem.split(" -"))[0] 254 listitem = listitem.replace(" ",""); 255 list_jobname.addItem(listitem); 256 s = "%s (%s)" % (listitem,timestamp) 257 tmphistory.append(s); 321 listitem = listitem.replace(" ","") 322 list_jobname.addItem(listitem) 323 s = "%s: %s" % (timestamp,listitem) 324 tmphistory.append(s) 325 326 327 tagitem = filter(None,tagitem.split(" ("))[1] 328 tagitem = tagitem.replace(")","") 329 if ( len(tagitem) == 0 ): 330 s = "Tag: empty" 331 else: 332 s = "Tag: %s" % (tagitem) 333 tmptag.append(s) 258 334 count = count +1 335 259 336 j = j+1 260 337 … … 264 341 265 342 # Send to list 266 list_jobname.clear() ;343 list_jobname.clear() 267 344 268 345 i=0 269 346 while i<len(tmphistory): 270 list_jobname.addItem(tmphistory[i]); 347 list_jobname.addItem(tmphistory[i]) 348 list_jobname.item(i).setToolTip(tmptag[i]) 271 349 i = i+1 272 350 … … 291 369 filename = str(list_jobname.currentItem().text()) 292 370 293 timestamp = filename[ len(filename)-17:][:16]294 jobname = filename[ :len(filename) - 19];295 371 timestamp = filename[:16] 372 jobname = filename[18:] 373 296 374 itemint = list_jobname.currentRow() 297 375 … … 301 379 302 380 # Set selected item to jobname 303 list_jobname.item(itemint).setSelected(True) ;381 list_jobname.item(itemint).setSelected(True) 304 382 305 383 # Set selected item to jobname in "available jobs" list 306 384 item2int = self.list_jobs.findItems(jobname,QtCore.Qt.MatchCaseSensitive) 307 self.list_jobs.setCurrentItem(item2int[0]) 385 386 if ( item2int != [] ): 387 self.list_jobs.setCurrentItem(item2int[0]) 308 388 self.update_input() 389 309 390 310 391 fileDir = "%s/.palmrungui.history" % (palm_dir) … … 312 393 history = file.readlines() 313 394 tmphistory = list() 314 file.close() ;395 file.close() 315 396 316 397 i = len(history) … … 319 400 listitem = filter(None,listitem.split(" -r"))[1] 320 401 listitem = filter(None,listitem.split(" -"))[0] 321 listitem = listitem.replace(" ","") ;402 listitem = listitem.replace(" ","") 322 403 323 404 # Select command line with correct timestamp and jobname … … 326 407 palmrunline = palmrunline[17:] 327 408 palmrunline = palmrunline[:len(palmrunline)-1] 328 self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline); 329 self.setup_gui(palmrunline); 330 self.list_jobname.item(itemint).setSelected(True); 409 palmrunline = filter(None,palmrunline.split("("))[0] 410 self.groupBox.findChild(QtGui.QLineEdit,"commandline").setText(palmrunline) 411 412 413 tag = history[i-1].split('\n')[0] 414 tag = filter(None,tag.split("("))[1] 415 tag = tag.replace(")","") 416 417 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setText(tag) 418 self.setup_gui(palmrunline) 419 self.list_jobname.item(itemint).setSelected(True) 331 420 332 421 return … … 389 478 self.groupBox.findChild(QtGui.QPushButton,"button_start").setEnabled(True) 390 479 self.menuBar.findChild(QtGui.QMenu,"menuStart").actions()[3].setEnabled(True) 480 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True) 391 481 392 482 elif ( param[0] == ""): … … 396 486 self.menuBar.findChild(QtGui.QMenu,"menuStart").actions()[3].setEnabled(False) 397 487 self.group_advanced.setEnabled(False) 488 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True) 398 489 self.delete_commandline("r") 399 490 self.change_commandline("a","remove") … … 504 595 self.button_start.setEnabled(True) 505 596 self.action_save.setEnabled(True) 597 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True) 506 598 507 599 # Change in any other parameter … … 528 620 ################################################################################### 529 621 def change_lineinput(self): 530 if ( self.sender() == self.group_execution.findChild(QtGui.QLineEdit, "line_host") ): 531 tmptext = self.group_execution.findChild(QtGui.QLineEdit,"line_host").text() 532 self.change_commandline("c",tmptext) 622 if ( self.sender() == self.group_execution.findChild(QtGui.QComboBox, "combo_configuration") ): 623 tmptext = self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").currentText() 624 if tmptext.isEmpty(): 625 self.change_commandline("c"," ") 626 self.group_execution.findChild(QtGui.QPushButton,'button_palmbuild').setEnabled(False) 627 else: 628 self.change_commandline("c",tmptext) 629 self.group_execution.findChild(QtGui.QPushButton,'button_palmbuild').setEnabled(True) 533 630 534 631 elif ( self.sender() == self.group_execution.findChild(QtGui.QLineEdit,"line_q")): … … 819 916 820 917 elif ( parameter == "c"): 821 self.group_execution.findChild(QtGui.QLineEdit,"line_host").setText(options) 822 918 tmpindex = self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").findText(options,QtCore.Qt.MatchExactly) 919 if tmpindex != -1: 920 self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").setCurrentIndex(tmpindex) 921 else: 922 self.group_execution.findChild(QtGui.QComboBox, "combo_configuration").setCurrentIndex(0) 823 923 elif ( parameter == "q"): 824 924 self.group_execution.findChild(QtGui.QLineEdit,"line_q").setText(options) … … 975 1075 self.group_advanced.setEnabled(False) 976 1076 self.check_advanced.setEnabled(False) 1077 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(False) 977 1078 978 1079 else: … … 982 1083 self.group_execution.findChild(QtGui.QComboBox, "drop_job").setEnabled(True) 983 1084 self.group_advanced.setEnabled(True) 1085 self.groupBox.findChild(QtGui.QLineEdit,"line_tag").setEnabled(True) 984 1086 985 1087 self.tabWidget.setCurrentIndex(0) … … 1053 1155 1054 1156 list_of_files = os.listdir(job_dir) 1055 1157 1158 1056 1159 for i in range(0,len(list_of_files)): 1057 1160 tmp_file = job_dir + "/" + list_of_files[i] 1058 1161 1059 1162 if ( os.path.isdir(tmp_file) ): 1060 self.list_jobs.addItem(str(list_of_files[i])) 1163 self.list_jobs.addItem(str(list_of_files[i])) 1164 1061 1165 1062 1166 … … 1310 1414 selection = self.list_output.selectedItems() 1311 1415 1312 print("test")1313 1416 if ( len(selection) != 0 ): 1314 1417
Note: See TracChangeset
for help on using the changeset viewer.