--- a/Tools/TRPreviewer.py Sun Mar 30 22:00:14 2014 +0200 +++ b/Tools/TRPreviewer.py Thu Apr 03 23:05:31 2014 +0200 @@ -55,11 +55,10 @@ Preferences.getUI("StyleSheet")) self.resize(QSize(800, 600).expandedTo(self.minimumSizeHint())) - self.setAttribute(Qt.WA_DeleteOnClose) self.statusBar() self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) - self.setWindowTitle(self.trUtf8("Translations Previewer")) + self.setWindowTitle(self.tr("Translations Previewer")) self.cw = QWidget(self) self.cw.setObjectName("qt_central_widget") @@ -75,14 +74,14 @@ self.languageLayout.setObjectName("languageLayout") self.languageLabel = QLabel( - self.trUtf8("Select language file"), self.cw) + self.tr("Select language file"), self.cw) self.languageLabel.setObjectName("languageLabel") self.languageLayout.addWidget(self.languageLabel) self.languageCombo = QComboBox(self.cw) self.languageCombo.setObjectName("languageCombo") self.languageCombo.setEditable(False) - self.languageCombo.setToolTip(self.trUtf8("Select language file")) + self.languageCombo.setToolTip(self.tr("Select language file")) self.languageCombo.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred) self.languageLayout.addWidget(self.languageCombo) @@ -159,54 +158,54 @@ """ self.openUIAct = QAction( UI.PixmapCache.getIcon("openUI.png"), - self.trUtf8('&Open UI Files...'), self) - self.openUIAct.setStatusTip(self.trUtf8('Open UI files for display')) - self.openUIAct.setWhatsThis(self.trUtf8( + self.tr('&Open UI Files...'), self) + self.openUIAct.setStatusTip(self.tr('Open UI files for display')) + self.openUIAct.setWhatsThis(self.tr( """<b>Open UI Files</b>""" """<p>This opens some UI files for display.</p>""" )) - self.openUIAct.triggered[()].connect(self.__openWidget) + self.openUIAct.triggered.connect(self.__openWidget) self.openQMAct = QAction( UI.PixmapCache.getIcon("openQM.png"), - self.trUtf8('Open &Translation Files...'), self) - self.openQMAct.setStatusTip(self.trUtf8( + self.tr('Open &Translation Files...'), self) + self.openQMAct.setStatusTip(self.tr( 'Open Translation files for display')) - self.openQMAct.setWhatsThis(self.trUtf8( + self.openQMAct.setWhatsThis(self.tr( """<b>Open Translation Files</b>""" """<p>This opens some translation files for display.</p>""" )) - self.openQMAct.triggered[()].connect(self.__openTranslation) + self.openQMAct.triggered.connect(self.__openTranslation) self.reloadAct = QAction( UI.PixmapCache.getIcon("reload.png"), - self.trUtf8('&Reload Translations'), self) - self.reloadAct.setStatusTip(self.trUtf8( + self.tr('&Reload Translations'), self) + self.reloadAct.setStatusTip(self.tr( 'Reload the loaded translations')) - self.reloadAct.setWhatsThis(self.trUtf8( + self.reloadAct.setWhatsThis(self.tr( """<b>Reload Translations</b>""" """<p>This reloads the translations for the loaded""" """ languages.</p>""" )) - self.reloadAct.triggered[()].connect(self.translations.reload) + self.reloadAct.triggered.connect(self.translations.reload) self.exitAct = QAction( - UI.PixmapCache.getIcon("exit.png"), self.trUtf8('&Quit'), self) + UI.PixmapCache.getIcon("exit.png"), self.tr('&Quit'), self) self.exitAct.setShortcut(QKeySequence( - self.trUtf8("Ctrl+Q", "File|Quit"))) - self.exitAct.setStatusTip(self.trUtf8('Quit the application')) - self.exitAct.setWhatsThis(self.trUtf8( + self.tr("Ctrl+Q", "File|Quit"))) + self.exitAct.setStatusTip(self.tr('Quit the application')) + self.exitAct.setWhatsThis(self.tr( """<b>Quit</b>""" """<p>Quit the application.</p>""" )) - self.exitAct.triggered[()].connect(qApp.closeAllWindows) + self.exitAct.triggered.connect(qApp.closeAllWindows) self.whatsThisAct = QAction( UI.PixmapCache.getIcon("whatsThis.png"), - self.trUtf8('&What\'s This?'), self) - self.whatsThisAct.setShortcut(QKeySequence(self.trUtf8("Shift+F1"))) - self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) - self.whatsThisAct.setWhatsThis(self.trUtf8( + self.tr('&What\'s This?'), self) + self.whatsThisAct.setShortcut(QKeySequence(self.tr("Shift+F1"))) + self.whatsThisAct.setStatusTip(self.tr('Context sensitive help')) + self.whatsThisAct.setWhatsThis(self.tr( """<b>Display context sensitive help</b>""" """<p>In What's This? mode, the mouse cursor shows an arrow""" """ with a question mark, and you can click on the interface""" @@ -214,62 +213,62 @@ """ how to use them. In dialogs, this feature can be accessed""" """ using the context help button in the titlebar.</p>""" )) - self.whatsThisAct.triggered[()].connect(self.__whatsThis) + self.whatsThisAct.triggered.connect(self.__whatsThis) - self.aboutAct = QAction(self.trUtf8('&About'), self) - self.aboutAct.setStatusTip(self.trUtf8( + self.aboutAct = QAction(self.tr('&About'), self) + self.aboutAct.setStatusTip(self.tr( 'Display information about this software')) - self.aboutAct.setWhatsThis(self.trUtf8( + self.aboutAct.setWhatsThis(self.tr( """<b>About</b>""" """<p>Display some information about this software.</p>""" )) - self.aboutAct.triggered[()].connect(self.__about) + self.aboutAct.triggered.connect(self.__about) - self.aboutQtAct = QAction(self.trUtf8('About &Qt'), self) + self.aboutQtAct = QAction(self.tr('About &Qt'), self) self.aboutQtAct.setStatusTip( - self.trUtf8('Display information about the Qt toolkit')) - self.aboutQtAct.setWhatsThis(self.trUtf8( + self.tr('Display information about the Qt toolkit')) + self.aboutQtAct.setWhatsThis(self.tr( """<b>About Qt</b>""" """<p>Display some information about the Qt toolkit.</p>""" )) - self.aboutQtAct.triggered[()].connect(self.__aboutQt) + self.aboutQtAct.triggered.connect(self.__aboutQt) - self.tileAct = QAction(self.trUtf8('&Tile'), self) - self.tileAct.setStatusTip(self.trUtf8('Tile the windows')) - self.tileAct.setWhatsThis(self.trUtf8( + self.tileAct = QAction(self.tr('&Tile'), self) + self.tileAct.setStatusTip(self.tr('Tile the windows')) + self.tileAct.setWhatsThis(self.tr( """<b>Tile the windows</b>""" """<p>Rearrange and resize the windows so that they are""" """ tiled.</p>""" )) - self.tileAct.triggered[()].connect(self.preview.tileSubWindows) + self.tileAct.triggered.connect(self.preview.tileSubWindows) - self.cascadeAct = QAction(self.trUtf8('&Cascade'), self) - self.cascadeAct.setStatusTip(self.trUtf8('Cascade the windows')) - self.cascadeAct.setWhatsThis(self.trUtf8( + self.cascadeAct = QAction(self.tr('&Cascade'), self) + self.cascadeAct.setStatusTip(self.tr('Cascade the windows')) + self.cascadeAct.setWhatsThis(self.tr( """<b>Cascade the windows</b>""" """<p>Rearrange and resize the windows so that they are""" """ cascaded.</p>""" )) - self.cascadeAct.triggered[()].connect(self.preview.cascadeSubWindows) + self.cascadeAct.triggered.connect(self.preview.cascadeSubWindows) self.closeAct = QAction( - UI.PixmapCache.getIcon("close.png"), self.trUtf8('&Close'), self) - self.closeAct.setShortcut(QKeySequence(self.trUtf8( + UI.PixmapCache.getIcon("close.png"), self.tr('&Close'), self) + self.closeAct.setShortcut(QKeySequence(self.tr( "Ctrl+W", "File|Close"))) - self.closeAct.setStatusTip(self.trUtf8('Close the current window')) - self.closeAct.setWhatsThis(self.trUtf8( + self.closeAct.setStatusTip(self.tr('Close the current window')) + self.closeAct.setWhatsThis(self.tr( """<b>Close Window</b>""" """<p>Close the current window.</p>""" )) - self.closeAct.triggered[()].connect(self.preview.closeWidget) + self.closeAct.triggered.connect(self.preview.closeWidget) - self.closeAllAct = QAction(self.trUtf8('Clos&e All'), self) - self.closeAllAct.setStatusTip(self.trUtf8('Close all windows')) - self.closeAllAct.setWhatsThis(self.trUtf8( + self.closeAllAct = QAction(self.tr('Clos&e All'), self) + self.closeAllAct.setStatusTip(self.tr('Close all windows')) + self.closeAllAct.setWhatsThis(self.tr( """<b>Close All Windows</b>""" """<p>Close all windows.</p>""" )) - self.closeAllAct.triggered[()].connect(self.preview.closeAllWidgets) + self.closeAllAct.triggered.connect(self.preview.closeAllWidgets) def __initMenus(self): """ @@ -277,7 +276,7 @@ """ mb = self.menuBar() - menu = mb.addMenu(self.trUtf8('&File')) + menu = mb.addMenu(self.tr('&File')) menu.setTearOffEnabled(True) menu.addAction(self.openUIAct) menu.addAction(self.openQMAct) @@ -288,14 +287,14 @@ menu.addSeparator() menu.addAction(self.exitAct) - self.windowMenu = mb.addMenu(self.trUtf8('&Window')) + self.windowMenu = mb.addMenu(self.tr('&Window')) self.windowMenu.setTearOffEnabled(True) self.windowMenu.aboutToShow.connect(self.__showWindowMenu) self.windowMenu.triggered.connect(self.preview.toggleSelectedWidget) mb.addSeparator() - menu = mb.addMenu(self.trUtf8('&Help')) + menu = mb.addMenu(self.tr('&Help')) menu.setTearOffEnabled(True) menu.addAction(self.aboutAct) menu.addAction(self.aboutQtAct) @@ -306,7 +305,7 @@ """ Private method to create the toolbars. """ - filetb = self.addToolBar(self.trUtf8("File")) + filetb = self.addToolBar(self.tr("File")) filetb.setIconSize(UI.Config.ToolBarIconSize) filetb.addAction(self.openUIAct) filetb.addAction(self.openQMAct) @@ -316,7 +315,7 @@ filetb.addSeparator() filetb.addAction(self.exitAct) - helptb = self.addToolBar(self.trUtf8("Help")) + helptb = self.addToolBar(self.tr("Help")) helptb.setIconSize(UI.Config.ToolBarIconSize) helptb.addAction(self.whatsThisAct) @@ -352,8 +351,8 @@ """ E5MessageBox.about( self, - self.trUtf8("TR Previewer"), - self.trUtf8( + self.tr("TR Previewer"), + self.tr( """<h3> About TR Previewer </h3>""" """<p>The TR Previewer loads and displays Qt User-Interface""" """ files and translation files and shows dialogs for a""" @@ -365,7 +364,7 @@ """ Private slot to show info about Qt. """ - E5MessageBox.aboutQt(self, self.trUtf8("TR Previewer")) + E5MessageBox.aboutQt(self, self.tr("TR Previewer")) def __openWidget(self): """ @@ -373,9 +372,9 @@ """ fileNameList = E5FileDialog.getOpenFileNames( None, - self.trUtf8("Select UI files"), + self.tr("Select UI files"), "", - self.trUtf8("Qt User-Interface Files (*.ui)")) + self.tr("Qt User-Interface Files (*.ui)")) for fileName in fileNameList: self.preview.loadWidget(fileName) @@ -388,9 +387,9 @@ """ fileNameList = E5FileDialog.getOpenFileNames( None, - self.trUtf8("Select translation files"), + self.tr("Select translation files"), "", - self.trUtf8("Qt Translation Files (*.qm)")) + self.tr("Qt Translation Files (*.qm)")) first = True for fileName in fileNameList: @@ -479,8 +478,8 @@ if ntr.name is None: E5MessageBox.warning( self.parent(), - self.trUtf8("Set Translator"), - self.trUtf8( + self.tr("Set Translator"), + self.tr( """<p>The translation filename <b>{0}</b>""" """ is invalid.</p>""").format(fileName)) return @@ -509,8 +508,8 @@ if trans is None: E5MessageBox.warning( self.parent(), - self.trUtf8("Set Translator"), - self.trUtf8( + self.tr("Set Translator"), + self.tr( """<p>The translator <b>{0}</b> is not known.</p>""") .format(name)) return @@ -652,9 +651,9 @@ E5MessageBox.warning( self.parent(), - self.trUtf8("Load Translator"), - self.trUtf8("""<p>The translation file <b>{0}</b> could""" - """ not be loaded.</p>""").format(transFileName)) + self.tr("Load Translator"), + self.tr("""<p>The translation file <b>{0}</b> could""" + """ not be loaded.</p>""").format(transFileName)) return None def hasTranslations(self): @@ -682,7 +681,6 @@ if name: self.setObjectName(name) self.setWindowTitle(name) - self.setAttribute(Qt.WA_DeleteOnClose) self.__widget = None self.__uiFileName = uiFileName @@ -726,8 +724,8 @@ if not self.__widget: E5MessageBox.warning( self, - self.trUtf8("Load UI File"), - self.trUtf8( + self.tr("Load UI File"), + self.tr( """<p>The file <b>{0}</b> could not be loaded.</p>""") .format(self.__uiFileName)) self.__valid = False @@ -782,8 +780,8 @@ if not name: E5MessageBox.warning( self, - self.trUtf8("Load UI File"), - self.trUtf8( + self.tr("Load UI File"), + self.tr( """<p>The file <b>{0}</b> could not be loaded.</p>""") .format(uiFileName)) return