Make the copy ctor for the wxPrint*Data classes avaialble from
Python. This is so we can ensure we get a copy of the data objects when needed instead of just a reference to a data object within another that may get deleted unexpectedly. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -130,7 +130,12 @@ class TestPrintPanel(wx.Panel):
|
|||||||
printerDialog = wx.PrintDialog(self, data)
|
printerDialog = wx.PrintDialog(self, data)
|
||||||
printerDialog.GetPrintDialogData().SetSetupDialog(True)
|
printerDialog.GetPrintDialogData().SetSetupDialog(True)
|
||||||
printerDialog.ShowModal();
|
printerDialog.ShowModal();
|
||||||
self.printData = printerDialog.GetPrintDialogData().GetPrintData()
|
|
||||||
|
# this makes a copy of the wx.PrintData instead of just saving
|
||||||
|
# a reference to the one inside the printDialogData that will
|
||||||
|
# be destroyed
|
||||||
|
self.printData = wx.PrintData( printerDialog.GetPrintDialogData().GetPrintData() )
|
||||||
|
|
||||||
printerDialog.Destroy()
|
printerDialog.Destroy()
|
||||||
|
|
||||||
|
|
||||||
@@ -163,7 +168,7 @@ class TestPrintPanel(wx.Panel):
|
|||||||
if not printer.Print(self.frame, printout, True):
|
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 = wx.PrintData( printer.GetPrintDialogData().GetPrintData() )
|
||||||
printout.Destroy()
|
printout.Destroy()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -40,7 +40,10 @@ enum wxPrintMode
|
|||||||
|
|
||||||
class wxPrintData : public wxObject {
|
class wxPrintData : public wxObject {
|
||||||
public:
|
public:
|
||||||
|
%nokwargs wxPrintData;
|
||||||
wxPrintData();
|
wxPrintData();
|
||||||
|
wxPrintData(const wxPrintData& data); // for making copies
|
||||||
|
|
||||||
~wxPrintData();
|
~wxPrintData();
|
||||||
|
|
||||||
int GetNoCopies();
|
int GetNoCopies();
|
||||||
@@ -103,7 +106,9 @@ public:
|
|||||||
|
|
||||||
class wxPageSetupDialogData : public wxObject {
|
class wxPageSetupDialogData : public wxObject {
|
||||||
public:
|
public:
|
||||||
|
%nokwargs wxPageSetupDialogData;
|
||||||
wxPageSetupDialogData();
|
wxPageSetupDialogData();
|
||||||
|
wxPageSetupDialogData(const wxPageSetupDialogData& data); // for making copies
|
||||||
~wxPageSetupDialogData();
|
~wxPageSetupDialogData();
|
||||||
|
|
||||||
void EnableHelp(bool flag);
|
void EnableHelp(bool flag);
|
||||||
@@ -168,7 +173,7 @@ class wxPrintDialogData : public wxObject {
|
|||||||
public:
|
public:
|
||||||
%nokwargs wxPrintDialogData;
|
%nokwargs wxPrintDialogData;
|
||||||
wxPrintDialogData();
|
wxPrintDialogData();
|
||||||
wxPrintDialogData(const wxPrintData& printData);
|
wxPrintDialogData(const wxPrintData& printData); // for making copies
|
||||||
~wxPrintDialogData();
|
~wxPrintDialogData();
|
||||||
|
|
||||||
int GetFromPage() const;
|
int GetFromPage() const;
|
||||||
|
Reference in New Issue
Block a user