def __printPreviewImage(self): """ Private slot to handle the Print Preview menu action. """ from PyQt4.QtGui import QPrintPreviewDialog if self.mainWidget is None: KQMessageBox.critical(None, self.trUtf8("Print Preview"), self.trUtf8("""There is no UI file loaded.""")) return settings = Preferences.Prefs.settings printer = KdeQt.KQPrinter.KQPrinter(mode = QPrinter.HighResolution) printer.setFullPage(True) if not KdeQt.isKDE(): printer.setPrinterName(settings.value("UIPreviewer/printername").toString()) printer.setPageSize( QPrinter.PageSize(settings.value("UIPreviewer/pagesize").toInt()[0])) printer.setPageOrder( QPrinter.PageOrder(settings.value("UIPreviewer/pageorder").toInt()[0])) printer.setOrientation( QPrinter.Orientation(settings.value("UIPreviewer/orientation").toInt()[0])) printer.setColorMode( QPrinter.ColorMode(settings.value("UIPreviewer/colormode").toInt()[0])) preview = QPrintPreviewDialog(printer, self) self.connect(preview, SIGNAL("paintRequested(QPrinter*)"), self.__print) preview.exec_()
def __printImage(self): """ Private slot to handle the Print Image menu action. """ if self.mainWidget is None: KQMessageBox.critical(None, self.trUtf8("Print Image"), self.trUtf8("""There is no UI file loaded.""")) return settings = Preferences.Prefs.settings printer = KdeQt.KQPrinter.KQPrinter(mode = QPrinter.HighResolution) printer.setFullPage(True) if not KdeQt.isKDE(): printer.setPrinterName(settings.value("UIPreviewer/printername").toString()) printer.setPageSize( QPrinter.PageSize(settings.value("UIPreviewer/pagesize").toInt()[0])) printer.setPageOrder( QPrinter.PageOrder(settings.value("UIPreviewer/pageorder").toInt()[0])) printer.setOrientation( QPrinter.Orientation(settings.value("UIPreviewer/orientation").toInt()[0])) printer.setColorMode( QPrinter.ColorMode(settings.value("UIPreviewer/colormode").toInt()[0])) printDialog = KQPrintDialog(printer, self) if printDialog.exec_() == QDialog.Accepted: self.statusBar().showMessage(self.trUtf8("Printing the image...")) self.__print(printer) if not KdeQt.isKDE(): settings.setValue("UIPreviewer/printername", QVariant(printer.printerName())) settings.setValue("UIPreviewer/pagesize", QVariant(printer.pageSize())) settings.setValue("UIPreviewer/pageorder", QVariant(printer.pageOrder())) settings.setValue("UIPreviewer/orientation", QVariant(printer.orientation())) settings.setValue("UIPreviewer/colormode", QVariant(printer.colorMode())) self.statusBar().showMessage(self.trUtf8("Image sent to printer..."), 2000)
def __initActions(self): """ Private method to initialize the actions. """ acts = [] self.aboutAct = E4Action(self.trUtf8('About %1').arg(Program), UI.PixmapCache.getIcon("helpAbout.png"), self.trUtf8('&About %1').arg(Program), 0, 0, self, 'about_eric') self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) self.aboutAct.setWhatsThis(self.trUtf8( """<b>About %1</b>""" """<p>Display some information about this software.</p>""" ).arg(Program)) self.connect(self.aboutAct, SIGNAL('triggered()'), self.__about) self.aboutAct.setMenuRole(QAction.AboutRole) acts.append(self.aboutAct) self.aboutQtAct = E4Action(self.trUtf8('About Qt'), UI.PixmapCache.getIcon("helpAboutQt.png"), self.trUtf8('About &Qt'), 0, 0, self, 'about_qt') 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>""" )) self.connect(self.aboutQtAct, SIGNAL('triggered()'), self.__aboutQt) self.aboutQtAct.setMenuRole(QAction.AboutQtRole) acts.append(self.aboutQtAct) if KdeQt.isKDE(): self.aboutKdeAct = E4Action(self.trUtf8('About KDE'), UI.PixmapCache.getIcon("helpAboutKde.png"), self.trUtf8('About &KDE'), 0, 0, self, 'about_kde') self.aboutKdeAct.setStatusTip(self.trUtf8('Display information about KDE')) self.aboutKdeAct.setWhatsThis(self.trUtf8( """<b>About KDE</b>""" """<p>Display some information about KDE.</p>""" )) self.connect(self.aboutKdeAct, SIGNAL('triggered()'), self.__aboutKde) acts.append(self.aboutKdeAct) else: self.aboutKdeAct = None self.__ui.addE4Actions(acts, 'ui')