[et-mgmt-tools] [PATCH] Automatically pick the correct keymap based on the X keymap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I made a patch that is automatically pick the correct keymap based
on the X keymap.

The virt-manager gets keymap information from "/etc/sysconfig/keyboard"
and keytable.py (keytable.py is new python file.)

For example.
=============================
"/etc/sysconfig/keyboard"
KEYBOARDTYPE="pc"
KEYTABLE="jp106"
=============================
If there is KEYTABLE="jp106", it compares "jp106"(/etc/sysconfig/keyboard)
to "jp106"(keytable.py). and it set keymap = "ja". because "jp106"(keytable.py) is "ja"
Other than those above. if KEYTABLE="us", it set keymap = "en-us".
Because "us"(keytable.py) is "en-us"

If there isn't "/etc/sysconfig/keyboard" or
it cannot open "/etc/sysconfig/keyboard"
The virt-manager doesn't get keymap information (same as before)
and outputs error messeage at virt-manager.log

keytable.py is incomplete file (ex."":"et"). Because I didn't know it.
So, I think that if someone knows it, they support keytable.py

Please give me an advice, if you have it.

Signed-off-by: Tomohiro Takahashi <takatom@xxxxxxxxxxxxxx>

Thanks,
Tomohiro Takahashi.


diff -uNrp virt-manager--devel.orig/src/virtManager/create.py virt-manager--devel/src/virtManager/create.py --- virt-manager--devel.orig/src/virtManager/create.py 2007-03-26 18:39:05.000000000 +0900 +++ virt-manager--devel/src/virtManager/create.py 2007-03-27 11:04:05.000000000 +0900
@@ -55,6 +55,8 @@ PAGE_NETWORK = 6
PAGE_CPUMEM = 7
PAGE_SUMMARY = 8

+KEYBOARD_DIR = "/etc/sysconfig/keyboard"
+
class vmmCreateMeter(progress.BaseMeter):
    def __init__(self, asyncjob):
        # progress meter has to run asynchronously, so pass in the
@@ -565,7 +567,24 @@ class vmmCreate(gobject.GObject):
            raise ValueError, "Unsupported networking type " + net[0]

        # set up the graphics to use SDL
-        guest.graphics = "vnc"
+        import keytable
+        keymap = None
+        vncport = None
+        try:
+            f = open(KEYBOARD_DIR, "r")
+        except IOError, e:
+ logging.debug('Could not open "/etc/sysconfig/keyboard" ' + str(e))
+        else:
+            while 1:
+                s = f.readline()
+                if s == "":
+                    break
+                if re.search("KEYTABLE", s) != None:
+                    kt = s.split('"')[1]
+                    if keytable.keytable.has_key(kt):
+                        keymap = keytable.keytable[kt]
+            f.close
+        guest.graphics = (True, "vnc", vncport, keymap)

        logging.debug("Creating a VM " + guest.name + \
                      "\n  Type: " + guest.type + \
diff -uNrp virt-manager--devel.orig/src/virtManager/keytable.py virt-manager--devel/src/virtManager/keytable.py --- virt-manager--devel.orig/src/virtManager/keytable.py 1970-01-01 09:00:00.000000000 +0900 +++ virt-manager--devel/src/virtManager/keytable.py 2007-03-26 16:49:06.000000000 +0900
@@ -0,0 +1,37 @@
+# keytable_name_from_dom0:keymap_name_to_Xen
+keytable = {
+    "ar":"ar",
+    "dk":"da",
+    "de":"de",
+    "de-ch":"de-ch",
+    "gb":"en-gb",
+    "us":"en-us",
+    "es":"es",
+    "":"et",
+    "se_FI":"fi",
+    "":"fo",
+    "":"fr",
+    "be":"fr-be",
+    "":"fr-ca",
+    "fr_CH":"fr_ch",
+    "hr":"hr",
+    "":"hu",
+    "":"is",
+    "it":"it",
+    "jp106":"ja",
+    "lt":"lt",
+    "lv":"lv",
+    "mk":"mk",
+    "": "nl",
+    "":"nl-be",
+    "no":"no",
+    "pl":"pl",
+    "pt":"pt",
+    "br":"pt-br",
+    "ru":"ru",
+    "sl":"sl",
+    "":"sv",
+    "th":"th",
+    "tr":"tr",
+    }
+




[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux