Beispiel #1
0
    def OnPrintPreview(self, event):
        self.setup()
        data = wx.PrintDialogData(self.printData)
        printout = MapPrint(self.mapwin)
        printout2 = MapPrint(self.mapwin)
        self.preview = wx.PrintPreview(printout, printout2, data)

        if not self.preview.Ok():
            wx.MessageBox("There was a problem printing this display\n", wx.OK)
            return

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

        pfrm.Initialize()
        pfrm.SetPosition(self.mapframe.GetPosition())
        pfrm.SetSize(self.mapframe.GetClientSize())
        pfrm.Show(True)
    def printPreview(self, text):
        data = wx.PrintDialogData(self.pdata)
        printout1 = TextDocPrintout(text, '打印预览', self.margins)
        printout2 = None
        preview = wx.PrintPreview(printout1, printout2, data)
        if not preview.Ok():
            return False
        else:
            frame = wx.PreviewFrame(preview,
                                    self.parent,
                                    '打印预览',
                                    pos=self.parent.GetPosition(),
                                    size=self.parent.GetSize())
            frame.Initialize()
            frame.Show()

        return True
Beispiel #3
0
 def OnPrintPreview(self, evt):
     data = wx.PrintDialogData(self.pdata)
     text = self.tc.GetValue()
     printout1 = TextDocPrintout(text, "title", self.margins)
     printout2 = TextDocPrintout(text, "title", self.margins)
     preview = wx.PrintPreview(printout1, printout2, data)
     if not preview:
         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()
Beispiel #4
0
    def Preview(self):
        printout = SetPrintout(self)
        printout2 = SetPrintout(self)
        self.preview = wx.PrintPreview(printout, printout2, self.printData)

        if not self.preview.IsOk():
            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)
Beispiel #5
0
    def Preview(self):
        data = wx.PrintDialogData(self.printData)
        printout = SetPrintout(self)
        printout2 = SetPrintout(self)
        self.preview = wx.PrintPreview(printout, printout2, data)
        if not self.preview.IsOk():
            wx.MessageBox("There was a problem printing!", "Printing", wx.OK)
            return

        self.preview.SetZoom(60)        # 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)
Beispiel #6
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)
Beispiel #7
0
def RunTest(panel, frame):
    pd = wx.PrintData()
    pdd = wx.PrintDialogData()
    pdd.SetPrintData(pd)
    printer = wx.Printer(pdd)
    printout = MyPrintout()
    printout2 = MyPrintout()

    preview = wx.PrintPreview(printout, printout2)
    preview.SetZoom(90)
    if not preview.Ok():
        print('preview error')
        return
    frame2 = wx.PreviewFrame(preview, frame, "This is a print preview")
    frame2.Initialize()
    frame2.SetPosition(frame.GetPosition())
    frame2.SetSize(frame.GetSize())
    wx.CallAfter(frame2.Show, True)
Beispiel #8
0
 def Preview(self, bmp):
     printout = self.CreatePrintout(bmp)
     printout2 = self.CreatePrintout(bmp)
     preview = wx.PrintPreview(printout, printout2, self.print_data)
     preview.SetZoom(100)
     if preview.IsOk():
         pre_frame = wx.PreviewFrame(preview, self.parent, "Print Preview")
         # Default size of the preview frame needs help
         dsize = wx.GetDisplaySize()
         width = self.parent.GetSize()[0]
         height = dsize.GetHeight() - 100
         pre_frame.SetInitialSize((width, height))
         pre_frame.Initialize()
         pre_frame.Show()
     else:
         wx.MessageBox("Failed to create print preview",
                       "Print Error",
                       style=wx.ICON_ERROR | wx.OK)
Beispiel #9
0
 def Preview(self, editor):
     printout1 = Printout(editor, self.margins)
     printout2 = Printout(editor, self.margins)
     preview = wx.PrintPreview(printout1, printout2, self.pdata)
     preview.SetZoom(100)
     if preview.IsOk():
         frame = wx.PreviewFrame(
             preview, editor._frame,
             _("Print Preview (%s) - Write++") %
             os.path.split(editor.filename)[1],
             editor._frame.rect.GetPosition(), editor._frame.rect.GetSize())
         frame.Initialize()
         frame.Show()
     else:
         wx.MessageBox(
             _("'%s' cannot be previewed.\nMake sure that you have a print driver installed."
               ) % editor.filename, _("Print Preview"),
             wx.ICON_ERROR | wx.OK)
Beispiel #10
0
 def previewPrintout(self):
     data = PageSetup.getPageSetupData()
     printout = self.mode.getPrintout(data)
     printout2 = self.mode.getPrintout(data)
     preview = wx.PrintPreview(printout, printout2, PageSetup.getPrintData())
     preview.SetZoom(100)
     if preview.IsOk():
         pre_frame = wx.PreviewFrame(preview, self.mode.frame,
                                          _("Print Preview"))
         dsize = wx.GetDisplaySize()
         pre_frame.SetInitialSize((self.mode.frame.GetSize()[0],
                                   self.mode.frame.GetSize()[1]))
         pre_frame.Initialize()
         pre_frame.Show()
     else:
         wx.MessageBox(_("Failed to create print preview"),
                       _("Print Error"),
                       style=wx.ICON_ERROR|wx.OK)
Beispiel #11
0
    def __init__(self, parent, **argv):
        self.canvas = HtmlCanvas(parent.Parametry)
        self.printData = wx.PrintData()
        self.printData.SetPaperId(wx.PAPER_A4)
        self.printData.SetPrintMode(wx.PRINT_MODE_PRINTER)
        self.printData.SetOrientation(wx.PORTRAIT)

        data = wx.PrintDialogData(self.printData)
        printout = MyPrintout(self.canvas)
        printout2 = MyPrintout(self.canvas)
        self.preview = wx.PrintPreview(printout, printout2, data)
        if 'name' in argv:
            name = argv['name']
        else:
            name = 'htmlpreview'
        wx.PreviewCanvas.__init__(self, self.preview, parent, name=name)

        self.preview.SetCanvas(self)
        self.preview.SetZoom(100)
Beispiel #12
0
    def PrintPreview(self, parent=None, title="ObjectListView Print Preview", bounds=(20, 50, 800, 800)):
        """
        Show a Print Preview of this report
        """
        data = wx.PrintDialogData(self.printData)
        t = TestPrinter(self.margins)
        t2 = TestPrinter(self.margins)
        self.preview = wx.PrintPreview(t, t2, data)

        if not self.preview.Ok():
            return False

        pfrm = wx.PreviewFrame(self.preview, parent, title)

        pfrm.Initialize()
        pfrm.SetPosition(bounds[0:2])
        pfrm.SetSize(bounds[2:4])
        pfrm.Show(True)

        return True
Beispiel #13
0
 def printPreview(self, event):
     printout1 = RichTextPrintout()
     printout1.SetRichTextBuffer(
         self.rtc.GetBuffer())  # Set the rich text buffer
     printout2 = RichTextPrintout()
     printout2.SetRichTextBuffer(self.rtc.GetBuffer())
     data = wx.PrintDialogData()
     data.SetAllPages(True)
     data.SetCollate(True)
     datapr = wx.PrintData()
     data.SetPrintData(datapr)
     # Impression
     preview = wx.PrintPreview(printout1, printout2, data)
     if not preview.Ok():
         return
     pfrm = wx.PreviewFrame(preview, self, "Print Preview Test")
     pfrm.Initialize()
     pfrm.SetPosition(self.GetPosition())
     pfrm.SetSize(self.GetSize())
     pfrm.Show(True)
 def printPreview(context, text):
     data = wx.PrintDialogData(
         context.pdata)  # Initialize data as a PrintDialogData object
     printout1 = Print(
         text, "title",
         context.margins)  # Set printout 1 and 2 to display the text
     printout2 = print(text, "title", context.margins)
     preview = wx.PrintPreview(printout1, printout2,
                               data)  # Set Preview Data
     if not preview.IsOk():  # If not preview.Ok (something went wrong)
         wx.MessageBox("Unable to create Print Preview!",
                       "Error")  # Display an error window
     else:  # Everything worked
         frame = wx.PreviewFrame(preview,
                                 context,
                                 "Print Preview",
                                 pos=context.GetPosition(),
                                 size=(800, 500))  # Render the preview
         frame.Initialize()  # Initialize the frame
         frame.Show()  # Show the window
Beispiel #15
0
    def doPreview(self, printer, wikiDocument, wordList, printType, addopt):
        self.setContext(printer, wikiDocument, wordList, printType, addopt)
        text = self._buildHtml()

        try:
            pddata = wx.PrintDialogData(self.printer.getPrintData())
            printout = HtmlPrintout(text, self.printer)
            printout2 = HtmlPrintout(text, self.printer)

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

            frame = wx.PreviewFrame(preview, self.mainControl, _("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)
        finally:
            self._freeHtml()
Beispiel #16
0
 def OnPrintPreview(self, event=None):
     self.OnSave()
     self.__customPageSetup()
     #Set data to print
     printout = Printout(self)
     printoutForPrinting = Printout(self)
     preview = wx.PrintPreview(printout, printoutForPrinting,
                               self.printData)
     if not preview.Ok():
         wx.MessageBox(_(u"Unable to create Print Preview!"),
                       _(u"Preview Error"))
     else:
         previewFrame = wx.PreviewFrame(preview,
                                        self,
                                        _(u"Print Preview"),
                                        pos=self.GetPosition(),
                                        size=self.GetSize())
         previewFrame.Initialize()
         previewFrame.Show()
     return True
Beispiel #17
0
 def PreviewText(self, htmltext, basepath="", scale=1.0):
     printout1=self._getprintout(htmltext, basepath, scale)
     printout2=self._getprintout(htmltext, basepath, scale)
     if self.printData.Ok():
         pd=self.printData.copy()
     else:
         pd=PrintData()
     if not pd.Orientation:
         pd.SetOrientation(wx.PORTRAIT)
     preview=wx.PrintPreview(printout1, printout2, pd)
     if not preview.Ok():
         print "preview problem"
         assert False, "preview problem"
         return
     self.frame=wx.PreviewFrame(preview, self.parent, "Print Preview")
     self.guiwidgets.set_size("PrintPreview", self.frame, screenpct=90, aspect=0.58)
     wx.EVT_CLOSE(self.frame, self.OnPreviewClose)
     self.frame.Initialize()
     # self.frame.SetPosition(self.parent.GetPosition())
     # self.frame.SetSize(self.parent.GetSize())
     self.frame.Show(True)
    def print_preview(self, print_area, print_data):
        """Launch print preview"""

        # Create the print canvas
        canvas = PrintCanvas(self.main_window, self.grid, print_area)

        printout = Printout(canvas)
        printout2 = Printout(canvas)

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

        if not preview.Ok():
            print "Printout preview failed.\n"
            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)
Beispiel #19
0
    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)
        if preview.IsOk():
            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()
        else:
            wx.MessageBox(_("Failed to create print preview"),
                          _("Print Error"),
                          style=wx.ICON_ERROR | wx.OK)
Beispiel #20
0
    def previewFigure(self, figure, title=None):
        """
        Open a "Print Preview" window for the matplotlib chart C{figure}.  The
        keyword argument C{title} provides the printing framework with a title
        for the print job.
        """
        window = self.view
        while not isinstance(window, wx.Frame):
            window = window.GetParent()
            assert window is not None

        fpo = FigurePrintout(figure, title)
        fpo4p = FigurePrintout(figure, title)
        preview = wx.PrintPreview(fpo, fpo4p, self.pData)
        frame = wx.PreviewFrame(preview, window, 'Print Preview')
        if self.pData.GetOrientation() == wx.PORTRAIT:
            frame.SetSize(wx.Size(450, 625))
        else:
            frame.SetSize(wx.Size(600, 500))
        frame.Initialize()
        frame.Show(True)
        self.copyPrintData()
Beispiel #21
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)
Beispiel #22
0
    def OnBtnPreview(self, event):
        """
        Show the print preview.
        """

        text = self.tc.GetValue()

        #------------

        data = wx.PrintDialogData(self.printdata)

        printout1 = My_Printout(self.canvas, text, "- My printing object")
        printout2 = My_Printout(self.canvas, text, "- My printing object")

        printPreview = wx.PrintPreview(printout1, printout2, data)

        # Initial zoom value.
        if "__WXMAC__" in wx.PlatformInfo:
            printPreview.SetZoom(50)
        else:
            printPreview.SetZoom(35)

        if not printPreview.IsOk():
            wx.MessageBox(("There was a problem printing.\nPerhaps "\
                           "your current printer is \nnot "\
                           "set correctly ?"),
                          ("Printing"),
                          wx.OK)
            return

        else:
            previewFrame = wx.PreviewFrame(printPreview, None, "Print preview")
            previewFrame.Initialize()
            previewFrame.SetPosition(self.GetPosition())
            previewFrame.SetSize(self.GetSize())
            # Or full screen :
            # previewFrame.Maximize()
            previewFrame.Show(True)
            previewFrame.Layout()
        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)
Beispiel #24
0
    def OnPrintPreview(self, event):
        data = wx.PrintDialogData(self.m_pd)
        printout = self.m_po(self.m_canvas)
        printout2 = self.m_po(self.m_canvas)
        self.preview = wx.PrintPreview(printout, printout2, data)

        if not self.preview.Ok():
            info("Houston, we have a problem...\n")
            return

        # be sure to have a Frame object
        frameInst = self
        while not isinstance(frameInst, wx.Frame):
            frameInst = frameInst.GetParent()

        # create the Frame for previewing
        pfrm = wx.PreviewFrame(self.preview, frameInst,
                               message('print_preview'))

        pfrm.Initialize()
        pfrm.SetPosition(self.m_parent.GetPosition())
        pfrm.SetSize(self.m_parent.GetSize())
        pfrm.Show(True)
Beispiel #25
0
def f_imprimir_texto(editor, frame, print_data, idioma=None):
    '''Función para imprimir texto del editor'''
    pdata = print_data
    margenes = (wx.Point(15, 15), wx.Point(15, 15))
    # Inicializamos vista preliminar de impresión.
    data = wx.PrintDialogData(pdata)
    # Obtenemos texto del editor.
    text = editor.GetText()
    # Instanciamos clase Printout.
    printout1 = EditorPrintout(text, t(u"Título", idioma), margenes)
    printout2 = EditorPrintout(text, t(u"Título", idioma), margenes)
    # Instanciamos wx.PrintPreview.
    preview = wx.PrintPreview(printout1, printout2, data)
    if not preview.Ok():
        wx.MessageBox(t(u"No se puede mostrar la vista preliminar", idioma),
                      t(u"Atención", idioma), wx.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)
Beispiel #26
0
 def PrintPreview(self, printer_name=None, orientation=None):
     pdd = wx.PrintDialogData()
     pdd.SetMinPage(1)
     pdd.SetFromPage(1)
     pdd.SetMaxPage(self.numpages)
     pdd.SetToPage(self.numpages)
     pdata = pdd.GetPrintData()
     if printer_name:
         pdata.SetPrinterName(printer_name)
     if orientation:
         pdata.SetOrientation(orientation)
     # PrintData does not return actual PrintQuality - it can't as printer_name not known
     # but it defaults to wx.PRINT_QUALITY_HIGH, overriding user's own setting for the
     # printer. However calling SetQuality with a value of 0 seems to leave the printer
     # setting untouched
     pdata.SetQuality(0)
     printer = wx.Printer(pdd)
     # printout = pdfPrintout('', self)
     preview = wx.PrintPreview(pdfPrintout('', self), pdfPrintout('', self))
     # preview.Print(prompt=True)
     preview_frame = wx.PreviewFrame(preview, self)
     preview_frame.Initialize()
     preview_frame.Show()
Beispiel #27
0
    def OnPrintPreview(self, event):
        data = wx.PrintDialogData(self.printData)
        printout = MyPrintout(self.canvas)
        printout2 = None  #MyPrintout(self.canvas)
        self.preview = wx.PrintPreview(printout, printout2, data)

        if not self.preview.Ok():
            self.log.WriteText("Houston, we have a problem...\n")
            return
        #frame = wx.PreviewFrame(self.preview, self, "Print Preview",
        #                            pos=self.GetPosition(),
        #                            size=self.GetSize())
        #frame.Initialize()
        #frame.Show()

        pfrm = wx.PreviewFrame(self.preview, self.frame,
                               u"اين پيش نمايش چاپ است ")

        pfrm.Initialize()
        pfrm.SetPosition(self.frame.GetPosition())
        #pfrm.SetSize(self.frame.GetSize())
        pfrm.SetSize((300, 500))
        pfrm.Show(True)
Beispiel #28
0
	def onPrintPreview(self, evt):
		data = wx.PrintDialogData(self.printData)
		printout = PBPrint(self.dsp, self.fileName)
		printout2 = PBPrint(self.dsp, self.fileName)
		self.preview = wx.PrintPreview(printout, printout2, data)

		if not self.preview.Ok():
			rc = self.preview.GetLastError()
			if rc == wx.PRINTER_ERROR:
				wx.MessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wx.OK)
				return

		title = "Print Preview: "
		if self.fileName is None:
			title += "<untitled>"
		else:
			title += self.fileName
		pfrm = wx.PreviewFrame(self.preview, self.parent, title)

		pfrm.Initialize()
		pfrm.SetPosition(self.GetPosition())
		pfrm.SetSize(self.GetSize())
		pfrm.Show(True)
Beispiel #29
0
 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)
Beispiel #30
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)