Helpviewer/History/HistoryManager.py

changeset 3020
542e97d4ecb3
parent 3002
6ffc581f00f1
child 3034
7ce719013078
child 3058
0a02c433f52d
equal deleted inserted replaced
3019:7912530a33e2 3020:542e97d4ecb3
380 """ 380 """
381 historyFile = QFile(self.getFileName()) 381 historyFile = QFile(self.getFileName())
382 if not historyFile.exists(): 382 if not historyFile.exists():
383 return 383 return
384 if not historyFile.open(QIODevice.ReadOnly): 384 if not historyFile.open(QIODevice.ReadOnly):
385 E5MessageBox.warning(None, 385 E5MessageBox.warning(
386 None,
386 self.trUtf8("Loading History"), 387 self.trUtf8("Loading History"),
387 self.trUtf8( 388 self.trUtf8(
388 """<p>Unable to open history file <b>{0}</b>.<br/>""" 389 """<p>Unable to open history file <b>{0}</b>.<br/>"""
389 """Reason: {1}</p>""")\ 390 """Reason: {1}</p>""")\
390 .format(historyFile.fileName, historyFile.errorString())) 391 .format(historyFile.fileName, historyFile.errorString()))
459 else: 460 else:
460 f = historyFile 461 f = historyFile
461 opened = f.open(QIODevice.Append) 462 opened = f.open(QIODevice.Append)
462 463
463 if not opened: 464 if not opened:
464 E5MessageBox.warning(None, 465 E5MessageBox.warning(
466 None,
465 self.trUtf8("Saving History"), 467 self.trUtf8("Saving History"),
466 self.trUtf8( 468 self.trUtf8(
467 """<p>Unable to open history file <b>{0}</b>.<br/>""" 469 """<p>Unable to open history file <b>{0}</b>.<br/>"""
468 """Reason: {1}</p>""")\ 470 """Reason: {1}</p>""")\
469 .format(f.fileName(), f.errorString())) 471 .format(f.fileName(), f.errorString()))
481 f.write(data) 483 f.write(data)
482 484
483 f.close() 485 f.close()
484 if saveAll: 486 if saveAll:
485 if historyFile.exists() and not historyFile.remove(): 487 if historyFile.exists() and not historyFile.remove():
486 E5MessageBox.warning(None, 488 E5MessageBox.warning(
489 None,
487 self.trUtf8("Saving History"), 490 self.trUtf8("Saving History"),
488 self.trUtf8( 491 self.trUtf8(
489 """<p>Error removing old history file <b>{0}</b>.""" 492 """<p>Error removing old history file <b>{0}</b>."""
490 """<br/>Reason: {1}</p>""")\ 493 """<br/>Reason: {1}</p>""")\
491 .format(historyFile.fileName(), 494 .format(historyFile.fileName(),
492 historyFile.errorString())) 495 historyFile.errorString()))
493 if not f.copy(historyFile.fileName()): 496 if not f.copy(historyFile.fileName()):
494 E5MessageBox.warning(None, 497 E5MessageBox.warning(
498 None,
495 self.trUtf8("Saving History"), 499 self.trUtf8("Saving History"),
496 self.trUtf8( 500 self.trUtf8(
497 """<p>Error moving new history file over old one """ 501 """<p>Error moving new history file over old one """
498 """(<b>{0}</b>).<br/>Reason: {1}</p>""")\ 502 """(<b>{0}</b>).<br/>Reason: {1}</p>""")\
499 .format(historyFile.fileName(), f.errorString())) 503 .format(historyFile.fileName(), f.errorString()))

eric ide

mercurial