예제 #1
0
 def set_column_title(self):
     if self.mode == 'package' or self.mode == 'kernel':
         n = len(self.__check_list)
         self.__column.set_title(
                 gettext.ngettext('%d package selected to remove' % n, 
                                 '%d packages selected to remove' % n, n))
     elif self.mode == 'cache':
         self.compute_cache_size()
         self.__column.set_title(_('%s of space will be freed') % filesizeformat(self.size))
예제 #2
0
    def update_cache_model(self):
        model = self.get_model()
        model.clear()
        self.mode = 'cache'

        cache_dir = '/var/cache/apt/archives' 
        icon = get_icon_with_name('deb', 24)
        list = map(lambda file: '%s/%s' % (cache_dir, file),
                    filter(lambda x:x.endswith('deb'), os.listdir(cache_dir))) 
        self.total_num = len(list)
        self.__column.set_title(_('Package Cache'))

        for pkg in list:
            size = str(os.path.getsize(pkg))

            model.append((
                False,
                icon,
                pkg,
                size,
                _('<b>%s</b>\nTake %s of disk space') % (os.path.basename(pkg), filesizeformat(size))
                ))
예제 #3
0
 def set_clean_button_label(self, button):
     try:
         size = os.popen('du -bs ~/.thumbnails').read().split()[0]
     except:
         size = '0'
         button.set_sensitive(False)
     set_label_for_stock_button(button, _('Clean up the thumbnails cache (will free %s of disk space)') % filesizeformat(size))