From a97bd77f927c1c34787bdc5e23bdac17e24225a4 Mon Sep 17 00:00:00 2001 From: jerous Date: Thu, 12 Jun 2008 01:31:27 +0200 Subject: loading dynamically all plugins in ./plugins/*.py --- plugins/Shortcuts.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 plugins/Shortcuts.py (limited to 'plugins/Shortcuts.py') diff --git a/plugins/Shortcuts.py b/plugins/Shortcuts.py new file mode 100644 index 0000000..cd419dd --- /dev/null +++ b/plugins/Shortcuts.py @@ -0,0 +1,45 @@ +from PyQt4 import QtGui, QtCore + +from Xlib.display import Display +from Xlib import X +from Xlib.XK import * +from thread import start_new_thread + +from clPlugin import Plugin +from clSettings import settings + + +class pluginShortcuts(Plugin): + display=None + root=None + def __init__(self, winMain): + global keycodes + Plugin.__init__(self, winMain, 'Shortcuts') + + self.disp=Display() + self.root=self.disp.screen().root + self.root.change_attributes(event_mask=X.KeyPressMask) + #for keycode,name in enumerate(keycodes): + #print keycode + #self.root.grab_key(keycode, X.AnyModifier, 0, X.GrabModeAsync, X.GrabModeAsync) + start_new_thread(self.keyHandler, (None,)) + + def err(self,param=None,param2=None): + print param + print param2 + + def getInfo(self): + return "Control playing using shortcuts." + + def _getSettings(self): + return [ + ['shortcuts.playpauze', 'Play/pauze', 'Key to start playing/pauze.', QtGui.QLineEdit(settings.get('shortcuts.playpauze', 'Win+Home'))], + ] + def afterSaveSettings(self): + pass + + def keyHandler(self, emptyParam): + while 1: + event=self.root.display.next_event() + keycode=event.detail + print keycode -- cgit v1.2.3