MultiProject/MultiProject.py

changeset 3020
542e97d4ecb3
parent 2992
dbdf27746da5
child 3022
57179e4cdadd
equal deleted inserted replaced
3019:7912530a33e2 3020:542e97d4ecb3
203 f.close() 203 f.close()
204 if reader.hasError(): 204 if reader.hasError():
205 return False 205 return False
206 else: 206 else:
207 QApplication.restoreOverrideCursor() 207 QApplication.restoreOverrideCursor()
208 E5MessageBox.critical(self.ui, 208 E5MessageBox.critical(
209 self.ui,
209 self.trUtf8("Read multiproject file"), 210 self.trUtf8("Read multiproject file"),
210 self.trUtf8( 211 self.trUtf8(
211 "<p>The multiproject file <b>{0}</b> could not be" 212 "<p>The multiproject file <b>{0}</b> could not be"
212 " read.</p>").format(fn)) 213 " read.</p>").format(fn))
213 return False 214 return False
245 MultiProjectWriter( 246 MultiProjectWriter(
246 f, self, os.path.splitext(os.path.basename(fn))[0])\ 247 f, self, os.path.splitext(os.path.basename(fn))[0])\
247 .writeXML() 248 .writeXML()
248 res = True 249 res = True
249 else: 250 else:
250 E5MessageBox.critical(self.ui, 251 E5MessageBox.critical(
252 self.ui,
251 self.trUtf8("Save multiproject file"), 253 self.trUtf8("Save multiproject file"),
252 self.trUtf8("<p>The multiproject file <b>{0}</b> could not be " 254 self.trUtf8("<p>The multiproject file <b>{0}</b> could not be "
253 "written.</p>").format(fn)) 255 "written.</p>").format(fn))
254 res = False 256 res = False
255 257
486 if not ext: 488 if not ext:
487 ex = selectedFilter.split("(*")[1].split(")")[0] 489 ex = selectedFilter.split("(*")[1].split(")")[0]
488 if ex: 490 if ex:
489 fn += ex 491 fn += ex
490 if QFileInfo(fn).exists(): 492 if QFileInfo(fn).exists():
491 res = E5MessageBox.yesNo(self.parent(), 493 res = E5MessageBox.yesNo(
494 self.parent(),
492 self.trUtf8("Save File"), 495 self.trUtf8("Save File"),
493 self.trUtf8("<p>The file <b>{0}</b> already exists." 496 self.trUtf8("<p>The file <b>{0}</b> already exists."
494 " Overwrite it?</p>").format(fn), 497 " Overwrite it?</p>").format(fn),
495 icon=E5MessageBox.Warning) 498 icon=E5MessageBox.Warning)
496 if not res: 499 if not res:
510 Public method to check the dirty status and open a message window. 513 Public method to check the dirty status and open a message window.
511 514
512 @return flag indicating whether this operation was successful (boolean) 515 @return flag indicating whether this operation was successful (boolean)
513 """ 516 """
514 if self.isDirty(): 517 if self.isDirty():
515 res = E5MessageBox.okToClearData(self.parent(), 518 res = E5MessageBox.okToClearData(
519 self.parent(),
516 self.trUtf8("Close Multiproject"), 520 self.trUtf8("Close Multiproject"),
517 self.trUtf8("The current multiproject has unsaved changes."), 521 self.trUtf8("The current multiproject has unsaved changes."),
518 self.saveMultiProject) 522 self.saveMultiProject)
519 if res: 523 if res:
520 self.setDirty(False) 524 self.setDirty(False)

eric ide

mercurial