Changeset 354

Show
Ignore:
Timestamp:
Wed Nov 28 01:43:01 2007
Author:
Brian
Message:

Standardize on names 'object type' and 'fact type'. Revise windows and layout of ORM frame. Implement auto layout of ORM diagram. Implement multiple selection logic.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • scripts/trunk/ORM/Install ORM Tables.py

    r347 r354  
    56 56 #       - DerivationRule  
    57 57  
    58       rt = { 'Name': 'ORM Diagram', 'TableA': 'ORMObject', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
      58     rt = { 'Name': 'ORM Diagram', 'TableA': 'ORMObjectType', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
    58 58            'SuggestedColumns': ',ID;,Name', 'AdjustRowOption': 'ORMDiagram' }  
    59 59     ct = [  
     
    65 65  
    66 66  
    67       rt = { 'Name': 'ORM Objects', 'TableA': 'ORMObject', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
      67     rt = { 'Name': 'ORM ObjectTypes', 'TableA': 'ORMObjectType', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
    67 67            'SuggestedColumns': ',ID;,Name;,RefMode;,Type;,Independent;,Derived;,DerivationRule;,DateAdded' }  
    68 68     ct = [  
     
    77 77     { 'Name': 'Derived',      'Label': None,             'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 50  },  
    78 78     { 'Name': 'DerivationRule',  'Label': None,          'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 180  },  
      79     { 'Name': 'Description',  'Label': None,             'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
    79 80     { 'Name': 'DateAdded',    'Label': 'Date\nAdded',    'DataType': 'd', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 80  },  
    80 81         ]  
     
    90 91 #       - DerivationRule  
    91 92  
    92       rt = { 'Name': 'ORM Facts', 'TableA': 'ORMFact', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
    93              'SuggestedColumns': ',ID;,Name;,RefMode;,Type;,Independent;,Derived;,DerivationRule;,DateAdded' }  
      93     rt = { 'Name': 'ORM FactTypes', 'TableA': 'ORMFactType', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
      94            'SuggestedColumns': ',ID;,Name;,Nary;,ORMReadingID;,Derived;,DerivationRule;,DateAdded' }  
    94 95     ct = [  
    95 96     { 'Name': 'ProjectID',    'Label': 'Project\nID',    'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 50  },  
    96 97     { 'Name': 'Project/Name', 'Label': 'Project\nName',  'DataType': 't', 'AccessType': 'i', 'T': 'A', 'Edit': False, 'Width': 100  },  
    97 98     { 'Name': 'ID',           'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': False, 'Width': 35  },  
      99     # why do I have name? -- New to ORM2 (see ref doc p.6?) - not displayed in diagram, used for naming tables  
    98 100     { 'Name': 'Name',         'Label': None,             'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
    99 101     { 'Name': 'Nary',          'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
     
    102 104     { 'Name': 'Derived',       'Label': None,             'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 50  },  
    103 105     { 'Name': 'DerivationRule',  'Label': None,          'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 180  },  
      106     { 'Name': 'Description',  'Label': None,             'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
    104 107     { 'Name': 'DateAdded',     'Label': 'Date\nAdded',    'DataType': 'd', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 80  },  
    105 108         ]  
     
    112 115 #       - Reading (reading text refers to role ids??)  
    113 116  
    114       rt = { 'Name': 'ORM Reading', 'TableA': 'ORMReading', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
    115              'SuggestedColumns': ',ID;,FactID;,Reading;,DateAdded' }  
      117     rt = { 'Name': 'ORM Readings', 'TableA': 'ORMReading', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
      118            'SuggestedColumns': ',ID;,ORMFactTypeID;,Reading;,DateAdded' }  
    116 119     ct = [  
    117 120     { 'Name': 'ProjectID',     'Label': 'Project\nID',    'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 50  },  
    118 121     { 'Name': 'Project/Name',  'Label': 'Project\nName',  'DataType': 't', 'AccessType': 'i', 'T': 'A', 'Edit': False, 'Width': 100  },  
    119 122     { 'Name': 'ID',            'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': False, 'Width': 35  },  
    120       { 'Name': 'ORMFactID',     'Label': 'ORMFactID',      'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
      123     { 'Name': 'ORMFactTypeID', 'Label': 'ORMFactTypeID','DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
    120 123     { 'Name': 'Reading',       'Label': None,             'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 35  },  
    121 124     { 'Name': 'DateAdded',     'Label': 'Date\nAdded',    'DataType': 'd', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 80  },  
     
    135 138  
    136 139     rt = { 'Name': 'ORM Role', 'TableA': 'ORMRole', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
    137              'SuggestedColumns': ',ID;,FactID;,Seq;,Name;,DateAdded' }  
      140            'SuggestedColumns': ',ID;,ORMFactTypeID;,Seq;,Name;,Mandatory;,Unique;,DateAdded' }  
    137 140     ct = [  
    138 141     { 'Name': 'ProjectID',     'Label': 'Project\nID',    'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 50  },  
    139 142     { 'Name': 'Project/Name',  'Label': 'Project\nName',  'DataType': 't', 'AccessType': 'i', 'T': 'A', 'Edit': False, 'Width': 100  },  
    140 143     { 'Name': 'ID',            'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': False, 'Width': 35  },  
    141       { 'Name': 'ORMFactID',     'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
    142       { 'Name': 'ORMObjectID',   'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
      144     { 'Name': 'ORMFactTypeID',     'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
      145     { 'Name': 'ORMObjectTypeID',   'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
    143 146     { 'Name': 'Seq',           'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
    144 147     { 'Name': 'Name',          'Label': None,             'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 35  },  
     
    159 162 #       - ORMPathAltID  
    160 163  
    161       rt = { 'Name': 'ORM Constraint', 'TableA': 'ORMConstraint', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
    162              'SuggestedColumns': ',ID;,FactID;,Seq;,Name;,DateAdded' }  
      164     rt = { 'Name': 'ORM Constraints', 'TableA': 'ORMConstraint', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
      165            'SuggestedColumns': ',ID;,Type;,Alethic;,DateAdded' }  
    163 166     ct = [  
    164 167     { 'Name': 'ProjectID',     'Label': 'Project\nID',    'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 50  },  
     
    172 175  
    173 176     rt = { 'Name': 'ORM Constraint Connectors', 'TableA': 'ORMConstraintConnector', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
    174              'SuggestedColumns': ',ID;,ORMNoteID;,TableName;,TableID' }  
      177            'SuggestedColumns': ',ID;,ORMConstraintID;,TableName;,TableID' }  
    174 177     ct = [  
    175 178     { 'Name': 'ID',           'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': False, 'Width': 35  },  
    176 179     { 'Name': 'ORMConstraintID',    'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 55  },  
    177       { 'Name': 'ORMRoleID',      'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 55  },  
      180 #    { 'Name': 'ORMRoleID',      'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 55  },  
      181     { 'Name': 'TableName',    'Label': None,             'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True,  'Width': 100  },  
      182     { 'Name': 'TableID',      'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 55  },  
      183         ]  
      184     Data.AddReportType(rt, ct)  
      185  
      186     rt = { 'Name': 'ORM Subtype Connectors', 'TableA': 'ORMSubtypeConnector', 'TableB': None, 'Also': None, 'AllOrEach': 'each',  
      187            'SuggestedColumns': ',ID;,ORMObjectTypeID;,ORMSubtypeID' }  
      188     ct = [  
      189     { 'Name': 'ID',           'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': False, 'Width': 35  },  
      190     { 'Name': 'ORMObjectTypeID','Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 55  },  
      191     { 'Name': 'ORMSubtypeID',   'Label': None,             'DataType': 'i', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 55  },  
    178 192         ]  
    179 193     Data.AddReportType(rt, ct)  
     
    275 289 #    Data.AddTable('ProjectWeek')  
    276 290  
    277       # add required aliases  
      291     # add required aliases  (It shouldn't take two steps  
    277 291     Data.Database['NodeA'] = Data.Database['ReportRow']  # Does this name work?  
    278 292     Data.Database['NodeB'] = Data.Database['ReportRow']  
     
    281 295     Data.AddAlias('NodeB', 'ReportRow')  
    282 296  
      297     Data.Database['ORMSubtype'] = Data.Database['ORMObjectType']  
      298     Data.AddAlias('ORMSubtype', 'ORMObjectType')  
      299  
      300     Data.Database['ORMReadingAlt'] = Data.Database['ORMReading']  
      301     Data.AddAlias('ORMReadingAlt', 'ORMReading')  
      302  
    283 303     Data.SetUndo("Install ORM Tables")  
    284 304  
  • scripts/trunk/ORM/Open ORM Window.py

    r352 r354  
    4 4  
    5 5 # higher priority  
      6 # - get undo working  
      7 # - add a refresh diagram button or menu item  
    6 8 # 1) add a menu bar to the window - change content depending on which pane is active?  
    7   # 2))put a toolbar at the top of each page in the notebooks  
    8   #  steal it from the demo  
    9 9 # 3) put a status bar at the bottom  
    10   # 4) put popupmenus on the orm drawing canvas - to select different types of objects  
    11   #       -- partly DONE working for pseudo dc canvas  
    12   # 5) add a pseudo dc window -- DONE  
    13 10 # 6) put all of the notebook windows into a dynamic sash window??  
    14 11 #   but there may be problems with the scroll bars??  
    15 12 #   also, I can't see how to save and restore the subwindow layout  
      13 # - when lots of lines cross the diagram to the same object  
      14 #       select object; it suggests how may times to repeat graphic;  
      15 #       repeats graphic and moves each instance to a good location  
      16 # - drag to select all objects totally within the rectangle  
      17 # - move all selected items when moving  
      18 # - automatic positioning algorithm for imported data  
      19 # when typing into an object -- added on 071111  
      20  
      21 # cntrl-double click selects an object and its nearest neighbors???  
      22 # cntrl-triple click selects an object and its nearest neighbors once removed???  
      23 #   these inclusions travel accross connectors (added on 071115)  
      24  
      25 # if editing text in object:  
      26 #   if shift key:  
      27 #       select text  
      28 #   else:  
      29 #       arrow keys move the cursor in the field  
      30 # else:  
      31 #   if shift key:  
      32 #       select the different fields inside of the object  
      33 #   else:  
      34 #       move the object a pixel in that direction  
    16 35  
    17 36 # lower priority  
     
    21 40 #        the document, maybe also can drag into other objects?  
    22 41  
      42 #COMPLETED  
      43 # 2))put a toolbar at the top of each page in the notebooks  
      44 #  steal it from the demo -- Drafted  
      45 # 4) put popupmenus on the orm drawing canvas - to select different types of objects  
      46 #       -- partly DONE working for pseudo dc canvas  
      47 # 5) add a pseudo dc window -- DONE  
      48 # - get subtypes working -- DONE 071112  
    23 49  
    24 50 # 070806 - First experiments with combining FlatNoteBook and OGL  
    25 51 # 070807 - Added pseudo dc window  
    26   # 070825 - Added separate sections for adding orm ojext to the model and to the display  
      52 # 070825 - Added separate sections for adding orm objext to the model and to the display  
      53 # 071128 - Ready do commit changes to standardize names to 'object type' and 'fact type'  
      54 #           Revise window layout within frame. Implement a draft of auto layout.  
      55 #           Implement multiple selection.  
    27 56  
    28 57 import wx  
     
    38 67 ogl.OGLInitialize()  # affter app object, but before OGL is used  
    39 68 db = Data._dbDatabase(Data.Database)  # will get objects from this database  
      69 Data._db = db  # where should this be saved????? ---IMPORTANT TO FIX  
    40 70  
    41 71 debug = 1  
     
    214 244     }  
    215 245  
    216   ###---------------------------------------------------------------------------  
    217   ### Just A Dialog To Select Pen Styles  
    218   ###---------------------------------------------------------------------------  
    219   ##class PenDialog(wx.Dialog):  
    220   ##     
    221   ##    def __init__(self, parent=None, id=-1, title="", pos=wx.DefaultPosition,  
    222   ##                 size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE, oldpen=None,  
    223   ##                 pentype=0):  
    224   ##  
    225   ##        wx.Dialog.__init__(self, parent, id, title, pos, size, style)  
    226   ##         
    227   ##        self.colourbutton = csel.ColourSelect(self)  
    228   ##        self.spinwidth = wx.SpinCtrl(self, -1, "1", min=1, max=3, style=wx.SP_ARROW_KEYS)  
    229   ##         
    230   ##        self.combostyle = wx.ComboBox(self, -1, choices=penstyle, style=wx.CB_DROPDOWN|wx.CB_READONLY)  
    231   ##         
    232   ##        choices = ["[1, 1]", "[2, 2]", "[3, 3]", "[4, 4]"]  
    233   ##        self.combodash = wx.ComboBox(self, -1, choices=choices, style=wx.CB_DROPDOWN|wx.CB_READONLY)  
    234   ##         
    235   ##        self.okbutton = wx.Button(self, wx.ID_OK)  
    236   ##        self.cancelbutton = wx.Button(self, wx.ID_CANCEL)  
    237   ##  
    238   ##        self.oldpen = oldpen  
    239   ##        self.parent = parent  
    240   ##        self.pentype = pentype  
    241   ##  
    242   ##        self.__set_properties()  
    243   ##        self.__do_layout()  
    244   ##  
    245   ##        self.Bind(wx.EVT_COMBOBOX, self.OnStyle, self.combostyle)  
    246   ##        self.Bind(wx.EVT_BUTTON, self.OnOk, self.okbutton)  
    247   ##        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancelbutton)  
    248   ##  
    249   ##  
    250   ##    def __set_properties(self):  
    251   ##  
    252   ##        self.SetTitle("Pen Dialog Selector")  
    253   ##        self.colourbutton.SetMinSize((25, 25))  
    254   ##        self.colourbutton.SetColour(self.oldpen.GetColour())  
    255   ##  
    256   ##        style = self.oldpen.GetStyle()  
    257   ##        for count, st in enumerate(penstyle):  
    258   ##            if eval(st) == style:                 
    259   ##                self.combostyle.SetSelection(count)  
    260   ##                if count == 5:  
    261   ##                    self.combodash.Enable(True)  
    262   ##                else:  
    263   ##                    self.combodash.Enable(False)  
    264   ##                break  
    265   ##  
    266   ##        if self.combodash.IsEnabled():  
    267   ##            dashes = repr(self.oldpen.GetDashes())  
    268   ##            self.combodash.SetValue(dashes)  
    269   ##  
    270   ##        self.spinwidth.SetValue(self.oldpen.GetWidth())  
    271   ##        self.okbutton.SetDefault()  
    272   ##  
    273   ##        if self.pentype == 1:  
    274   ##            self.spinwidth.Enable(False)  
    275   ##  
    276   ##  
    277   ##    def __do_layout(self):  
    278   ##  
    279   ##        mainsizer = wx.BoxSizer(wx.VERTICAL)  
    280   ##        bottomsizer = wx.BoxSizer(wx.HORIZONTAL)  
    281   ##        middlesizer = wx.BoxSizer(wx.VERTICAL)  
    282   ##        stylesizer = wx.BoxSizer(wx.HORIZONTAL)  
    283   ##        widthsizer = wx.BoxSizer(wx.HORIZONTAL)  
    284   ##        coloursizer = wx.BoxSizer(wx.HORIZONTAL)  
    285   ##        label_1 = wx.StaticText(self, -1, "Please Choose The Pen Settings:")  
    286   ##        label_1.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))  
    287   ##        mainsizer.Add(label_1, 0, wx.ALL|wx.ADJUST_MINSIZE, 10)  
    288   ##        label_2 = wx.StaticText(self, -1, "Pen Colour")  
    289   ##        coloursizer.Add(label_2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)  
    290   ##        coloursizer.Add((5, 5), 1, wx.ADJUST_MINSIZE, 0)  
    291   ##        coloursizer.Add(self.colourbutton, 0, wx.ALL|wx.ADJUST_MINSIZE, 5)  
    292   ##        middlesizer.Add(coloursizer, 0, wx.EXPAND, 0)  
    293   ##        label_3 = wx.StaticText(self, -1, "Pen Width")  
    294   ##        widthsizer.Add(label_3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)  
    295   ##        widthsizer.Add((5, 5), 1, wx.ADJUST_MINSIZE, 0)  
    296   ##        widthsizer.Add(self.spinwidth, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)  
    297   ##        middlesizer.Add(widthsizer, 0, wx.EXPAND, 0)  
    298   ##        label_4 = wx.StaticText(self, -1, "Pen Style")  
    299   ##        stylesizer.Add(label_4, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)  
    300   ##        stylesizer.Add((5, 5), 1, wx.ADJUST_MINSIZE, 0)  
    301   ##        stylesizer.Add(self.combostyle, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)  
    302   ##        stylesizer.Add(self.combodash, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)  
    303   ##        middlesizer.Add(stylesizer, 0, wx.BOTTOM|wx.EXPAND, 5)  
    304   ##        mainsizer.Add(middlesizer, 1, wx.EXPAND, 0)  
    305   ##        bottomsizer.Add(self.okbutton, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 20)  
    306   ##        bottomsizer.Add((20, 20), 1, wx.ADJUST_MINSIZE, 0)  
    307   ##        bottomsizer.Add(self.cancelbutton, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 20)  
    308   ##        mainsizer.Add(bottomsizer, 0, wx.EXPAND, 0)  
    309   ##        self.SetAutoLayout(True)  
    310   ##        self.SetSizer(mainsizer)  
    311   ##        mainsizer.Fit(self)  
    312   ##        mainsizer.SetSizeHints(self)  
    313   ##        self.Layout()  
    314   ##        self.Centre()  
    315   ##  
    316   ##  
    317   ##  
    318   ##  
    319   ##    def OnStyle(self, event):  
    320   ##  
    321   ##        choice = event.GetEventObject().GetValue()  
    322   ##        self.combodash.Enable(choice==5)  
    323   ##        event.Skip()  
    324   ##  
    325   ##  
    326   ##    def OnOk(self, event):  
    327   ##  
    328   ##        colour = self.colourbutton.GetColour()  
    329   ##        style = eval(self.combostyle.GetValue())  
    330   ##        width = int(self.spinwidth.GetValue())  
    331   ##         
    332   ##        dashes = None  
    333   ##        if self.combostyle.GetSelection() == 5:  
    334   ##            dashes = eval(self.combodash.GetValue())  
    335   ##  
    336   ##        pen = wx.Pen(colour, width, style)  
    337   ##         
    338   ##        if dashes:  
    339   ##            pen.SetDashes(dashes)  
    340   ##  
    341   ##        pen.SetCap(wx.CAP_BUTT)  
    342   ##  
    343   ##        if self.pentype == 0:  
    344   ##            self.parent.SetConnectionPen(pen)  
    345   ##        else:  
    346   ##            self.parent.SetBorderPen(pen)  
    347   ##             
    348   ##        self.Destroy()  
    349   ##        event.Skip()  
    350   ##  
    351   ##  
    352   ##    def OnCancel(self, event):  
    353   ##  
    354   ##        self.Destroy()     
    355   ##        event.Skip()  
    356    
    357    
    358   ###---------------------------------------------------------------------------  
    359   ### Just A Dialog To Select Tree Buttons Icons  
    360   ###---------------------------------------------------------------------------  
    361   ##class TreeButtonsDialog(wx.Dialog):  
    362   ##     
    363   ##    def __init__(self, parent=None, id=-1, title="", pos=wx.DefaultPosition,  
    364   ##                 size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE, oldicons=None):  
    365   ##         
    366   ##        wx.Dialog.__init__(self, parent, id, title, pos, size, style)  
    367   ##  
    368   ##        self.listicons = wx.ListBox(self, -1, choices=["Set 1", "Set 2", "Set 3", "Set 4", "Set 5"], style=wx.LB_SINGLE)  
    369   ##  
    370   ##        bitmap_plus = opj("bitmaps/plus" + str(oldicons+1) + ".ico")  
    371   ##        bitmap_minus = opj("bitmaps/minus" + str(oldicons+1) + ".ico")  
    372   ##  
    373   ##        bitmap_plus = wx.Image(bitmap_plus, wx.BITMAP_TYPE_ICO)  
    374   ##        bitmap_plus.Rescale(24, 24)  
    375   ##        bitmap_plus = bitmap_plus.ConvertToBitmap()  
    376   ##        bitmap_minus = wx.Image(bitmap_minus, wx.BITMAP_TYPE_ICO)  
    377   ##        bitmap_minus.Rescale(24, 24)  
    378   ##        bitmap_minus = bitmap_minus.ConvertToBitmap()  
    379   ##         
    380   ##        self.bitmap_plus = wx.StaticBitmap(self, -1, bitmap_plus)  
    381   ##        self.bitmap_minus = wx.StaticBitmap(self, -1, bitmap_minus)  
    382   ##  
    383   ##        self.okbutton = wx.Button(self, wx.ID_OK)  
    384   ##        self.cancelbutton = wx.Button(self, wx.ID_CANCEL)  
    385   ##  
    386   ##        self.parent = parent         
    387   ##  
    388   ##        self.__set_properties()  
    389   ##        self.__do_layout()  
    390   ##  
    391   ##        self.Bind(wx.EVT_BUTTON, self.OnOk, self.okbutton)  
    392   ##        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancelbutton)  
    393   ##        self.Bind(wx.EVT_LISTBOX, self.OnListBox, self.listicons)  
    394   ##  
    395   ##  
    396   ##    def __set_properties(self):  
    397   ##  
    398   ##        self.SetTitle("Tree Buttons Selector")  
    399   ##        self.listicons.SetSelection(0)  
    400   ##        self.okbutton.SetDefault()  
    401   ##  
    402   ##  
    403   ##    def __do_layout(self):  
    404   ##  
    405   ##        mainsizer = wx.BoxSizer(wx.VERTICAL)  
    406   ##        bottomsizer = wx.BoxSizer(wx.HORIZONTAL)  
    407   ##        topsizer = wx.BoxSizer(wx.HORIZONTAL)  
    408   ##        rightsizer = wx.BoxSizer(wx.VERTICAL)  
    409   ##        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)  
    410   ##        sizer_1 = wx.BoxSizer(wx.HORIZONTAL)  
    411   ##        label_1 = wx.StaticText(self, -1, "Please Choose One Of These Sets Of Icons:")  
    412   ##        label_1.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))  
    413   ##        mainsizer.Add(label_1, 0, wx.ALL|wx.ADJUST_MINSIZE, 10)  
    414   ##        topsizer.Add(self.listicons, 0, wx.ALL|wx.EXPAND|wx.ADJUST_MINSIZE, 5)  
    415   ##        label_2 = wx.StaticText(self, -1, "Collapsed")  
    416   ##        sizer_1.Add(label_2, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    417   ##        sizer_1.Add((20, 20), 1, wx.ALIGN_RIGHT|wx.ADJUST_MINSIZE, 0)  
    418   ##        sizer_1.Add(self.bitmap_plus, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    419   ##        rightsizer.Add(sizer_1, 0, wx.EXPAND, 0)  
    420   ##        label_3 = wx.StaticText(self, -1, "Expanded")  
    421   ##        sizer_2.Add(label_3, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    422   ##        sizer_2.Add((20, 20), 1, wx.ADJUST_MINSIZE, 0)  
    423   ##        sizer_2.Add(self.bitmap_minus, 1, wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    424   ##        rightsizer.Add(sizer_2, 0, wx.EXPAND, 0)  
    425   ##        topsizer.Add(rightsizer, 0, wx.ALL|wx.EXPAND, 5)  
    426   ##        mainsizer.Add(topsizer, 1, wx.EXPAND, 0)  
    427   ##        bottomsizer.Add(self.okbutton, 0, wx.ALL|wx.ADJUST_MINSIZE, 20)  
    428   ##        bottomsizer.Add((20, 20), 1, wx.ADJUST_MINSIZE, 0)  
    429   ##        bottomsizer.Add(self.cancelbutton, 0, wx.ALL|wx.ADJUST_MINSIZE, 20)  
    430   ##        mainsizer.Add(bottomsizer, 0, wx.EXPAND, 0)  
    431   ##        self.SetAutoLayout(True)  
    432   ##        self.SetSizer(mainsizer)  
    433   ##        mainsizer.Fit(self)  
    434   ##        mainsizer.SetSizeHints(self)  
    435   ##        self.Layout()  
    436   ##  
    437   ##  
    438   ##    def OnListBox(self, event):  
    439   ##  
    440   ##        selection = self.listicons.GetSelection()  
    441   ##        bitmap_plus = opj("bitmaps/plus" + str(selection+1) + ".ico")  
    442   ##        bitmap_minus = opj("bitmaps/minus" + str(selection+1) + ".ico")  
    443   ##  
    444   ##        bitmap_plus = wx.Image(bitmap_plus, wx.BITMAP_TYPE_ICO)  
    445   ##        bitmap_plus.Rescale(24, 24)  
    446   ##        bitmap_plus = bitmap_plus.ConvertToBitmap()  
    447   ##        bitmap_minus = wx.Image(bitmap_minus, wx.BITMAP_TYPE_ICO)  
    448   ##        bitmap_minus.Rescale(24, 24)  
    449   ##        bitmap_minus = bitmap_minus.ConvertToBitmap()  
    450   ##         
    451   ##        self.bitmap_plus.SetBitmap(bitmap_plus)         
    452   ##        self.bitmap_minus.SetBitmap(bitmap_minus)  
    453   ##  
    454   ##        self.bitmap_plus.Refresh()  
    455   ##        self.bitmap_minus.Refresh()  
    456   ##        event.Skip()  
    457   ##         
    458   ##  
    459   ##    def OnOk(self, event):  
    460   ##  
    461   ##        selection = self.listicons.GetSelection()  
    462   ##        self.parent.SetTreeButtons(selection)  
    463   ##        self.Destroy()  
    464   ##        event.Skip()  
    465   ##  
    466   ##  
    467   ##    def OnCancel(self, event):  
    468   ##  
    469   ##        self.Destroy()  
    470   ##        event.Skip()  
    471    
    472    
    473   ###---------------------------------------------------------------------------  
    474   ### Just A Dialog To Select Tree Check/Radio Item Icons  
    475   ###---------------------------------------------------------------------------  
    476   ##class CheckDialog(wx.Dialog):  
    477   ##     
    478   ##    def __init__(self, parent=None, id=-1, title="", pos=wx.DefaultPosition,  
    479   ##                 size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE):  
    480   ##         
    481   ##        wx.Dialog.__init__(self, parent, id, title, pos, size, style)  
    482   ##  
    483   ##        self.listicons = wx.ListBox(self, -1, choices=["Set 1", "Set 2"], style=wx.LB_SINGLE)  
    484   ##  
    485   ##        bitmap_check = wx.Bitmap(opj("bitmaps/checked.ico"), wx.BITMAP_TYPE_ICO)  
    486   ##        bitmap_uncheck = wx.Bitmap(opj("bitmaps/notchecked.ico"), wx.BITMAP_TYPE_ICO)  
    487   ##        bitmap_flag = wx.Bitmap(opj("bitmaps/flagged.ico"), wx.BITMAP_TYPE_ICO)  
    488   ##        bitmap_unflag = wx.Bitmap(opj("bitmaps/notflagged.ico"), wx.BITMAP_TYPE_ICO)  
    489   ##  
    490   ##        self.bitmap_check = wx.StaticBitmap(self, -1, bitmap_check)  
    491   ##        self.bitmap_uncheck = wx.StaticBitmap(self, -1, bitmap_uncheck)  
    492   ##        self.bitmap_flag = wx.StaticBitmap(self, -1, bitmap_flag)  
    493   ##        self.bitmap_unflag = wx.StaticBitmap(self, -1, bitmap_unflag)  
    494   ##  
    495   ##        self.okbutton = wx.Button(self, wx.ID_OK)  
    496   ##        self.cancelbutton = wx.Button(self, wx.ID_CANCEL)  
    497   ##  
    498   ##        self.parent = parent         
    499   ##  
    500   ##        self.__set_properties()  
    501   ##        self.__do_layout()  
    502   ##  
    503   ##        self.Bind(wx.EVT_BUTTON, self.OnOk, self.okbutton)  
    504   ##        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancelbutton)  
    505   ##        self.Bind(wx.EVT_LISTBOX, self.OnListBox, self.listicons)  
    506   ##  
    507   ##  
    508   ##    def __set_properties(self):  
    509   ##  
    510   ##        self.SetTitle("Check/Radio Icon Selector")  
    511   ##        self.listicons.SetSelection(0)  
    512   ##        self.okbutton.SetDefault()  
    513   ##  
    514   ##  
    515   ##    def __do_layout(self):  
    516   ##  
    517   ##        mainsizer = wx.BoxSizer(wx.VERTICAL)  
    518   ##        bottomsizer = wx.BoxSizer(wx.HORIZONTAL)  
    519   ##        topsizer = wx.BoxSizer(wx.HORIZONTAL)  
    520   ##        rightsizer = wx.BoxSizer(wx.VERTICAL)  
    521   ##        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)  
    522   ##        sizer_1 = wx.BoxSizer(wx.HORIZONTAL)  
    523   ##        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)  
    524   ##        sizer_4 = wx.BoxSizer(wx.HORIZONTAL)  
    525   ##        label_1 = wx.StaticText(self, -1, "Please Choose One Of These Sets Of Icons:")  
    526   ##        label_1.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))  
    527   ##        mainsizer.Add(label_1, 0, wx.ALL|wx.ADJUST_MINSIZE, 10)  
    528   ##        topsizer.Add(self.listicons, 0, wx.ALL|wx.EXPAND|wx.ADJUST_MINSIZE, 5)  
    529   ##        label_2 = wx.StaticText(self, -1, "Checked")  
    530   ##        sizer_1.Add(label_2, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    531   ##        sizer_1.Add((20, 20), 1, wx.ALIGN_RIGHT|wx.ADJUST_MINSIZE, 0)  
    532   ##        sizer_1.Add(self.bitmap_check, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    533   ##        rightsizer.Add(sizer_1, 0, wx.EXPAND, 0)  
    534   ##        label_3 = wx.StaticText(self, -1, "Not Checked")  
    535   ##        sizer_2.Add(label_3, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    536   ##        sizer_2.Add((20, 20), 1, wx.ADJUST_MINSIZE, 0)  
    537   ##        sizer_2.Add(self.bitmap_uncheck, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    538   ##        rightsizer.Add(sizer_2, 0, wx.EXPAND, 0)  
    539   ##        label_4 = wx.StaticText(self, -1, "Flagged")  
    540   ##        sizer_3.Add(label_4, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    541   ##        sizer_3.Add((20, 20), 1, wx.ADJUST_MINSIZE, 0)  
    542   ##        sizer_3.Add(self.bitmap_flag, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    543   ##        rightsizer.Add(sizer_3, 0, wx.EXPAND, 0)  
    544   ##        label_5 = wx.StaticText(self, -1, "Not Flagged")  
    545   ##        sizer_4.Add(label_5, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    546   ##        sizer_4.Add((20, 20), 1, wx.ADJUST_MINSIZE, 0)  
    547   ##        sizer_4.Add(self.bitmap_unflag, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 10)  
    548   ##        rightsizer.Add(sizer_4, 0, wx.EXPAND, 0)  
    549   ##         
    550   ##        topsizer.Add(rightsizer, 0, wx.ALL|wx.EXPAND, 5)  
    551   ##        mainsizer.Add(topsizer, 1, wx.EXPAND, 0)  
    552   ##        bottomsizer.Add(self.okbutton, 0, wx.ALL|wx.ADJUST_MINSIZE, 20)  
    553   ##        bottomsizer.Add((20, 20), 1, wx.ADJUST_MINSIZE, 0)  
    554   ##        bottomsizer.Add(self.cancelbutton, 0, wx.ALL|wx.ADJUST_MINSIZE, 20)  
    555   ##        mainsizer.Add(bottomsizer, 0, wx.EXPAND, 0)  
    556   ##        self.SetAutoLayout(True)  
    557   ##        self.SetSizer(mainsizer)  
    558   ##        mainsizer.Fit(self)  
    559   ##        mainsizer.SetSizeHints(self)  
    560   ##        self.Layout()  
    561   ##  
    562   ##  
    563   ##    def OnListBox(self, event):  
    564   ##  
    565   ##        selection = self.listicons.GetSelection()  
    566   ##  
    567   ##        if selection == 0:  
    568   ##            bitmap_check = opj("bitmaps/checked.ico")  
    569   ##            bitmap_uncheck = opj("bitmaps/notchecked.ico")  
    570   ##            bitmap_flag = opj("bitmaps/flagged.ico")  
    571   ##            bitmap_unflag = opj("bitmaps/notflagged.ico")  
    572   ##        else:  
    573   ##            bitmap_check = opj("bitmaps/aquachecked.ico")  
    574   ##            bitmap_uncheck = opj("bitmaps/aquanotchecked.ico")  
    575   ##            bitmap_flag = opj("bitmaps/aquaflagged.ico")  
    576   ##            bitmap_unflag = opj("bitmaps/aquanotflagged.ico")  
    577   ##  
    578   ##        bitmap_check = wx.Bitmap(bitmap_check, wx.BITMAP_TYPE_ICO)  
    579   ##        bitmap_uncheck = wx.Bitmap(bitmap_uncheck, wx.BITMAP_TYPE_ICO)  
    580   ##        bitmap_flag = wx.Bitmap(bitmap_flag, wx.BITMAP_TYPE_ICO)  
    581   ##        bitmap_unflag = wx.Bitmap(bitmap_unflag, wx.BITMAP_TYPE_ICO)  
    582   ##         
    583   ##        self.bitmap_uncheck.SetBitmap(bitmap_uncheck)  
    584   ##        self.bitmap_check.SetBitmap(bitmap_check)  
    585   ##        self.bitmap_unflag.SetBitmap(bitmap_unflag)  
    586   ##        self.bitmap_flag.SetBitmap(bitmap_flag)  
    587   ##         
    588   ##        self.bitmap_check.Refresh()  
    589   ##        self.bitmap_uncheck.Refresh()  
    590   ##        self.bitmap_flag.Refresh()  
    591   ##        self.bitmap_unflag.Refresh()  
    592   ##         
    593   ##        event.Skip()  
    594   ##         
    595   ##  
    596   ##    def OnOk(self, event):  
    597   ##  
    598   ##        selection = self.listicons.GetSelection()  
    599   ##        self.parent.SetCheckRadio(selection)  
    600   ##        self.Destroy()  
    601   ##        event.Skip()  
    602   ##  
    603   ##  
    604   ##    def OnCancel(self, event):  
    605   ##  
    606   ##        self.Destroy()  
    607   ##        event.Skip()  
    608    
    609    
    610 246 #---------------------------------------------------------------------------  
    611 247 # Just A Dialog To Select Tree Items Icons  
     
    807 443 # CustomTreeCtrl Demo Implementation  
    808 444 #---------------------------------------------------------------------------  
    809   class CustomTreeCtrlDemo(wx.Panel):  
    810    
    811       def __init__(self, parent, log):  
    812           wx.Panel.__init__(self, parent)  
    813            
    814           self.log = log  
    815           self.oldicons = 0         
    816    
    817           splitter = wx.SplitterWindow(self, -1, style=wx.CLIP_CHILDREN | wx.SP_LIVE_UPDATE | wx.SP_3D)  
    818    
    819           # Create the CustomTreeCtrl, using a derived class defined below  
    820           self.tree = CustomTreeCtrl(splitter, -1, log=self.log, style=wx.SUNKEN_BORDER)             
    821    
    822           self.leftpanel = wx.ScrolledWindow(splitter, -1, style=wx.SUNKEN_BORDER)  
    823           self.leftpanel.SetScrollRate(20,20)  
    824           width = self.PopulateLeftPanel(self.tree.styles, self.tree.events)  
    825            
    826           # add the windows to the splitter and split it.  
    827           splitter.SplitVertically(self.leftpanel, self.tree, 300)  
    828           splitter.SetMinimumPaneSize(width+5)  
    829            
    830           sizer = wx.BoxSizer()  
    831           sizer.Add(splitter, 1, wx.EXPAND)  
    832           self.SetSizer(sizer)  
    833            
    834    
    835       def PopulateLeftPanel(self, styles, events):  
    836           pnl = wx.Panel(self.leftpanel)  
    837           mainsizer = wx.BoxSizer(wx.VERTICAL)  
    838           recreatetree = wx.Button(pnl, -1, "Recreate CustomTreeCtrl")  
    839           mainsizer.Add(recreatetree, 0, wx.