PrintFramework fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26157 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -100,22 +100,23 @@ class TestPrintPanel(wx.Panel):
|
|||||||
|
|
||||||
self.printData = wx.PrintData()
|
self.printData = wx.PrintData()
|
||||||
self.printData.SetPaperId(wx.PAPER_LETTER)
|
self.printData.SetPaperId(wx.PAPER_LETTER)
|
||||||
|
self.printData.SetPrintMode(wx.PRINT_MODE_PRINTER)
|
||||||
|
|
||||||
self.box = wx.BoxSizer(wx.VERTICAL)
|
self.box = wx.BoxSizer(wx.VERTICAL)
|
||||||
self.canvas = ScrolledWindow.MyCanvas(self)
|
self.canvas = ScrolledWindow.MyCanvas(self)
|
||||||
self.box.Add(self.canvas, 1, wx.GROW)
|
self.box.Add(self.canvas, 1, wx.GROW)
|
||||||
|
|
||||||
subbox = wx.BoxSizer(wx.HORIZONTAL)
|
subbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
btn = wx.Button(self, ID_Setup, "Print Setup")
|
btn = wx.Button(self, ID_Setup, "Print Setup")
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnPrintSetup, id=ID_Setup)
|
self.Bind(wx.EVT_BUTTON, self.OnPrintSetup, btn)
|
||||||
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
|
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
|
||||||
|
|
||||||
btn = wx.Button(self, ID_Preview, "Print Preview")
|
btn = wx.Button(self, ID_Preview, "Print Preview")
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnPrintPreview, id=ID_Preview)
|
self.Bind(wx.EVT_BUTTON, self.OnPrintPreview, btn)
|
||||||
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
|
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
|
||||||
|
|
||||||
btn = wx.Button(self, ID_Print, "Print")
|
btn = wx.Button(self, ID_Print, "Print")
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnDoPrint, id=ID_Print)
|
self.Bind(wx.EVT_BUTTON, self.OnDoPrint, btn)
|
||||||
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
|
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
|
||||||
|
|
||||||
self.box.Add(subbox, 0, wx.GROW)
|
self.box.Add(subbox, 0, wx.GROW)
|
||||||
@@ -125,8 +126,8 @@ class TestPrintPanel(wx.Panel):
|
|||||||
|
|
||||||
|
|
||||||
def OnPrintSetup(self, event):
|
def OnPrintSetup(self, event):
|
||||||
printerDialog = wx.PrintDialog(self)
|
data = wx.PrintDialogData(self.printData)
|
||||||
printerDialog.GetPrintDialogData().SetPrintData(self.printData)
|
printerDialog = wx.PrintDialog(self, data)
|
||||||
printerDialog.GetPrintDialogData().SetSetupDialog(True)
|
printerDialog.GetPrintDialogData().SetSetupDialog(True)
|
||||||
printerDialog.ShowModal();
|
printerDialog.ShowModal();
|
||||||
self.printData = printerDialog.GetPrintDialogData().GetPrintData()
|
self.printData = printerDialog.GetPrintDialogData().GetPrintData()
|
||||||
@@ -135,9 +136,10 @@ class TestPrintPanel(wx.Panel):
|
|||||||
|
|
||||||
def OnPrintPreview(self, event):
|
def OnPrintPreview(self, event):
|
||||||
self.log.WriteText("OnPrintPreview\n")
|
self.log.WriteText("OnPrintPreview\n")
|
||||||
|
data = wx.PrintDialogData(self.printData)
|
||||||
printout = MyPrintout(self.canvas, self.log)
|
printout = MyPrintout(self.canvas, self.log)
|
||||||
printout2 = MyPrintout(self.canvas, self.log)
|
printout2 = MyPrintout(self.canvas, self.log)
|
||||||
self.preview = wx.PrintPreview(printout, printout2, self.printData)
|
self.preview = wx.PrintPreview(printout, printout2, data)
|
||||||
|
|
||||||
if not self.preview.Ok():
|
if not self.preview.Ok():
|
||||||
self.log.WriteText("Houston, we have a problem...\n")
|
self.log.WriteText("Houston, we have a problem...\n")
|
||||||
@@ -153,12 +155,12 @@ class TestPrintPanel(wx.Panel):
|
|||||||
|
|
||||||
|
|
||||||
def OnDoPrint(self, event):
|
def OnDoPrint(self, event):
|
||||||
pdd = wx.PrintDialogData()
|
pdd = wx.PrintDialogData(self.printData)
|
||||||
pdd.SetPrintData(self.printData)
|
pdd.SetToPage(2)
|
||||||
printer = wx.Printer(pdd)
|
printer = wx.Printer(pdd)
|
||||||
printout = MyPrintout(self.canvas, self.log)
|
printout = MyPrintout(self.canvas, self.log)
|
||||||
|
|
||||||
if not printer.Print(self.frame, printout):
|
if not printer.Print(self.frame, printout, True):
|
||||||
wx.MessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wx.OK)
|
wx.MessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wx.OK)
|
||||||
else:
|
else:
|
||||||
self.printData = printer.GetPrintDialogData().GetPrintData()
|
self.printData = printer.GetPrintDialogData().GetPrintData()
|
||||||
|
@@ -164,7 +164,9 @@ public:
|
|||||||
|
|
||||||
class wxPrintDialogData : public wxObject {
|
class wxPrintDialogData : public wxObject {
|
||||||
public:
|
public:
|
||||||
|
%nokwargs wxPrintDialogData;
|
||||||
wxPrintDialogData();
|
wxPrintDialogData();
|
||||||
|
wxPrintDialogData(const wxPrintData& printData);
|
||||||
~wxPrintDialogData();
|
~wxPrintDialogData();
|
||||||
|
|
||||||
int GetFromPage() const;
|
int GetFromPage() const;
|
||||||
@@ -458,9 +460,13 @@ public:
|
|||||||
|
|
||||||
class wxPrintPreview : public wxObject {
|
class wxPrintPreview : public wxObject {
|
||||||
public:
|
public:
|
||||||
|
%nokwargs wxPrintPreview;
|
||||||
wxPrintPreview(wxPyPrintout* printout,
|
wxPrintPreview(wxPyPrintout* printout,
|
||||||
wxPyPrintout* printoutForPrinting,
|
wxPyPrintout* printoutForPrinting,
|
||||||
wxPrintData* data=NULL);
|
wxPrintDialogData *data=NULL);
|
||||||
|
wxPrintPreview(wxPyPrintout* printout,
|
||||||
|
wxPyPrintout* printoutForPrinting,
|
||||||
|
wxPrintData* data);
|
||||||
|
|
||||||
virtual bool SetCurrentPage(int pageNum);
|
virtual bool SetCurrentPage(int pageNum);
|
||||||
int GetCurrentPage();
|
int GetCurrentPage();
|
||||||
@@ -545,6 +551,11 @@ class wxPyPrintPreview : public wxPrintPreview
|
|||||||
{
|
{
|
||||||
DECLARE_CLASS(wxPyPrintPreview)
|
DECLARE_CLASS(wxPyPrintPreview)
|
||||||
public:
|
public:
|
||||||
|
wxPyPrintPreview(wxPyPrintout* printout,
|
||||||
|
wxPyPrintout* printoutForPrinting,
|
||||||
|
wxPrintDialogData* data=NULL)
|
||||||
|
: wxPrintPreview(printout, printoutForPrinting, data)
|
||||||
|
{}
|
||||||
wxPyPrintPreview(wxPyPrintout* printout,
|
wxPyPrintPreview(wxPyPrintout* printout,
|
||||||
wxPyPrintout* printoutForPrinting,
|
wxPyPrintout* printoutForPrinting,
|
||||||
wxPrintData* data=NULL)
|
wxPrintData* data=NULL)
|
||||||
@@ -585,10 +596,13 @@ class wxPyPrintPreview : public wxPrintPreview
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
%pythonAppend wxPyPrintPreview "self._setCallbackInfo(self, PyPrintPreview)"
|
%pythonAppend wxPyPrintPreview "self._setCallbackInfo(self, PyPrintPreview)"
|
||||||
|
%nokwargs wxPyPrintPreview;
|
||||||
wxPyPrintPreview(wxPyPrintout* printout,
|
wxPyPrintPreview(wxPyPrintout* printout,
|
||||||
wxPyPrintout* printoutForPrinting,
|
wxPyPrintout* printoutForPrinting,
|
||||||
wxPrintData* data=NULL);
|
wxPrintDialogData* data=NULL);
|
||||||
|
wxPyPrintPreview(wxPyPrintout* printout,
|
||||||
|
wxPyPrintout* printoutForPrinting,
|
||||||
|
wxPrintData* data);
|
||||||
|
|
||||||
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user