--- a/Tools/UIPreviewer.py Fri Jan 10 19:30:21 2014 +0100 +++ b/Tools/UIPreviewer.py Sat Jan 11 11:55:33 2014 +0100 @@ -52,7 +52,7 @@ self.statusBar() self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) - self.setWindowTitle(self.trUtf8("UI Previewer")) + self.setWindowTitle(self.tr("UI Previewer")) self.cw = QWidget(self) self.cw.setObjectName("centralWidget") @@ -67,14 +67,14 @@ self.styleLayout.setSpacing(6) self.styleLayout.setObjectName("styleLayout") - self.styleLabel = QLabel(self.trUtf8("Select GUI Theme"), self.cw) + self.styleLabel = QLabel(self.tr("Select GUI Theme"), self.cw) self.styleLabel.setObjectName("styleLabel") self.styleLayout.addWidget(self.styleLabel) self.styleCombo = QComboBox(self.cw) self.styleCombo.setObjectName("styleCombo") self.styleCombo.setEditable(False) - self.styleCombo.setToolTip(self.trUtf8("Select the GUI Theme")) + self.styleCombo.setToolTip(self.tr("Select the GUI Theme")) self.styleLayout.addWidget(self.styleCombo) self.styleCombo.addItems(list(QStyleFactory().keys())) currentStyle = Preferences.Prefs.settings.value('UIPreviewer/style') @@ -126,11 +126,11 @@ """ self.openAct = QAction( UI.PixmapCache.getIcon("openUI.png"), - self.trUtf8('&Open File'), self) + self.tr('&Open File'), self) self.openAct.setShortcut( - QKeySequence(self.trUtf8("Ctrl+O", "File|Open"))) - self.openAct.setStatusTip(self.trUtf8('Open a UI file for display')) - self.openAct.setWhatsThis(self.trUtf8( + QKeySequence(self.tr("Ctrl+O", "File|Open"))) + self.openAct.setStatusTip(self.tr('Open a UI file for display')) + self.openAct.setWhatsThis(self.tr( """<b>Open File</b>""" """<p>This opens a new UI file for display.</p>""" )) @@ -138,11 +138,11 @@ self.printAct = QAction( UI.PixmapCache.getIcon("print.png"), - self.trUtf8('&Print'), self) + self.tr('&Print'), self) self.printAct.setShortcut( - QKeySequence(self.trUtf8("Ctrl+P", "File|Print"))) - self.printAct.setStatusTip(self.trUtf8('Print a screen capture')) - self.printAct.setWhatsThis(self.trUtf8( + QKeySequence(self.tr("Ctrl+P", "File|Print"))) + self.printAct.setStatusTip(self.tr('Print a screen capture')) + self.printAct.setWhatsThis(self.tr( """<b>Print</b>""" """<p>Print a screen capture.</p>""" )) @@ -150,10 +150,10 @@ self.printPreviewAct = QAction( UI.PixmapCache.getIcon("printPreview.png"), - self.trUtf8('Print Preview'), self) - self.printPreviewAct.setStatusTip(self.trUtf8( + self.tr('Print Preview'), self) + self.printPreviewAct.setStatusTip(self.tr( 'Print preview a screen capture')) - self.printPreviewAct.setWhatsThis(self.trUtf8( + self.printPreviewAct.setWhatsThis(self.tr( """<b>Print Preview</b>""" """<p>Print preview a screen capture.</p>""" )) @@ -161,35 +161,35 @@ self.imageAct = QAction( UI.PixmapCache.getIcon("screenCapture.png"), - self.trUtf8('&Screen Capture'), self) + self.tr('&Screen Capture'), self) self.imageAct.setShortcut( - QKeySequence(self.trUtf8("Ctrl+S", "File|Screen Capture"))) - self.imageAct.setStatusTip(self.trUtf8( + QKeySequence(self.tr("Ctrl+S", "File|Screen Capture"))) + self.imageAct.setStatusTip(self.tr( 'Save a screen capture to an image file')) - self.imageAct.setWhatsThis(self.trUtf8( + self.imageAct.setWhatsThis(self.tr( """<b>Screen Capture</b>""" """<p>Save a screen capture to an image file.</p>""" )) self.imageAct.triggered[()].connect(self.__saveImage) 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( + QKeySequence(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.copyAct = QAction( - UI.PixmapCache.getIcon("editCopy.png"), self.trUtf8('&Copy'), self) + UI.PixmapCache.getIcon("editCopy.png"), self.tr('&Copy'), self) self.copyAct.setShortcut( - QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy"))) + QKeySequence(self.tr("Ctrl+C", "Edit|Copy"))) self.copyAct.setStatusTip( - self.trUtf8('Copy screen capture to clipboard')) - self.copyAct.setWhatsThis(self.trUtf8( + self.tr('Copy screen capture to clipboard')) + self.copyAct.setWhatsThis(self.tr( """<b>Copy</b>""" """<p>Copy screen capture to clipboard.</p>""" )) @@ -197,10 +197,10 @@ 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""" @@ -210,19 +210,19 @@ )) 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.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>""" )) @@ -234,7 +234,7 @@ """ mb = self.menuBar() - menu = mb.addMenu(self.trUtf8('&File')) + menu = mb.addMenu(self.tr('&File')) menu.setTearOffEnabled(True) menu.addAction(self.openAct) menu.addAction(self.imageAct) @@ -244,13 +244,13 @@ menu.addSeparator() menu.addAction(self.exitAct) - menu = mb.addMenu(self.trUtf8("&Edit")) + menu = mb.addMenu(self.tr("&Edit")) menu.setTearOffEnabled(True) menu.addAction(self.copyAct) 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) @@ -261,7 +261,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.openAct) filetb.addAction(self.imageAct) @@ -271,11 +271,11 @@ filetb.addSeparator() filetb.addAction(self.exitAct) - edittb = self.addToolBar(self.trUtf8("Edit")) + edittb = self.addToolBar(self.tr("Edit")) edittb.setIconSize(UI.Config.ToolBarIconSize) edittb.addAction(self.copyAct) - helptb = self.addToolBar(self.trUtf8("Help")) + helptb = self.addToolBar(self.tr("Help")) helptb.setIconSize(UI.Config.ToolBarIconSize) helptb.addAction(self.whatsThisAct) @@ -300,8 +300,8 @@ """ E5MessageBox.about( self, - self.trUtf8("UI Previewer"), - self.trUtf8( + self.tr("UI Previewer"), + self.tr( """<h3> About UI Previewer </h3>""" """<p>The UI Previewer loads and displays Qt User-Interface""" """ files with various styles, which are selectable via a""" @@ -313,7 +313,7 @@ """ Private slot to show info about Qt. """ - E5MessageBox.aboutQt(self, self.trUtf8("UI Previewer")) + E5MessageBox.aboutQt(self, self.tr("UI Previewer")) def __openFile(self): """ @@ -321,9 +321,9 @@ """ fn = E5FileDialog.getOpenFileName( self, - self.trUtf8("Select UI file"), + self.tr("Select UI file"), self.currentFile, - self.trUtf8("Qt User-Interface Files (*.ui)")) + self.tr("Qt User-Interface Files (*.ui)")) if fn: self.__loadFile(fn) @@ -358,8 +358,8 @@ else: 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(fn)) self.__updateActions() @@ -447,8 +447,8 @@ if self.mainWidget is None: E5MessageBox.critical( self, - self.trUtf8("Save Image"), - self.trUtf8("""There is no UI file loaded.""")) + self.tr("Save Image"), + self.tr("""There is no UI file loaded.""")) return defaultExt = "PNG" @@ -457,11 +457,11 @@ for format in formats: filters = "{0}*.{1} ".format( filters, bytes(format).decode().lower()) - filter = self.trUtf8("Images ({0})").format(filters[:-1]) + filter = self.tr("Images ({0})").format(filters[:-1]) fname = E5FileDialog.getSaveFileName( self, - self.trUtf8("Save Image"), + self.tr("Save Image"), "", filter) if not fname: @@ -480,8 +480,8 @@ if not pix.save(fname, str(ext)): E5MessageBox.critical( self, - self.trUtf8("Save Image"), - self.trUtf8( + self.tr("Save Image"), + self.tr( """<p>The file <b>{0}</b> could not be saved.</p>""") .format(fname)) @@ -492,8 +492,8 @@ if self.mainWidget is None: E5MessageBox.critical( self, - self.trUtf8("Save Image"), - self.trUtf8("""There is no UI file loaded.""")) + self.tr("Save Image"), + self.tr("""There is no UI file loaded.""")) return cb = QApplication.clipboard() @@ -510,8 +510,8 @@ if self.mainWidget is None: E5MessageBox.critical( self, - self.trUtf8("Print Image"), - self.trUtf8("""There is no UI file loaded.""")) + self.tr("Print Image"), + self.tr("""There is no UI file loaded.""")) return settings = Preferences.Prefs.settings @@ -532,7 +532,7 @@ printDialog = QPrintDialog(printer, self) if printDialog.exec_() == QDialog.Accepted: - self.statusBar().showMessage(self.trUtf8("Printing the image...")) + self.statusBar().showMessage(self.tr("Printing the image...")) self.__print(printer) settings.setValue("UIPreviewer/printername", printer.printerName()) @@ -542,7 +542,7 @@ settings.setValue("UIPreviewer/colormode", printer.colorMode()) self.statusBar().showMessage( - self.trUtf8("Image sent to printer..."), 2000) + self.tr("Image sent to printer..."), 2000) def __printPreviewImage(self): """ @@ -553,8 +553,8 @@ if self.mainWidget is None: E5MessageBox.critical( self, - self.trUtf8("Print Preview"), - self.trUtf8("""There is no UI file loaded.""")) + self.tr("Print Preview"), + self.tr("""There is no UI file loaded.""")) return settings = Preferences.Prefs.settings