# Path: plover/machine/base.py
# class StenotypeBase(object):
#     """The base class for all Stenotype classes."""
# 
#     def __init__(self):
#         self.stroke_subscribers = []
#         self.state_subscribers = []
#         self.state = STATE_STOPPED
#         self.suppress = None
# 
#     def start_capture(self):
#         """Begin listening for output from the stenotype machine."""
#         pass
# 
#     def stop_capture(self):
#         """Stop listening for output from the stenotype machine."""
#         pass
# 
#     def add_stroke_callback(self, callback):
#         """Subscribe to output from the stenotype machine.
# 
#         Argument:
# 
#         callback -- The function to call whenever there is output from
#         the stenotype machine and output is being captured.
# 
#         """
#         self.stroke_subscribers.append(callback)
# 
#     def remove_stroke_callback(self, callback):
#         """Unsubscribe from output from the stenotype machine.
# 
#         Argument:
# 
#         callback -- A function that was previously subscribed.
# 
#         """
#         self.stroke_subscribers.remove(callback)
# 
#     def add_state_callback(self, callback):
#         self.state_subscribers.append(callback)
#         
#     def remove_state_callback(self, callback):
#         self.state_subscribers.remove(callback)
# 
#     def _notify(self, steno_keys):
#         """Invoke the callback of each subscriber with the given argument."""
#         # If the stroke matches a command while the keyboard is not suppressed 
#         # then the stroke needs to be suppressed after the fact. One of the 
#         # handlers will set the suppress function. This function is passed in to 
#         # prevent threading issues with the gui.
#         self.suppress = None
#         for callback in self.stroke_subscribers:
#             callback(steno_keys)
#         if self.suppress:
#             self._post_suppress(self.suppress, steno_keys)
#             
#     def _post_suppress(self, suppress, steno_keys):
#         """This is a complicated way for the application to tell the machine to 
#         suppress this stroke after the fact. This only currently has meaning for 
#         the keyboard machine so it can backspace over the last stroke when used 
#         to issue a command when plover is 'off'.
#         """
#         pass
# 
#     def _set_state(self, state):
#         self.state = state
#         for callback in self.state_subscribers:
#             callback(state)
# 
#     def _stopped(self):
#         self._set_state(STATE_STOPPED)
# 
#     def _initializing(self):
#         self._set_state(STATE_INITIALIZING)
# 
#     def _ready(self):
#         self._set_state(STATE_RUNNING)
#             
#     def _error(self):
#         self._set_state(STATE_ERROR)
# 
#     @staticmethod
#     def get_option_info():
#         """Get the default options for this machine."""
#         return {}


from plover.machine.base import StenotypeBase
from plover.oslayer import keyboardcontrol
                          "p": "-n",
                          ";": "-$",
                          "[": "-D",
                          "'": "-C",
                          "1": "#",
                          "2": "#",
                          "3": "#",
                          "4": "#",
                          "5": "#",
                          "6": "#",
                          "7": "#",
                          "8": "#",
                          "9": "#",
                          "0": "#",
                          "-": "#",
                          "=": "#",
                         }


class Stenotype(StenotypeBase):
    """Standard stenotype interface for a Microsoft Sidewinder X4 keyboard.

    This class implements the three methods necessary for a standard
    stenotype interface: start_capture, stop_capture, and
    add_callback.

    """

    def __init__(self, params):
        """Monitor a Microsoft Sidewinder X4 keyboard via X events."""

# Path: plover/machine/base.py
# class StenotypeBase(object):
#     """The base class for all Stenotype classes."""
# 
#     def __init__(self):
#         self.stroke_subscribers = []
#         self.state_subscribers = []
#         self.state = STATE_STOPPED
#         self.suppress = None
# 
#     def start_capture(self):
#         """Begin listening for output from the stenotype machine."""
#         pass
# 
#     def stop_capture(self):
#         """Stop listening for output from the stenotype machine."""
#         pass
# 
#     def add_stroke_callback(self, callback):
#         """Subscribe to output from the stenotype machine.
# 
#         Argument:
# 
#         callback -- The function to call whenever there is output from
#         the stenotype machine and output is being captured.
# 
#         """
#         self.stroke_subscribers.append(callback)
# 
#     def remove_stroke_callback(self, callback):
#         """Unsubscribe from output from the stenotype machine.
# 
#         Argument:
# 
#         callback -- A function that was previously subscribed.
# 
#         """
#         self.stroke_subscribers.remove(callback)
# 
#     def add_state_callback(self, callback):
#         self.state_subscribers.append(callback)
#         
#     def remove_state_callback(self, callback):
#         self.state_subscribers.remove(callback)
# 
#     def _notify(self, steno_keys):
#         """Invoke the callback of each subscriber with the given argument."""
#         # If the stroke matches a command while the keyboard is not suppressed 
#         # then the stroke needs to be suppressed after the fact. One of the 
#         # handlers will set the suppress function. This function is passed in to 
#         # prevent threading issues with the gui.
#         self.suppress = None
#         for callback in self.stroke_subscribers:
#             callback(steno_keys)
#         if self.suppress:
#             self._post_suppress(self.suppress, steno_keys)
#             
#     def _post_suppress(self, suppress, steno_keys):
#         """This is a complicated way for the application to tell the machine to 
#         suppress this stroke after the fact. This only currently has meaning for 
#         the keyboard machine so it can backspace over the last stroke when used 
#         to issue a command when plover is 'off'.
#         """
#         pass
# 
#     def _set_state(self, state):
#         self.state = state
#         for callback in self.state_subscribers:
#             callback(state)
# 
#     def _stopped(self):
#         self._set_state(STATE_STOPPED)
# 
#     def _initializing(self):
#         self._set_state(STATE_INITIALIZING)
# 
#     def _ready(self):
#         self._set_state(STATE_RUNNING)
#             
#     def _error(self):
#         self._set_state(STATE_ERROR)
# 
#     @staticmethod
#     def get_option_info():
#         """Get the default options for this machine."""
#         return {}


# Path: plover/machine/francais.py
from plover.machine.base import StenotypeBase
from plover.oslayer import keyboardcontrol

                          "p": "-n",
                          ";": "-$",
                          "[": "-D",
                          "'": "-C",
                          "1": "#",
                          "2": "#",
                          "3": "#",
                          "4": "#",
                          "5": "#",
                          "6": "#",
                          "7": "#",
                          "8": "#",
                          "9": "#",
                          "0": "#",
                          "-": "#",
                          "=": "#",
                         }


class Stenotype(StenotypeBase):
    """Standard stenotype interface for a Microsoft Sidewinder X4 keyboard.

    This class implements the three methods necessary for a standard
    stenotype interface: start_capture, stop_capture, and
    add_callback.

    """

    def __init__(self, params):
        """Monitor a Microsoft Sidewinder X4 keyboard via X events."""

        StenotypeBase.__init__(self)