eric7/QScintilla/Shell.py

branch
eric7
changeset 9153
506e35e424d5
parent 9152
8a68afaf1ba2
equal deleted inserted replaced
9152:8a68afaf1ba2 9153:506e35e424d5
2408 if fpath.exists(): 2408 if fpath.exists():
2409 res = EricMessageBox.yesNo( 2409 res = EricMessageBox.yesNo(
2410 self, 2410 self,
2411 self.tr("Save Shell Contents"), 2411 self.tr("Save Shell Contents"),
2412 self.tr("<p>The file <b>{0}</b> already exists." 2412 self.tr("<p>The file <b>{0}</b> already exists."
2413 " Overwrite it?</p>").format(str(fpath)), 2413 " Overwrite it?</p>").format(fpath),
2414 icon=EricMessageBox.Warning) 2414 icon=EricMessageBox.Warning)
2415 if not res: 2415 if not res:
2416 return 2416 return
2417 try: 2417 try:
2418 with fpath.open("w", encoding="utf-8") as f: 2418 with fpath.open("w", encoding="utf-8") as f:
2421 EricMessageBox.critical( 2421 EricMessageBox.critical(
2422 self, 2422 self,
2423 self.tr("Save Shell Contents"), 2423 self.tr("Save Shell Contents"),
2424 self.tr('<p>The file <b>{0}</b> could not be saved.<br/>' 2424 self.tr('<p>The file <b>{0}</b> could not be saved.<br/>'
2425 'Reason: {1}</p>') 2425 'Reason: {1}</p>')
2426 .format(str(fpath), str(why))) 2426 .format(fpath, str(why)))
2427 2427
2428 ################################################################# 2428 #################################################################
2429 ## Project Support 2429 ## Project Support
2430 ################################################################# 2430 #################################################################
2431 2431

eric ide

mercurial