Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
keytypes = Enum.Enum("SIMPLE SPECIAL").vals(illegal=255)
alignments = Enum.Enum("LEFT CENTRE RIGHT").vals(illegal=255)
keysegments = Enum.Enum("ALL ONE TWO THREE FOUR NONE").vals(illegal=255)
keyvaluetype = Enum.Enum("UNICHAR CODEPOINT KEYSYM CONSTANT DEADKEY ANY VOIDSYMBOL NOSYMBOL NOACTION VERBATIM").vals(illegal=255)
keyvaluetype = Enum.Enum("UNICHAR CODEPOINT KEYSYM CONSTANT DEADKEY ANY VOIDSYMBOL NOSYMBOL NOACTION VERBATIM").vals(
illegal=255)

keysegmentslist = [keysegments.ONE, keysegments.TWO,
keysegmentslist = [keysegments.ONE, keysegments.TWO,
keysegments.THREE, keysegments.FOUR]
keysegmentslistreverse = list(keysegmentslist)
keysegmentslistreverse.reverse()
Expand Down Expand Up @@ -52,10 +53,10 @@
HOMEDIR = ''

# The application's official full name.
applicationname="Keyboard Layout Editor"
applicationname = "Keyboard Layout Editor"

# Holds the current filename.
currentlayoutfile=''
currentlayoutfile = ''

# The directory to the xkeyboard-config base directory.
basedir = '/usr/share/X11/xkb/'
Expand All @@ -78,27 +79,31 @@

"""


# Sorts a dictionary by value, produces a sorted list of values.
def sortDict(adict, cmp_function = None):
def sortDict(adict, cmp_function=None):
keys = adict.keys()
keys.sort(cmp_function)
return map(adict.get, keys)


def addtostatusbar(message):
statusbar.push(statusbar.console_context, message)


def parseIncludeString(include):
"""
Parses strings of the form 'us(intl)', 'us', and produces
{ 'filename': 'us', 'variant': 'intl' }, { 'filename': 'us', 'variant': 'basic' }
"""
if include.partition('(')[1] == '(':
return { 'filename': include.partition('(')[0], 'variant': include.partition('(')[2].partition(')')[0] }
return {'filename': include.partition('(')[0], 'variant': include.partition('(')[2].partition(')')[0]}
else:
return { 'filename': include.partition('(')[0], 'variant': '' }
return {'filename': include.partition('(')[0], 'variant': ''}


if __name__ == '__main__':
print parseIncludeString('us')
print parseIncludeString('us(level1)')


if __name__ != '__main__':
pass
else:
print(parseIncludeString('us'))
print(parseIncludeString('us(level1)'))
69 changes: 35 additions & 34 deletions DeadKeysDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,43 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>

class DeadKeysClass:
def __init__(self):
self.dict = {
'dead_grave' : ('Grave', '`'),
'dead_acute' : ('Acute', '´'),
'dead_circumflex' : ('Circumflex', '^'),
'dead_tilde' : ('Tilde', '~'),
'dead_perispomeni' : ('Perispomeni', '῀'),
'dead_macron' : ('Macron', 'ˉ'),
'dead_breve' : ('Breve', '˘'),
'dead_abovedot' : ('Abovedot', '˙'),
'dead_diaeresis' : ('Diaeresis', '¨'),
'dead_abovering' : ('Abovering', '˚'),
'dead_doubleacute' : ('Double Acute', '˝'),
'dead_caron' : ('Caron', 'ˇ'),
'dead_cedilla' : ('Cedilla', '¸'),
'dead_ogonek' : ('Ogonek', '˛'),
'dead_iota' : ('Iota', 'ͺ'),
'dead_voiced_sound' : ('Voiced Sound', '゙'), # TODO (maybe)
'dead_semivoiced_sound' : ('Semivoiced Sound', '゚'), # TODO (maybe)
'dead_belowdot' : ('Below Dot', '?'), # TODO
'dead_hook' : ('Hook', '?'), # TODO
'dead_horn' : ('Horn', '?'), # TODO
'dead_stroke' : ('Stroke', '?'), # TODO
'dead_abovecomma' : ('Above Comma', '?'), # TODO
'dead_psili' : ('Psili', '?'), # TODO
'dead_abovereversedcomma' : ('Above Reversed Comma', 'ʽ'),
'dead_dasia' : ('Dasia', '῾'),
'dead_belowring' : ('Below Ring', '˳'),
'dead_belowmacron' : ('Below Macron', 'ˍ'),
'dead_belowcircumflex' : ('Below Circumflex', 'ˬ'),
'dead_belowtilde' : ('Below Tilde', '˷'),
'dead_belowbreve' : ('Below Breve', '?'), # TODO
'dead_belowdiaeresis' : ('Below Diaeresis', '?') } # TODO
def __init__(self):
self.dict = {
'dead_grave': ('Grave', '`'),
'dead_acute': ('Acute', '´'),
'dead_circumflex': ('Circumflex', '^'),
'dead_tilde': ('Tilde', '~'),
'dead_perispomeni': ('Perispomeni', '῀'),
'dead_macron': ('Macron', 'ˉ'),
'dead_breve': ('Breve', '˘'),
'dead_abovedot': ('Abovedot', '˙'),
'dead_diaeresis': ('Diaeresis', '¨'),
'dead_abovering': ('Abovering', '˚'),
'dead_doubleacute': ('Double Acute', '˝'),
'dead_caron': ('Caron', 'ˇ'),
'dead_cedilla': ('Cedilla', '¸'),
'dead_ogonek': ('Ogonek', '˛'),
'dead_iota': ('Iota', 'ͺ'),
'dead_voiced_sound': ('Voiced Sound', '゙'), # TODO (maybe)
'dead_semivoiced_sound': ('Semivoiced Sound', '゚'), # TODO (maybe)
'dead_belowdot': ('Below Dot', '?'), # TODO
'dead_hook': ('Hook', '?'), # TODO
'dead_horn': ('Horn', '?'), # TODO
'dead_stroke': ('Stroke', '?'), # TODO
'dead_abovecomma': ('Above Comma', '?'), # TODO
'dead_psili': ('Psili', '?'), # TODO
'dead_abovereversedcomma': ('Above Reversed Comma', 'ʽ'),
'dead_dasia': ('Dasia', '῾'),
'dead_belowring': ('Below Ring', '˳'),
'dead_belowmacron': ('Below Macron', 'ˍ'),
'dead_belowcircumflex': ('Below Circumflex', 'ˬ'),
'dead_belowtilde': ('Below Tilde', '˷'),
'dead_belowbreve': ('Below Breve', '?'), # TODO
'dead_belowdiaeresis': ('Below Diaeresis', '?')} # TODO


DeadKeys = DeadKeysClass()

if __name__ == "__main__":
for k in DeadKeys.dict.keys():
print k, DeadKeys.dict[k]
print(k, DeadKeys.dict[k])
Loading