Changeset 3662

Show
Ignore:
Timestamp:
11/15/07 08:09:24 (1 year ago)
Author:
pobrien
Message:

More progress.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Wx/schevowx/entity.py

    r3661 r3662  
    99import os 
    1010import wx 
     11import wx.aui 
    1112 
    1213from schevo.label import label, plural 
     
    5657        wx.Panel.__init__(self, parent=parent, *args, **kw) 
    5758        self._extent = None 
    58         self.grid = EntityGrid(self) 
     59        mgr = self._mgr = wx.aui.AuiManager() 
     60        mgr.ManagedWindow = self 
    5961 
    6062    def set_extent(self, extent): 
     63        mgr = self._mgr 
    6164        self._extent = extent 
    62         self.grid.set_extent(extent) 
    6365        self.SetName('%s_panel' % label(extent).lower()) 
     66        # Toolbar. 
     67        button_size = (32, 32) 
     68        tb = self.tb = wx.ToolBar(self, style=wx.TB_FLAT | wx.TB_NODIVIDER) 
     69        tb.SetToolBitmapSize(button_size) 
     70        # 
     71        bmp = wx.ArtProvider_GetBitmap(wx.ART_ERROR, size=button_size) 
     72        tb.AddLabelTool(10, 'Test', bmp, shortHelp='Autosize column data') 
     73        self.Bind(wx.EVT_TOOL, self.on_autosize_grid_data__clicked, id=10) 
     74##         tb.AddSeparator() 
     75        # 
     76        bmp = wx.ArtProvider_GetBitmap(wx.ART_QUESTION, size=button_size) 
     77        tb.AddLabelTool(20, 'Test', bmp, shortHelp='Autosize column headers') 
     78        self.Bind(wx.EVT_TOOL, self.on_autosize_grid_headers__clicked, id=20) 
     79        # 
     80        bmp = wx.ArtProvider_GetBitmap(wx.ART_INFORMATION, size=button_size) 
     81        tb.AddLabelTool(30, 'Test', bmp, shortHelp='Autosize column maximum') 
     82        self.Bind(wx.EVT_TOOL, self.on_autosize_grid_max__clicked, id=30) 
     83        # 
     84        bmp = wx.ArtProvider_GetBitmap(wx.ART_WARNING, size=button_size) 
     85        tb.AddLabelTool(40, 'Test', bmp) 
     86        # 
     87        bmp = wx.ArtProvider_GetBitmap(wx.ART_MISSING_IMAGE, size=button_size) 
     88        tb.AddLabelTool(50, 'Test', bmp) 
     89        tb.Realize() 
     90        p = wx.aui.AuiPaneInfo() 
     91        p.ToolbarPane() 
     92        p.CloseButton(False) 
     93        p.Floatable(False) 
     94        p.LeftDockable(False) 
     95        p.MaximizeButton(False) 
     96        p.Movable(False) 
     97        p.Name('%s_toolbar' % label(extent).lower()) 
     98        p.RightDockable(False) 
     99        p.Show() 
     100        p.Top() 
     101        mgr.AddPane(tb, p) 
     102        # Grid. 
     103        grid = self.grid = EntityGrid(self) 
     104        grid.set_extent(extent) 
     105        p = wx.aui.AuiPaneInfo() 
     106        p.Caption('%s' % plural(extent)) 
     107        p.CloseButton(False) 
     108        p.Center() 
     109        p.MaximizeButton(True) 
     110        p.Name('%s_grid' % label(extent).lower()) 
     111        p.Show() 
     112        mgr.AddPane(grid, p) 
     113        # Update. 
     114        mgr.Update() 
     115 
     116    def autosize_grid_data(self): 
     117        grid = self.grid 
     118        grid.Freeze() 
     119        for n in range(grid.GetColumnCount()): 
     120            grid.SetColumnWidth(n, wx.LIST_AUTOSIZE) 
     121##             width = grid.GetColumnWidth(n) + 10 
     122##             grid.SetColumnWidth(n, width) 
     123        grid.Thaw() 
     124 
     125    def on_autosize_grid_data__clicked(self, event): 
     126        self.autosize_grid_data() 
     127 
     128    def autosize_grid_headers(self): 
     129        grid = self.grid 
     130        grid.Freeze() 
     131        for n in range(grid.GetColumnCount()): 
     132            grid.SetColumnWidth(n, wx.LIST_AUTOSIZE_USEHEADER) 
     133##             width = grid.GetColumnWidth(n) + 10 
     134##             grid.SetColumnWidth(n, width) 
     135        grid.Thaw() 
     136 
     137    def on_autosize_grid_headers__clicked(self, event): 
     138        self.autosize_grid_headers() 
     139 
     140    def autosize_grid_max(self): 
     141        grid = self.grid 
     142        grid.Freeze() 
     143        for n in range(grid.GetColumnCount()): 
     144            grid.SetColumnWidth(n, wx.LIST_AUTOSIZE) 
     145            width_1 = grid.GetColumnWidth(n) 
     146            grid.SetColumnWidth(n, wx.LIST_AUTOSIZE_USEHEADER) 
     147            width_2 = grid.GetColumnWidth(n) 
     148            width = max(width_1, width_2) + 10 
     149            grid.SetColumnWidth(n, width) 
     150        grid.Thaw() 
     151 
     152    def on_autosize_grid_max__clicked(self, event): 
     153        self.autosize_grid_max() 
    64154 
    65155 
  • trunk/Wx/schevowx/navigator.py

    r3661 r3662  
    7070        p.Caption('Extents') 
    7171        p.CloseButton(False) 
    72 ##         p.Layer(0) 
    7372        p.Left() 
    7473        p.MaximizeButton(True) 
     
    7877        mgr.AddPane(grid, p) 
    7978        self.update_ui() 
    80         self.open_shell() 
     79##         self.open_shell() 
    8180        # Frame bindings. 
    8281        self.Bind(wx.EVT_CLOSE, self.on_close) 
     
    258257                p = wx.aui.AuiPaneInfo() 
    259258                p.BestSize((600, 400)) 
    260                 p.Caption(plural(extent)) 
     259                p.Caption('%s Panel' % label(extent)) 
    261260                p.CloseButton(True) 
    262261                p.Center()