keyboardlayouteditor

[Fork] Archive of the keyboard layout editor.
git clone https://git.jojolepro.com/keyboardlayouteditor.git
Log | Files | Refs | README | LICENSE

commit d293556d41fd2c0081e72a9af6e3327148133d55
parent 9ec8adb95a5746da0e2b702478bfd8850abe499c
Author: simos.lists <simos.lists@70737e48-4f4a-0410-8df8-290828ad50c4>
Date:   Tue, 30 Sep 2008 16:20:17 +0000

Find the application home directory, and use when referencing other package files.

git-svn-id: http://keyboardlayouteditor.googlecode.com/svn/trunk@69 70737e48-4f4a-0410-8df8-290828ad50c4

Diffstat:
MKeyboardLayoutEditor/src/Common.py | 3+++
MKeyboardLayoutEditor/src/KeyboardLayoutEditor.py | 6+++++-
MKeyboardLayoutEditor/src/KeycodesReader.py | 8+++++---
3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/KeyboardLayoutEditor/src/Common.py b/KeyboardLayoutEditor/src/Common.py @@ -44,6 +44,9 @@ KLEiconfile = "kleiconfile.ico" # Max levels, currently 4. May go 8 in future. LEVELMAX = 4 +# The application home directory +HOMEDIR = '' + # The application's official full name. applicationname="Keyboard Layout Editor" diff --git a/KeyboardLayoutEditor/src/KeyboardLayoutEditor.py b/KeyboardLayoutEditor/src/KeyboardLayoutEditor.py @@ -24,6 +24,7 @@ __license__ = "GPLv3" try: import os + import sys import copy import string import gtk @@ -66,6 +67,9 @@ class Controller_KeyboardLayoutEditor: """ The keyboard layout editor controller """ def __init__(self): + # Set the home directory of the application + Common.HOMEDIR = os.path.split( os.path.realpath( sys.argv[0] ) )[0] + '/' + # This is the parser for XKB files, creates an lxml.etree object. self.parse_xkb = ParseXKB.ParseXKB() @@ -92,7 +96,7 @@ class Controller_KeyboardLayoutEditor: self.window.connect("check_resize", self.check_resize) - self.icon_pixbuf = gtk.gdk.pixbuf_new_from_file('kle-icon4.svg') + self.icon_pixbuf = gtk.gdk.pixbuf_new_from_file(Common.HOMEDIR + 'kle-icon4.svg') self.window.set_icon(self.icon_pixbuf) self.TARGET_TYPE_TEXT = 80 diff --git a/KeyboardLayoutEditor/src/KeycodesReader.py b/KeyboardLayoutEditor/src/KeycodesReader.py @@ -38,7 +38,7 @@ def getChildrenListByType(tree, type_value): return list -def parseFile(fileandvariant = "xfree86|xfree86", *morefilesandvariants): +def parseFile(fileandvariant = "/usr/share/X11/xkb/keycodes/xfree86|xfree86", *morefilesandvariants): keycodedb = {} for eachfileandvariant in (fileandvariant,) + morefilesandvariants: filename, pipe, variant = eachfileandvariant.partition('|') @@ -119,8 +119,10 @@ def compare_keycode(a, b): def initialise(): global KEYCODEDB - KEYCODEDB = parseFile("xfree86|xfree86", "aliases|qwerty", "evdev|evdev") + KEYCODEDB = parseFile("/usr/share/X11/xkb/keycodes/xfree86|xfree86", + "/usr/share/X11/xkb/keycodes/aliases|qwerty", + "/usr/share/X11/xkb/keycodes/evdev|evdev") #KEYCODEDB = parseFile("evdev|evdev", "aliases|qwerty") if __name__ == "__main__": - KEYCODEDB = parseFile("xfree86|xfree86", "aliases|qwerty") + KEYCODEDB = parseFile("/usr/share/X11/xkb/keycodes/xfree86|xfree86", "/usr/share/X11/xkb/keycodes/aliases|qwerty")