Source

boa-constructor / PropertyEditors.py

Full commit
  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
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
#----------------------------------------------------------------------
# Name:        PropertyEditors.py
# Purpose:     
#
# Author:      Riaan Booysen
#
# Created:     1999
# RCS-ID:      $Id$
# Copyright:   (c) 1999, 2000 Riaan Booysen
# Licence:     GPL
#----------------------------------------------------------------------
"""
    XXX Todo XXX
    
    * write/wrap many more classes
    * choice between PropertyEditors having
    	- Predetermined editor controls (Textbox, combo, ellipsis button) 
    	  determined by a type flag
    	- Custom control derived from InspectorEditor control 
    	  attached per PropertyEditor
    	  This involves a little more work
    	  * needs solid default options/base classes for extension
    	  
Exception exceptions.AttributeError: 'thisown' in <method wxColourPtr.__del__
 wxColour instance at b09100> ignored    	  
"""

# XXX Value getting setting of value between internal and sometime control value
# XXX Is still too fuzzy

from wxPython.wx import *
from types import *
import Inspector, Utils
from Enumerations import reverseDict
from InspectorEditorControls import *

class EditorStyles:pass
class esExpandable(EditorStyles):pass
class esDialog(EditorStyles):pass
class esReadOnly(EditorStyles):pass
class esChoice(EditorStyles):pass

class PropertyRegistry:
    """ Factory to return propery editors from recognisable types
      	It does not return property editors for certain design-time types like
      	sets, enumerations, booleans, etc.
    """
    def __init__(self):
        self.classRegistry = {}
        self.typeRegistry = {}#{type(None): None}
    
    def registerClasses(self, propClass, propEditors):
        for propEdit in propEditors:
            self.classRegistry[propClass.__name__] = propEdit
#            print propClass.__name__, 'registered'

    def registerTypes(self, propType, propEditors):
        for propEdit in propEditors:
            self.typeRegistry[propType] = propEdit
#            print propType, 'registered'
    
    def factory(self, name, parent, companion, rootCompanion, getsetters, idx, width):
        try:
            value = getsetters[0](companion.control)
        except Exception, message:
            print 'Error on accessing Getter for', name, ':', message
            value = ''
            
        
        if type(value) == InstanceType:
            if self.classRegistry.has_key(value.__class__.__name__):
                return self.classRegistry[value.__class__.__name__](name, parent, companion, rootCompanion, getsetters, idx, width)
            else:
#                raise 'Class '+value.__class__.__name__+' not supported by factory.'
#                pass
                print 'e:class', value, value.__class__.__name__, 'for', name, 'not supported'
        else:
            if type(value) == type(None):
                return None 
            elif self.typeRegistry.has_key(type(value)):
         	return self.typeRegistry[type(value)](name, parent, companion, rootCompanion, getsetters, idx, width)
            else:
#                raise 'Type '+`type(value)`+' not supported by factory.'
#                pass
                print 'e:type', value, type(value), 'for', name, 'not supported'


# XXX Check IEC initialisation not from Display value but from 'valueFromIEC'
class PropertyEditor:
    """ Class associated with a design time identified type, 
        it manages the behaviour of a NameValue in the Inspector """
    def __init__(self, name, parent, companion, rootCompanion, getsetters, idx, width):
        self.name = name
        self.parent = parent
        
        self.idx = idx
        self.width = width
        self.editorCtrl = None
#        print 'gs',getsetters
        self.getter = getsetters[0]
        self.setter = getsetters[1]
        self.companion = companion
        self.obj = companion.control
        self.rootCompanion = rootCompanion
        self.root = rootCompanion.control
        self.initFromComponent()
        self.style = []
    	
    def initFromComponent(self):
        if self.obj: 
            self.value = self.getter(self.obj)
#            print 'ic:', self.value, self.valueToIECValue()
            if self.editorCtrl:
                self.editorCtrl.setValue(self.valueToIECValue())
        else: self.value = ''

    def edit(self):
        pass
    def inspectorEdit(self):
        pass
    def refreshCompCtrl(self):
        if self.root and hasattr(self.root, 'Refresh'):
            self.root.Refresh()
        
    def inspectorPost(self):
        if self.editorCtrl:
            v = self.getValue()
#            print 'posting', v
            cv = self.getCtrlValue()
            if v != cv:
                self.setCtrlValue(cv, v)
                self.persistValue(self.valueAsExpr())
            else:
                print "prop's the same"
            self.editorCtrl.destroyControl()
            self.refreshCompCtrl()
            self.editorCtrl = None

    def inspectorCancel(self):
        if self.editorCtrl:
            self.editorCtrl.destroyControl()
            self.editorCtrl = None

    def getStyle(self):
        return self.style

    def getValue(self):
        if self.editorCtrl:
            self.value = self.editorCtrl.getValue()
        else: print ''
        return self.value

    def setValue(self, value):
        'property editor: set value', value
        self.value = value
        if self.editorCtrl:
            self.editorCtrl.SetValue(self.value)

    def getCtrlValue(self):
        return self.getter(self.obj)

    def setCtrlValue(self, oldValue, value):
        # If overwridden, rem to call check triggers if not calling parent method
        self.companion.checkTriggers(self.name, oldValue, value)
        self.setter(self.obj, value)

    def persistValue(self, value):
#        print 'property editor, persistprop', self.name, value
        self.companion.persistProp(self.name, self.setter, value)

    def getDisplayValue(self):
        return `self.value`

    def valueAsExpr(self):
        return self.getDisplayValue()

    def getValues(self):
        return self.values

    def setValues(self, values):
        self.values = values

    def valueToIECValue(self):
        return self.value

    def setWidth(self, width):
        self.width = width
        if self.editorCtrl:
            self.editorCtrl.setWidth(width)

    def setIdx(self, idx):
        self.idx = idx
        if self.editorCtrl:
            self.editorCtrl.setIdx(idx)
                                
class FactoryPropEdit(PropertyEditor):
    pass

class OptionedPropEdit(PropertyEditor):
    """ Property editors initialised with options """
    def __init__(self, name, parent, companion, rootCompanion, getsetters, idx, width, options, names):
        PropertyEditor.__init__(self, name, parent, companion, rootCompanion, getsetters, idx, width)
        self.options = options
        self.names = names
        if names:
            self.revNames = reverseDict(names)
        else:
    	    self.revNames = None	

class ConstrPropEditFacade:
    def setCtrlValue(self, oldValue, value):
        self.companion.checkTriggers(self.name, oldValue, value)
        
        #self.setter(self.name, value)
    def initFromComponent(self):
        self.value = ''
    def getCtrlValue(self):
        return ''#self.getter(self.obj)
    def getValue(self):
        return ''
    def setValue(self, value):
        self.value = value
        
class ConstrPropEdit(ConstrPropEditFacade, PropertyEditor):
    def __init__(self, name, parent, companion, rootCompanion, getsetters, idx, 
      width, options, names):
        PropertyEditor.__init__(self, name, parent, companion, rootCompanion, 
          getsetters, idx, width)
#        self.value = ''        
    def initFromComponent(self):
        self.value = self.getValue()
    def valueToIECValue(self):
        return self.value
    def getDisplayValue(self):
        return  self.getValue()
    def getCtrlValue(self):
        return self.companion.textConstr.params[ \
          self.companion.constructor()[self.name]]

class IntConstrPropEdit(ConstrPropEdit):
    def inspectorEdit(self):
        self.editorCtrl = TextCtrlIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.value, self.idx, 
          self.width)
    
    def getValue(self):
        if self.editorCtrl:
            try:
                anInt = eval(self.editorCtrl.getValue())
                if type(anInt) is IntType:
                    self.value = self.editorCtrl.getValue()
                else:
                    self.value = self.getCtrlValue()
            except Exception, message:
                self.value = self.getCtrlValue()
                print 'invalid constr prop value', message
        else:
            self.value = self.getCtrlValue()
        return self.value

class StyleConstrPropEdit(IntConstrPropEdit):
    pass
#    constrKey = 'style'
    # self.companion.constructors()[self.name]

#        self.getter(self.obj)

class StrConstrPropEdit(ConstrPropEdit):
    def inspectorEdit(self):
        self.editorCtrl = TextCtrlIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.value, self.idx, 
          self.width)
    
    def getValue(self):
        if self.editorCtrl:
            try:
                aStr = eval(self.editorCtrl.getValue())
                if type(aStr) is StringType:
                    self.value = self.editorCtrl.getValue()
                else:
                    self.value = self.getCtrlValue()
            except Exception, message:
                self.value = self.getCtrlValue()
                print 'invalid constr prop value', message
        else:
            self.value = self.getCtrlValue()
        return self.value

class ChoicesConstrPropEdit(ConstrPropEdit):
    def inspectorEdit(self):
        self.editorCtrl = TextCtrlIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.value, self.idx, 
          self.width)
    
    def getValue(self):
        if self.editorCtrl:
            try:
                aList = eval(self.editorCtrl.getValue())
                if type(aList) is ListType:
                    self.value = self.editorCtrl.getValue()
                else:
                    self.value = self.getCtrlValue()
            except Exception, message:
                self.value = self.getCtrlValue()
                print 'invalid constr prop value', message
        else:
            self.value = self.getCtrlValue()
        return self.value

class MajorDimensionConstrPropEdit(ConstrPropEdit):
#    constrKey = 'style'
    # self.companion.constructors()[self.name]
    def inspectorEdit(self):
        self.editorCtrl = TextCtrlIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.value, self.idx, 
          self.width)
    
    def getValue(self):
        if self.editorCtrl:
            try:
                anInt = eval(self.editorCtrl.getValue())
                if type(anInt) is IntType:
                    self.value = self.editorCtrl.getValue()
                else:
                    self.value = self.getCtrlValue()
            except Exception, message:
                self.value = self.getCtrlValue()
                print 'invalid constr prop value', message
        else:
            self.value = self.getCtrlValue()
        return self.value
        
##    
##(PropertyEditor):
##    def __init__(self, name, parent, companion, rootCompanion, getsetters, idx, width, options, names):
##        PropertyEditor.__init__(self, name, parent, companion, rootCompanion, getsetters, idx, width)
##        self.value = ''        
##    def initFromComponent(self):
##        self.value = ''
    
class EventPropEdit(OptionedPropEdit):
    """ Property editor to handle design time definition of events """
    def initFromComponent(self):
        # unlike other propedit getter setters these are methods not funcs
        self.value = self.getter(self.name)

    def valueToIECValue(self):
    	v = self.value
    	return v

    def inspectorEdit(self):
        self.editorCtrl = ChoiceIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.idx, self.width)
        self.editorCtrl.setValue(self.value)

    def setCtrlValue(self, oldValue, value):
#        self.companion.checkTriggers(self.name, oldValue, value)
        self.setter(self.name, value)

    def getDisplayValue(self):
#        print 'evt getdisplayval', self.valueToIECValue()
        return self.valueToIECValue()

    def getValues(self):
        vals = []
        if self.companion:
            for evt in self.companion.textEventList:
                if evt.trigger_meth <> '(delete)':
                   try: vals.index(evt.trigger_meth)
                   except: vals.append(evt.trigger_meth)
        vals.append('(delete)')
        return vals
        
    def getValue(self):
        if self.editorCtrl:
            self.value = self.editorCtrl.getValue()
        return self.value
    def persistValue(self, value):
        self.companion.persistEvt(self.name, value)
                
##        if self.obj: 
##            self.value = self.getter(self.obj)
###            print 'ic:', self.value, self.valueToIECValue()
##            if self.editorCtrl:
##                self.editorCtrl.setValue(self.valueToIECValue())
##     	else: self.value = ''

    	    	    
class BITPropEditor(FactoryPropEdit):
    """ Editors for Built-in Python Types """
    def valueToIECValue(self):
        return `self.value`
    def inspectorEdit(self):
        self.editorCtrl = TextCtrlIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.value, self.idx, self.width)
	     	         	    
class IntPropEdit(BITPropEditor):
    def getValue(self):
        if self.editorCtrl:
            try:
                value = eval(self.editorCtrl.getValue())
            except Exception, mess:
		Utils.ShowErrorMessage(self.parent, 'Invalid value', mess)
                raise                          
            self.value = value
        return self.value
	
class StrPropEdit(BITPropEditor):
    def valueToIECValue(self):
        return self.value

class TuplPropEdit(BITPropEditor): pass

# Property editors for design type types :)
class BoolPropEdit(OptionedPropEdit):
    def valueToIECValue(self):
    	v = self.value
    	if type(v) == IntType:
    	    return self.getValues()[v]
    	else: return `v`
    def inspectorEdit(self):
        self.editorCtrl = ChoiceIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.idx, self.width)
        self.editorCtrl.setValue(self.getValues()[self.value])
    def getDisplayValue(self):
        return self.valueToIECValue()
    def getValues(self):
        return ['false', 'true']
    def getValue(self):
        if self.editorCtrl:
            # trick to convert boolean string to integer
            v = self.editorCtrl.getValue()
            self.value = self.getValues().index(self.editorCtrl.getValue())
        return self.value

class EnumPropEdit(OptionedPropEdit):
    def valueToIECValue(self):
        if self.revNames:
    	    return self.revNames[self.value]
    	else: OptionedPropEdit.getDisplayValue(self)
    def inspectorEdit(self):
        self.editorCtrl = ChoiceIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.idx, self.width)
        self.setValue(self.value)
    def getDisplayValue(self):
	return self.valueToIECValue()
    def getValues(self):
        return self.names.keys()
    def setValue(self, value):
        self.value = value
        if self.editorCtrl:
            self.editorCtrl.setValue(self.revNames[value])
    def getValue(self):
        if self.editorCtrl:
	    strVal = self.editorCtrl.getValue()
            self.value = self.names[strVal]
        return self.value
# SetPropEdit


# Property editors for classes
class ClassPropEdit(FactoryPropEdit):
    def getDisplayValue(self):
        return '('+self.value.__class__.__name__+')'
    def getStyle(self):
        return [esExpandable]

class ClassLinkPropEdit(ClassPropEdit):
    def getStyle(self):
        return []
    
class ColPropEdit(ClassPropEdit):
#    def getDisplayValue(self):
#	return 
    def getStyle(self):
        return [esDialog]
        
    def inspectorEdit(self):
        self.editorCtrl = ButtonIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.idx, self.width, self.edit)
    
    def edit(self, event):
        data = wxColourData()
        data.SetColour(self.value)
        dlg = wxColourDialog(self.parent, data)
#        dlg.GetColourData().SetColour(self.value)
        if dlg.ShowModal() == wxID_OK:
            self.value = dlg.GetColourData().GetColour()
            self.setter(self.obj, self.value)
            self.obj.Refresh()
        dlg.Destroy()

    def getValue(self):
        return self.value

    def valueAsExpr(self):
        return 'wxColour(%d, %d, %d)'%(self.value.Red(), self.value.Green(), self.value.Blue())


##class ColElementPE(OptionedPropEdit):
##    def __init__(self, parent, obj, getsetters, idx, width, options, names):
##        OptionedPropEdit.__init__(self, parent, obj, getsetters, idx, width, options, names)
##        if self.obj: self.value = wxColor(self.value[0],self.value[1],self.value[2])
##        else: print 'Fuck'
##    def inspectorEdit(self):
##        elemVal = self.getElemValue()
##        self.editorCtrl = TextCtrlIEC(self, self.value)
##        self.editorCtrl.createControl(self.parent, elemVal, self.idx, self.width)
##    def inspectorPost(self):
##        if self.editorCtrl:
##            v = self.getValue()
##            self.setter(self.obj, v.Red(), v.Green(), v.Blue())
##            print 'set:', v.Red(), v.Green(), v.Blue()
##            self.editorCtrl.destroyControl()

##class RedColPE(ColElementPE):
##    def getElemValue(self):
##        if self.editorCtrl: 
##            ev = self.editorCtrl.getValue()
##            print 'ec, red:', self.editorCtrl.getValue(), type(ev), ev
##            if type(ev) == InstanceType:
##                return ev.Red()
##            else:
##                return int(ev)
##        else: 
##            print 'ne, red', self.value.Red()
##            return self.value.Red()
##    def setValue(self, value):
##        self.value = value
##        if self.editorCtrl:
##            self.editorCtrl.SetValue(`self.value.Red()`)
##    def getValue(self):
##        return wxColour(self.getElemValue(), self.value.Green(), self.value.Blue())
##    def getDisplayValue(self):
##        return `self.getElemValue()`
##        

##class GreenColPE(ColElementPE):
##    def getElemValue(self):
##        if self.editorCtrl: 
##            ev = self.editorCtrl.getValue()
##            print 'ec, green:', self.editorCtrl.getValue(), type(ev), ev
##            if type(ev) == InstanceType:
##                return ev.Green()
##            else: return int(ev)
##        else: 
##            print 'ne, green', self.value.Green()
##            return self.value.Green()
##    def setValue(self, value):
##        self.value = value
##        if self.editorCtrl:
##            self.editorCtrl.SetValue(`self.value.Green()`)
##    def getValue(self):
##        return wxColour(self.value.Red(), self.getElemValue(), self.value.Blue())
##    def getDisplayValue(self):
##        return `self.getElemValue()`

##class BlueColPE(ColElementPE):
##    def getElemValue(self):
##        if self.editorCtrl: 
##            ev = self.editorCtrl.getValue()
##            print 'ec, blue:', self.editorCtrl.getValue(), type(ev), ev
##            if type(ev) == InstanceType:
##                return ev.Blue()
##            else: return int(ev)
##        else: 
##            print 'ne, blue', self.value.Blue()
##            return self.value.Blue()
##    def setValue(self, value):
##        self.value = value
##        if self.editorCtrl:
##            self.editorCtrl.SetValue(`self.value.Blue()`)
##    def getValue(self):
##        return wxColour(self.value.Red(), self.value.Green(), self.getElemValue())
##    def getDisplayValue(self):
##        return `self.getElemValue()`
    
class SizePropEdit(ClassPropEdit):
    def getDisplayValue(self):
        return self.valueToIECValue()
    def valueToIECValue(self):
        return `self.value`
    def inspectorEdit(self):
        self.editorCtrl = TextCtrlIEC(self, self.valueToIECValue())
        self.editorCtrl.createControl(self.parent, self.valueToIECValue(), self.idx, self.width)
    def getValue(self):
        if self.editorCtrl:
            try:
                tuplePos = eval(self.editorCtrl.getValue())
            except Exception, mess:
		Utils.ShowErrorMessage(self.parent, 'Invalid value', mess)
                raise                          
            self.value = wxSize(tuplePos[0], tuplePos[1])
        return self.value
#    def setValue(self, value):
    def valueAsExpr(self):
        return 'wxSize(%d, %d)'%(self.value.x, self.value.y)
                

class PosPropEdit(ClassPropEdit):
    def getDisplayValue(self):
        return self.valueToIECValue()
    def valueToIECValue(self):
        return `self.value`
    def inspectorEdit(self):
        self.editorCtrl = TextCtrlIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.value, self.idx, self.width)
    def getValue(self):
        if self.editorCtrl:
            try:
                tuplePos = eval(self.editorCtrl.getValue())
            except Exception, mess:
		Utils.ShowErrorMessage(self.parent, 'Invalid value', mess)
                raise                          
            self.value = wxPoint(tuplePos[0], tuplePos[1])
        return self.value
    def valueAsExpr(self):
        return 'wxPoint(%d, %d)'%(self.value.x, self.value.y)

class FontPropEdit(ClassPropEdit):
    def getStyle(self):
        return ClassPropEdit.getStyle(self) + [esDialog, esReadOnly]

    def inspectorEdit(self):
        self.editorCtrl = ButtonIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.idx, self.width, self.edit)

    def getValue(self):
        return self.value
    
    def edit(self, event):
#        print 'FPE:edit'
        dlg = wxFontDialog(self.parent)
        dlg.GetFontData().SetInitialFont(self.value)
        if dlg.ShowModal() == wxID_OK:
            self.value = dlg.GetFontData().GetChosenFont()
            self.setter(self.obj, self.value)
            self.obj.Refresh()
        dlg.Destroy()
    def valueAsExpr(self):
        fnt = self.value
        return 'wxFont(%d, %d, %d, %d, %d, %s)'%(fnt.GetPointSize(), 
          fnt.GetFamily(), fnt.GetStyle(), fnt.GetWeight(), fnt.GetUnderlined(),
          `fnt.GetFaceName()`)
        
class BitmapPropEdit(ClassPropEdit):
    def getStyle(self):
        return ClassPropEdit.getStyle(self) + [esDialog, esReadOnly]

    def inspectorEdit(self):
        self.editorCtrl = ButtonIEC(self, self.value)
        self.editorCtrl.createControl(self.parent, self.idx, self.width, self.edit)

    def getValue(self):
        return self.value
    
##    def edit(self, event):
###        print 'FPE:edit'
##        dlg = wxFontDialog(self.parent)
##        dlg.GetFontData().SetInitialFont(self.value)
##        if dlg.ShowModal() == wxID_OK:
##            self.value = dlg.GetFontData().GetChosenFont()
##            self.setter(self.obj, self.value)
##            self.obj.Refresh()
##        dlg.Destroy()
        

""" Property editor registration """

propertyRegistry = PropertyRegistry()

propertyRegistry.registerTypes(IntType, [IntPropEdit])
propertyRegistry.registerTypes(StringType, [StrPropEdit])
propertyRegistry.registerTypes(TupleType, [TuplPropEdit])
propertyRegistry.registerClasses(wxSize, [SizePropEdit])
propertyRegistry.registerClasses(wxSizePtr, [SizePropEdit])
propertyRegistry.registerClasses(wxPoint, [PosPropEdit])
propertyRegistry.registerClasses(wxPointPtr, [PosPropEdit])
propertyRegistry.registerClasses(wxFontPtr, [FontPropEdit])
propertyRegistry.registerClasses(wxColourPtr, [ColPropEdit])
propertyRegistry.registerClasses(wxValidator, [ClassLinkPropEdit])