Exemplo n.º 1
0
    def update_updates(self, pkgs):
        '''apps is a list to iter pkgname,
        cates is a dict to find what the category the pkg is
        '''
        model = self.get_model()
        length = len(pkgs)

        if pkgs:
            model.append((None,
                          None,
                          None,
                          None,
                          None,
                          '<span size="large" weight="bold">%s</span>' %
                          ngettext('Available %d Package Update',
                                   'Available %d Package Updates',
                                   length) % length,
                          None,
                          None))

            apps = []
            updates = []
            for pkg in pkgs:
                if pkg in APP_PARSER:
                    apps.append(pkg)
                else:
                    updates.append(pkg)

            for pkgname in apps:
                pixbuf = self.get_app_logo(APP_PARSER[pkgname]['logo'])

                package = PackageInfo(pkgname)
                appname = package.get_name()
                desc = APP_PARSER.get_summary(pkgname)

                self.append_app(False,
                        pixbuf,
                        pkgname,
                        appname,
                        desc,
                        0,
                        'update')

            for pkgname in updates:
                package = PACKAGE_WORKER.get_cache()[pkgname]

                self.append_update(False, package.name, package.summary)
        else:
            model.append((None,
                            None,
                            None,
                            None,
                            None,
                            '<span size="large" weight="bold">%s</span>' %
                            _('No Available Package Update'),
                            None,
                            None))
Exemplo n.º 2
0
    def update_updates(self, pkgs):
        '''apps is a list to iter pkgname,
        cates is a dict to find what the category the pkg is
        '''
        model = self.get_model()
        length = len(pkgs)

        if pkgs:
            iter = model.append()
            model.set(iter,
                      self.COLUMN_DISPLAY,
                      '<span size="large" weight="bold">%s</span>' %
                      ngettext('%d Package Update Available',
                               '%d Package Updates Available',
                               length) % length)

            apps = []
            updates = []
            for pkg in pkgs:
                if pkg in APP_PARSER:
                    apps.append(pkg)
                else:
                    updates.append(pkg)

            for pkgname in apps:
                pixbuf = self.get_app_logo(APP_PARSER[pkgname]['logo'])

                package = PackageInfo(pkgname)
                appname = package.get_name()
                desc = APP_PARSER.get_summary(pkgname)

                iter = model.append()
                model.set(iter,
                          self.COLUMN_INSTALLED, False,
                          self.COLUMN_ICON, pixbuf,
                          self.COLUMN_PKG, pkgname,
                          self.COLUMN_NAME, appname,
                          self.COLUMN_DESC, desc,
                          self.COLUMN_DISPLAY, '<b>%s</b>\n%s' % (appname, desc),
                          self.COLUMN_TYPE, 'update')

            for pkgname in updates:
                package = PACKAGE_WORKER.get_cache()[pkgname]

                self.append_update(False, package.name, package.summary)
        else:
            iter = model.append()
            model.set(iter,
                      self.COLUMN_DISPLAY,
                        '<span size="large" weight="bold">%s</span>' %
                        _('No Available Package Updates'))
Exemplo n.º 3
0
    def update_model(self, apps=None):
        '''apps is a list to iter pkgname,
        '''
        model = self.get_model()
        model.clear()

        app_parser = AppParser()

        if self.__status:
            self.__status.load_objects_from_parser(app_parser)

        if not apps:
            apps = app_parser.keys()

        for pkgname in apps:
            category = app_parser.get_category(pkgname)
            pixbuf = self.get_app_logo(app_parser[pkgname]['logo'])

            try:
                package = PackageInfo(pkgname)
                is_installed = package.check_installed()
                appname = package.get_name()
                desc = app_parser.get_summary(pkgname)
            except:
                # Confirm the invalid package isn't in the count
                # But in the future, Ubuntu Tweak should display the invalid package too
                if self.__status and not self.__status.get_read_status(pkgname):
                    self.__status.set_as_read(pkgname)
                continue

            if self.filter == None or self.filter == category:
                iter = model.append()
                if pkgname in self.to_add or pkgname in self.to_rm:
                    status = not is_installed
                    display = self.__fill_changed_display(appname, desc)
                else:
                    status = is_installed
                    if self.__status and not self.__status.get_read_status(pkgname):
                        display = '<b>%s <span foreground="#ff0000">(New!!!)</span>\n%s</b>' % (appname, desc)
                    else:
                        display = '<b>%s</b>\n%s' % (appname, desc)

                model.set(iter,
                          self.COLUMN_INSTALLED, status,
                          self.COLUMN_ICON, pixbuf,
                          self.COLUMN_PKG, pkgname,
                          self.COLUMN_NAME, appname,
                          self.COLUMN_DESC, desc,
                          self.COLUMN_DISPLAY, display,
                          self.COLUMN_CATE, category,
                          self.COLUMN_TYPE, 'app')
Exemplo n.º 4
0
    def update_model(self, apps=None):
        '''apps is a list to iter pkgname,
        '''
        model = self.get_model()
        model.clear()

        app_parser = AppParser()

        if self.__status:
            self.__status.load_objects_from_parser(app_parser)

        if not apps:
            apps = app_parser.keys()

        for pkgname in apps:
            category = app_parser.get_category(pkgname)
            pixbuf = self.get_app_logo(app_parser[pkgname]['logo'])

            try:
                package = PackageInfo(pkgname)
                is_installed = package.check_installed()
                appname = package.get_name()
                desc = app_parser.get_summary(pkgname)
            except:
                # Confirm the invalid package isn't in the count
                # But in the future, Ubuntu Tweak should display the invalid package too
                if self.__status and not self.__status.get_read_status(
                        pkgname):
                    self.__status.set_as_read(pkgname)
                continue

            if self.filter == None or self.filter == category:
                iter = model.append()
                if pkgname in self.to_add or pkgname in self.to_rm:
                    status = not is_installed
                    display = self.__fill_changed_display(appname, desc)
                else:
                    status = is_installed
                    if self.__status and not self.__status.get_read_status(
                            pkgname):
                        display = '<b>%s <span foreground="#ff0000">(New!!!)</span>\n%s</b>' % (
                            appname, desc)
                    else:
                        display = '<b>%s</b>\n%s' % (appname, desc)

                model.set(iter, self.COLUMN_INSTALLED, status,
                          self.COLUMN_ICON, pixbuf, self.COLUMN_PKG, pkgname,
                          self.COLUMN_NAME, appname, self.COLUMN_DESC, desc,
                          self.COLUMN_DISPLAY, display, self.COLUMN_CATE,
                          str(category), self.COLUMN_TYPE, 'app')
Exemplo n.º 5
0
    def update_updates(self, pkgs):
        '''apps is a list to iter pkgname,
        cates is a dict to find what the category the pkg is
        '''
        model = self.get_model()
        length = len(pkgs)

        if pkgs:
            iter = model.append()
            model.set(
                iter, self.COLUMN_DISPLAY,
                '<span size="large" weight="bold">%s</span>' %
                ngettext('%d Package Update Available',
                         '%d Package Updates Available', length) % length)

            apps = []
            updates = []
            for pkg in pkgs:
                if pkg in APP_PARSER:
                    apps.append(pkg)
                else:
                    updates.append(pkg)

            for pkgname in apps:
                pixbuf = self.get_app_logo(APP_PARSER[pkgname]['logo'])

                package = PackageInfo(pkgname)
                appname = package.get_name()
                desc = APP_PARSER.get_summary(pkgname)

                iter = model.append()
                model.set(iter, self.COLUMN_INSTALLED, False, self.COLUMN_ICON,
                          pixbuf, self.COLUMN_PKG, pkgname, self.COLUMN_NAME,
                          appname, self.COLUMN_DESC, desc, self.COLUMN_DISPLAY,
                          '<b>%s</b>\n%s' % (appname, desc), self.COLUMN_TYPE,
                          'update')

            for pkgname in updates:
                package = PACKAGE_WORKER.get_cache()[pkgname]

                self.append_update(False, package.name, package.summary)
        else:
            iter = model.append()
            model.set(
                iter, self.COLUMN_DISPLAY,
                '<span size="large" weight="bold">%s</span>' %
                _('No Available Package Updates'))
Exemplo n.º 6
0
    def update_model(self, apps=None):
        '''apps is a list to iter pkgname,
        '''
        def do_append(is_installed, pixbuf, pkgname, appname, desc, category):
            if pkgname in self.to_add or pkgname in self.to_rm:
                self.append_changed_app(not is_installed,
                        pixbuf,
                        pkgname,
                        appname,
                        desc,
                        category)
            else:
                self.append_app(is_installed,
                        pixbuf,
                        pkgname,
                        appname,
                        desc,
                        category)

        model = self.get_model()
        model.clear()

        app_parser = AppParser()

        if not apps:
            apps = app_parser.keys()

        for pkgname in apps:
            category = app_parser.get_category(pkgname)
            pixbuf = self.get_app_logo(app_parser[pkgname]['logo'])

            try:
                package = PackageInfo(pkgname)
                is_installed = package.check_installed()
                appname = package.get_name()
                desc = app_parser.get_summary(pkgname)
            except:
                continue

            if self.filter == None or self.filter == category:
                do_append(is_installed, pixbuf,
                          pkgname, appname, desc, category)