Tools/UIPreviewer.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3201
0f115f6db6cb
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
50 self.resize(QSize(600, 480).expandedTo(self.minimumSizeHint())) 50 self.resize(QSize(600, 480).expandedTo(self.minimumSizeHint()))
51 self.setAttribute(Qt.WA_DeleteOnClose) 51 self.setAttribute(Qt.WA_DeleteOnClose)
52 self.statusBar() 52 self.statusBar()
53 53
54 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) 54 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
55 self.setWindowTitle(self.trUtf8("UI Previewer")) 55 self.setWindowTitle(self.tr("UI Previewer"))
56 56
57 self.cw = QWidget(self) 57 self.cw = QWidget(self)
58 self.cw.setObjectName("centralWidget") 58 self.cw.setObjectName("centralWidget")
59 59
60 self.UIPreviewerLayout = QVBoxLayout(self.cw) 60 self.UIPreviewerLayout = QVBoxLayout(self.cw)
65 self.styleLayout = QHBoxLayout() 65 self.styleLayout = QHBoxLayout()
66 self.styleLayout.setContentsMargins(0, 0, 0, 0) 66 self.styleLayout.setContentsMargins(0, 0, 0, 0)
67 self.styleLayout.setSpacing(6) 67 self.styleLayout.setSpacing(6)
68 self.styleLayout.setObjectName("styleLayout") 68 self.styleLayout.setObjectName("styleLayout")
69 69
70 self.styleLabel = QLabel(self.trUtf8("Select GUI Theme"), self.cw) 70 self.styleLabel = QLabel(self.tr("Select GUI Theme"), self.cw)
71 self.styleLabel.setObjectName("styleLabel") 71 self.styleLabel.setObjectName("styleLabel")
72 self.styleLayout.addWidget(self.styleLabel) 72 self.styleLayout.addWidget(self.styleLabel)
73 73
74 self.styleCombo = QComboBox(self.cw) 74 self.styleCombo = QComboBox(self.cw)
75 self.styleCombo.setObjectName("styleCombo") 75 self.styleCombo.setObjectName("styleCombo")
76 self.styleCombo.setEditable(False) 76 self.styleCombo.setEditable(False)
77 self.styleCombo.setToolTip(self.trUtf8("Select the GUI Theme")) 77 self.styleCombo.setToolTip(self.tr("Select the GUI Theme"))
78 self.styleLayout.addWidget(self.styleCombo) 78 self.styleLayout.addWidget(self.styleCombo)
79 self.styleCombo.addItems(list(QStyleFactory().keys())) 79 self.styleCombo.addItems(list(QStyleFactory().keys()))
80 currentStyle = Preferences.Prefs.settings.value('UIPreviewer/style') 80 currentStyle = Preferences.Prefs.settings.value('UIPreviewer/style')
81 if currentStyle is not None: 81 if currentStyle is not None:
82 self.styleCombo.setCurrentIndex(int(currentStyle)) 82 self.styleCombo.setCurrentIndex(int(currentStyle))
124 """ 124 """
125 Private method to define the user interface actions. 125 Private method to define the user interface actions.
126 """ 126 """
127 self.openAct = QAction( 127 self.openAct = QAction(
128 UI.PixmapCache.getIcon("openUI.png"), 128 UI.PixmapCache.getIcon("openUI.png"),
129 self.trUtf8('&Open File'), self) 129 self.tr('&Open File'), self)
130 self.openAct.setShortcut( 130 self.openAct.setShortcut(
131 QKeySequence(self.trUtf8("Ctrl+O", "File|Open"))) 131 QKeySequence(self.tr("Ctrl+O", "File|Open")))
132 self.openAct.setStatusTip(self.trUtf8('Open a UI file for display')) 132 self.openAct.setStatusTip(self.tr('Open a UI file for display'))
133 self.openAct.setWhatsThis(self.trUtf8( 133 self.openAct.setWhatsThis(self.tr(
134 """<b>Open File</b>""" 134 """<b>Open File</b>"""
135 """<p>This opens a new UI file for display.</p>""" 135 """<p>This opens a new UI file for display.</p>"""
136 )) 136 ))
137 self.openAct.triggered[()].connect(self.__openFile) 137 self.openAct.triggered[()].connect(self.__openFile)
138 138
139 self.printAct = QAction( 139 self.printAct = QAction(
140 UI.PixmapCache.getIcon("print.png"), 140 UI.PixmapCache.getIcon("print.png"),
141 self.trUtf8('&Print'), self) 141 self.tr('&Print'), self)
142 self.printAct.setShortcut( 142 self.printAct.setShortcut(
143 QKeySequence(self.trUtf8("Ctrl+P", "File|Print"))) 143 QKeySequence(self.tr("Ctrl+P", "File|Print")))
144 self.printAct.setStatusTip(self.trUtf8('Print a screen capture')) 144 self.printAct.setStatusTip(self.tr('Print a screen capture'))
145 self.printAct.setWhatsThis(self.trUtf8( 145 self.printAct.setWhatsThis(self.tr(
146 """<b>Print</b>""" 146 """<b>Print</b>"""
147 """<p>Print a screen capture.</p>""" 147 """<p>Print a screen capture.</p>"""
148 )) 148 ))
149 self.printAct.triggered[()].connect(self.__printImage) 149 self.printAct.triggered[()].connect(self.__printImage)
150 150
151 self.printPreviewAct = QAction( 151 self.printPreviewAct = QAction(
152 UI.PixmapCache.getIcon("printPreview.png"), 152 UI.PixmapCache.getIcon("printPreview.png"),
153 self.trUtf8('Print Preview'), self) 153 self.tr('Print Preview'), self)
154 self.printPreviewAct.setStatusTip(self.trUtf8( 154 self.printPreviewAct.setStatusTip(self.tr(
155 'Print preview a screen capture')) 155 'Print preview a screen capture'))
156 self.printPreviewAct.setWhatsThis(self.trUtf8( 156 self.printPreviewAct.setWhatsThis(self.tr(
157 """<b>Print Preview</b>""" 157 """<b>Print Preview</b>"""
158 """<p>Print preview a screen capture.</p>""" 158 """<p>Print preview a screen capture.</p>"""
159 )) 159 ))
160 self.printPreviewAct.triggered[()].connect(self.__printPreviewImage) 160 self.printPreviewAct.triggered[()].connect(self.__printPreviewImage)
161 161
162 self.imageAct = QAction( 162 self.imageAct = QAction(
163 UI.PixmapCache.getIcon("screenCapture.png"), 163 UI.PixmapCache.getIcon("screenCapture.png"),
164 self.trUtf8('&Screen Capture'), self) 164 self.tr('&Screen Capture'), self)
165 self.imageAct.setShortcut( 165 self.imageAct.setShortcut(
166 QKeySequence(self.trUtf8("Ctrl+S", "File|Screen Capture"))) 166 QKeySequence(self.tr("Ctrl+S", "File|Screen Capture")))
167 self.imageAct.setStatusTip(self.trUtf8( 167 self.imageAct.setStatusTip(self.tr(
168 'Save a screen capture to an image file')) 168 'Save a screen capture to an image file'))
169 self.imageAct.setWhatsThis(self.trUtf8( 169 self.imageAct.setWhatsThis(self.tr(
170 """<b>Screen Capture</b>""" 170 """<b>Screen Capture</b>"""
171 """<p>Save a screen capture to an image file.</p>""" 171 """<p>Save a screen capture to an image file.</p>"""
172 )) 172 ))
173 self.imageAct.triggered[()].connect(self.__saveImage) 173 self.imageAct.triggered[()].connect(self.__saveImage)
174 174
175 self.exitAct = QAction( 175 self.exitAct = QAction(
176 UI.PixmapCache.getIcon("exit.png"), self.trUtf8('&Quit'), self) 176 UI.PixmapCache.getIcon("exit.png"), self.tr('&Quit'), self)
177 self.exitAct.setShortcut( 177 self.exitAct.setShortcut(
178 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit"))) 178 QKeySequence(self.tr("Ctrl+Q", "File|Quit")))
179 self.exitAct.setStatusTip(self.trUtf8('Quit the application')) 179 self.exitAct.setStatusTip(self.tr('Quit the application'))
180 self.exitAct.setWhatsThis(self.trUtf8( 180 self.exitAct.setWhatsThis(self.tr(
181 """<b>Quit</b>""" 181 """<b>Quit</b>"""
182 """<p>Quit the application.</p>""" 182 """<p>Quit the application.</p>"""
183 )) 183 ))
184 self.exitAct.triggered[()].connect(qApp.closeAllWindows) 184 self.exitAct.triggered[()].connect(qApp.closeAllWindows)
185 185
186 self.copyAct = QAction( 186 self.copyAct = QAction(
187 UI.PixmapCache.getIcon("editCopy.png"), self.trUtf8('&Copy'), self) 187 UI.PixmapCache.getIcon("editCopy.png"), self.tr('&Copy'), self)
188 self.copyAct.setShortcut( 188 self.copyAct.setShortcut(
189 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy"))) 189 QKeySequence(self.tr("Ctrl+C", "Edit|Copy")))
190 self.copyAct.setStatusTip( 190 self.copyAct.setStatusTip(
191 self.trUtf8('Copy screen capture to clipboard')) 191 self.tr('Copy screen capture to clipboard'))
192 self.copyAct.setWhatsThis(self.trUtf8( 192 self.copyAct.setWhatsThis(self.tr(
193 """<b>Copy</b>""" 193 """<b>Copy</b>"""
194 """<p>Copy screen capture to clipboard.</p>""" 194 """<p>Copy screen capture to clipboard.</p>"""
195 )) 195 ))
196 self.copyAct.triggered[()].connect(self.__copyImageToClipboard) 196 self.copyAct.triggered[()].connect(self.__copyImageToClipboard)
197 197
198 self.whatsThisAct = QAction( 198 self.whatsThisAct = QAction(
199 UI.PixmapCache.getIcon("whatsThis.png"), 199 UI.PixmapCache.getIcon("whatsThis.png"),
200 self.trUtf8('&What\'s This?'), self) 200 self.tr('&What\'s This?'), self)
201 self.whatsThisAct.setShortcut(QKeySequence(self.trUtf8("Shift+F1"))) 201 self.whatsThisAct.setShortcut(QKeySequence(self.tr("Shift+F1")))
202 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) 202 self.whatsThisAct.setStatusTip(self.tr('Context sensitive help'))
203 self.whatsThisAct.setWhatsThis(self.trUtf8( 203 self.whatsThisAct.setWhatsThis(self.tr(
204 """<b>Display context sensitive help</b>""" 204 """<b>Display context sensitive help</b>"""
205 """<p>In What's This? mode, the mouse cursor shows an arrow""" 205 """<p>In What's This? mode, the mouse cursor shows an arrow"""
206 """ with a question mark, and you can click on the interface""" 206 """ with a question mark, and you can click on the interface"""
207 """ elements to get a short description of what they do and""" 207 """ elements to get a short description of what they do and"""
208 """ how to use them. In dialogs, this feature can be accessed""" 208 """ how to use them. In dialogs, this feature can be accessed"""
209 """ using the context help button in the titlebar.</p>""" 209 """ using the context help button in the titlebar.</p>"""
210 )) 210 ))
211 self.whatsThisAct.triggered[()].connect(self.__whatsThis) 211 self.whatsThisAct.triggered[()].connect(self.__whatsThis)
212 212
213 self.aboutAct = QAction(self.trUtf8('&About'), self) 213 self.aboutAct = QAction(self.tr('&About'), self)
214 self.aboutAct.setStatusTip(self.trUtf8( 214 self.aboutAct.setStatusTip(self.tr(
215 'Display information about this software')) 215 'Display information about this software'))
216 self.aboutAct.setWhatsThis(self.trUtf8( 216 self.aboutAct.setWhatsThis(self.tr(
217 """<b>About</b>""" 217 """<b>About</b>"""
218 """<p>Display some information about this software.</p>""" 218 """<p>Display some information about this software.</p>"""
219 )) 219 ))
220 self.aboutAct.triggered[()].connect(self.__about) 220 self.aboutAct.triggered[()].connect(self.__about)
221 221
222 self.aboutQtAct = QAction(self.trUtf8('About &Qt'), self) 222 self.aboutQtAct = QAction(self.tr('About &Qt'), self)
223 self.aboutQtAct.setStatusTip( 223 self.aboutQtAct.setStatusTip(
224 self.trUtf8('Display information about the Qt toolkit')) 224 self.tr('Display information about the Qt toolkit'))
225 self.aboutQtAct.setWhatsThis(self.trUtf8( 225 self.aboutQtAct.setWhatsThis(self.tr(
226 """<b>About Qt</b>""" 226 """<b>About Qt</b>"""
227 """<p>Display some information about the Qt toolkit.</p>""" 227 """<p>Display some information about the Qt toolkit.</p>"""
228 )) 228 ))
229 self.aboutQtAct.triggered[()].connect(self.__aboutQt) 229 self.aboutQtAct.triggered[()].connect(self.__aboutQt)
230 230
232 """ 232 """
233 Private method to create the menus. 233 Private method to create the menus.
234 """ 234 """
235 mb = self.menuBar() 235 mb = self.menuBar()
236 236
237 menu = mb.addMenu(self.trUtf8('&File')) 237 menu = mb.addMenu(self.tr('&File'))
238 menu.setTearOffEnabled(True) 238 menu.setTearOffEnabled(True)
239 menu.addAction(self.openAct) 239 menu.addAction(self.openAct)
240 menu.addAction(self.imageAct) 240 menu.addAction(self.imageAct)
241 menu.addSeparator() 241 menu.addSeparator()
242 menu.addAction(self.printPreviewAct) 242 menu.addAction(self.printPreviewAct)
243 menu.addAction(self.printAct) 243 menu.addAction(self.printAct)
244 menu.addSeparator() 244 menu.addSeparator()
245 menu.addAction(self.exitAct) 245 menu.addAction(self.exitAct)
246 246
247 menu = mb.addMenu(self.trUtf8("&Edit")) 247 menu = mb.addMenu(self.tr("&Edit"))
248 menu.setTearOffEnabled(True) 248 menu.setTearOffEnabled(True)
249 menu.addAction(self.copyAct) 249 menu.addAction(self.copyAct)
250 250
251 mb.addSeparator() 251 mb.addSeparator()
252 252
253 menu = mb.addMenu(self.trUtf8('&Help')) 253 menu = mb.addMenu(self.tr('&Help'))
254 menu.setTearOffEnabled(True) 254 menu.setTearOffEnabled(True)
255 menu.addAction(self.aboutAct) 255 menu.addAction(self.aboutAct)
256 menu.addAction(self.aboutQtAct) 256 menu.addAction(self.aboutQtAct)
257 menu.addSeparator() 257 menu.addSeparator()
258 menu.addAction(self.whatsThisAct) 258 menu.addAction(self.whatsThisAct)
259 259
260 def __initToolbars(self): 260 def __initToolbars(self):
261 """ 261 """
262 Private method to create the toolbars. 262 Private method to create the toolbars.
263 """ 263 """
264 filetb = self.addToolBar(self.trUtf8("File")) 264 filetb = self.addToolBar(self.tr("File"))
265 filetb.setIconSize(UI.Config.ToolBarIconSize) 265 filetb.setIconSize(UI.Config.ToolBarIconSize)
266 filetb.addAction(self.openAct) 266 filetb.addAction(self.openAct)
267 filetb.addAction(self.imageAct) 267 filetb.addAction(self.imageAct)
268 filetb.addSeparator() 268 filetb.addSeparator()
269 filetb.addAction(self.printPreviewAct) 269 filetb.addAction(self.printPreviewAct)
270 filetb.addAction(self.printAct) 270 filetb.addAction(self.printAct)
271 filetb.addSeparator() 271 filetb.addSeparator()
272 filetb.addAction(self.exitAct) 272 filetb.addAction(self.exitAct)
273 273
274 edittb = self.addToolBar(self.trUtf8("Edit")) 274 edittb = self.addToolBar(self.tr("Edit"))
275 edittb.setIconSize(UI.Config.ToolBarIconSize) 275 edittb.setIconSize(UI.Config.ToolBarIconSize)
276 edittb.addAction(self.copyAct) 276 edittb.addAction(self.copyAct)
277 277
278 helptb = self.addToolBar(self.trUtf8("Help")) 278 helptb = self.addToolBar(self.tr("Help"))
279 helptb.setIconSize(UI.Config.ToolBarIconSize) 279 helptb.setIconSize(UI.Config.ToolBarIconSize)
280 helptb.addAction(self.whatsThisAct) 280 helptb.addAction(self.whatsThisAct)
281 281
282 def __whatsThis(self): 282 def __whatsThis(self):
283 """ 283 """
298 """ 298 """
299 Private slot to show the about information. 299 Private slot to show the about information.
300 """ 300 """
301 E5MessageBox.about( 301 E5MessageBox.about(
302 self, 302 self,
303 self.trUtf8("UI Previewer"), 303 self.tr("UI Previewer"),
304 self.trUtf8( 304 self.tr(
305 """<h3> About UI Previewer </h3>""" 305 """<h3> About UI Previewer </h3>"""
306 """<p>The UI Previewer loads and displays Qt User-Interface""" 306 """<p>The UI Previewer loads and displays Qt User-Interface"""
307 """ files with various styles, which are selectable via a""" 307 """ files with various styles, which are selectable via a"""
308 """ selection list.</p>""" 308 """ selection list.</p>"""
309 ) 309 )
311 311
312 def __aboutQt(self): 312 def __aboutQt(self):
313 """ 313 """
314 Private slot to show info about Qt. 314 Private slot to show info about Qt.
315 """ 315 """
316 E5MessageBox.aboutQt(self, self.trUtf8("UI Previewer")) 316 E5MessageBox.aboutQt(self, self.tr("UI Previewer"))
317 317
318 def __openFile(self): 318 def __openFile(self):
319 """ 319 """
320 Private slot to load a new file. 320 Private slot to load a new file.
321 """ 321 """
322 fn = E5FileDialog.getOpenFileName( 322 fn = E5FileDialog.getOpenFileName(
323 self, 323 self,
324 self.trUtf8("Select UI file"), 324 self.tr("Select UI file"),
325 self.currentFile, 325 self.currentFile,
326 self.trUtf8("Qt User-Interface Files (*.ui)")) 326 self.tr("Qt User-Interface Files (*.ui)"))
327 if fn: 327 if fn:
328 self.__loadFile(fn) 328 self.__loadFile(fn)
329 329
330 def __loadFile(self, fn): 330 def __loadFile(self, fn):
331 """ 331 """
356 self.previewSV.setWidget(self.mainWidget) 356 self.previewSV.setWidget(self.mainWidget)
357 self.mainWidget.show() 357 self.mainWidget.show()
358 else: 358 else:
359 E5MessageBox.warning( 359 E5MessageBox.warning(
360 self, 360 self,
361 self.trUtf8("Load UI File"), 361 self.tr("Load UI File"),
362 self.trUtf8( 362 self.tr(
363 """<p>The file <b>{0}</b> could not be loaded.</p>""") 363 """<p>The file <b>{0}</b> could not be loaded.</p>""")
364 .format(fn)) 364 .format(fn))
365 self.__updateActions() 365 self.__updateActions()
366 366
367 def __updateChildren(self, sstyle): 367 def __updateChildren(self, sstyle):
445 Private slot to handle the Save Image menu action. 445 Private slot to handle the Save Image menu action.
446 """ 446 """
447 if self.mainWidget is None: 447 if self.mainWidget is None:
448 E5MessageBox.critical( 448 E5MessageBox.critical(
449 self, 449 self,
450 self.trUtf8("Save Image"), 450 self.tr("Save Image"),
451 self.trUtf8("""There is no UI file loaded.""")) 451 self.tr("""There is no UI file loaded."""))
452 return 452 return
453 453
454 defaultExt = "PNG" 454 defaultExt = "PNG"
455 filters = "" 455 filters = ""
456 formats = QImageWriter.supportedImageFormats() 456 formats = QImageWriter.supportedImageFormats()
457 for format in formats: 457 for format in formats:
458 filters = "{0}*.{1} ".format( 458 filters = "{0}*.{1} ".format(
459 filters, bytes(format).decode().lower()) 459 filters, bytes(format).decode().lower())
460 filter = self.trUtf8("Images ({0})").format(filters[:-1]) 460 filter = self.tr("Images ({0})").format(filters[:-1])
461 461
462 fname = E5FileDialog.getSaveFileName( 462 fname = E5FileDialog.getSaveFileName(
463 self, 463 self,
464 self.trUtf8("Save Image"), 464 self.tr("Save Image"),
465 "", 465 "",
466 filter) 466 filter)
467 if not fname: 467 if not fname:
468 return 468 return
469 469
478 pix = QPixmap.grabWidget(self.mainWidget) 478 pix = QPixmap.grabWidget(self.mainWidget)
479 self.__updateChildren(self.lastStyle) 479 self.__updateChildren(self.lastStyle)
480 if not pix.save(fname, str(ext)): 480 if not pix.save(fname, str(ext)):
481 E5MessageBox.critical( 481 E5MessageBox.critical(
482 self, 482 self,
483 self.trUtf8("Save Image"), 483 self.tr("Save Image"),
484 self.trUtf8( 484 self.tr(
485 """<p>The file <b>{0}</b> could not be saved.</p>""") 485 """<p>The file <b>{0}</b> could not be saved.</p>""")
486 .format(fname)) 486 .format(fname))
487 487
488 def __copyImageToClipboard(self): 488 def __copyImageToClipboard(self):
489 """ 489 """
490 Private slot to handle the Copy Image menu action. 490 Private slot to handle the Copy Image menu action.
491 """ 491 """
492 if self.mainWidget is None: 492 if self.mainWidget is None:
493 E5MessageBox.critical( 493 E5MessageBox.critical(
494 self, 494 self,
495 self.trUtf8("Save Image"), 495 self.tr("Save Image"),
496 self.trUtf8("""There is no UI file loaded.""")) 496 self.tr("""There is no UI file loaded."""))
497 return 497 return
498 498
499 cb = QApplication.clipboard() 499 cb = QApplication.clipboard()
500 if qVersion() >= "5.0.0": 500 if qVersion() >= "5.0.0":
501 cb.setPixmap(self.mainWidget.grab()) 501 cb.setPixmap(self.mainWidget.grab())
508 Private slot to handle the Print Image menu action. 508 Private slot to handle the Print Image menu action.
509 """ 509 """
510 if self.mainWidget is None: 510 if self.mainWidget is None:
511 E5MessageBox.critical( 511 E5MessageBox.critical(
512 self, 512 self,
513 self.trUtf8("Print Image"), 513 self.tr("Print Image"),
514 self.trUtf8("""There is no UI file loaded.""")) 514 self.tr("""There is no UI file loaded."""))
515 return 515 return
516 516
517 settings = Preferences.Prefs.settings 517 settings = Preferences.Prefs.settings
518 printer = QPrinter(QPrinter.HighResolution) 518 printer = QPrinter(QPrinter.HighResolution)
519 printer.setFullPage(True) 519 printer.setFullPage(True)
530 printer.setColorMode( 530 printer.setColorMode(
531 QPrinter.ColorMode(int(settings.value("UIPreviewer/colormode")))) 531 QPrinter.ColorMode(int(settings.value("UIPreviewer/colormode"))))
532 532
533 printDialog = QPrintDialog(printer, self) 533 printDialog = QPrintDialog(printer, self)
534 if printDialog.exec_() == QDialog.Accepted: 534 if printDialog.exec_() == QDialog.Accepted:
535 self.statusBar().showMessage(self.trUtf8("Printing the image...")) 535 self.statusBar().showMessage(self.tr("Printing the image..."))
536 self.__print(printer) 536 self.__print(printer)
537 537
538 settings.setValue("UIPreviewer/printername", printer.printerName()) 538 settings.setValue("UIPreviewer/printername", printer.printerName())
539 settings.setValue("UIPreviewer/pagesize", printer.pageSize()) 539 settings.setValue("UIPreviewer/pagesize", printer.pageSize())
540 settings.setValue("UIPreviewer/pageorder", printer.pageOrder()) 540 settings.setValue("UIPreviewer/pageorder", printer.pageOrder())
541 settings.setValue("UIPreviewer/orientation", printer.orientation()) 541 settings.setValue("UIPreviewer/orientation", printer.orientation())
542 settings.setValue("UIPreviewer/colormode", printer.colorMode()) 542 settings.setValue("UIPreviewer/colormode", printer.colorMode())
543 543
544 self.statusBar().showMessage( 544 self.statusBar().showMessage(
545 self.trUtf8("Image sent to printer..."), 2000) 545 self.tr("Image sent to printer..."), 2000)
546 546
547 def __printPreviewImage(self): 547 def __printPreviewImage(self):
548 """ 548 """
549 Private slot to handle the Print Preview menu action. 549 Private slot to handle the Print Preview menu action.
550 """ 550 """
551 from PyQt4.QtGui import QPrintPreviewDialog 551 from PyQt4.QtGui import QPrintPreviewDialog
552 552
553 if self.mainWidget is None: 553 if self.mainWidget is None:
554 E5MessageBox.critical( 554 E5MessageBox.critical(
555 self, 555 self,
556 self.trUtf8("Print Preview"), 556 self.tr("Print Preview"),
557 self.trUtf8("""There is no UI file loaded.""")) 557 self.tr("""There is no UI file loaded."""))
558 return 558 return
559 559
560 settings = Preferences.Prefs.settings 560 settings = Preferences.Prefs.settings
561 printer = QPrinter(QPrinter.HighResolution) 561 printer = QPrinter(QPrinter.HighResolution)
562 printer.setFullPage(True) 562 printer.setFullPage(True)

eric ide

mercurial