コード例 #1
0
ファイル: ewmh.py プロジェクト: plotnick/dim
 def handle_state_change(self, client_message):
     # A state change message consists of an action (add, remove, toggle),
     # one or two states, and a source indication (application or user).
     # We always treat the states as independent.
     action, first, second, source, _ = client_message.data.data32
     for atom in first, second:
         if atom:
             name = self.atoms.name(atom)
             handler = net_wm_state_classes.get(name)
             if handler:
                 assert issubclass(handler, NetWMStateChange)
                 handler(self.manager, self, action, atom, source)
             else:
                 self.log.debug("Ignoring hint %s.", name)
     raise StopPropagation
コード例 #2
0
 def compressed_handler(self, event):
     window = event_window(event)
     event_type = type(event)
     while True:
         next_event = self.check_typed_window_event(window, event_type)
         if next_event:
             event = next_event
         else:
             break
     return handler(self, event)
コード例 #3
0
ファイル: sim.py プロジェクト: x4x/serialsim_g
    def __init__(self, sport, boud, answer, question=None):
        """Initalise Sensor simulator.

        Attributes:
         sport     Serial port number. eg.: '/dev/ttyS0' or on win: COM1 = 0
         boud      Boud eg.: 9600, 19200
         answer    String sent form simulator
         question  Question to wate in polld mode. eg.: '?A' 
         mode      operration mode. eg.: 'c1' continous 1sec
                                         'c2' continous 2sec
                                         'p'  polled (wating for question string)
         call  object to call if event (set to self)

         :var data_in: string with entire serial input data
        """
        self.question = question
        self.answer = answer
        self._data = ""
        self.data_in = ""
        self.handler = handler()

        self.serial = serial.Serial(port=sport, baudrate=boud, bytesize=8, parity='N',
                                  stopbits=1, timeout=None, xonxoff=0, rtscts=0)
コード例 #4
0
 def head_geometry_changed(self, old_geometry, new_geometry):
     for handler in self.change_handlers:
         handler(old_geometry, new_geometry)