spiegel-keyman/linux/keyman-config/km-config
Eberhard Beilharz cc0317af2c
fix(linux): Don't use restart option of exit()
Instead of trying to restart ibus by passing True to bus.exit()
we now exit ibus and then let verify_ibus_daemon() start it again.
Also added additional checks to verify that we're not running
multiple ibus-daemons at the start of km-config and before
restarting.
2022-03-11 18:14:02 +01:00

54 lines
2.5 KiB
Python
Executable file

#!/usr/bin/python3
import argparse
import logging
from keyman_config import __versionwithtag__, __pkgversion__
from keyman_config.handle_install import download_and_install_package
from keyman_config.ibus_util import verify_ibus_daemon
if __name__ == '__main__':
if __pkgversion__:
versionstring = "%s (package version %s)" % (__versionwithtag__, __pkgversion__)
else:
versionstring = "%s" % __versionwithtag__
parser = argparse.ArgumentParser(description='km-config shows the currently installed ' +
'Keyman keyboard packages and allows you to view ' +
'information about them. It enables you to download new ' +
'keyboard packages from the website or install from ' +
'local files.')
parser.add_argument('--version', action='version', version='%(prog)s version ' + versionstring)
parser.add_argument('-v', '--verbose', action='store_true', help='verbose logging')
parser.add_argument('-vv', '--veryverbose', action='store_true', help='very verbose logging')
parser.add_argument('-i', '--install', action='store', help='download and/or install .kmp ' +
'package. INSTALL can either be a downloaded .kmp file, a file:// URL ' +
'pointing to a .kmp file, or a keyman:// URL, possibly with a ' +
'bcp47=<language> specified.')
parser.add_argument('url', nargs='?', default='', metavar='INSTALL',
help='download and/or install .kmp ' +
'package. INSTALL can either be a downloaded .kmp file, a file:// URL ' +
'pointing to a .kmp file, or a keyman:// URL, possibly with a ' +
'bcp47=<language> specified.')
args = parser.parse_args()
if args.verbose:
logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(message)s')
elif args.veryverbose:
logging.basicConfig(level=logging.DEBUG, format='%(levelname)s:%(message)s')
else:
logging.basicConfig(format='%(levelname)s:%(message)s')
logging.info('Keyman version %s %s', __versionwithtag__, __pkgversion__)
verify_ibus_daemon(False)
if args.install:
download_and_install_package(args.install)
elif args.url:
download_and_install_package(args.url)
else:
from keyman_config.view_installed import ViewInstalledWindow
w = ViewInstalledWindow()
w.run()
w.destroy()