Exemplo n.º 1
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()
 def prefs_extension_check_updates(self, url_params):
     logger.info('Handling /extension/check-updates')
     ext_id = url_params['query']['id']
     try:
         return ExtensionDownloader.get_instance().get_new_version(ext_id)
     except ExtensionIsUpToDateError:
         return None
 def prefs_extension_check_updates(self, url_params):
     logger.info('Handling /extension/check-updates')
     ext_id = url_params['query']['id']
     try:
         return ExtensionDownloader.get_instance().get_new_version(ext_id)
     except ExtensionIsUpToDateError as e:
         pass
 def prefs_extension_update_ext(self, url_params):
     ext_id = url_params['query']['id']
     logger.info('Update extension: %s', ext_id)
     downloader = ExtensionDownloader.get_instance()
     try:
         downloader.update(ext_id)
     except ExtensionManifestError as e:
         raise PrefsApiError(e)
    def prefs_extension_add(self, url_params):
        url = url_params['query']['url']
        logger.info('Add extension: %s', url)
        downloader = ExtensionDownloader.get_instance()
        ext_id = downloader.download(url)
        ExtensionRunner.get_instance().run(ext_id)

        return self._get_all_extensions()
Exemplo n.º 6
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()
 def prefs_extension_update_ext(self, url_params):
     ext_id = url_params['query']['id']
     logger.info('Update extension: %s' % ext_id)
     downloader = ExtensionDownloader.get_instance()
     try:
         downloader.update(ext_id)
     except ManifestValidationError as e:
         raise PrefsApiError(e.message)
    def prefs_extension_add(self, url_params):
        url = url_params['query']['url']
        logger.info('Add extension: %s' % url)
        downloader = ExtensionDownloader.get_instance()
        try:
            ext_id = downloader.download(url)
            ExtensionRunner.get_instance().run(ext_id)
        except (ExtensionDownloaderError, ManifestValidationError) as e:
            raise PrefsApiError(e.message)

        return self._get_all_extensions()
    def prefs_extension_add(self, url_params):
        url = url_params['query']['url']
        logger.info('Add extension: %s' % url)
        downloader = ExtensionDownloader.get_instance()
        try:
            ext_id = downloader.download(url)
            ExtensionRunner.get_instance().run(ext_id)
        except (ExtensionDownloaderError, ManifestValidationError) as e:
            raise PrefsApiError(e.message)

        return self._get_all_extensions()
Exemplo n.º 10
0
 def prefs_extension_remove(self, url_params):
     ext_id = url_params['query']['id']
     logger.info('Remove extension: %s', ext_id)
     downloader = ExtensionDownloader.get_instance()
     downloader.remove(ext_id)
 def prefs_extension_remove(self, url_params):
     ext_id = url_params['query']['id']
     logger.info('Remove extension: %s' % ext_id)
     downloader = ExtensionDownloader.get_instance()
     downloader.remove(ext_id)