Tools/TRPreviewer.py

changeset 3020
542e97d4ecb3
parent 2997
7f0ef975da9e
child 3030
4a0a82ddd9d2
equal deleted inserted replaced
3019:7912530a33e2 3020:542e97d4ecb3
342 342
343 def __about(self): 343 def __about(self):
344 """ 344 """
345 Private slot to show the about information. 345 Private slot to show the about information.
346 """ 346 """
347 E5MessageBox.about(self, self.trUtf8("TR Previewer"), self.trUtf8( 347 E5MessageBox.about(
348 """<h3> About TR Previewer </h3>""" 348 self,
349 """<p>The TR Previewer loads and displays Qt User-Interface""" 349 self.trUtf8("TR Previewer"),
350 """ files and translation files and shows dialogs for a""" 350 self.trUtf8(
351 """ selected language.</p>""" 351 """<h3> About TR Previewer </h3>"""
352 )) 352 """<p>The TR Previewer loads and displays Qt User-Interface"""
353 """ files and translation files and shows dialogs for a"""
354 """ selected language.</p>"""
355 )
356 )
353 357
354 def __aboutQt(self): 358 def __aboutQt(self):
355 """ 359 """
356 Private slot to show info about Qt. 360 Private slot to show info about Qt.
357 """ 361 """
465 if not self.__haveFileName(fileName): 469 if not self.__haveFileName(fileName):
466 ntr = Translation() 470 ntr = Translation()
467 ntr.fileName = fileName 471 ntr.fileName = fileName
468 ntr.name = self.__uniqueName(fileName) 472 ntr.name = self.__uniqueName(fileName)
469 if ntr.name is None: 473 if ntr.name is None:
470 E5MessageBox.warning(self.parent(), 474 E5MessageBox.warning(
475 self.parent(),
471 self.trUtf8("Set Translator"), 476 self.trUtf8("Set Translator"),
472 self.trUtf8("""<p>The translation filename <b>{0}</b>""" 477 self.trUtf8("""<p>The translation filename <b>{0}</b>"""
473 """ is invalid.</p>""").format(fileName)) 478 """ is invalid.</p>""").format(fileName))
474 return 479 return
475 480
493 nTranslator = None 498 nTranslator = None
494 499
495 if name != noTranslationName: 500 if name != noTranslationName:
496 trans = self.__findName(name) 501 trans = self.__findName(name)
497 if trans is None: 502 if trans is None:
498 E5MessageBox.warning(self.parent(), 503 E5MessageBox.warning(
504 self.parent(),
499 self.trUtf8("Set Translator"), 505 self.trUtf8("Set Translator"),
500 self.trUtf8( 506 self.trUtf8(
501 """<p>The translator <b>{0}</b> is not known.</p>""")\ 507 """<p>The translator <b>{0}</b> is not known.</p>""")\
502 .format(name)) 508 .format(name))
503 return 509 return
635 """ 641 """
636 tr = QTranslator() 642 tr = QTranslator()
637 if tr.load(transFileName): 643 if tr.load(transFileName):
638 return tr 644 return tr
639 645
640 E5MessageBox.warning(self.parent(), 646 E5MessageBox.warning(
647 self.parent(),
641 self.trUtf8("Load Translator"), 648 self.trUtf8("Load Translator"),
642 self.trUtf8("""<p>The translation file <b>{0}</b> could""" 649 self.trUtf8("""<p>The translation file <b>{0}</b> could"""
643 """ not be loaded.</p>""").format(transFileName)) 650 """ not be loaded.</p>""").format(transFileName))
644 return None 651 return None
645 652
708 self.__widget = uic.loadUi(self.__uiFileName) 715 self.__widget = uic.loadUi(self.__uiFileName)
709 except: 716 except:
710 pass 717 pass
711 718
712 if not self.__widget: 719 if not self.__widget:
713 E5MessageBox.warning(self, 720 E5MessageBox.warning(
721 self,
714 self.trUtf8("Load UI File"), 722 self.trUtf8("Load UI File"),
715 self.trUtf8( 723 self.trUtf8(
716 """<p>The file <b>{0}</b> could not be loaded.</p>""")\ 724 """<p>The file <b>{0}</b> could not be loaded.</p>""")\
717 .format(self.__uiFileName)) 725 .format(self.__uiFileName))
718 self.__valid = False 726 self.__valid = False
763 """ 771 """
764 wview = self.__findWidget(uiFileName) 772 wview = self.__findWidget(uiFileName)
765 if wview is None: 773 if wview is None:
766 name = os.path.basename(uiFileName) 774 name = os.path.basename(uiFileName)
767 if not name: 775 if not name:
768 E5MessageBox.warning(self, 776 E5MessageBox.warning(
777 self,
769 self.trUtf8("Load UI File"), 778 self.trUtf8("Load UI File"),
770 self.trUtf8( 779 self.trUtf8(
771 """<p>The file <b>{0}</b> could not be loaded.</p>""")\ 780 """<p>The file <b>{0}</b> could not be loaded.</p>""")\
772 .format(uiFileName)) 781 .format(uiFileName))
773 return 782 return

eric ide

mercurial