-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathscreenkey
More file actions
executable file
·93 lines (83 loc) · 3.46 KB
/
screenkey
File metadata and controls
executable file
·93 lines (83 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python
# Copyright (c) 2010 Pablo Seminario <pabluk@gmail.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import logging
from optparse import OptionParser
import pygtk
pygtk.require('2.0')
import gtk
import gettext
import locale
locale.setlocale(locale.LC_ALL, '')
gettext.install('screenkey', unicode=True)
from Screenkey import APP_NAME, APP_DESC, VERSION
from Screenkey.screenkey import Screenkey
gtk.gdk.threads_init()
def Main():
parser = OptionParser(description=APP_DESC, version=VERSION)
parser.add_option("--no-detach", action="store_true",
dest="nodetach", default=False,
help=_("do not detach from the parent"))
parser.add_option("-d", "--debug", action="store_true",
dest="debug", default=False, help=_("show debug information"))
parser.add_option("-t", "--timeout", type="int", dest="timeout",
help=_("timeout"), default=2)
parser.add_option("-s", "--size", type="int", dest="size",
help=_("size"), default=4)
parser.add_option("-m", "--mode", type="int", dest="mode",
help=_("mode"), default=1)
parser.add_option("-p", "--position", type="int", dest="position",
help=_("position"), default=2)
parser.add_option("-o", "--opacity", type="float", dest="opacity",
help=_("opacity"), default=0.7)
parser.add_option("-b", "--bgcolor", type="string", dest="bgcolor",
help=_("bgcolor"), default='black')
parser.add_option("-f", "--font", type="string", dest="font",
help=_("font"), default='Sans')
parser.add_option("-n", "--no-hide", action="store_true",
dest="nohide", default=False, help=_("do not hide"))
#parser.add_option("-c", "--color", type="string",
#dest="color", help=_("color"), default='TODO')
(options, args) = parser.parse_args()
if options.debug:
if options.nodetach:
# Send debug messages to standard output
logfile = None
else:
logfile = os.path.join(os.path.expanduser('~'),
'.screenkey.log')
username = os.environ.get('SUDO_USER')
if username:
homedir = os.path.expanduser('~%s' % username)
if homedir != '~%s' % username:
logfile = os.path.join(homedir, '.screenkey.log')
logging.basicConfig(filename=logfile, level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(APP_NAME)
s = Screenkey(logger=logger, nodetach=options.nodetach,
timeout=options.timeout,
size=options.size,
mode=options.mode,
position=options.position,
opacity=options.opacity,
bgcolor=options.bgcolor,
nohide=options.nohide,
font=options.font#,
#color=options.color)
)
gtk.main()
if __name__ == "__main__":
Main()