コード例 #1
0
    def FilePrint(self, event):

        from common.printframework import MyPrintout

        self.printData = wx.PrintData()
        self.printData.SetPaperId(wx.PAPER_LETTER)

        self.box = wx.BoxSizer(wx.VERTICAL)
        self.canvas = self.umlwin.GetDiagram().GetCanvas()

        #self.log.WriteText("OnPrintPreview\n")
        printout = MyPrintout(self.canvas, self.log)
        printout2 = MyPrintout(self.canvas, self.log)
        self.preview = wx.PrintPreview(printout, printout2, self.printData)
        if not self.preview.Ok():
            self.log.WriteText("Houston, we have a problem...\n")
            return

        frame = wx.PreviewFrame(self.preview, self.frame,
                                "This is a print preview")

        frame.Initialize()
        frame.SetPosition(self.frame.GetPosition())
        frame.SetSize(self.frame.GetSize())
        frame.Show(True)
コード例 #2
0
    def doPreview(self, printer, wikiDocument, wordList, printType, addopt):
        """
        Part of "Prints" plugin API. A Printing.Printer object calls this
        to show a print preview for a list of wiki words.
        
        printer -- Printer object
        wikiDocument -- WikiDataManager aka WikiDocument object
        wordList -- list of wiki words to print
        printType -- bytestring as returned as <print type> by getPrintTypes()
            (only interesting if class provides more than one print type)
        addOpt -- additional options as returned by getAddOpt()
        """
        self.setContext(printer, wikiDocument, wordList, printType, addopt)
        text = self._buildText()

        pddata = wx.PrintDialogData(self.printer.getPrintData())
        printout = PlainTextPrintout(text, self.printer, addopt)
        printout2 = PlainTextPrintout(text, self.printer, addopt)

        preview = wx.PrintPreview(printout, printout2, pddata)

        frame = wx.PreviewFrame(preview,
                                self.mainControl,
                                _(u"Print Preview"),
                                style=wx.DEFAULT_FRAME_STYLE
                                | wx.FRAME_FLOAT_ON_PARENT)

        frame.Initialize()
        frame.SetPosition(self.mainControl.GetPosition())
        frame.SetSize(self.mainControl.GetSize())
        frame.Show(True)
コード例 #3
0
ファイル: NoteEditor.py プロジェクト: raj347/Transana
 def OnPrintPreview(self, event):
     """ Define the method that implements Print Preview """
     # Convert the Note Text (in plain text format) into the form needed for the
     # TranscriptPrintoutClass's Print Preview display.  (This creates graphic and pageData)
     (graphic, pageData) = TranscriptPrintoutClass.PrepareData(TransanaGlobal.printData, noteTxt = self.txt.GetValue())
     # Pass the graph can data obtained from PrepareData() to the Print Preview mechanism TWICE,
     # once for the preview and once for the printer.
     printout = TranscriptPrintoutClass.MyPrintout('', graphic, pageData)
     printout2 = TranscriptPrintoutClass.MyPrintout('', graphic, pageData)
     # use wxPython's PrintPreview object to display the Print Preview.
     self.preview = wx.PrintPreview(printout, printout2, self.printData)
     # Check to see if the Print Preview was properly created.  
     if not self.preview.Ok():
         # If not, display an error message and exit
         self.SetStatusText(_("Print Preview Problem"))
         return
     # Calculate the best size for the Print Preview window
     theWidth = max(wx.Display(TransanaGlobal.configData.primaryScreen).GetClientArea()[2] - 180, 760)  # wx.ClientDisplayRect()
     theHeight = max(wx.Display(TransanaGlobal.configData.primaryScreen).GetClientArea()[3] - 200, 560)  # wx.ClientDisplayRect()
     # Create the dialog to hold the wx.PrintPreview object
     frame2 = wx.PreviewFrame(self.preview, TransanaGlobal.menuWindow, _("Print Preview"), size=(theWidth, theHeight))
     frame2.Centre()
     # Initialize the frame so it will display correctly
     frame2.Initialize()
     # Finally, we actually show the frame!
     frame2.Show(True)
コード例 #4
0
	def menuPrintPreview( self, event ):
		self.commit()
		title = self.getTitle()
		page = self.pages[self.notebook.GetSelection()]
		try:
			grid = page.getGrid()
			printout = SprintMgrPrintout( title, grid )
			printout2 = SprintMgrPrintout( title, grid )
		except AttributeError:
			if page == self.graphDraw:
				printout = GraphDrawPrintout( title, page )
				printout2 = GraphDrawPrintout( title, page )
			else:
				return
		
		data = wx.PrintDialogData(self.printData)
		self.preview = wx.PrintPreview(printout, printout2, data)

		self.preview.SetZoom( 110 )
		if not self.preview.IsOk():
			return

		pfrm = wx.PreviewFrame(self.preview, self, "Print preview")

		pfrm.Initialize()
		pfrm.SetPosition(self.GetPosition())
		pfrm.SetSize(self.GetSize())
		pfrm.Show(True)
コード例 #5
0
    def OnApercu(self, event):
        """ Aperçu avant impression """
        # Demande à l'utilisateur la mise en page
        reglages = self.parent.reglagesImpression
        
        data = wx.PrintData()
        data.SetOrientation(reglages["orientation"])
        data.SetPaperId(reglages["papier"])
        pageData = wx.PageSetupDialogData(data)
        pageData.SetMarginTopLeft(wx.Point(reglages["marge_haut"], reglages["marge_gauche"]))
        pageData.SetMarginBottomRight(wx.Point(reglages["marge_bas"], reglages["marge_droite"]))

        dlg = wx.PageSetupDialog(self, pageData)
        if dlg.ShowModal() == wx.ID_OK:
            data = dlg.GetPageSetupData()
            reglages["papier"] = data.GetPrintData().GetPaperId()
            reglages["orientation"] = data.GetPrintData().GetOrientation()
            reglages["marge_haut"] = data.GetMarginTopLeft()[0]
            reglages["marge_gauche"] = data.GetMarginTopLeft()[1]
            reglages["marge_bas"] = data.GetMarginBottomRight()[0]
            reglages["marge_droite"] = data.GetMarginBottomRight()[1]
            dlg.Destroy()
        else :
            dlg.Destroy()
            return

        format = self.parent.ctrl_planning.GetViewType()
        style = self.parent.ctrl_planning.GetStyle()
        drawer = self.parent.ctrl_planning.GetDrawer()
        weekstart = self.parent.ctrl_planning.GetWeekStart()
        periodCount = self.parent.ctrl_planning.GetPeriodCount()
        day	 = self.parent.ctrl_planning.GetDate()
        rpt1	 = wxReportScheduler.wxReportScheduler( format, style, drawer, day, weekstart, periodCount, self.parent.ctrl_planning.GetSchedules(), self.parent.ctrl_planning.joursSpeciaux, reglages )
        rpt2	 = wxReportScheduler.wxReportScheduler( format, style, drawer, day, weekstart, periodCount, self.parent.ctrl_planning.GetSchedules(), self.parent.ctrl_planning.joursSpeciaux, reglages )

        data = wx.PrintData()
        data.SetOrientation(reglages["orientation"])
        data.SetPaperId(reglages["papier"])

        preview = wx.PrintPreview(rpt1, rpt2, data)
##        preview.SetZoom( 100 )
##        if preview.Ok():
##            frame = wx.PreviewFrame(preview, None, _(u"Aperçu avant impression"), size=wx.Size( 700, 500 ) )
##            frame.Initialize()
##            frame.Show( True )
        
##        from Utils import UTILS_Printer
##        preview_window = UTILS_Printer.PreviewFrame(preview, None, _(u"Aperçu avant impression"), reglages["orientation"])
##        preview_window.Initialize()
##        preview_window.MakeModal(False)
##        preview_window.Show(True)
        
        preview.SetZoom(100)
        frame = wx.GetApp().GetTopWindow() 
        preview_window = wx.PreviewFrame(preview, None, _(u"Aperçu avant impression"))
        preview_window.Initialize()
        preview_window.MakeModal(False)
        preview_window.SetPosition(frame.GetPosition())
        preview_window.SetSize(frame.GetSize())
        preview_window.Show(True)
コード例 #6
0
ファイル: PrintOut.py プロジェクト: naushad-rahman/DEVSimPy
    def PrintPreview(self, event):

        parent = self.print_canvas.GetTopLevelParent()

        ### copy in order to not change the size of original canvas when we rescal with zoom
        c = copy.copy(self.print_canvas
                      ) if wx.VERSION_STRING < '4.0' else self.print_canvas

        data = wx.PrintDialogData(self.printData)

        printout = Printout(c)
        printout2 = Printout(c)

        self.preview = wx.PrintPreview(printout, printout2, data)

        if self.preview.IsOk():
            pfrm = wx.PreviewFrame(self.preview,
                                   parent,
                                   _("Print preview"),
                                   style=wx.DEFAULT_FRAME_STYLE
                                   | wx.CLIP_CHILDREN)
            pfrm.SetIcon(parent.GetIcon())
            pfrm.Initialize()
            pfrm.SetPosition((300, 200))
            pfrm.SetSize((550, 700))
            pfrm.Show(True)
            return True

        else:
            sys.stderr.write(_("Problem on print preview...\n"))
            return False
コード例 #7
0
 def OnPrintPreview(self, evt):
     data = wx.PrintDialogData(self.pdata)
     text = self.tc.GetValue()
     printout1 = TextDocPrintout(text, "title", self.margins)
     printout2 = None #TextDocPrintout(text, "title", self.margins)
     preview = wx.PrintPreview(printout1, printout2, data)
     if not preview.Ok():
     wx.MessageBox("Unable to create PrintPreview!", "Error")
     else:
     # create the preview frame such that it overlays the app frame
     frame = wx.PreviewFrame(preview, self, "Print Preview",
     pos=self.GetPosition(),
     size=self.GetSize())
     frame.Initialize()
     frame.Show()
 def OnPrint(self, evt):
     data = wx.PrintDialogData(self.pdata)
     printer = wx.Printer(data)
     text = self.tc.GetValue()
     printout = TextDocPrintout(text, "title", self.margins)
     useSetupDialog = True
     if not printer.Print(self, printout, useSetupDialog) and printer.GetLastError() == wx.PRINTER_ERROR:
         wx.MessageBox(
         "There was a problem printing.\n"
         "Perhaps your current printer is not set correctly?","Printing Error", wx.OK)
     else:
         data = printer.GetPrintDialogData()
         self.pdata = wx.PrintData(data.GetPrintData()) # force a copy
         printout.Destroy()
コード例 #8
0
    def Preview(self, title=None, event=None):
        """ generate Print Preview with wx Print mechanism"""
        if title is None:
            title = self.title
        if self.canvas is None:
            self.canvas = self.parent.canvas

        po1 = PrintoutWx(self.parent.canvas,
                         title=title,
                         width=self.pwidth,
                         margin=self.pmargin)
        po2 = PrintoutWx(self.parent.canvas,
                         title=title,
                         width=self.pwidth,
                         margin=self.pmargin)
        self.preview = wx.PrintPreview(po1, po2, self.printerData)

        if ((is_wxPhoenix and self.preview.IsOk())
                or (not is_wxPhoenix and self.preview.Ok())):
            self.preview.SetZoom(85)
            frameInst = self.parent
            while not isinstance(frameInst, wx.Frame):
                frameInst = frameInst.GetParent()
            frame = wx.PreviewFrame(self.preview, frameInst, "Preview")
            frame.Initialize()
            frame.SetSize((850, 650))
            frame.Centre(wx.BOTH)
            frame.Show(True)
コード例 #9
0
    def print_preview(self, print_area, print_data):
        """Launch print preview"""

        if cairo is None:
            return

        print_info = \
            self.main_window.interfaces.get_cairo_export_info("Print")

        if print_info is None:
            # Dialog has been canceled
            return

        printout_preview = Printout(self.grid, print_data, print_info)
        printout_printing = Printout(self.grid, print_data, print_info)

        preview = wx.PrintPreview(printout_preview, printout_printing,
                                  print_data)

        if not preview.Ok():
            # Printout preview failed
            return

        pfrm = wx.PreviewFrame(preview, self.main_window, _("Print preview"))

        pfrm.Initialize()
        pfrm.SetPosition(self.main_window.GetPosition())
        pfrm.SetSize(self.main_window.GetSize())
        pfrm.Show(True)
コード例 #10
0
 def __on_preview(self, _event):
     printout = PrintOut(self.graph, self.filename, self.pageConfig)
     printoutPrinting = PrintOut(self.graph, self.filename, self.pageConfig)
     preview = wx.PrintPreview(printout, printoutPrinting, self.printConfig)
     frame = wx.PreviewFrame(preview, self, 'Print Preview')
     frame.Initialize()
     frame.SetSize(self.GetSize())
     frame.Show(True)
コード例 #11
0
 def Preview(self, args, parent = None):
     self.body.Retrieve(*args)
     printData = wx.PrintDialogData(self.printData)
     preview = wx.PrintPreview(self.printout, self.printoutForPrinting,
             printData)
     frame = wx.PreviewFrame(preview, parent, self.title,
             size = self.defaultSize)
     frame.Initialize()
     frame.Show(True)
コード例 #12
0
    def OnPrintPreview(self, e):
        printDialogData = wx.PrintDialogData(self.printData)
        preview = wx.PrintPreview(Printout(), Printout(), printDialogData)
        if not preview.IsOk():
            preview = None
            wx.MessageBox('There was a problem previewing.\nPerhaps your current printer is not set correctly?', 'Previewing', wx.OK)

        frame = wx.PreviewFrame(preview, self.frame, 'Print Preview', wx.Point(100,100), wx.Size(600, 650))
        frame.Centre(wx.BOTH)
        frame.Initialize()
        frame.Show()
コード例 #13
0
    def Preview(self):
        """Preview the Print
        @return: None

        """
        printout = self.CreatePrintout()
        printout2 = self.CreatePrintout()
        preview = wx.PrintPreview(printout, printout2, self.print_data)
        pre_frame = wx.PreviewFrame(preview, self.parent, _("Print Preview"))
        pre_frame.Initialize()
        pre_frame.Show()
コード例 #14
0
ファイル: STCPrinting.py プロジェクト: aricsanders/boa
    def OnPrintPreview(self, event):
        printout1 = self.createSTCPrintout()
        printout2 = self.createSTCPrintout()
        self.preview = wx.PrintPreview(printout1, printout2, self.printData)
        if not self.preview.Ok():
            wx.LogError(_('An error occured while preparing preview.'))
            return

        frame = wx.PreviewFrame(self.preview, self.parentFrame, _('Print Preview'))
        frame.Initialize()
        frame.Show(True)
コード例 #15
0
    def GetTotalPages(self):
        self.page_total = 999 
        return self.page_total

        self.preview.SetZoom(110)        # initial zoom value
        frame = wx.PreviewFrame(self.preview, self.parentFrame, "Print preview")

        frame.Initialize()
        if self.parentFrame:
            frame.SetPosition(self.preview_frame_pos)
            frame.SetSize(self.preview_frame_size)
        frame.Show(True)
コード例 #16
0
ファイル: printing.py プロジェクト: wenlibin02/sk1-wx
def print_dlg(parent, presenter):
    app = presenter.app
    printout = SK1_Printout(presenter)
    printout2 = SK1_Printout(presenter)
    data = wx.PrintDialogData(get_print_data(app))
    preview = wx.PrintPreview(printout, printout2, data)
    title = '[%s] - ' % presenter.doc_name + _('Print Preview')
    frame = wx.PreviewFrame(preview, parent, title, size=wx.Size(600, 650))
    frame.Initialize()
    frame.CenterOnParent()
    preview.GetCanvas().SetBackgroundColour(wal.DARK_GRAY)
    frame.Show(True)
コード例 #17
0
ファイル: impresion_vipera.py プロジェクト: RomanVolak/vipera
def f_imprimir_ogl(ogl, frame, print_data, idioma=None):
    '''Función para imprimir diseño del OGL'''
    data = wx.PrintDialogData(print_data)
    printout = MyPrintout(ogl.canvas)
    printout2 = MyPrintout(ogl.canvas)
    preview = wx.PrintPreview(printout, printout2, data)
    if not preview.Ok(): return
    pfrm = wx.PreviewFrame(preview, frame,
                           t(u"Vista preliminar de impresión", idioma))
    pfrm.Initialize()
    pfrm.SetPosition(frame.GetPosition())
    pfrm.SetSize(frame.GetSize())
    pfrm.Show(True)
コード例 #18
0
    def Preview(self):
        if self.InitParametres() == False :
            return
        printPreview = self.printer.printout.GetPrintPreview()
##        preview_window = PreviewFrame(printPreview, None, self.titre, self.orientation)
        printPreview.SetZoom(100)
        frame = wx.GetApp().GetTopWindow() 
        preview_window = wx.PreviewFrame(printPreview, None, _(u"Aperçu avant impression"))
        preview_window.Initialize()
        preview_window.MakeModal(False)
        preview_window.SetPosition(frame.GetPosition())
        preview_window.SetSize(frame.GetSize())
        preview_window.Show(True)
コード例 #19
0
        def OnPrintPreview(self, event):
            """ Print Preview Method """
            # Define a Subtitle
            subtitle = "Subtitles are optional"

            # We already have our report (our self.data structure) defined.  The data should be a list of
            # lines, and each line is a tuple of text elements.   Each text element is a tuple of Style and Text.
            # There can be multiple text elements on a line, but the report creator is responsible for making sure
            # they have different alignments and don't overlap.  A line can also be too long, in which case it is
            # automatically wrapped.
            #
            # The initial data structure needs to be prepared.  What PrepareData() does is to create a graphic
            # object that is the correct size and dimensions for the type of paper selected, and to create
            # a datastructure that breaks the data sent in into separate pages, again based on the dimensions
            # of the paper currently selected.
            (self.graphic,
             self.pageData) = PrepareData(self.printData, self.title,
                                          self.data, subtitle)

            # Send the results of the PrepareData() call to the MyPrintout object, once for the print preview
            # version and once for the printer version.
            printout = MyPrintout(self.title, self.graphic, self.pageData,
                                  subtitle)
            printout2 = MyPrintout(self.title, self.graphic, self.pageData,
                                   subtitle)

            # Create the Print Preview Object
            self.preview = wx.PrintPreview(printout, printout2, self.printData)
            # Check for errors during Print preview construction
            if not self.preview.Ok():
                self.SetStatusText("Print Preview Problem")
                return

            # Create the Frame for the Print Preview
            theWidth = max(
                wx.Display(
                    TransanaGlobal.configData.primaryScreen).GetClientArea()[2]
                - 180, 760)  # wx.ClientDisplayRect()
            theHeight = max(
                wx.Display(
                    TransanaGlobal.configData.primaryScreen).GetClientArea()[3]
                - 200, 560)  # wx.ClientDisplayRect()
            frame2 = wx.PreviewFrame(self.preview,
                                     self,
                                     _("Print Preview"),
                                     size=(theWidth, theHeight))
            frame2.Centre()
            # Initialize the Frame for the Print Preview
            frame2.Initialize()
            # Display the Print Preview Frame
            frame2.Show(True)
コード例 #20
0
 def OnPrintPreview(self, event=None):
     self._checkPrintSetup()
     data = wx.PrintDialogData(self.printData)
     printout = Printout(self)
     printout2 = Printout(self)
     self.preview = wx.PrintPreview(printout, printout2, data)
     if not self.preview.Ok():
         return
     frame = wx.PreviewFrame(self.preview, self.frame,
                             "SPE - Print Preview")
     frame.Initialize()
     frame.SetPosition(self.frame.GetPosition())
     frame.SetSize(self.frame.GetSize())
     frame.Show(True)
コード例 #21
0
 def OnPrintPreview(self, evt):
     data = wx.PrintDialogData(self.pdata)
     text = self.tc.GetValue() 
     printout1 = TextDocPrintout(text, "title", self.margins)
     printout2 = None #TextDocPrintout(text, "title", self.margins)
     preview = wx.PrintPreview(printout1, printout2, data)
     if not preview.Ok():
         wx.MessageBox("Unable to create PrintPreview!", "Error")
     else:
         # create the preview frame such that it overlays the app frame
         frame = wx.PreviewFrame(preview, self, "Print Preview",
                                 pos=self.GetPosition(),
                                 size=self.GetSize())
         frame.Initialize()
         frame.Show()
コード例 #22
0
 def print_preview(self):
     """Print-preview current plot."""
     printout = graph_printout(self)
     printout2 = graph_printout(self)
     self.preview = wx.PrintPreview(printout, printout2, self.print_data)
     if not self.preview.Ok():
         wx.MessageDialog(self, "Print Preview failed.\n" \
                            "Check that default printer is configured\n", \
                            "Print error", wx.OK|wx.CENTRE).ShowModal()
     else:
         frame = wx.PreviewFrame(self.preview, self.parent, "Preview")
         frame.Initialize()
         frame.SetPosition(self.GetPosition())
         frame.SetSize(self.GetSize())
         frame.Show(True)
コード例 #23
0
 def file_preview(self, event):
     printout = graph_printout(self.client)
     printout2 = graph_printout(self.client)
     self.preview = wx.PrintPreview(printout, printout2, self.print_data)
     if not self.preview.Ok():
         #self.log.WriteText("Print Preview failed." \
         #                   "Check that default printer is configured\n")
         print("Print Preview failed." \
               "Check that default printer is configured\n")
         return
     frame = wx.PreviewFrame(self.preview, self, "Preview")
     frame.Initialize()
     frame.SetPosition(self.GetPosition())
     frame.SetSize(self.GetSize())
     frame.Show(True)
コード例 #24
0
ファイル: ed_print.py プロジェクト: wangdyna/wxPython
    def Preview(self):
        """Preview the Print
        @return: None

        """
        printout = self.CreatePrintout()
        printout2 = self.CreatePrintout()
        preview = wx.PrintPreview(printout, printout2, self.print_data)
        preview.SetZoom(150)
        pre_frame = wx.PreviewFrame(preview, self.parent, _("Print Preview"))
        dsize = wx.GetDisplaySize()
        pre_frame.SetInitialSize((self.stc.GetSize()[0],
                                  dsize.GetHeight() - 100))
        pre_frame.Initialize()
        pre_frame.Show()
コード例 #25
0
    def OnPrintPreview(self, event):
        data = wx.PrintDialogData(self.printData)
        printout = MyPrintout(self.canvas, self.log)
        printout2 = MyPrintout(self.canvas, self.log)
        self.preview = wx.PrintPreview(printout, printout2, data)

        if not self.preview.Ok():
            pass

        pfrm = wx.PreviewFrame(self.preview, self.frame, "This is a print preview")

        pfrm.Initialize()
        pfrm.SetPosition(self.frame.GetPosition())
        pfrm.SetSize(self.frame.GetSize())
        pfrm.Show(True)
コード例 #26
0
ファイル: DLG_Stats.py プロジェクト: neoclust/Noethys
    def Imprimer(self, event=None):
        ID = event.GetId() 
        listeCodes = self.ctrl_impression.GetCoches() 
        
        # Imprimer tout
        dlgAttente = wx.BusyInfo(_(u"Création du rapport..."), None)
        if 'phoenix' not in wx.PlatformInfo:
            wx.Yield()
        
        if ID == 10 : 
            html = self.baseHTML.GetHTML(mode="impression", selectionsCodes=listeCodes)
        # Imprimer la rubrique affichée
        if ID == 20 : 
            indexRubrique = self.ctrl_labelbook.GetSelection()
            codeRubrique = self.RechercherElement(indexRubrique=indexRubrique)[0]
            html = self.baseHTML.GetHTML(mode="impression", rubrique=codeRubrique, selectionsCodes=listeCodes)
        # Imprimer la page affichée
        if ID == 30 : 
            codeRubrique, codePage = self.RecherchePageAffichee() 
            html = self.baseHTML.GetHTML(mode="impression", rubrique=codeRubrique, page=codePage, selectionsCodes=listeCodes)
        
        if len(listeCodes) == 0 or len(html) <= 50 :
            dlg = wx.MessageDialog(self, _(u"Vous n'avez sélectionné aucune information à imprimer !"), _(u"Erreur"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        
        del dlgAttente
        
        # Impression
        printout = HtmlPrintout(html)
        printout2 = HtmlPrintout(html)
        preview = wx.PrintPreview(printout, printout2)
        
##        from Utils import UTILS_Printer
##        preview_window = UTILS_Printer.PreviewFrame(preview, None, _(u"Aperçu avant impression"))
##        preview_window.Initialize()
##        preview_window.MakeModal(False)
##        preview_window.Show(True)

        preview.SetZoom(100)
        frame = wx.GetApp().GetTopWindow() 
        preview_window = wx.PreviewFrame(preview, None, _(u"Aperçu avant impression"))
        preview_window.Initialize()
        preview_window.MakeModal(False)
        preview_window.SetPosition(frame.GetPosition())
        preview_window.SetSize(frame.GetSize())
        preview_window.Show(True)
コード例 #27
0
    def Apercu(self, event=None):
        # Aperçu avant impression
        html = self.GetSource()
        printout = HtmlPrintout(html)
        printout2 = HtmlPrintout(html)
        preview = wx.PrintPreview(printout, printout2)

        preview.SetZoom(100)
        frame = wx.GetApp().GetTopWindow()
        preview_window = wx.PreviewFrame(preview, None,
                                         _(u"Aperçu avant impression"))
        preview_window.Initialize()
        preview_window.MakeModal(False)
        preview_window.SetPosition(frame.GetPosition())
        preview_window.SetSize(frame.GetSize())
        preview_window.Show(True)
コード例 #28
0
    def OnPrintPreview(self, event):
        data = wx.PrintDialogData(self.printData)
        printout = MyPrintout(self.canvas, self.log)
        printout2 = MyPrintout(self.canvas, self.log)
        self.preview = wx.PrintPreview(printout, printout2, data)

        if not self.preview.IsOk():
            self.log.WriteText("Houston, we have a problem...\n")
            return

        pfrm = wx.PreviewFrame(self.preview, self.frame, "This is a print preview")

        pfrm.Initialize()
        pfrm.SetPosition(self.frame.GetPosition())
        pfrm.SetSize(self.frame.GetSize())
        pfrm.Show(True)
コード例 #29
0
 def showPrintPreview(self):
     printout = STCPrintout(self.stc, title="Testing!!!", border=True, output_point_size=10)
     printout2 = STCPrintout(self.stc, title="Testing!!!", border=True, output_point_size=10)
     preview = wx.PrintPreview(printout, printout2, self.getPrintData())
     preview.SetZoom(100)
     if preview.IsOk():
         pre_frame = wx.PreviewFrame(preview, self, _("Print Preview"))
         dsize = wx.GetDisplaySize()
         pre_frame.SetInitialSize((self.GetSize()[0],
                                   dsize.GetHeight() - 100))
         pre_frame.Initialize()
         pre_frame.Show()
     else:
         wx.MessageBox(_("Failed to create print preview"),
                       _("Print Error"),
                       style=wx.ICON_ERROR|wx.OK)
コード例 #30
0
ファイル: Calendar.py プロジェクト: wangdyna/wxPython
    def Preview(self):
        printout = SetPrintout(self)
        printout2 = SetPrintout(self)
        self.preview = wx.PrintPreview(printout, printout2, self.printData)

        if not self.preview.Ok():
            wx.MessageBox("There was a problem printing!", "Printing", wx.OK)
            return

        self.preview.SetZoom(60)        # initial zoom value

        frame = wx.PreviewFrame(self.preview, self.frame, "Print preview")

        frame.Initialize()
        frame.SetPosition(self.frame.GetPosition())
        frame.SetSize(self.frame.GetSize())
        frame.Show(True)