Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on dead-greek key. #8

Open
Rmano opened this issue Mar 18, 2016 · 2 comments
Open

Error on dead-greek key. #8

Rmano opened this issue Mar 18, 2016 · 2 comments

Comments

@Rmano
Copy link

Rmano commented Mar 18, 2016

Hi, I am trying to load my own layout to edit (see http://rlog.rgtti.com/2015/03/26/a-new-nice-trick-for-the-linux-keyboard-greek-letters/ ) and the (very nice!) program is unable to manage the dead-greek ky definition:

[romano:~/software/keyboardlayouteditor] master* 1 ± ./KeyboardLayoutEditor
Traceback (most recent call last):
  File "./KeyboardLayoutEditor", line 662, in open_layout
    self.mykeyboard.layoutvariant)
  File "/home/romano/software/keyboardlayouteditor/ParseXML.py", line 178, in ExtractVariantsKeycodes
    return __extract_keycodes__(xmllayoutroot, VariantsNew, KeyDictNew, variant)
  File "/home/romano/software/keyboardlayouteditor/ParseXML.py", line 119, in __extract_keycodes__
    result = __extract_keycodes__(n, variants, keydict, variant)
  File "/home/romano/software/keyboardlayouteditor/ParseXML.py", line 165, in __extract_keycodes__
    newkeyvalue = KeyValue.KeyValue(sg.text)
  File "/home/romano/software/keyboardlayouteditor/KeyValue.py", line 33, in __init__
    self.add(value, verbatim)
  File "/home/romano/software/keyboardlayouteditor/KeyValue.py", line 113, in add
    self.__presentation_value__ = "D" + DeadKeys.dict[value][1]
KeyError: 'dead_greek'

...BTW, seems that this nice program is more or less orphaned... Or is there some active fork around?

@Rmano
Copy link
Author

Rmano commented Mar 18, 2016

I tried with this patch:

diff --git a/DeadKeysDict.py b/DeadKeysDict.py
index 782f1af..db2f24f 100644
--- a/DeadKeysDict.py
+++ b/DeadKeysDict.py
@@ -47,10 +47,11 @@ class DeadKeysClass:
                         'dead_belowcircumflex' : ('Below Circumflex', 'ˬ'), 
                         'dead_belowtilde' : ('Below Tilde', '˷'), 
                         'dead_belowbreve' : ('Below Breve', '?'),        # TODO
-                        'dead_belowdiaeresis' : ('Below Diaeresis', '?') } # TODO
+                        'dead_belowdiaeresis' : ('Below Diaeresis', '?'), # TODO
+                        'dead_greek' : ('Dead Greek', '∇') } # using nabla 

 DeadKeys = DeadKeysClass()

 if __name__ == "__main__":
     for k in DeadKeys.dict.keys():
-        print k, DeadKeys.dict[k]
\ No newline at end of file
+        print k, DeadKeys.dict[k]
diff --git a/Keysyms.py b/Keysyms.py
index 68ddb58..3a11489 100644
--- a/Keysyms.py
+++ b/Keysyms.py
@@ -1501,6 +1501,7 @@ KeysymDB = {
     "dead_diaeresis" : 0xfe57,
     "dead_doubleacute" : 0xfe59,
     "dead_grave" : 0xfe50,
+    "dead_greek" : 0xfe8c,
     "dead_hook" : 0xfe61,
     "dead_horn" : 0xfe62,
     "dead_iota" : 0xfe5d,
diff --git a/KeysymsUni.py b/KeysymsUni.py
index 4ddbfc5..11739b4 100644
--- a/KeysymsUni.py
+++ b/KeysymsUni.py
@@ -928,6 +928,7 @@ KeysymsUni = {
     "dead_diaeresis" : 0x308,
     "dead_doubleacute" : 0x30B,
     "dead_grave" : 0x300,
+    "dead_greek" : 0x2207, # nabla here
     "dead_hook" : 0x309,
     "dead_horn" : 0x31B,
     "dead_iota" : 0x345,

but still I get an error --- this one:

[romano:~/software/keyboardlayouteditor] master(+5/-2)* ± ./KeyboardLayoutEditor 
line 18:2 required (...)+ loop did not match anything at input u'replace'
line 18:2 required (...)+ loop did not match anything at input u'replace'
Traceback (most recent call last):
  File "./KeyboardLayoutEditor", line 707, in open_layout
    included_files[parsed_variant['filename']]["xml"])
  File "./KeyboardLayoutEditor", line 852, in select_include_variant
    variant)
  File "/home/romano/software/keyboardlayouteditor/ParseXKB.py", line 342, in parse_layout_controller
    self.parse_layout_recursive(store_keydict, xkbfilename, variantname, start = True)
  File "/home/romano/software/keyboardlayouteditor/ParseXKB.py", line 363, in parse_layout_recursive
    True)
  File "/home/romano/software/keyboardlayouteditor/ParseXKB.py", line 363, in parse_layout_recursive
    True)
  File "/home/romano/software/keyboardlayouteditor/ParseXKB.py", line 347, in parse_layout_recursive
    parsed_layout = self.parse_layout_slave(xkbfilename, variantname)
  File "/home/romano/software/keyboardlayouteditor/ParseXKB.py", line 503, in parse_layout_slave
    'variants': extraction_result['variants'], 
TypeError: 'NoneType' object has no attribute '__getitem__'

That seems a different one. Anyone can help?


@Rmano
Copy link
Author

Rmano commented Mar 18, 2016

Ok, found it.
Just add this patch:

--- a/ParseXKB.py
+++ b/ParseXKB.py
@@ -500,9 +500,9 @@ class ParseXKB:
         extraction_result = ExtractVariantsKeycodes(xml_layout, variantname)
         return { 'success': True, 
                  'all_variants': variants,
-                 'variants': extraction_result['variants'], 
+                 'variants': extraction_result['variants'] if extraction_result else [], 
                  'layout': xml_layout, 
-                 'keydict': extraction_result['keydict']
+                 'keydict': extraction_result['keydict'] if extraction_result else {}
              }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant