Exemple #1
0
    def initialize_apps(self, apps_json, *args):
        apps = json.loads(apps_json)
        for package in apps.keys():
            apps[package] = proxy.is_package_installed(package)

        self.execute_script('''
                            var apps_dict = %s;
                            Utapp.get("router.appsController").content.forEach(function(app) {
                            app.set('isInstalled', apps_dict[app.package]);
                            });''' % json.dumps(apps))
Exemple #2
0
    def initialize_apps(self, apps_json, *args):
        apps = json.loads(apps_json)
        for package in apps.keys():
            apps[package] = proxy.is_package_installed(package)

        self.execute_script('''
                            var apps_dict = %s;
                            Utapp.get("router.appsController").content.forEach(function(app) {
                            app.set('isInstalled', apps_dict[app.package]);
                            });''' % json.dumps(apps))
Exemple #3
0
 def on_update_work_finished(self, transaction, status, kwargs):
     parent = kwargs["parent"]
     proxy.update_apt_cache(True)
     if proxy.is_package_upgradable(self.current_app) or (
         not proxy.is_package_installed(self.current_app) and proxy.is_package_avaiable(self.current_app)
     ):
         worker = AptWorker(self.get_toplevel(), finish_handler=self.on_package_work_finished, data={"parent": self})
         worker.install_packages([self.current_app])
     else:
         unset_busy(parent)
         self.reset_install_button()
Exemple #4
0
    def update_app(self, pkgname, *args):
        if pkgname != self.current_app:
            self.current_app = pkgname

        if proxy.is_package_avaiable(pkgname):
            if proxy.is_package_installed(pkgname):
                self.update_action_button(self.UNINSTALL_ACTION)
            else:
                self.update_action_button(self.INSTALL_ACTION)
        else:
            self.update_action_button(self.NOT_AVAILABLE_ACTION)

        self.update_sources();
Exemple #5
0
 def on_update_work_finished(self, transaction, status, kwargs):
     parent = kwargs['parent']
     proxy.update_apt_cache(True)
     if proxy.is_package_upgradable(self.current_app) or \
        (not proxy.is_package_installed(self.current_app) and \
         proxy.is_package_avaiable(self.current_app)):
         worker = AptWorker(self.get_toplevel(),
                            finish_handler=self.on_package_work_finished,
                            data={'parent': self})
         worker.install_packages([self.current_app])
     else:
         unset_busy(parent)
         self.reset_install_button()
Exemple #6
0
    def update_app(self, pkgname, *args):
        if pkgname != self.current_app:
            self.current_app = pkgname

        if proxy.is_package_avaiable(pkgname):
            if proxy.is_package_installed(pkgname):
                self.update_action_button(self.UNINSTALL_ACTION)
            else:
                self.update_action_button(self.INSTALL_ACTION)
        else:
            self.update_action_button(self.NOT_AVAILABLE_ACTION)

        self.update_sources();
Exemple #7
0
    def update_app(self, pkgname, *args):
        if pkgname != self.current_app:
            self.current_app = pkgname

        if proxy.is_package_avaiable(pkgname):
            if proxy.is_package_installed(pkgname):
                self.execute_script('Utapp.get("router.appController").currentApp.set("isInstalled", true);');
                self.update_action_button(self.UNINSTALL_ACTION)
            else:
                self.execute_script('Utapp.get("router.appController").currentApp.set("isInstalled", false);');
                self.update_action_button(self.INSTALL_ACTION)
        else:
            self.update_action_button(self.NOT_AVAILABLE_ACTION)

        self.update_sources();
Exemple #8
0
    def update_app(self, pkgname, *args):
        if pkgname != self.current_app:
            self.current_app = pkgname

        if proxy.is_package_avaiable(pkgname):
            if proxy.is_package_installed(pkgname):
                self.execute_script(
                    'Utapp.get("router.appController").currentApp.set("isInstalled", true);'
                )
                self.update_action_button(self.UNINSTALL_ACTION)
            else:
                self.execute_script(
                    'Utapp.get("router.appController").currentApp.set("isInstalled", false);'
                )
                self.update_action_button(self.INSTALL_ACTION)
        else:
            self.update_action_button(self.NOT_AVAILABLE_ACTION)

        self.update_sources()
Exemple #9
0
 def preload_proxy_cache(self):
     #This function just called to make sure the cache is loaded as soon as possible
     proxy.is_package_installed('ubuntu-tweak')
Exemple #10
0
 def preload_proxy_cache(self):
     #This function just called to make sure the cache is loaded as soon as possible
     proxy.is_package_installed('ubuntu-tweak')