2020-09-30 09:09:17 +02:00
|
|
|
diff -Nur ibus-1.5.23/setup/main.py ibus-1.5.23-new/setup/main.py
|
|
|
|
--- ibus-1.5.23/setup/main.py 2020-09-29 18:58:24.000000000 +0800
|
|
|
|
+++ ibus-1.5.23-new/setup/main.py 2020-09-30 13:44:05.023868829 +0800
|
|
|
|
@@ -508,11 +508,16 @@
|
2016-03-04 16:49:11 +01:00
|
|
|
self.__engine_setup_exec_list[name] = os.spawnl(os.P_NOWAIT, *args)
|
|
|
|
|
|
|
|
def __init_bus(self):
|
|
|
|
+ method_name="ibus"
|
|
|
|
+ filename=".i18n"
|
|
|
|
+ usr_home =os.path.expanduser('~')
|
2020-09-30 09:09:17 +02:00
|
|
|
+
|
2016-03-04 16:49:11 +01:00
|
|
|
self.__bus = IBus.Bus()
|
|
|
|
if self.__bus.is_connected():
|
|
|
|
return
|
|
|
|
|
|
|
|
- message = _("The IBus daemon is not running. Do you wish to start it?")
|
|
|
|
+ message = _("Could not connect to IBus daemon.\n"
|
|
|
|
+ "Do you wish to switch to IBus on next login?")
|
|
|
|
dlg = Gtk.MessageDialog(message_type = Gtk.MessageType.QUESTION,
|
|
|
|
buttons = Gtk.ButtonsType.YES_NO,
|
|
|
|
text = message)
|
2020-09-30 09:09:17 +02:00
|
|
|
@@ -522,39 +527,12 @@
|
2016-03-04 16:49:11 +01:00
|
|
|
if id != Gtk.ResponseType.YES:
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
- main_loop = GLib.MainLoop()
|
|
|
|
-
|
|
|
|
- timeout = 5
|
|
|
|
- GLib.timeout_add_seconds(timeout, lambda *args: main_loop.quit())
|
|
|
|
- self.__bus.connect("connected", lambda *args: main_loop.quit())
|
|
|
|
-
|
|
|
|
- os.spawnlp(os.P_NOWAIT, "ibus-daemon", "ibus-daemon", "--xim")
|
|
|
|
-
|
|
|
|
- main_loop.run()
|
|
|
|
-
|
|
|
|
- if self.__bus.is_connected():
|
|
|
|
- message = _("IBus has been started! "
|
|
|
|
- "If you cannot use IBus, add the following lines to your $HOME/.bashrc; then relog into your desktop.\n"
|
|
|
|
- " export GTK_IM_MODULE=ibus\n"
|
|
|
|
- " export XMODIFIERS=@im=ibus\n"
|
|
|
|
- " export QT_IM_MODULE=ibus"
|
|
|
|
- )
|
|
|
|
- dlg = Gtk.MessageDialog(message_type = Gtk.MessageType.INFO,
|
|
|
|
- buttons = Gtk.ButtonsType.OK,
|
|
|
|
- text = message)
|
|
|
|
- id = dlg.run()
|
|
|
|
- dlg.destroy()
|
|
|
|
- self.__flush_gtk_events()
|
|
|
|
- else:
|
|
|
|
- # Translators: %d == 5 currently
|
2020-09-30 09:09:17 +02:00
|
|
|
- message = _("IBus daemon could not be started in %d seconds.")
|
2016-03-04 16:49:11 +01:00
|
|
|
- dlg = Gtk.MessageDialog(message_type = Gtk.MessageType.INFO,
|
|
|
|
- buttons = Gtk.ButtonsType.OK,
|
|
|
|
- text = message % timeout)
|
|
|
|
- id = dlg.run()
|
|
|
|
- dlg.destroy()
|
|
|
|
- self.__flush_gtk_events()
|
|
|
|
- sys.exit(0)
|
|
|
|
+ filename = os.path.join(usr_home, filename)
|
|
|
|
+ f=file(filename,"w+")
|
|
|
|
+ cmd = 'export INPUT_METHOD=\"' + method_name + '\"'
|
|
|
|
+ f.writelines(cmd)
|
|
|
|
+ f.close()
|
|
|
|
+ sys.exit(0)
|
|
|
|
|
|
|
|
def __shortcut_button_clicked_cb(self, button, name, section, _name, entry):
|
|
|
|
buttons = (_("_Cancel"), Gtk.ResponseType.CANCEL,
|