def export_objects():
    app = QtWidgets.qApp
    app.setApplicationVersion("0.4.1")
    app.setOrganizationName("Youdao")
    app.setApplicationName("Youdao Dict")

    # set default font
    defaultFont = QtGui.QFont()
    defaultFont.setPointSize(11)
    app.setFont(defaultFont)

    if not session_bus.registerService(DBUS_NAME):
        print("Service is running: %s" % DBUS_NAME)
        iface = QtDBus.QDBusInterface(DBUS_NAME, DBUS_PATH, DBUS_INTERFACE, session_bus)
        iface.call("Raise")
        sys.exit(0)
    else:
        unique_obj = UniqueService()
        session_bus.registerObject(DBUS_PATH, unique_obj)
        print("Youdao Dict Unique Service is started...")
        youdao_api = ExternalApi()
        splash_window = SplashWindow(youdao_api)
        if not "--autostart" in sys.argv and not setting_config.get_basic_option("start_mini"):
            splash_window.showCenter()
            splash_window.startTimer()
        indicator = YoudaoIndicator()
        return [
                dict(name=unique_obj.name, obj=unique_obj),
                dict(name="indicator", obj=indicator),
                dict(name="splash_window", obj=splash_window),
                dict(name=youdao_api.name, obj=youdao_api),
                dict(name="config", obj=setting_config),
               ]
Example #2
0
def export_objects():
    app = QtWidgets.qApp
    app.setApplicationVersion("0.4.1")
    app.setOrganizationName("Youdao")
    app.setApplicationName("Youdao Dict")

    # set default font
    defaultFont = QtGui.QFont()
    defaultFont.setPointSize(11)
    app.setFont(defaultFont)

    if not session_bus.registerService(DBUS_NAME):
        print("Service is running: %s" % DBUS_NAME)
        iface = QtDBus.QDBusInterface(DBUS_NAME, DBUS_PATH, DBUS_INTERFACE,
                                      session_bus)
        iface.call("Raise")
        sys.exit(0)
    else:
        unique_obj = UniqueService()
        session_bus.registerObject(DBUS_PATH, unique_obj)
        print("Youdao Dict Unique Service is started...")
        youdao_api = ExternalApi()
        splash_window = SplashWindow(youdao_api)
        if not "--autostart" in sys.argv and not setting_config.get_basic_option(
                "start_mini"):
            splash_window.showCenter()
            splash_window.startTimer()
        indicator = YoudaoIndicator()
        return [
            dict(name=unique_obj.name, obj=unique_obj),
            dict(name="indicator", obj=indicator),
            dict(name="splash_window", obj=splash_window),
            dict(name=youdao_api.name, obj=youdao_api),
            dict(name="config", obj=setting_config),
        ]
Example #3
0
 def toggleTopMost(self):
     state = setting_config.get_basic_option("main_window_topmost")
     self.emitTopMost(not state)