Esempio n. 1
0
 def __init__(self, exec_by_ibus):
     self._mainloop = GLib.MainLoop()
     self._bus = IBus.Bus()
     self._bus.connect("disconnected", self._bus_disconnected_cb)
     self._factory = IBus.Factory(self._bus)
     self._factory.add_engine("hiragana",
                              GObject.type_from_name("EngineHiragana"))
     if exec_by_ibus:
         self._bus.request_name("org.freedesktop.IBus.Hiragana", 0)
     else:
         self._component = IBus.Component(
             name="org.freedesktop.IBus.Hiragana",
             description="Hiragana IME",
             version=package.get_version(),
             license="Apache",
             author="Esrille Inc. <*****@*****.**>",
             homepage="https://github.com/esrille/" + package.get_name(),
             textdomain=package.get_name())
         engine = IBus.EngineDesc(name="hiragana",
                                  longname="Hiragana IME",
                                  description="Hiragana IME",
                                  language="ja",
                                  license="Apache",
                                  author="Esrille Inc. <*****@*****.**>",
                                  icon=package.get_name(),
                                  layout="default")
         self._component.add_engine(engine)
         self._bus.register_component(self._component)
         self._bus.set_global_engine_async("hiragana", -1, None, None, None)
Esempio n. 2
0
 def on_about(self, action, param):
     dialog = Gtk.AboutDialog(transient_for=self.window, modal=True)
     dialog.set_program_name(_("Typing Practice"))
     dialog.set_copyright("Copyright 2020, 2021 Esrille Inc.")
     dialog.set_authors(["Esrille Inc."])
     dialog.set_documenters(["Esrille Inc."])
     dialog.set_website(
         "file://" + os.path.join(package.get_datadir(), "help/index.html"))
     dialog.set_website_label(_("Introduction to Typing Practice"))
     dialog.set_logo_icon_name(package.get_name())
     dialog.set_version(package.get_version())
     dialog.present()
     # To close the dialog when "close" is clicked, e.g. on Raspberry Pi OS,
     # the "response" signal needs to be connected on_about_response
     dialog.connect("response", self.on_about_response)
     dialog.show()
Esempio n. 3
0
 def about_callback(self, action, parameter):
     dialog = Gtk.AboutDialog()
     dialog.set_transient_for(self)
     dialog.set_modal(True)
     dialog.set_program_name(self.title)
     dialog.set_copyright("Copyright 2020, 2021 Esrille Inc.")
     dialog.set_authors(["Esrille Inc."])
     dialog.set_documenters(["Esrille Inc."])
     dialog.set_website("http://www.esrille.com/")
     dialog.set_website_label("Esrille Inc.")
     dialog.set_logo_icon_name(package.get_name())
     dialog.set_version(package.get_version())
     # To close the dialog when "close" is clicked, e.g. on Raspberry Pi OS,
     # the "response" signal needs to be connected about_response_callback
     dialog.connect("response", self.about_response_callback)
     dialog.show()
Esempio n. 4
0
 def do_property_activate(self, prop_name, state):
     logger.info(f'property_activate({prop_name}, {state})')
     if prop_name == 'Setup':
         self._setup_start()
     elif prop_name == 'Help':
         url = 'file://' + os.path.join(package.get_datadir(), 'help/index.html')
         # Use yelp to open local HTML help files.
         subprocess.Popen(['yelp', url])
     elif prop_name == 'About':
         if self._about_dialog:
             self._about_dialog.present()
             return
         dialog = Gtk.AboutDialog()
         dialog.set_program_name(_("Hiragana IME"))
         dialog.set_copyright("Copyright 2017-2022 Esrille Inc.")
         dialog.set_authors(["Esrille Inc."])
         dialog.set_documenters(["Esrille Inc."])
         dialog.set_website("https://www.esrille.com/")
         dialog.set_website_label("Esrille Inc.")
         dialog.set_logo_icon_name(package.get_name())
         dialog.set_default_icon_name(package.get_name())
         dialog.set_version(package.get_version())
         # To close the dialog when "close" is clicked on Raspberry Pi OS,
         # we connect the "response" signal to _about_response_cb
         dialog.connect("response", self._about_response_cb)
         self._about_dialog = dialog
         dialog.show()
     elif prop_name.startswith('InputMode.'):
         if state == IBus.PropState.CHECKED:
             mode = {
                 'InputMode.Alphanumeric': 'A',
                 'InputMode.Hiragana': 'あ',
                 'InputMode.Katakana': 'ア',
                 'InputMode.WideAlphanumeric': 'A',
                 'InputMode.HalfWidthKatakana': 'ア',
             }.get(prop_name, 'A')
             self.set_mode(mode, True)
Esempio n. 5
0
 def do_property_activate(self, prop_name, state):
     logger.info("property_activate(%s, %d)" % (prop_name, state))
     if prop_name == "Setup":
         self._start_setup()
     if prop_name == "About":
         if self._about_dialog:
             self._about_dialog.present()
             return
         dialog = Gtk.AboutDialog()
         dialog.set_program_name(_("Hiragana IME"))
         dialog.set_copyright("Copyright 2017-2020 Esrille Inc.")
         dialog.set_authors(["Esrille Inc."])
         dialog.set_documenters(["Esrille Inc."])
         dialog.set_website(
             "file://" +
             os.path.join(package.get_datadir(), "help/index.html"))
         dialog.set_website_label(_("Introduction to Hiragana IME"))
         dialog.set_logo_icon_name(package.get_name())
         dialog.set_version(package.get_version())
         # To close the dialog when "close" is clicked, e.g. on RPi,
         # we connect the "response" signal to about_response_callback
         dialog.connect("response", self.about_response_callback)
         self._about_dialog = dialog
         dialog.show()