Exemplo n.º 1
0
    def __init__(self, options):
        """Create the Key Mon window.
    Options dict:
      scale: float 1.0 is default which means normal size.
      meta: boolean show the meta (windows key)
      kbd_file: string Use the kbd file given.
      emulate_middle: Emulate the middle mouse button.
      theme: Name of the theme to use to draw keys
    """
        settings.SettingsDialog.register()
        self.btns = [
            'MOUSE', 'BTN_RIGHT', 'BTN_MIDDLE', 'BTN_MIDDLERIGHT', 'BTN_LEFT',
            'BTN_LEFTRIGHT', 'BTN_LEFTMIDDLE', 'BTN_LEFTMIDDLERIGHT'
        ]
        self.options = options
        self.pathname = os.path.dirname(os.path.abspath(__file__))
        if self.options.scale < 1.0:
            self.svg_size = '-small'
        else:
            self.svg_size = ''
        # Make lint happy by defining these.
        self.hbox = None
        self.window = None
        self.event_box = None
        self.mouse_indicator_win = None
        self.key_image = None
        self.buttons = None

        self.no_press_timer = None

        self.move_dragged = False
        self.shape_mask_current = None
        self.shape_mask_cache = {}

        self.MODS = ['SHIFT', 'CTRL', 'META', 'ALT']
        self.IMAGES = ['MOUSE'] + self.MODS
        self.images = dict([(img, None) for img in self.IMAGES])
        self.enabled = dict([(img, self.get_option(cstrf(img.lower)))
                             for img in self.IMAGES])

        self.options.kbd_files = settings.get_kbd_files()
        self.modmap = mod_mapper.safely_read_mod_map(self.options.kbd_file,
                                                     self.options.kbd_files)

        self.name_fnames = self.create_names_to_fnames()
        self.devices = xlib.XEvents()
        self.devices.start()

        self.pixbufs = lazy_pixbuf_creator.LazyPixbufCreator(
            self.name_fnames, self.options.scale)
        self.create_window()
        self.reset_no_press_timer()
Exemplo n.º 2
0
  def __init__(self, options):
    """Create the Key Mon window.
    Options dict:
      scale: float 1.0 is default which means normal size.
      meta: boolean show the meta (windows key)
      kbd_file: string Use the kbd file given.
      emulate_middle: Emulate the middle mouse button.
      theme: Name of the theme to use to draw keys
    """
    settings.SettingsDialog.register()
    self.btns = ['MOUSE', 'BTN_RIGHT', 'BTN_MIDDLE', 'BTN_MIDDLERIGHT',
                 'BTN_LEFT', 'BTN_LEFTRIGHT', 'BTN_LEFTMIDDLE',
                 'BTN_LEFTMIDDLERIGHT']
    self.options = options
    self.pathname = os.path.dirname(os.path.abspath(__file__))
    if self.options.scale < 1.0:
      self.svg_size = '-small'
    else:
      self.svg_size = ''
    # Make lint happy by defining these.
    self.hbox = None
    self.window = None
    self.event_box = None
    self.mouse_indicator_win = None
    self.key_image = None
    self.buttons = None

    self.no_press_timer = None

    self.move_dragged = False
    self.shape_mask_current = None
    self.shape_mask_cache = {}

    self.MODS = ['SHIFT', 'CTRL', 'META', 'ALT', 'ALTGR', 'CAPS']
    self.IMAGES = ['MOUSE'] + self.MODS
    self.images = dict([(img, None) for img in self.IMAGES])
    self.enabled = dict([(img, self.get_option(cstrf(img.lower))) for img in self.IMAGES])


    self.options.kbd_files = settings.get_kbd_files()
    self.modmap = mod_mapper.safely_read_mod_map(self.options.kbd_file, self.options.kbd_files)

    self.name_fnames = self.create_names_to_fnames()
    self.devices = xlib.XEvents()
    self.devices.start()

    self.pixbufs = lazy_pixbuf_creator.LazyPixbufCreator(self.name_fnames,
                                                         self.options.scale)
    self.create_window()
    self.reset_no_press_timer()
Exemplo n.º 3
0
  def __init__(self, options):
    """Options dict:
      meta: boolean show the meta (windows key)
      kbd_file: string Use the kbd file given.
    """
    self.btns = ['MOUSE', 'BTN_RIGHT', 'BTN_MIDDLE', 'BTN_MIDDLERIGHT',
                 'BTN_LEFT', 'BTN_LEFTRIGHT', 'BTN_LEFTMIDDLE',
                 'BTN_LEFTMIDDLERIGHT']
    self.options = options

    self.MODS = ['SHIFT', 'CTRL', 'META', 'ALT']

    self.options.kbd_files = settings.get_kbd_files()
    self.modmap = mod_mapper.safely_read_mod_map(self.options.kbd_file, self.options.kbd_files)

    self.devices = xlib.XEvents()
    self.devices.start()

    path = '/tmp/prvak-log-%s' % time.strftime('%Y%m%d-%H%M%S', time.gmtime())
    print 'Logging into: %s' % path
    self.event_log = open(path, 'w')

    self.add_events()