2
Copyright (C) 2007 Lincoln de Sousa <lincoln@archlinux-br.org>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of the
7
License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the
16
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301 USA
21
Globahotkeys test file
22
======================
26
This is a really simple test of globalhotkeys module.
28
To use this you must compile globalhotkeys module, and run this file with
29
python. Please only remember to copy your globalhotkeys.so file to a path
30
contained in sys.path (maybe you can use PYTHONPATH).
32
The module contains only 3 functions, init/bind/unbind and they are very simple
35
What you can not forget?
36
~~~~~~~~~~~~~~~~~~~~~~~~
37
- Compile your module with debug flag, it will help you find a possible
40
- Run every test from a terminal, all messages will be displayed there.
42
- Globalhotkeys module depends on gtk, so if you don't import gtk before call
43
any funcion in that module, you will see some warnings on your terminal =D
45
- globalhotkeys.init MUST be called before binding/unbinding keys.
48
What shoud happen here?
49
~~~~~~~~~~~~~~~~~~~~~~~
50
This script is a simple test that initializes globalhotkeys machinery and
51
bindings a key to a simple function. So after running this program, you shoud
52
se a message 'great =D' or 'bad =('. If every thing goes right, when you press
53
the F12 key, you should see ('F12',) on your terminal otherwise, you will see a
54
warning saying that binding has failed.
56
A really important thing is that globalhotkeys.bind returns boolean values, so
57
if you want to know if binding works properly, only test this with a simple if.
61
if you want to test your program when it shoud say to the user that the binding
62
failed, you can simply use this program to bind the key that you're running.
63
Because you can bind a key once.
73
binded = globalhotkeys.GlobalHotkey().bind('F12', hammer)