def _get_extension_info(self, ext_id: str, prefs: ExtensionPreferences, error: ExtError = None) -> ExtensionInfo:
     ext_db = ExtensionDb.get_instance()
     is_connected = True
     try:
         ExtensionServer.get_instance().get_controller(ext_id)
     except KeyError:
         is_connected = False
     ext_runner = ExtensionRunner.get_instance()
     is_running = is_connected or ext_runner.is_running(ext_id)
     ext_db_record = ext_db.find(ext_id, {})
     return {
         'id': ext_id,
         'url': ext_db_record.get('url'),
         'updated_at': ext_db_record.get('updated_at'),
         'last_commit': ext_db_record.get('last_commit'),
         'last_commit_time': ext_db_record.get('last_commit_time'),
         'name': prefs.manifest.get_name(),
         'icon': prefs.manifest.get_icon_path(),
         'description': prefs.manifest.get_description(),
         'developer_name': prefs.manifest.get_developer_name(),
         'preferences': prefs.get_items(),
         'error': error,
         'is_running': is_running,
         'runtime_error': ext_runner.get_extension_error(ext_id) if not is_running else None
     }
Exemplo n.º 2
0
    def finish_initializing(self, builder):
        """Called while initializing this instance in __new__

        finish_initializing should be called after parsing the UI definition
        and creating a UlauncherWindow object with it in order to finish
        initializing the start of the new UlauncherWindow instance.
        """
        # Get a reference to the builder and set up the signals.
        self.builder = builder
        self.ui = builder.get_ui(self, True)
        self.PreferencesDialog = None  # class
        self.preferences_dialog = None  # instance

        self.results_nav = None
        self.window = self.ui['ulauncher_window']
        self.window_body = self.ui['body']
        self.input = self.ui['input']
        self.prefs_btn = self.ui['prefs_btn']
        self.result_box = self.ui["result_box"]

        self.input.connect('changed', self.on_input_changed)
        self.prefs_btn.connect('clicked', self.on_mnu_preferences_activate)

        self.set_keep_above(True)

        self.PreferencesDialog = PreferencesUlauncherDialog
        self.settings = Settings.get_instance()

        self.fix_window_width()
        self.position_window()
        self.init_theme()

        # this will trigger to show frequent apps if necessary
        self.show_results([])

        if not is_wayland_compatibility_on():
            # bind hotkey
            Keybinder.init()
            accel_name = self.settings.get_property('hotkey-show-app')
            # bind in the main thread
            GLib.idle_add(self.bind_show_app_hotkey, accel_name)

        start_app_watcher()
        ExtensionServer.get_instance().start()
        time.sleep(0.01)
        ExtensionRunner.get_instance().run_all()
        if not get_options().no_extensions:
            ExtensionDownloader.get_instance().download_missing()
Exemplo n.º 3
0
    def finish_initializing(self, builder):
        """Called while initializing this instance in __new__

        finish_initializing should be called after parsing the UI definition
        and creating a UlauncherWindow object with it in order to finish
        initializing the start of the new UlauncherWindow instance.
        """
        # Get a reference to the builder and set up the signals.
        self.builder = builder
        self.ui = builder.get_ui(self, True)
        self.PreferencesDialog = None  # class
        self.preferences_dialog = None  # instance

        self.results_nav = None
        self.window = self.ui['ulauncher_window']
        self.input = self.ui['input']
        self.prefs_btn = self.ui['prefs_btn']
        self.result_box = self.ui["result_box"]

        self.input.connect('changed', self.on_input_changed)
        self.prefs_btn.connect('clicked', self.on_mnu_preferences_activate)

        self.set_keep_above(True)

        self.PreferencesDialog = PreferencesUlauncherDialog
        self.settings = Settings.get_instance()

        self.fix_window_width()
        self.position_window()
        self.init_theme()

        # this will trigger to show frequent apps if necessary
        self.show_results([])

        if not is_wayland_compatibility_on():
            # bind hotkey
            Keybinder.init()
            accel_name = self.settings.get_property('hotkey-show-app')
            # bind in the main thread
            GLib.idle_add(self.bind_show_app_hotkey, accel_name)

        start_app_watcher()
        ExtensionServer.get_instance().start()
        time.sleep(0.01)
        ExtensionRunner.get_instance().run_all()
        ExtensionDownloader.get_instance().download_missing()
Exemplo n.º 4
0
 def prefs_extension_update_prefs(self, url_params):
     query = url_params['query']
     ext_id = query['id']
     logger.info('Update extension preferences: %s' % query)
     prefix = 'pref.'
     controller = ExtensionServer.get_instance().get_controller(ext_id)
     preferences = [(key[len(prefix):], value) for key, value in query.items() if key.startswith(prefix)]
     for pref_id, value in preferences:
         old_value = controller.preferences.get(pref_id)['value']
         controller.preferences.set(pref_id, value)
         if value != old_value:
             controller.trigger_event(PreferencesUpdateEvent(pref_id, old_value, value))
 def prefs_extension_update_prefs(self, url_params):
     query = url_params['query']
     ext_id = query['id']
     logger.info('Update extension preferences: %s' % query)
     prefix = 'pref.'
     controller = ExtensionServer.get_instance().get_controller(ext_id)
     preferences = [(key[len(prefix):], value) for key, value in query.items() if key.startswith(prefix)]
     for pref_id, value in preferences:
         old_value = controller.preferences.get(pref_id)['value']
         controller.preferences.set(pref_id, value)
         if value != old_value:
             controller.trigger_event(PreferencesUpdateEvent(pref_id, old_value, value))
 def prefs_extension_update_prefs(self, url_params):
     query = url_params['query']
     ext_id = query['id']
     logger.info('Update extension preferences: %s', query)
     prefix = 'pref.'
     controller = ExtensionServer.get_instance().get_controller(ext_id)
     if not controller:
         logger.error("Cannot update preferences. The extension controller is not registered. \
         Try relaunching or restarting Ulauncher, and check the extension readme for external dependencies \
         you may have to install manually")
         return
     preferences = [(key[len(prefix):], value) for key, value in query.items() if key.startswith(prefix)]
     for pref_id, value in preferences:
         old_value = controller.preferences.get(pref_id)['value']
         controller.preferences.set(pref_id, value)
         if value != old_value:
             controller.trigger_event(PreferencesUpdateEvent(pref_id, old_value, value))
Exemplo n.º 7
0
 def __init__(self):
     self.extensionServer = ExtensionServer.get_instance()
     self.deferredResultRenderer = DeferredResultRenderer.get_instance()
Exemplo n.º 8
0
 def get_instance(cls) -> 'ExtensionRunner':
     return cls(ExtensionServer.get_instance())
Exemplo n.º 9
0
 def __init__(self):
     self.extensionServer = ExtensionServer.get_instance()
     self.deferredResultRenderer = DeferredResultRenderer.get_instance()