Tools/UIPreviewer.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3048
83f86da6344e
child 3145
a9de05d4a22f
--- a/Tools/UIPreviewer.py	Fri Nov 01 15:48:48 2013 +0100
+++ b/Tools/UIPreviewer.py	Sun Nov 03 15:58:22 2013 +0100
@@ -133,8 +133,8 @@
             QKeySequence(self.trUtf8("Ctrl+O", "File|Open")))
         self.openAct.setStatusTip(self.trUtf8('Open a UI file for display'))
         self.openAct.setWhatsThis(self.trUtf8(
-                """<b>Open File</b>"""
-                """<p>This opens a new UI file for display.</p>"""
+            """<b>Open File</b>"""
+            """<p>This opens a new UI file for display.</p>"""
         ))
         self.openAct.triggered[()].connect(self.__openFile)
         
@@ -145,8 +145,8 @@
             QKeySequence(self.trUtf8("Ctrl+P", "File|Print")))
         self.printAct.setStatusTip(self.trUtf8('Print a screen capture'))
         self.printAct.setWhatsThis(self.trUtf8(
-                """<b>Print</b>"""
-                """<p>Print a screen capture.</p>"""
+            """<b>Print</b>"""
+            """<p>Print a screen capture.</p>"""
         ))
         self.printAct.triggered[()].connect(self.__printImage)
         
@@ -154,10 +154,10 @@
             UI.PixmapCache.getIcon("printPreview.png"),
             self.trUtf8('Print Preview'), self)
         self.printPreviewAct.setStatusTip(self.trUtf8(
-                'Print preview a screen capture'))
+            'Print preview a screen capture'))
         self.printPreviewAct.setWhatsThis(self.trUtf8(
-                """<b>Print Preview</b>"""
-                """<p>Print preview a screen capture.</p>"""
+            """<b>Print Preview</b>"""
+            """<p>Print preview a screen capture.</p>"""
         ))
         self.printPreviewAct.triggered[()].connect(self.__printPreviewImage)
         
@@ -169,8 +169,8 @@
         self.imageAct.setStatusTip(self.trUtf8(
             'Save a screen capture to an image file'))
         self.imageAct.setWhatsThis(self.trUtf8(
-                """<b>Screen Capture</b>"""
-                """<p>Save a screen capture to an image file.</p>"""
+            """<b>Screen Capture</b>"""
+            """<p>Save a screen capture to an image file.</p>"""
         ))
         self.imageAct.triggered[()].connect(self.__saveImage)
         
@@ -180,8 +180,8 @@
             QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit")))
         self.exitAct.setStatusTip(self.trUtf8('Quit the application'))
         self.exitAct.setWhatsThis(self.trUtf8(
-                """<b>Quit</b>"""
-                """<p>Quit the application.</p>"""
+            """<b>Quit</b>"""
+            """<p>Quit the application.</p>"""
         ))
         self.exitAct.triggered[()].connect(qApp.closeAllWindows)
         
@@ -192,8 +192,8 @@
         self.copyAct.setStatusTip(
             self.trUtf8('Copy screen capture to clipboard'))
         self.copyAct.setWhatsThis(self.trUtf8(
-                """<b>Copy</b>"""
-                """<p>Copy screen capture to clipboard.</p>"""
+            """<b>Copy</b>"""
+            """<p>Copy screen capture to clipboard.</p>"""
         ))
         self.copyAct.triggered[()].connect(self.__copyImageToClipboard)
         
@@ -216,8 +216,8 @@
         self.aboutAct.setStatusTip(self.trUtf8(
             'Display information about this software'))
         self.aboutAct.setWhatsThis(self.trUtf8(
-                """<b>About</b>"""
-                """<p>Display some information about this software.</p>"""
+            """<b>About</b>"""
+            """<p>Display some information about this software.</p>"""
         ))
         self.aboutAct.triggered[()].connect(self.__about)
                      
@@ -225,8 +225,8 @@
         self.aboutQtAct.setStatusTip(
             self.trUtf8('Display information about the Qt toolkit'))
         self.aboutQtAct.setWhatsThis(self.trUtf8(
-                """<b>About Qt</b>"""
-                """<p>Display some information about the Qt toolkit.</p>"""
+            """<b>About Qt</b>"""
+            """<p>Display some information about the Qt toolkit.</p>"""
         ))
         self.aboutQtAct.triggered[()].connect(self.__aboutQt)
 
@@ -362,8 +362,8 @@
                 self,
                 self.trUtf8("Load UI File"),
                 self.trUtf8(
-                    """<p>The file <b>{0}</b> could not be loaded.</p>""")\
-                    .format(fn))
+                    """<p>The file <b>{0}</b> could not be loaded.</p>""")
+                .format(fn))
         self.__updateActions()
     
     def __updateChildren(self, sstyle):
@@ -485,7 +485,7 @@
                 self.trUtf8("Save Image"),
                 self.trUtf8(
                     """<p>The file <b>{0}</b> could not be saved.</p>""")
-                    .format(fname))
+                .format(fname))
 
     def __copyImageToClipboard(self):
         """
@@ -520,7 +520,9 @@
         printer = QPrinter(QPrinter.HighResolution)
         printer.setFullPage(True)
         
-        printer.setPrinterName(settings.value("UIPreviewer/printername"))
+        printerName = Preferences.getPrinter("UIPreviewer/printername")
+        if printerName:
+            self.setPrinterName(printerName)
         printer.setPageSize(
             QPrinter.PageSize(int(settings.value("UIPreviewer/pagesize"))))
         printer.setPageOrder(
@@ -561,7 +563,9 @@
         printer = QPrinter(QPrinter.HighResolution)
         printer.setFullPage(True)
         
-        printer.setPrinterName(settings.value("UIPreviewer/printername"))
+        printerName = Preferences.getPrinter("UIPreviewer/printername")
+        if printerName:
+            self.setPrinterName(printerName)
         printer.setPageSize(
             QPrinter.PageSize(int(settings.value("UIPreviewer/pagesize"))))
         printer.setPageOrder(

eric ide

mercurial