Пример #1
0
 def start_capture(self):
     """Begin listening for output from the stenotype machine."""
     self._initializing()
     try:
         self._keyboard_capture = KeyboardCapture()
         self._keyboard_capture.key_down = self._key_down
         self._keyboard_capture.key_up = self._key_up
         self._suppress()
         self._keyboard_capture.start()
     except:
         self._error()
         raise
     self._ready()
Пример #2
0
 def start_capture(self):
     """Begin listening for output from the stenotype machine."""
     self._released_keys.clear()
     self._last_stroke_key_down_count = 0
     self._initializing()
     try:
         self._keyboard_capture = KeyboardCapture()
         self._keyboard_capture.key_down = self._key_down
         self._keyboard_capture.key_up = self._key_up
         self._keyboard_capture.start()
     except:
         self._error()
         raise
     self._ready()
Пример #3
0
 def __init__(self, parent, action, keys):
     super(EditKeysDialog, self).__init__(parent)
     self.sizer = wx.BoxSizer(wx.VERTICAL)
     sizer_flags = wx.SizerFlags().Border(wx.ALL, UI_BORDER).Center()
     instructions = wx.StaticText(
         self, label='Press on the key you want to add/remove.')
     self.sizer.AddF(instructions, sizer_flags)
     self.message = wx.StaticText(self)
     self.sizer.AddF(self.message, sizer_flags)
     buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
     clear_button = wx.Button(self, id=wx.ID_CLEAR)
     clear_button.Bind(wx.EVT_BUTTON, self.on_clear)
     buttons.InsertF(0, clear_button, sizer_flags.Left())
     self.sizer.AddF(buttons, sizer_flags.Expand())
     self.SetSizerAndFit(self.sizer)
     self.action = action
     self.keys = set(keys)
     self.original_keys = self.keys.copy()
     self.capture = KeyboardCapture()
     self.capture.key_down = lambda key: wx.CallAfter(
         self.on_capture_key, key)
Пример #4
0
 def __init__(self, parent, action, keys):
     super(EditKeysDialog, self).__init__(parent)
     self.sizer = wx.BoxSizer(wx.VERTICAL)
     instructions = wx.StaticText(
         self, label='Press on the key you want to add/remove.')
     self.sizer.Add(instructions,
                    border=UI_BORDER,
                    flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL)
     self.message = wx.StaticText(self)
     self.sizer.Add(self.message,
                    border=UI_BORDER,
                    flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL)
     buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
     self.sizer.Add(buttons,
                    border=UI_BORDER,
                    flag=wx.ALL | wx.ALIGN_CENTER_HORIZONTAL)
     self.SetSizer(self.sizer)
     self.sizer.Fit(self)
     self.action = action
     self.keys = set(keys)
     self.original_keys = self.keys.copy()
     self.capture = KeyboardCapture(KeyboardCapture.SUPPORTED_KEYS)
     self.capture.key_down = lambda key: wx.CallAfter(
         self.on_capture_key, key)