[GRASS-SVN] r34381 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 18 17:08:19 EST 2008


Author: martinl
Date: 2008-11-18 17:08:18 -0500 (Tue, 18 Nov 2008)
New Revision: 34381

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/disp_print.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/histogram.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
Log:
glynn: Don't allocate wx.PrintData object until needed (due to warnings)
       (merge from trunk, r34380)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/disp_print.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/disp_print.py	2008-11-18 21:59:19 UTC (rev 34380)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/disp_print.py	2008-11-18 22:08:18 UTC (rev 34381)
@@ -98,16 +98,21 @@
     def __init__(self, parent, mapwin):
         self.mapframe = parent
         self.mapwin = mapwin
-#        self.frame = frame
+	#self.frame = frame
 
+	self.printData = None
+
+	#self.canvas = ScrolledWindow.MyCanvas(self)
+
+    def setup(self):
+	if self.printData:
+	    return
         self.printData = wx.PrintData()
         self.printData.SetPaperId(wx.PAPER_LETTER)
         self.printData.SetPrintMode(wx.PRINT_MODE_PRINTER)
 
-#        self.canvas = ScrolledWindow.MyCanvas(self)
-
-
     def OnPageSetup(self, event):
+	self.setup()
         psdd = wx.PageSetupDialogData(self.printData)
         psdd.CalculatePaperSizeFromId()
         dlg = wx.PageSetupDialog(self.mapwin, psdd)
@@ -121,6 +126,7 @@
         dlg.Destroy()
 
     def OnPrintPreview(self, event):
+	self.setup()
         data = wx.PrintDialogData(self.printData)
         printout = MapPrint(self.mapwin)
         printout2 = MapPrint(self.mapwin)
@@ -138,6 +144,7 @@
         pfrm.Show(True)
 
     def OnDoPrint(self, event):
+	self.setup()
         pdd = wx.PrintDialogData(self.printData)
         # set number of pages/copies
         pdd.SetToPage(1)
@@ -149,3 +156,6 @@
         else:
             self.printData = wx.PrintData( printer.GetPrintDialogData().GetPrintData() )
         printout.Destroy()
+
+    def OnReset(self):
+	self.printData = None

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/histogram.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/histogram.py	2008-11-18 21:59:19 UTC (rev 34380)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/histogram.py	2008-11-18 22:08:18 UTC (rev 34381)
@@ -518,6 +518,10 @@
         printmenu.AppendItem(doprint)
         self.Bind(wx.EVT_MENU, self.printopt.OnDoPrint, doprint)
 
+        reset = wx.MenuItem(printmenu, -1,'Reset')
+        printmenu.AppendItem(reset)
+        self.Bind(wx.EVT_MENU, self.printopt.OnReset, reset)
+
         # Popup the menu.  If an item is selected then its handler
         # will be called before PopupMenu returns.
         self.PopupMenu(printmenu)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-11-18 21:59:19 UTC (rev 34380)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-11-18 22:08:18 UTC (rev 34381)
@@ -3303,6 +3303,10 @@
         printmenu.AppendItem(doprint)
         self.Bind(wx.EVT_MENU, self.printopt.OnDoPrint, doprint)
 
+        reset = wx.MenuItem(printmenu, -1,'Reset')
+        printmenu.AppendItem(reset)
+        self.Bind(wx.EVT_MENU, self.printopt.OnReset, reset)
+
         # Popup the menu.  If an item is selected then its handler
         # will be called before PopupMenu returns.
         self.PopupMenu(printmenu)



More information about the grass-commit mailing list