/
fs_grid.py
72 lines (53 loc) · 2.58 KB
/
fs_grid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- coding: utf-8 -*-
import wx
import wx.grid
import logging
logging.basicConfig(filename='journal_events.log',format='%(asctime)s %(levelname)s %(message)s',level=logging.DEBUG)
###########################################################################
## Class fullgrid
###########################################################################
class fullgrid ( wx.Frame ):
def __init__( self, parent, gridtable ):
editor = parent
titl = ('%s:%s' % (editor.schema, editor.table))
wx.Frame.__init__ ( self, parent=None, id = wx.ID_ANY, title=titl, pos = wx.DefaultPosition, size = wx.Size( 1000,700 ))#, style = wx.CAPTION|wx.STAY_ON_TOP|wx.SYSTEM_MENU )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
bSizer1 = wx.BoxSizer( wx.VERTICAL )
self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
bSizer2 = wx.BoxSizer( wx.VERTICAL )
self.m_grid2 = wx.grid.Grid( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, (950, 650), 0 )
# Grid
self.m_grid2.CreateGrid( 5, 5 )
self.m_grid2.EnableEditing( True )
self.m_grid2.EnableGridLines( True )
self.m_grid2.EnableDragGridSize( False )
self.m_grid2.SetMargins( 0, 0 )
# Columns
self.m_grid2.EnableDragColMove( False )
self.m_grid2.EnableDragColSize( True )
self.m_grid2.SetColLabelSize( 30 )
self.m_grid2.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
# Rows
self.m_grid2.EnableDragRowSize( True )
self.m_grid2.SetRowLabelSize( 80 )
self.m_grid2.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
# Cell Defaults
self.m_grid2.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP )
bSizer2.Add( self.m_grid2, 1, wx.EXPAND)
self.m_panel1.SetSizer( bSizer2 )
self.m_panel1.Layout()
bSizer2.Fit( self.m_panel1 )
bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
self.SetSizer( bSizer1 )
self.Layout()
self.Centre( wx.BOTH )
self.m_grid2.SetTable(gridtable, True)
self.m_grid2.AutoSizeColumns( True )
self.m_panel1.Bind( wx.EVT_LEFT_DCLICK, self.OnRDC )
#self.m_grid2.AutoSize(True)
self.SetFocus()
def OnRDC(self, event):
self.Close()
#self.Destroy()
def __del__( self ):
pass