/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/sizers.py
ViewVC logotype

Annotation of /branches/WIP-pyshapelib-bramz/Thuban/UI/sizers.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2700 - (hide annotations)
Mon Sep 18 14:27:02 2006 UTC (18 years, 5 months ago) by dpinte
Original Path: trunk/thuban/Thuban/UI/sizers.py
File MIME type: text/x-python
File size: 1921 byte(s)
2006-09-18 Didrik Pinte <dpinte@itae.be>
    
        * wxPython 2.6 update : wx 2.4 syntax has been updated to 2.6


1 bh 1808 # Copyright (C) 2003 by Intevation GmbH
2     # Authors:
3     # Bernhard Herzog <[email protected]>
4     #
5     # This program is free software under the GPL (>=v2)
6     # Read the file COPYING coming with the software for details.
7    
8     """Custom Sizers"""
9    
10     __version__ = "$Revision$"
11     # $Source$
12     # $Id$
13    
14 dpinte 2700 import wx
15 bh 1808
16 dpinte 2700 class NotebookLikeSizer(wx.PySizer):
17 bh 1808
18     """Similar to a wxNotebookSizer but doesn't need a real notebook
19     """
20    
21     def __init__(self):
22 dpinte 2700 wx.PySizer.__init__(self)
23 bh 1808 self.item_dict = {}
24    
25     def Add(self, item):
26     """Add the item to the sizer.
27    
28     The children added with Add must must be an object that has
29     Show() and Hide() methods
30     """
31 dpinte 2700 wx.PySizer.Add(self, item)
32 bh 1808
33     def Activate(self, item):
34     """Activate the item.
35    
36     Call this item's Show method and the Hide method of all other
37     items. The item must have been added to the sizer with Add.
38     """
39     for child in self.GetChildren():
40     window = child.GetWindow()
41     if window is item:
42     window.Show()
43     else:
44     window.Hide()
45    
46     def RecalcSizes(self):
47     """Set all children to the current size of the sizer
48    
49     This method is automatically called by the wxWindows sizer
50     mechanism.
51     """
52     pos = self.GetPosition()
53     size = self.GetSize()
54    
55     for item in self.GetChildren():
56     item.SetDimension(pos, size)
57    
58     def CalcMin(self):
59     """Return the maximum of the minimum sizes of the children.
60    
61     This method is automatically called by the wxWindows sizer
62     mechanism.
63     """
64     widths = []
65     heights = []
66     for item in self.GetChildren():
67     size = item.CalcMin()
68     widths.append(size.width)
69     heights.append(size.height)
70     if widths:
71 dpinte 2700 return wx.Size(max(widths), max(heights))
72     return wx.Size(0, 0)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26