Ejemplo n.º 1
0
    def update_ppa_model(self):
        self.set_busy()
        self.__column.set_title('PPA Sources')
        model = self.get_model()
        model.clear()
        self.mode = 'ppa'

        ppa_source_dict = get_ppa_source_dict()

        for source in self.get_sourceslist():
            if ppa.is_ppa(source.uri) and source.type == 'deb' and not source.disabled:
                try:
                    id = ppa_source_dict[source.uri]
                    pixbuf = get_source_logo_from_filename(SOURCE_PARSER[id]['logo'])
                    name = SOURCE_PARSER.get_name(id)
                    comment = SOURCE_PARSER.get_summary(id)
                except:
                    id = source.uri
                    name = ppa.get_short_name(source.uri)
                    comment = ppa.get_homepage(source.uri)
                    pixbuf = get_source_logo_from_filename('')

                self.total_num += 1
                iter = model.append()
                log.debug("Found an enalbed PPA: %s" % name)
                model.set(iter,
                       COLUMN_ICON, pixbuf,
                       COLUMN_CHECK, False,
                       COLUMN_NAME, str(id),
                       COLUMN_DESC, '',
                       COLUMN_DISPLAY, '<b>%s</b>\n%s' % (name, comment),
                    )
        self.unset_busy()
Ejemplo n.º 2
0
    def test_ppa(self):
        self.assertTrue(ppa.is_ppa(self.ppa_archive_url))

        list_name = ppa.get_list_name(self.ppa_archive_url)
        self.failUnless(list_name == '' or list_name.startswith('/var/lib/apt/lists/'))

        self.assertEqual(ppa.get_short_name(self.ppa_archive_url), 'ppa:tualatrix/ppa')

        self.assertEqual(ppa.get_homepage(self.ppa_archive_url), self.ppa_home_url)
Ejemplo n.º 3
0
    def test_ppa(self):
        self.assertTrue(ppa.is_ppa(self.ppa_archive_url))

        list_name = ppa.get_list_name(self.ppa_archive_url)
        self.failUnless(list_name == ''
                        or list_name.startswith('/var/lib/apt/lists/'))

        self.assertEqual(ppa.get_short_name(self.ppa_archive_url),
                         'ppa:tualatrix/ppa')

        self.assertEqual(ppa.get_homepage(self.ppa_archive_url),
                         self.ppa_home_url)
Ejemplo n.º 4
0
    def set_details(self,
                    homepage='http://ubuntu-tweak.com',
                    url='http://ubuntu-tweak.com',
                    description=None):
        self.homepage_button.set_label(homepage)
        self.homepage_button.set_uri(homepage)

        if ppa.is_ppa(url):
            url = ppa.get_homepage(url)
        self.url_button.set_label(url)
        self.url_button.set_uri(url)

        self.description_label.set_text(description or _('Description is here'))
Ejemplo n.º 5
0
    def set_details(self,
                    homepage='http://ubuntu-tweak.com',
                    url='http://ubuntu-tweak.com',
                    description=None):
        self.homepage_button.set_label(homepage)
        self.homepage_button.set_uri(homepage)

        if ppa.is_ppa(url):
            url = ppa.get_homepage(url)
        self.url_button.set_label(url)
        self.url_button.set_uri(url)

        self.description_label.set_text(description
                                        or _('Description is here'))
Ejemplo n.º 6
0
    def set_details(self, homepage = None, url = None, description = None):
        if homepage:
            self.homepage_button.destroy()
            self.homepage_button = gtk.LinkButton(homepage, homepage)
            self.homepage_button.show()
            self.table.attach(self.homepage_button, 1, 2, 0, 1)

        if url:
            if ppa.is_ppa(url):
                url = ppa.get_homepage(url)
            self.url_button.destroy()
            self.url_button = gtk.LinkButton(url, url)
            self.url_button.show()
            self.table.attach(self.url_button, 1, 2, 1, 2)

        if description:
            self.description.set_text(description)
Ejemplo n.º 7
0
    def set_details(self, homepage=None, url=None, description=None):
        if homepage:
            self.homepage_button.destroy()
            self.homepage_button = gtk.LinkButton(homepage, homepage)
            self.homepage_button.show()
            self.table.attach(self.homepage_button, 1, 2, 0, 1)

        if url:
            if ppa.is_ppa(url):
                url = ppa.get_homepage(url)
            self.url_button.destroy()
            self.url_button = gtk.LinkButton(url, url)
            self.url_button.show()
            self.table.attach(self.url_button, 1, 2, 1, 2)

        if description:
            self.description.set_text(description)
Ejemplo n.º 8
0
    def set_details(self, homepage=None, url=None, description=None):
        self.homepage_button.set_label(homepage or 'http://ubuntu-tweak.com')
        self.homepage_button.set_uri(homepage or 'http://ubuntu-tweak.com')

        if url:
            if ppa.is_ppa(url):
                url = ppa.get_homepage(url)
            self.url_button.destroy()
            self.url_button = Gtk.LinkButton(url, url)
            self.url_button.show()
        else:
            url = 'http://ubuntu-tweak.com'

        self.url_button.set_label(homepage or 'http://ubuntu-tweak.com')
        self.url_button.set_uri(homepage or 'http://ubuntu-tweak.com')

        self.description_label.set_text(description or _('Description is here'))
Ejemplo n.º 9
0
    def update_ppa_model(self):
        self.set_busy()
        self.__column.set_title('PPA Sources')
        model = self.get_model()
        model.clear()
        self.mode = 'ppa'

        ppa_source_dict = get_ppa_source_dict()

        for source in self.get_sourceslist():
            if ppa.is_ppa(source.uri
                          ) and source.type == 'deb' and not source.disabled:
                try:
                    id = ppa_source_dict[source.uri]
                    pixbuf = get_source_logo_from_filename(
                        SOURCE_PARSER[id]['logo'])
                    name = SOURCE_PARSER.get_name(id)
                    comment = SOURCE_PARSER.get_summary(id)
                except:
                    id = source.uri
                    name = ppa.get_short_name(source.uri)
                    comment = ppa.get_homepage(source.uri)
                    pixbuf = get_source_logo_from_filename('')

                self.total_num += 1
                iter = model.append()
                log.debug("Found an enalbed PPA: %s" % name)
                model.set(
                    iter,
                    COLUMN_ICON,
                    pixbuf,
                    COLUMN_CHECK,
                    False,
                    COLUMN_NAME,
                    str(id),
                    COLUMN_DESC,
                    '',
                    COLUMN_DISPLAY,
                    '<b>%s</b>\n%s' % (name, comment),
                )
        self.unset_busy()
Ejemplo n.º 10
0
    def update_source_model(self, find='all', limit=-1, only_enabled=False):
        self.model.clear()
        sourceslist = self.get_sourceslist()
        enabled_list = []

        for source in sourceslist.list:
            if source.type == 'deb' and not source.disabled:
                enabled_list.append(source.uri)

        if self._status:
            self._status.load_objects_from_parser(SOURCE_PARSER)

        index = 0

        for id in SOURCE_PARSER:
            enabled = False
            index = index + 1
            url = SOURCE_PARSER.get_url(id)
            enabled = url in enabled_list

            if enabled:
                enabled_list.remove(url)

            if only_enabled:
                if not enabled:
                    continue
                elif not ppa.is_ppa(url):
                    continue
                else:
                    enabled = not enabled

            slug = SOURCE_PARSER.get_slug(id)
            comps = SOURCE_PARSER.get_comps(id)
            distro = SOURCE_PARSER.get_distro(id)
            category = SOURCE_PARSER.get_category(id)
            
            if find != 'all' and category != find:
                continue

            #TODO real top-10
            if limit > 0 and index >= limit:
                break

            name = SOURCE_PARSER.get_name(id)
            comment = SOURCE_PARSER.get_summary(id)
            pixbuf = get_source_logo_from_filename(SOURCE_PARSER[id]['logo'])
            website = SOURCE_PARSER.get_website(id)
            key = SOURCE_PARSER.get_key(id)

            if self._status and not self._status.get_read_status(slug):
                display = '<b>%s <span foreground="#ff0000">(New!!!)</span>\n%s</b>' % (name, comment)
            else:
                display = '<b>%s</b>\n%s' % (name, comment)

            iter = self.model.append()
            self.model.set(iter,
                           self.COLUMN_ENABLED, enabled,
                           self.COLUMN_ID, id,
                           self.COLUMN_CATE, category,
                           self.COLUMN_URL, url,
                           self.COLUMN_DISTRO, distro,
                           self.COLUMN_COMPS, comps,
                           self.COLUMN_COMMENT, comment,
                           self.COLUMN_SLUG, slug,
                           self.COLUMN_NAME, name,
                           self.COLUMN_DISPLAY, display,
                           self.COLUMN_LOGO, pixbuf,
                           self.COLUMN_HOME, website,
                           self.COLUMN_KEY, key,
            )

        path = os.path.join(consts.DATA_DIR, 'pixmaps/ppa-logo.png')

        pixbuf = icon.get_from_file(path, size=32)

        if enabled_list and only_enabled:
            for url in enabled_list:
                if ppa.is_ppa(url):
                    iter = self.model.append()
                    self.model.set(iter,
                                   self.COLUMN_ENABLED, False,
                                   self.COLUMN_ID, 9999,
                                   self.COLUMN_CATE, -1,
                                   self.COLUMN_URL, url,
                                   self.COLUMN_DISTRO, distro,
                                   self.COLUMN_COMPS, comps,
                                   self.COLUMN_COMMENT, '',
                                   self.COLUMN_SLUG, url,
                                   self.COLUMN_NAME, ppa.get_basename(url),
                                   self.COLUMN_DISPLAY, ppa.get_long_name(url),
                                   self.COLUMN_LOGO, pixbuf,
                                   self.COLUMN_HOME, ppa.get_homepage(url),
                                   self.COLUMN_KEY, '',
                    )
Ejemplo n.º 11
0
    def update_source_model(self, find='all', limit=-1, only_enabled=False):
        self.model.clear()
        sourceslist = self.get_sourceslist()
        enabled_list = []

        for source in sourceslist.list:
            if source.type == 'deb' and not source.disabled:
                enabled_list.append(source.uri)

        if self._status:
            self._status.load_objects_from_parser(SOURCE_PARSER)

        index = 0

        for id in SOURCE_PARSER:
            enabled = False
            index = index + 1
            url = SOURCE_PARSER.get_url(id)
            enabled = url in enabled_list

            if enabled:
                enabled_list.remove(url)

            if only_enabled:
                if not enabled:
                    continue
                elif not ppa.is_ppa(url):
                    continue
                else:
                    enabled = not enabled

            slug = SOURCE_PARSER.get_slug(id)
            comps = SOURCE_PARSER.get_comps(id)
            distro = SOURCE_PARSER.get_distro(id)
            category = SOURCE_PARSER.get_category(id)

            if find != 'all' and category != find:
                continue

            #TODO real top-10
            if limit > 0 and index >= limit:
                break

            name = SOURCE_PARSER.get_name(id)
            comment = SOURCE_PARSER.get_summary(id)
            pixbuf = get_source_logo_from_filename(SOURCE_PARSER[id]['logo'])
            website = SOURCE_PARSER.get_website(id)
            key = SOURCE_PARSER.get_key(id)

            if self._status and not self._status.get_read_status(slug):
                display = '<b>%s <span foreground="#ff0000">(New!!!)</span>\n%s</b>' % (
                    name, comment)
            else:
                display = '<b>%s</b>\n%s' % (name, comment)

            iter = self.model.append()
            self.model.set(
                iter,
                self.COLUMN_ENABLED,
                enabled,
                self.COLUMN_ID,
                id,
                self.COLUMN_CATE,
                category,
                self.COLUMN_URL,
                url,
                self.COLUMN_DISTRO,
                distro,
                self.COLUMN_COMPS,
                comps,
                self.COLUMN_COMMENT,
                comment,
                self.COLUMN_SLUG,
                slug,
                self.COLUMN_NAME,
                name,
                self.COLUMN_DISPLAY,
                display,
                self.COLUMN_LOGO,
                pixbuf,
                self.COLUMN_HOME,
                website,
                self.COLUMN_KEY,
                key,
            )

        path = os.path.join(consts.DATA_DIR, 'pixmaps/ppa-logo.png')

        pixbuf = icon.get_from_file(path, size=32)

        if enabled_list and only_enabled:
            for url in enabled_list:
                if ppa.is_ppa(url):
                    iter = self.model.append()
                    self.model.set(
                        iter,
                        self.COLUMN_ENABLED,
                        False,
                        self.COLUMN_ID,
                        9999,
                        self.COLUMN_CATE,
                        -1,
                        self.COLUMN_URL,
                        url,
                        self.COLUMN_DISTRO,
                        distro,
                        self.COLUMN_COMPS,
                        comps,
                        self.COLUMN_COMMENT,
                        '',
                        self.COLUMN_SLUG,
                        url,
                        self.COLUMN_NAME,
                        ppa.get_basename(url),
                        self.COLUMN_DISPLAY,
                        ppa.get_long_name(url),
                        self.COLUMN_LOGO,
                        pixbuf,
                        self.COLUMN_HOME,
                        ppa.get_homepage(url),
                        self.COLUMN_KEY,
                        '',
                    )