xkb
sezanzeb 4 years ago committed by sezanzeb
parent de240b8965
commit c2f6195196

@ -33,7 +33,7 @@ def get_data_path(filename=''):
# depending on where this file is installed to, make sure to use the proper
# prefix path for data
# https://docs.python.org/3/distutils/setupscript.html?highlight=package_data#installing-additional-files # noqa
# https://docs.python.org/3/distutils/setupscript.html?highlight=package_data#installing-additional-files # noqa pylint: disable=line-too-long
if source_path.startswith(site.USER_BASE):
data_path = os.path.join(site.USER_BASE, 'share/key-mapper')
elif source_path.startswith('/usr/local/'):

@ -274,8 +274,8 @@ class KeycodeInjector:
handler=lambda keycode, value: (
self._write(
keymapper_device,
target_keycode,
event.value
keycode,
value
)
)
).run()

@ -101,12 +101,12 @@ class _Macro:
self.tasks.append(lambda: self.handler(character, 0))
return self
def wait(self, min, max=None):
def wait(self, min_time, max_time=None):
"""Wait a random time in milliseconds"""
if max is None:
sleeptime = min
if max_time is None:
sleeptime = min_time
else:
sleeptime = random.random() * (max - min) + min
sleeptime = random.random() * (max_time - min_time) + min_time
self.tasks.append(lambda: time.sleep(sleeptime / 1000))
return self
@ -188,7 +188,7 @@ def _parse_recurse(macro, handler, macro_instance=None, depth=0):
}
if functions.get(call) is None:
logger.error(f'Unknown function %s', call)
logger.error('Unknown function %s', call)
# get all the stuff inbetween
brackets = 0
@ -203,14 +203,14 @@ def _parse_recurse(macro, handler, macro_instance=None, depth=0):
if char == ')':
brackets -= 1
if brackets < 0:
logger.error(f'There is one ")" too much at %s', position)
logger.error('There is one ")" too much at %s', position)
return
if brackets == 0:
# the closing bracket of the call
break
if brackets != 0:
logger.error(f'There are %s closing brackets missing', brackets)
logger.error('There are %s closing brackets missing', brackets)
inner = macro[2:position - 1]

@ -40,7 +40,7 @@ def can_read_devices():
def warn(group):
logger.warning(
'Some devices may not be visible without being in the '
f'"%s" user group. Try `sudo usermod -a -G %s $USER` '
'"%s" user group. Try `sudo usermod -a -G %s $USER` '
'and log out and back in.',
group,
group

@ -225,7 +225,7 @@ class Window:
self.dbus.stop_injecting(self.selected_device)
self.get('status_bar').push(
CTX_APPLY,
f'Applied the system default'
'Applied the system default'
)
# restart reading because after injecting the device landscape
# changes a bit

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="73" height="20">
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<mask id="anybadge_1">
<rect width="73" height="20" rx="3" fill="#fff"/>
<rect width="80" height="20" rx="3" fill="#fff"/>
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h44v20H0z"/>
<path fill="#4c1" d="M44 0h29v20H44z"/>
<path fill="url(#b)" d="M0 0h73v20H0z"/>
<path fill="#4c1" d="M44 0h36v20H44z"/>
<path fill="url(#b)" d="M0 0h80v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="23.0" y="15" fill="#010101" fill-opacity=".3">pylint</text>
<text x="22.0" y="14">pylint</text>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="59.5" y="15" fill="#010101" fill-opacity=".3">9.6</text>
<text x="58.5" y="14">9.6</text>
<text x="63.0" y="15" fill="#010101" fill-opacity=".3">9.77</text>
<text x="62.0" y="14">9.77</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -37,9 +37,9 @@ class TestMacros(unittest.TestCase):
self.assertListEqual(self.result, [(1, 1), (1, 0)])
def test_1(self):
parse('k(1).k(a).k(3)', self.handler).run()
parse('k(1 2).k(a).k(3)', self.handler).run()
self.assertListEqual(self.result, [
(1, 1), (1, 0),
('1 2', 1), ('1 2', 0),
('a', 1), ('a', 0),
(3, 1), (3, 0),
])

Loading…
Cancel
Save