# HG changeset patch # User laurent # Date 1316118572 -7200 # Node ID 984c51d1bf6b7caf75cfdad05e7da43042eac430 # Parent 01e2c3d58a279b330ff82b99fbcdd085c028bfb5 Fix PrintPreview behavior diff -r 01e2c3d58a27 -r 984c51d1bf6b PLCOpenEditor.py --- a/PLCOpenEditor.py Wed Sep 14 23:06:47 2011 +0200 +++ b/PLCOpenEditor.py Thu Sep 15 22:29:32 2011 +0200 @@ -319,8 +319,8 @@ kind=wx.ITEM_NORMAL, text=_(u'Undo\tCTRL+Z')) AppendMenu(parent, help='', id=wx.ID_REDO, kind=wx.ITEM_NORMAL, text=_(u'Redo\tCTRL+Y')) - AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO, - kind=wx.ITEM_CHECK, text=_(u'Enable Undo/Redo')) + #AppendMenu(parent, help='', id=ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO, + # kind=wx.ITEM_CHECK, text=_(u'Enable Undo/Redo')) parent.AppendSeparator() AppendMenu(parent, help='', id=wx.ID_CUT, kind=wx.ITEM_NORMAL, text=_(u'Cut\tCTRL+X')) @@ -947,10 +947,14 @@ preview = wx.PrintPreview(printout, printout2, data) if preview.Ok(): - preview_frame = wx.PreviewFrame(preview, self, _("Print preview")) + preview_frame = wx.PreviewFrame(preview, self, _("Print preview"), style=wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT) preview_frame.Initialize() + preview_canvas = preview.GetCanvas() + preview_canvas.SetMinSize(preview_canvas.GetVirtualSize()) + preview_frame.Fit() + preview_frame.Show(True) def OnPrintMenu(self, event): @@ -965,7 +969,7 @@ printer = wx.Printer(dialog_data) printout = GraphicPrintout(window, page_size, margins) - if not printer.Print(self, printout, True): + if not printer.Print(self, printout, True) and printer.GetLastError() != wx.PRINTER_CANCELLED: self.ShowErrorMessage(_("There was a problem printing.\nPerhaps your current printer is not set correctly?")) printout.Destroy()