summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglasseyes <dglassey@gmail.com>2018-12-22 21:59:10 +0700
committerglasseyes <dglassey@gmail.com>2018-12-22 21:59:10 +0700
commit61cba6361f8777e65bab989c663f62a7bf51a836 (patch)
tree251ca7cf286c490d85144bce65cae76a0f0961ee
parentd3f9c488fb52e241c9b31916ad51a00783082d3c (diff)
d/p/missing_files.patchdebian/10.99.69-2
-rw-r--r--debian/changelog6
-rw-r--r--debian/patches/missing_files.patch160
-rw-r--r--debian/patches/series1
3 files changed, 167 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index de4aeb6..aa794e1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+keyman-config (10.99.69-2) unstable; urgency=medium
+
+ * d/p/missing_files.patch: files missing from released source
+
+ -- Daniel Glassey <wdg@debian.org> Sat, 22 Dec 2018 21:56:13 +0700
+
keyman-config (10.99.69-1) unstable; urgency=medium
* New upstream pre-release
diff --git a/debian/patches/missing_files.patch b/debian/patches/missing_files.patch
new file mode 100644
index 0000000..64ad943
--- /dev/null
+++ b/debian/patches/missing_files.patch
@@ -0,0 +1,160 @@
+--- /dev/null
++++ b/keyman_config/get_info.py
+@@ -0,0 +1,35 @@
++#!/usr/bin/python3
++
++import os
++import threading
++from keyman_config.install_kmp import process_keyboard_data
++from keyman_config.kmpmetadata import parsemetadata
++
++class GetInfo(object):
++ """ Get information about kmp packages and keyboards
++ The run() method will be started and it will run in the background.
++ """
++
++ def __init__(self, kmp_list):
++ """ Constructor
++ :type kmp_list: list
++ :param kmp_list: List of keyboards to get info for
++ """
++ self.kmp_list = kmp_list
++
++ thread = threading.Thread(target=self.run, args=())
++ thread.daemon = True # Daemonize thread
++ thread.start() # Start the execution
++
++ def run(self):
++ """ Method that gets info for installed kmp that were installed manually
++ rather then from the download window.
++ """
++ for kmp in self.kmp_list:
++ packageDir = os.path.join(kmp['areapath'], kmp['packageID'])
++ process_keyboard_data(kmp['packageID'], packageDir)
++ info, system, options, keyboards, files = parsemetadata(packageDir, "kmp.json")
++ if keyboards:
++ for kb in keyboards:
++ if kb['id'] != kmp['packageID']:
++ process_keyboard_data(kb['id'], packageDir)
+\ No newline at end of file
+--- /dev/null
++++ b/keyman_config/ibus_util.py
+@@ -0,0 +1,99 @@
++#!/usr/bin/python3
++
++import gi
++import logging
++import subprocess
++
++gi.require_version('IBus', '1.0')
++from gi.repository import IBus, Gio
++
++def get_ibus_bus():
++ try:
++ for i in range(10000):
++ bus = IBus.Bus()
++ if bus.is_connected() and bus.is_global_engine_enabled():
++ return bus
++ bus.destroy()
++ except Exception as e:
++ logging.warning("Failed get bus")
++ logging.warning(e)
++ logging.warning("could not find connected IBus.Bus")
++ return None
++
++def install_to_ibus(bus, keyboard_id):
++ try:
++ # keyboard_id = "%s:%s" % (lang, kmx_file)
++ # logging.debug("getting bus")
++ # bus = IBus.Bus()
++ logging.debug("installing to ibus")
++ ibus_settings = Gio.Settings.new("org.freedesktop.ibus.general")
++ preload_engines = ibus_settings.get_strv("preload-engines")
++ logging.debug(preload_engines)
++ if keyboard_id not in preload_engines:
++ preload_engines.append(keyboard_id)
++ logging.debug(preload_engines)
++ ibus_settings.set_strv("preload-engines", preload_engines)
++ bus.preload_engines(preload_engines)
++ except Exception as e:
++ logging.warning("Failed to set up install %s to IBus", keyboard_id)
++ logging.warning(e)
++
++def uninstall_from_ibus(bus, keyboard_id):
++# need to uninstall for all installed langs
++ try:
++ # logging.debug("getting bus")
++ # bus = IBus.Bus()
++ ibus_settings = Gio.Settings.new("org.freedesktop.ibus.general")
++ preload_engines = ibus_settings.get_strv("preload-engines")
++ logging.debug(preload_engines)
++ if keyboard_id in preload_engines:
++ preload_engines.remove(keyboard_id)
++ logging.debug(preload_engines)
++ ibus_settings.set_strv("preload-engines", preload_engines)
++ bus.preload_engines(preload_engines)
++ except Exception as e:
++ logging.warning("Failed to uninstall keyboard %s", keyboard_id)
++ logging.warning(e)
++
++def restart_ibus_subp():
++ logging.info("restarting IBus by subprocess")
++ subprocess.run(["ibus", "restart"])
++
++def restart_ibus(bus=None):
++ try:
++ if not bus:
++ bus = get_ibus_bus()
++ logging.info("restarting IBus")
++ bus.exit(True)
++ bus.destroy()
++ except Exception as e:
++ logging.warning("Failed to restart IBus")
++ logging.warning(e)
++
++def bus_has_engine(bus, name):
++ engines = bus.get_engines_by_names([name])
++ return len(engines)
++
++def get_current_engine(bus):
++ try:
++ contextname = bus.current_input_context()
++ ic = IBus.InputContext.get_input_context(contextname, bus.get_connection())
++ engine = ic.get_engine()
++ if engine:
++ return engine.get_name()
++ except Exception as e:
++ logging.warning("Failed to get current engine")
++ logging.warning(e)
++
++
++def change_to_keyboard(bus, keyboard_id):
++ try:
++ contextname = bus.current_input_context()
++ ic = IBus.InputContext.get_input_context(contextname, bus.get_connection())
++ if bus_has_engine(bus, name) <= 0:
++ logging.warning("Could not find engine %s"%name)
++ else:
++ ic.set_engine(name)
++ except Exception as e:
++ logging.warning("Failed to change keyboard")
++ logging.warning(e)
+--- a/keyman_config.egg-info/SOURCES.txt
++++ b/keyman_config.egg-info/SOURCES.txt
+@@ -17,7 +17,9 @@
+ keyman_config/check_mime_type.py
+ keyman_config/convertico.py
+ keyman_config/downloadkeyboard.py
++keyman_config/get_info.py
+ keyman_config/get_kmp.py
++keyman_config/ibus_util.py
+ keyman_config/install_kmp.py
+ keyman_config/install_window.py
+ keyman_config/keyboard_details.py
+@@ -37,4 +39,4 @@
+ keyman_config/icons/defaultpackage.gif
+ keyman_config/icons/expand20.png
+ keyman_config/icons/help20.png
+-keyman_config/icons/icon_kmp.png
+\ No newline at end of file
++keyman_config/icons/icon_kmp.png
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..b883bc8
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+missing_files.patch