[Fedora-i18n-bugs] [Bug 796070] run ibus-setup produces IBUS-CRITICAL ** Traceback.

bugzilla at redhat.com bugzilla at redhat.com
Fri Feb 24 03:31:25 UTC 2012


Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug.


https://bugzilla.redhat.com/show_bug.cgi?id=796070

--- Comment #15 from fujiwara <tfujiwar at redhat.com> 2012-02-23 22:31:24 EST ---
(In reply to comment #14)
> Hmm, this part still looks wrong.  Since IBus.Bus() does not raise any
> exception when bus is not connected, you need to check
> self.__bus.is_connected() and continue if it returns False.  Otherwise you will
> see a successful message dialog even if ibus-daemon fails to start.
> 
> try:
>     if self.__bus != None:
>         self.__bus.destroy()
>     self.__bus = IBus.Bus()
>     if not self.__bus.is_connected():
>         continue
> except:
>     continue

OK, revised.

--- ibus-phuang/setup/main.py.orig
+++ ibus-phuang/setup/main.py
@@ -338,9 +338,13 @@ class Setup(object):
             # self.__bus.config_add_watch("/general/hotkey")
             # self.__bus.config_add_watch("/panel")
         except:
-            while self.__bus == None:
+            pass
+        finally:
+            if self.__bus != None and self.__bus.is_connected():
+                return
+            while self.__bus == None or not self.__bus.is_connected():
                 message = _("IBus daemon is not started. Do you want to start
it now?")
-                dlg = Gtk.MessageDialog(type = Gtk.MESSAGE_QUESTION,
+                dlg = Gtk.MessageDialog(type = Gtk.MessageType.QUESTION,
                         buttons = Gtk.ButtonsType.YES_NO,
                         message_format = message)
                 id = dlg.run()
@@ -351,21 +355,23 @@ class Setup(object):
                 pid = os.spawnlp(os.P_NOWAIT, "ibus-daemon", "ibus-daemon",
"--xim")
                 time.sleep(1)
                 try:
+                    if self.__bus != None:
+                        self.__bus.destroy()
                     self.__bus = IBus.Bus()
                 except:
                     continue
-                message = _("IBus has been started! "
-                    "If you can not use IBus, please add below lines in
$HOME/.bashrc, and relogin your desktop.\n"
-                    "  export GTK_IM_MODULE=ibus\n"
-                    "  export XMODIFIERS=@im=ibus\n"
-                    "  export QT_IM_MODULE=ibus"
-                    )
-                dlg = Gtk.MessageDialog(type = Gtk.MESSAGE_INFO,
-                                        buttons = Gtk.ButtonsType.OK,
-                                        message_format = message)
-                id = dlg.run()
-                dlg.destroy()
-                self.__flush_gtk_events()
+            message = _("IBus has been started! "
+                "If you can not use IBus, please add below lines in
$HOME/.bashrc, and relogin your desktop.\n"
+                "  export GTK_IM_MODULE=ibus\n"
+                "  export XMODIFIERS=@im=ibus\n"
+                "  export QT_IM_MODULE=ibus"
+                )
+            dlg = Gtk.MessageDialog(type = Gtk.MessageType.INFO,
+                                    buttons = Gtk.ButtonsType.OK,
+                                    message_format = message)
+            id = dlg.run()
+            dlg.destroy()
+            self.__flush_gtk_events()

     def __shortcut_button_clicked_cb(self, button, name, section, _name,
entry):
         buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,

-- 
Configure bugmail: https://bugzilla.redhat.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the i18n-bugs mailing list