コード例 #1
0
 def __init__(self, app):
     UserDataManager.__init__(self)
     self.app = app
     self.setup_widgets()
     self._recursing = False
     self.app.config.reload()
     Action.register_all(sys.modules['scc.osd.osk_actions'], prefix="OSK")
     self.load_settings()
     self.load_profile_list()
     self._recursing = False
     self._eh_ids = (self.app.dm.connect('reconfigured',
                                         self.on_daemon_reconfigured), )
コード例 #2
0
	def __init__(self, app):
		UserDataManager.__init__(self)
		self.app = app
		self.setup_widgets()
		self._timer = None
		self._recursing = False
		self.app.config.reload()
		Action.register_all(sys.modules['scc.osd.osk_actions'], prefix="OSK")
		self.load_settings()
		self.load_profile_list()
		self._recursing = False
		self._eh_ids = (
			self.app.dm.connect('reconfigured', self.on_daemon_reconfigured),
		)
コード例 #3
0
 def __init__(self, app):
     UserDataManager.__init__(self)
     self.app = app
     self.setup_widgets()
     self._timer = None
     self._recursing = False
     self._gamepad_icons = {
         'unknown':
         GdkPixbuf.Pixbuf.new_from_file(
             os.path.join(self.app.imagepath, "controller-icons",
                          "unknown.svg"))
     }
     self.app.config.reload()
     Action.register_all(sys.modules['scc.osd.osk_actions'], prefix="OSK")
     self.load_settings()
     self.load_profile_list()
     self._recursing = False
     self._eh_ids = (self.app.dm.connect('reconfigured',
                                         self.on_daemon_reconfigured), )
コード例 #4
0
    def __init__(self, config=None):
        self.kbimage = os.path.join(get_config_path(), 'keyboard.svg')
        if not os.path.exists(self.kbimage):
            # Prefer image in ~/.config/scc, but load default one as fallback
            self.kbimage = os.path.join(get_share_path(), "images",
                                        'keyboard.svg')

        TimerManager.__init__(self)
        OSDWindow.__init__(self, "osd-keyboard")
        self.daemon = None
        self.mapper = None
        self.keymap = Gdk.Keymap.get_default()
        self.keymap.connect('state-changed', self.on_keymap_state_changed)
        Action.register_all(sys.modules['scc.osd.osk_actions'], prefix="OSK")
        self.profile = Profile(TalkingActionParser())
        self.config = config or Config()
        self.dpy = X.Display(hash(GdkX11.x11_get_default_xdisplay()))
        self.group = None
        self.limits = {}
        self.background = None

        cursor = os.path.join(get_share_path(), "images", 'menu-cursor.svg')
        self.cursors = {}
        self.cursors[LEFT] = Gtk.Image.new_from_file(cursor)
        self.cursors[LEFT].set_name("osd-keyboard-cursor")
        self.cursors[RIGHT] = Gtk.Image.new_from_file(cursor)
        self.cursors[RIGHT].set_name("osd-keyboard-cursor")
        self.cursors[CPAD] = Gtk.Image.new_from_file(cursor)
        self.cursors[CPAD].set_name("osd-keyboard-cursor")

        self._eh_ids = []
        self._controller = None
        self._stick = 0, 0
        self._hovers = {self.cursors[LEFT]: None, self.cursors[RIGHT]: None}
        self._pressed = {self.cursors[LEFT]: None, self.cursors[RIGHT]: None}
        self._pressed_areas = {}

        self.c = Gtk.Box()
        self.c.set_name("osd-keyboard-container")

        self.f = Gtk.Fixed()
コード例 #5
0
ファイル: keyboard.py プロジェクト: kozec/sc-controller
	def __init__(self, config=None):
		self.kbimage = os.path.join(get_config_path(), 'keyboard.svg')
		if not os.path.exists(self.kbimage):
			# Prefer image in ~/.config/scc, but load default one as fallback
			self.kbimage = os.path.join(get_share_path(), "images", 'keyboard.svg')
		
		TimerManager.__init__(self)
		OSDWindow.__init__(self, "osd-keyboard")
		self.daemon = None
		self.mapper = None
		self.keymap = Gdk.Keymap.get_default()
		self.keymap.connect('state-changed', self.on_keymap_state_changed)
		Action.register_all(sys.modules['scc.osd.osk_actions'], prefix="OSK")
		self.profile = Profile(TalkingActionParser())
		self.config = config or Config()
		self.dpy = X.Display(hash(GdkX11.x11_get_default_xdisplay()))
		self.group = None
		self.limits = {}
		self.background = None
		
		cursor = os.path.join(get_share_path(), "images", 'menu-cursor.svg')
		self.cursors = {}
		self.cursors[LEFT] = Gtk.Image.new_from_file(cursor)
		self.cursors[LEFT].set_name("osd-keyboard-cursor")
		self.cursors[RIGHT] = Gtk.Image.new_from_file(cursor)
		self.cursors[RIGHT].set_name("osd-keyboard-cursor")
		self.cursors[CPAD] = Gtk.Image.new_from_file(cursor)
		self.cursors[CPAD].set_name("osd-keyboard-cursor")
		
		self._eh_ids = []
		self._controller = None
		self._stick = 0, 0
		self._hovers = { self.cursors[LEFT]: None, self.cursors[RIGHT]: None }
		self._pressed = { self.cursors[LEFT]: None, self.cursors[RIGHT]: None }
		self._pressed_areas = {}
		
		self.c = Gtk.Box()
		self.c.set_name("osd-keyboard-container")
		
		self.f = Gtk.Fixed()
コード例 #6
0
            gstr:
            parser.from_json_data(data[GesturesAction.PROFILE_KEYS[0]][gstr])
            for gstr in data[GesturesAction.PROFILE_KEYS[0]]
        }
        if "name" in data:
            ga.name = data["name"]
        if "osd" in data:
            ga = OSDAction(ga)
        return ga

    def gesture(self, mapper, gesture_string):
        action = None
        if gesture_string in self.gestures:
            action = self.gestures[gesture_string]
        else:
            sgstr = strip_gesture(gesture_string)
            if sgstr in self.gestures:
                action = self.gestures[sgstr]
        if action:
            action.button_press(mapper)
            mapper.schedule(0, action.button_release)

    def whole(self, mapper, x, y, what):
        if (x, y) != (0, 0):
            # (0, 0) singlanizes released touchpad
            self.execute(mapper, x, y, what)


# Register actions from current module
Action.register_all(sys.modules[__name__])