home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 October / maximum-cd-2011-10.iso / DiscContents / digsby_setup.exe / lib / gui / lattice / __init__.pyo (.txt)
Encoding:
Python Compiled Bytecode  |  2011-06-22  |  2.0 KB  |  53 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. from peak.events import trellis
  5. import protocols
  6. import wx
  7. from util.lego.blocks import IBindableValue
  8.  
  9. class GUIChangeListener(trellis.Component):
  10.     
  11.     def __init__(self, model):
  12.         self.model = model
  13.  
  14.     
  15.     def bind(self, func):
  16.         self.func = func
  17.         self.model.Bind(self.evt_type, self.on_change)
  18.  
  19.     
  20.     def unbind(self):
  21.         self.model.Unbind(self.evt_type, handler = self.on_change)
  22.         del self.func
  23.  
  24.     
  25.     def on_change(self, e):
  26.         self.func()
  27.  
  28.  
  29.  
  30. class ChoiceListener(GUIChangeListener):
  31.     protocols.advise(asAdapterForTypes = [
  32.         wx.Choice], instancesProvide = [
  33.         IBindableValue])
  34.     evt_type = wx.EVT_CHOICE
  35.     
  36.     def value(self):
  37.         return self.model.GetSelection()
  38.  
  39.     value = property(value)
  40.  
  41.  
  42. class CheckListener(GUIChangeListener):
  43.     protocols.advise(asAdapterForTypes = [
  44.         wx.CheckBox], instancesProvide = [
  45.         IBindableValue])
  46.     evt_type = wx.EVT_CHECKBOX
  47.     
  48.     def value(self):
  49.         return self.model.Value
  50.  
  51.     value = property(value)
  52.  
  53.