plover 5.0.0.dev2__py3-none-any.whl → 5.0.0.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plover/__init__.py +8 -7
- plover/__main__.py +1 -1
- plover/command/set_config.py +7 -4
- plover/config.py +177 -74
- plover/dictionary/base.py +21 -9
- plover/dictionary/helpers.py +6 -4
- plover/dictionary/json_dict.py +10 -12
- plover/dictionary/loading_manager.py +8 -10
- plover/dictionary/rtfcre_dict.py +46 -43
- plover/dictionary/rtfcre_parse.py +116 -100
- plover/engine.py +112 -96
- plover/exception.py +4 -1
- plover/formatting.py +198 -140
- plover/gui_none/add_translation.py +17 -16
- plover/gui_none/engine.py +1 -3
- plover/gui_none/main.py +2 -2
- plover/gui_qt/about_dialog.py +17 -17
- plover/gui_qt/add_translation_dialog.py +8 -9
- plover/gui_qt/add_translation_widget.py +66 -63
- plover/gui_qt/config_window.py +274 -154
- plover/gui_qt/console_widget.py +9 -13
- plover/gui_qt/dictionaries_widget.py +140 -119
- plover/gui_qt/dictionary_editor.py +60 -61
- plover/gui_qt/engine.py +3 -3
- plover/gui_qt/info_browser.py +50 -4
- plover/gui_qt/log_qt.py +3 -2
- plover/gui_qt/lookup_dialog.py +9 -9
- plover/gui_qt/machine_options.py +38 -37
- plover/gui_qt/main.py +19 -19
- plover/gui_qt/main_window.py +88 -71
- plover/gui_qt/paper_tape.py +69 -52
- plover/gui_qt/paper_tape_ui.py +0 -3
- plover/gui_qt/plugins_manager.py +47 -43
- plover/gui_qt/resources_rc.py +28 -28
- plover/gui_qt/run_dialog.py +7 -6
- plover/gui_qt/steno_validator.py +2 -3
- plover/gui_qt/suggestions_dialog.py +34 -38
- plover/gui_qt/suggestions_widget.py +22 -16
- plover/gui_qt/tool.py +1 -3
- plover/gui_qt/trayicon.py +19 -19
- plover/gui_qt/utils.py +19 -9
- plover/i18n.py +9 -8
- plover/key_combo.py +130 -130
- plover/log.py +26 -26
- plover/machine/base.py +40 -35
- plover/machine/geminipr.py +7 -7
- plover/machine/keyboard.py +16 -14
- plover/machine/keyboard_capture/__init__.py +0 -1
- plover/machine/keymap.py +24 -20
- plover/machine/passport.py +6 -5
- plover/machine/procat.py +12 -16
- plover/machine/stentura.py +45 -29
- plover/machine/txbolt.py +5 -3
- plover/macro/repeat.py +0 -1
- plover/macro/retro.py +9 -9
- plover/macro/undo.py +4 -3
- plover/meta/attach.py +12 -10
- plover/meta/case.py +2 -1
- plover/meta/conditional.py +3 -3
- plover/meta/currency.py +4 -4
- plover/meta/mode.py +15 -15
- plover/meta/punctuation.py +1 -0
- plover/misc.py +21 -17
- plover/orthography.py +12 -10
- plover/oslayer/__init__.py +7 -5
- plover/oslayer/config.py +16 -15
- plover/oslayer/controller.py +13 -13
- plover/oslayer/linux/i18n.py +2 -1
- plover/oslayer/linux/keyboardcontrol.py +2 -2
- plover/oslayer/linux/keyboardcontrol_uinput.py +48 -3
- plover/oslayer/linux/keyboardcontrol_x11.py +860 -851
- plover/oslayer/linux/log.py +1 -1
- plover/oslayer/linux/log_dbus.py +97 -65
- plover/oslayer/linux/serial.py +2 -2
- plover/oslayer/linux/wmctrl_x11.py +11 -15
- plover/oslayer/osx/keyboardcontrol.py +194 -99
- plover/oslayer/osx/keyboardlayout.py +138 -119
- plover/oslayer/osx/log.py +14 -8
- plover/oslayer/osx/serial.py +1 -1
- plover/oslayer/osx/wmctrl.py +6 -1
- plover/oslayer/windows/keyboardcontrol.py +195 -89
- plover/oslayer/windows/keyboardlayout.py +367 -334
- plover/oslayer/windows/log.py +5 -3
- plover/oslayer/windows/serial.py +4 -5
- plover/oslayer/windows/wmctrl.py +1 -1
- plover/output/__init__.py +1 -2
- plover/output/keyboard.py +15 -15
- plover/plugins_manager/__main__.py +42 -39
- plover/plugins_manager/global_registry.py +2 -5
- plover/plugins_manager/local_registry.py +11 -13
- plover/plugins_manager/package_index.py +12 -18
- plover/plugins_manager/pip_wrapper.py +5 -5
- plover/plugins_manager/plugin_metadata.py +17 -9
- plover/plugins_manager/registry.py +39 -28
- plover/plugins_manager/requests.py +2 -4
- plover/plugins_manager/utils.py +9 -7
- plover/registry.py +28 -26
- plover/resource.py +13 -10
- plover/scripts/dist_main.py +7 -7
- plover/scripts/main.py +57 -34
- plover/scripts/send_command.py +13 -7
- plover/steno.py +16 -9
- plover/steno_dictionary.py +47 -21
- plover/suggestions.py +11 -11
- plover/system/__init__.py +39 -23
- plover/system/english_stenotype.py +231 -229
- plover/translation.py +67 -51
- {plover-5.0.0.dev2.dist-info → plover-5.0.0.dev3.dist-info}/METADATA +1 -1
- plover-5.0.0.dev3.dist-info/RECORD +216 -0
- plover_build_utils/check_requirements.py +5 -6
- plover_build_utils/download.py +10 -8
- plover_build_utils/get_pip.py +10 -5
- plover_build_utils/install_wheels.py +33 -31
- plover_build_utils/pyqt.py +24 -22
- plover_build_utils/setup.py +64 -54
- plover_build_utils/source_less.py +6 -6
- plover_build_utils/testing/blackbox.py +31 -31
- plover_build_utils/testing/dict.py +3 -3
- plover_build_utils/testing/output.py +5 -6
- plover_build_utils/testing/parametrize.py +5 -3
- plover_build_utils/testing/steno_dictionary.py +145 -124
- plover_build_utils/tree.py +21 -19
- plover_build_utils/trim.py +5 -5
- plover_build_utils/zipdir.py +3 -3
- plover-5.0.0.dev2.dist-info/RECORD +0 -216
- {plover-5.0.0.dev2.dist-info → plover-5.0.0.dev3.dist-info}/WHEEL +0 -0
- {plover-5.0.0.dev2.dist-info → plover-5.0.0.dev3.dist-info}/entry_points.txt +0 -0
- {plover-5.0.0.dev2.dist-info → plover-5.0.0.dev3.dist-info}/licenses/LICENSE.txt +0 -0
- {plover-5.0.0.dev2.dist-info → plover-5.0.0.dev3.dist-info}/top_level.txt +0 -0
- {plover-5.0.0.dev2.dist-info → plover-5.0.0.dev3.dist-info}/zip-safe +0 -0
plover/oslayer/__init__.py
CHANGED
|
@@ -11,17 +11,19 @@ from .config import PLATFORM
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
PLATFORM_PACKAGE = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
"bsd": "linux",
|
|
15
|
+
"linux": "linux",
|
|
16
|
+
"mac": "osx",
|
|
17
|
+
"win": "windows",
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
|
|
20
21
|
def _add_platform_package_to_path():
|
|
21
22
|
platform_package = PLATFORM_PACKAGE.get(PLATFORM)
|
|
22
23
|
if platform_package is None:
|
|
23
|
-
log.warning(
|
|
24
|
+
log.warning("No platform-specific oslayer package for: %s" % PLATFORM)
|
|
24
25
|
return
|
|
25
26
|
__path__.insert(0, os.path.join(__path__[0], platform_package))
|
|
26
27
|
|
|
28
|
+
|
|
27
29
|
_add_platform_package_to_path()
|
plover/oslayer/config.py
CHANGED
|
@@ -9,14 +9,14 @@ import sys
|
|
|
9
9
|
import appdirs
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
if sys.platform.startswith(
|
|
13
|
-
PLATFORM =
|
|
14
|
-
elif sys.platform.startswith(
|
|
15
|
-
PLATFORM =
|
|
16
|
-
elif sys.platform.startswith(
|
|
17
|
-
PLATFORM =
|
|
18
|
-
elif sys.platform.startswith((
|
|
19
|
-
PLATFORM =
|
|
12
|
+
if sys.platform.startswith("darwin"):
|
|
13
|
+
PLATFORM = "mac"
|
|
14
|
+
elif sys.platform.startswith("linux"):
|
|
15
|
+
PLATFORM = "linux"
|
|
16
|
+
elif sys.platform.startswith("win"):
|
|
17
|
+
PLATFORM = "win"
|
|
18
|
+
elif sys.platform.startswith(("freebsd", "openbsd")):
|
|
19
|
+
PLATFORM = "bsd"
|
|
20
20
|
else:
|
|
21
21
|
PLATFORM = None
|
|
22
22
|
|
|
@@ -25,20 +25,21 @@ else:
|
|
|
25
25
|
# keeping all Plover files in a portable drive.
|
|
26
26
|
#
|
|
27
27
|
# Note: the special case when run from an app bundle on macOS.
|
|
28
|
-
if PLATFORM ==
|
|
29
|
-
PROGRAM_DIR = os.path.abspath(
|
|
30
|
-
|
|
28
|
+
if PLATFORM == "mac" and ".app/" in os.path.realpath(__file__):
|
|
29
|
+
PROGRAM_DIR = os.path.abspath(
|
|
30
|
+
os.path.join(os.path.dirname(sys.executable), *[os.path.pardir] * 3)
|
|
31
|
+
)
|
|
31
32
|
else:
|
|
32
33
|
PROGRAM_DIR = os.getcwd()
|
|
33
34
|
|
|
34
35
|
# Setup configuration directory.
|
|
35
|
-
CONFIG_BASENAME =
|
|
36
|
+
CONFIG_BASENAME = "plover.cfg"
|
|
36
37
|
if os.path.isfile(os.path.join(PROGRAM_DIR, CONFIG_BASENAME)):
|
|
37
38
|
CONFIG_DIR = PROGRAM_DIR
|
|
38
39
|
else:
|
|
39
40
|
config_directories = [
|
|
40
|
-
getattr(appdirs, directory_type)(
|
|
41
|
-
for directory_type in (
|
|
41
|
+
getattr(appdirs, directory_type)("plover")
|
|
42
|
+
for directory_type in ("user_config_dir", "user_data_dir")
|
|
42
43
|
]
|
|
43
44
|
for CONFIG_DIR in config_directories:
|
|
44
45
|
if os.path.isfile(os.path.join(CONFIG_DIR, CONFIG_BASENAME)):
|
|
@@ -50,4 +51,4 @@ CONFIG_FILE = os.path.join(CONFIG_DIR, CONFIG_BASENAME)
|
|
|
50
51
|
# Setup plugins directory.
|
|
51
52
|
PLUGINS_PLATFORM = PLATFORM
|
|
52
53
|
|
|
53
|
-
ASSETS_DIR = os.path.realpath(os.path.join(__file__,
|
|
54
|
+
ASSETS_DIR = os.path.realpath(os.path.join(__file__, "../../assets"))
|
plover/oslayer/controller.py
CHANGED
|
@@ -9,14 +9,13 @@ from plover.oslayer.config import PLATFORM
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Controller:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
self.
|
|
16
|
-
self._family = 'AF_PIPE'
|
|
12
|
+
def __init__(self, instance="plover", authkey=b"plover"):
|
|
13
|
+
if PLATFORM == "win":
|
|
14
|
+
self._address = r"\\.\pipe" + "\\" + instance
|
|
15
|
+
self._family = "AF_PIPE"
|
|
17
16
|
else:
|
|
18
|
-
self._address = os.path.join(tempfile.gettempdir(), instance +
|
|
19
|
-
self._family =
|
|
17
|
+
self._address = os.path.join(tempfile.gettempdir(), instance + "_socket")
|
|
18
|
+
self._family = "AF_UNIX"
|
|
20
19
|
self._authkey = authkey
|
|
21
20
|
self._listen = None
|
|
22
21
|
self._thread = None
|
|
@@ -28,7 +27,7 @@ class Controller:
|
|
|
28
27
|
|
|
29
28
|
def force_cleanup(self):
|
|
30
29
|
assert not self.is_owner
|
|
31
|
-
if PLATFORM !=
|
|
30
|
+
if PLATFORM != "win" and os.path.exists(self._address):
|
|
32
31
|
os.unlink(self._address)
|
|
33
32
|
return True
|
|
34
33
|
return False
|
|
@@ -36,10 +35,11 @@ class Controller:
|
|
|
36
35
|
def __enter__(self):
|
|
37
36
|
assert self._listen is None
|
|
38
37
|
try:
|
|
39
|
-
self._listen = connection.Listener(
|
|
40
|
-
|
|
38
|
+
self._listen = connection.Listener(
|
|
39
|
+
self._address, self._family, authkey=self._authkey
|
|
40
|
+
)
|
|
41
41
|
except Exception as e:
|
|
42
|
-
if PLATFORM ==
|
|
42
|
+
if PLATFORM == "win":
|
|
43
43
|
if not isinstance(e, PermissionError):
|
|
44
44
|
raise
|
|
45
45
|
else:
|
|
@@ -68,7 +68,7 @@ class Controller:
|
|
|
68
68
|
if self._accept():
|
|
69
69
|
break
|
|
70
70
|
except Exception as e:
|
|
71
|
-
log.error(
|
|
71
|
+
log.error("handling client failed", exc_info=True)
|
|
72
72
|
|
|
73
73
|
def _send_message(self, msg):
|
|
74
74
|
conn = connection.Client(self._address, self._family, authkey=self._authkey)
|
|
@@ -78,7 +78,7 @@ class Controller:
|
|
|
78
78
|
conn.close()
|
|
79
79
|
|
|
80
80
|
def send_command(self, command):
|
|
81
|
-
self._send_message((
|
|
81
|
+
self._send_message(("command", command))
|
|
82
82
|
|
|
83
83
|
def start(self, message_cb):
|
|
84
84
|
assert self.is_owner
|
plover/oslayer/linux/i18n.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .display_server import DISPLAY_SERVER
|
|
2
2
|
|
|
3
3
|
if DISPLAY_SERVER == "x11":
|
|
4
|
-
from .keyboardcontrol_x11 import KeyboardCapture, KeyboardEmulation
|
|
4
|
+
from .keyboardcontrol_x11 import KeyboardCapture, KeyboardEmulation # pylint: disable=unused-import
|
|
5
5
|
else:
|
|
6
|
-
from .keyboardcontrol_uinput import KeyboardCapture, KeyboardEmulation
|
|
6
|
+
from .keyboardcontrol_uinput import KeyboardCapture, KeyboardEmulation # pylint: disable=unused-import
|
|
@@ -275,9 +275,50 @@ LAYOUTS = {
|
|
|
275
275
|
"k": e.KEY_N,
|
|
276
276
|
"h": e.KEY_M,
|
|
277
277
|
},
|
|
278
|
+
"dvorak": {
|
|
279
|
+
**BASE_LAYOUT,
|
|
280
|
+
# Top row
|
|
281
|
+
"'": e.KEY_Q,
|
|
282
|
+
",": e.KEY_W,
|
|
283
|
+
".": e.KEY_E,
|
|
284
|
+
"p": e.KEY_R,
|
|
285
|
+
"y": e.KEY_T,
|
|
286
|
+
"f": e.KEY_Y,
|
|
287
|
+
"g": e.KEY_U,
|
|
288
|
+
"c": e.KEY_I,
|
|
289
|
+
"r": e.KEY_O,
|
|
290
|
+
"l": e.KEY_P,
|
|
291
|
+
"/": e.KEY_LEFTBRACE,
|
|
292
|
+
"=": e.KEY_RIGHTBRACE,
|
|
293
|
+
# Middle row
|
|
294
|
+
"a": e.KEY_A,
|
|
295
|
+
"o": e.KEY_S,
|
|
296
|
+
"e": e.KEY_D,
|
|
297
|
+
"u": e.KEY_F,
|
|
298
|
+
"i": e.KEY_G,
|
|
299
|
+
"d": e.KEY_H,
|
|
300
|
+
"h": e.KEY_J,
|
|
301
|
+
"t": e.KEY_K,
|
|
302
|
+
"n": e.KEY_L,
|
|
303
|
+
"s": e.KEY_SEMICOLON,
|
|
304
|
+
"-": e.KEY_APOSTROPHE,
|
|
305
|
+
# Bottom row
|
|
306
|
+
";": e.KEY_Z,
|
|
307
|
+
"q": e.KEY_X,
|
|
308
|
+
"j": e.KEY_C,
|
|
309
|
+
"k": e.KEY_V,
|
|
310
|
+
"x": e.KEY_B,
|
|
311
|
+
"b": e.KEY_N,
|
|
312
|
+
"m": e.KEY_M,
|
|
313
|
+
"w": e.KEY_COMMA,
|
|
314
|
+
"v": e.KEY_DOT,
|
|
315
|
+
"z": e.KEY_SLASH,
|
|
316
|
+
},
|
|
278
317
|
}
|
|
279
318
|
|
|
280
|
-
KEYCODE_TO_KEY = dict(
|
|
319
|
+
KEYCODE_TO_KEY = dict(
|
|
320
|
+
zip(LAYOUTS[DEFAULT_LAYOUT].values(), LAYOUTS[DEFAULT_LAYOUT].keys())
|
|
321
|
+
)
|
|
281
322
|
|
|
282
323
|
|
|
283
324
|
class KeyboardEmulation(GenericKeyboardEmulation):
|
|
@@ -289,7 +330,9 @@ class KeyboardEmulation(GenericKeyboardEmulation):
|
|
|
289
330
|
|
|
290
331
|
# Check that ibus or fcitx5 is running
|
|
291
332
|
if not any(p.name() in ["ibus-daemon", "fcitx5"] for p in process_iter()):
|
|
292
|
-
log.warning(
|
|
333
|
+
log.warning(
|
|
334
|
+
"It appears that an input method, such as ibus or fcitx5, is not running on your system. Without this, some text may not be output correctly."
|
|
335
|
+
)
|
|
293
336
|
|
|
294
337
|
def _update_layout(self, layout):
|
|
295
338
|
if not layout in LAYOUTS:
|
|
@@ -464,7 +507,9 @@ class KeyboardCapture(Capture):
|
|
|
464
507
|
key_name = KEYCODE_TO_KEY[event.code]
|
|
465
508
|
if key_name in self._suppressed_keys:
|
|
466
509
|
pressed = event.value == 1
|
|
467
|
-
(self.key_down if pressed else self.key_up)(
|
|
510
|
+
(self.key_down if pressed else self.key_up)(
|
|
511
|
+
key_name
|
|
512
|
+
)
|
|
468
513
|
continue # Go to the next iteration, skipping the below code:
|
|
469
514
|
self._ui.write(e.EV_KEY, event.code, event.value)
|
|
470
515
|
self._ui.syn()
|