|
From: <sir...@us...> - 2003-02-23 21:01:49
|
Update of /cvsroot/btplusplus/BT++/src/TabTrans
In directory sc8-pr-cvs1:/tmp/cvs-serv22167/src/TabTrans
Modified Files:
Grid.py
Log Message:
The painting of the window is now encapsulated by a try - except block. Trivial errors, that are likely to occure when drawing are thus ignored. The grid is redrawn pretty frequent, so one draw failing shouldn't matter.
Index: Grid.py
===================================================================
RCS file: /cvsroot/btplusplus/BT++/src/TabTrans/Grid.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Grid.py 22 Feb 2003 21:12:30 -0000 1.5
--- Grid.py 23 Feb 2003 21:01:42 -0000 1.6
***************
*** 212,298 ****
###########################################################################################################
! def OnPaint(self, evt):
if self.IsShown() == false:
return
- if self.Table.GetNumberCols() == 0 or \
- self.Table.GetNumberRows() == 0:
- return
-
- dc = self.BufferDC
-
- # Clear background
- dc.SetBackground( self.DrawTools['EmptyBackground'] )
- dc.Clear()
-
- # Draw the selections
- dc.SetPen( self.DrawTools['HighlightOutline'] )
- dc.SetBrush( self.DrawTools['HighlightColor'] )
-
- if self.currentSelection != []:
- sel = self.currentSelection
- rect = self.BlockToDeviceRect( wxGridCellCoords(sel[0], 0),
- wxGridCellCoords(sel[len(sel)-1], 6) )
-
- dc.DrawRectangle( rect.x + 2,
- rect.y + 20,
- rect.width + 21,
- rect.height - 5 )
! numcols = range(self.Table.GetNumberCols())
! numrows = range(self.Table.GetNumberRows())
! x = 0
! y = 0
!
! # Draw the col labels
! dc.SetPen( self.DrawTools['HighlightOutline'] )
! dc.SetBrush( self.DrawTools['HighlightColor'] )
!
! dc.SetTextForeground( self.DrawTools['LabelFontColor'] )
! dc.SetFont( self.DrawTools['LabelFont'] )
!
! for col in numcols:
! rect = wxRect( x, 0, self.GetColSize(col), 18 )
! x = x + self.GetColSize(col)
! dc.DrawRectangle( rect.x + 25,
! rect.y,
! rect.width,
! rect.height )
! dc.DrawText( self.Table.GetColLabelValue(col),
! rect.x + 29,
! rect.y + 2 )
!
! # Draw the row 'labels'
! for row in numrows:
!
! dc.DrawBitmap( self.DrawTools['ArrowBitmap'], 0, y + 20, true )
! y = y + self.GetRowSize(row)
!
! for col in numcols:
! for row in numrows:
! rect = self.CellToRect(row, col)
! rend = self.GetCellRenderer(row, col)
! rend.Draw( self,
! None,
! dc,
! wxRect( rect.x + 25,
! rect.y + 18,
! rect.width,
! rect.height ),
! row,
! col,
! true )
!
! w, h = dc.GetSizeTuple()
- ondc = wxClientDC(self)
- ondc.Blit(0, 0, w, h, dc, 0, 0 )
def OnSize(self, evt):
--- 212,299 ----
###########################################################################################################
! def OnPaint(self, evt = None):
if self.IsShown() == false:
return
! try:
! dc = self.BufferDC
! # Clear background
! dc.SetBackground( self.DrawTools['EmptyBackground'] )
! dc.Clear()
! # Draw the selections
! dc.SetPen( self.DrawTools['HighlightOutline'] )
! dc.SetBrush( self.DrawTools['HighlightColor'] )
!
! if self.currentSelection != []:
! sel = self.currentSelection
! rect = self.BlockToDeviceRect( wxGridCellCoords(sel[0], 0),
! wxGridCellCoords(sel[len(sel)-1], 6) )
!
! dc.DrawRectangle( rect.x + 2,
! rect.y + 20,
! rect.width + 21,
! rect.height - 5 )
!
! numcols = range(self.Table.GetNumberCols())
! numrows = range(self.Table.GetNumberRows())
!
! x = 0
! y = 0
! # Draw the col labels
! dc.SetPen( self.DrawTools['HighlightOutline'] )
! dc.SetBrush( self.DrawTools['HighlightColor'] )
!
! dc.SetTextForeground( self.DrawTools['LabelFontColor'] )
! dc.SetFont( self.DrawTools['LabelFont'] )
! for col in numcols:
! rect = wxRect( x, 0, self.GetColSize(col), 18 )
! x = x + self.GetColSize(col)
! dc.DrawRectangle( rect.x + 25,
! rect.y,
! rect.width,
! rect.height )
!
! dc.DrawText( self.Table.GetColLabelValue(col),
! rect.x + 29,
! rect.y + 2 )
!
! # Draw the row 'labels'
! for row in numrows:
!
! dc.DrawBitmap( self.DrawTools['ArrowBitmap'], 0, y + 20, true )
! y = y + self.GetRowSize(row)
!
! for col in numcols:
! for row in numrows:
!
! rect = self.CellToRect(row, col)
! rend = self.GetCellRenderer(row, col)
!
! rend.Draw( self,
! None,
! dc,
! wxRect( rect.x + 25,
! rect.y + 18,
! rect.width,
! rect.height ),
! row,
! col,
! true )
!
!
! w, h = dc.GetSizeTuple()
! ondc = wxClientDC(self)
! ondc.Blit(0, 0, w, h, dc, 0, 0 )
! except:
! pass
def OnSize(self, evt):
|