def update_cache_model(self): self.set_busy() 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')) while gtk.events_pending(): gtk.main_iteration() for pkg in list: size = str(os.path.getsize(pkg)) iter = model.append() model.set( iter, COLUMN_ICON, icon, COLUMN_CHECK, False, COLUMN_NAME, pkg, COLUMN_DESC, size, COLUMN_DISPLAY, _('<b>%s</b>\nOccupies %s of disk space') % (os.path.basename(pkg), filesizeformat(size))) self.unset_busy()
def update_cache_model(self): self.set_busy() model = self.get_model() model.clear() self.mode = 'cache' cache_dir = '/var/cache/apt/archives' pixbuf = icon.get_from_name('deb') 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(_('Cached Package Files')) while gtk.events_pending(): gtk.main_iteration() for pkg in list: size = str(os.path.getsize(pkg)) iter = model.append() model.set( iter, COLUMN_ICON, pixbuf, COLUMN_CHECK, False, COLUMN_NAME, pkg, COLUMN_DESC, size, COLUMN_DISPLAY, _('<b>%s</b>\nOccupies %s of disk space') % (os.path.basename(pkg), filesizeformat(size))) self.unset_busy()
def set_column_title(self): if self.mode == 'package' or self.mode == 'kernel': n = len(self.__check_list) self.__column.set_title(ngettext('%d package selected for removal', '%d packages selected for removal', n) % n) elif self.mode == 'cache': self.compute_cache_size() self.__column.set_title(_('%s of disk space will be freed') % filesizeformat(self.size))
def set_column_title(self): if self.mode == 'package' or self.mode == 'kernel': n = len(self.__check_list) self.__column.set_title( ngettext('%d package selected for removal', '%d packages selected for removal', n) % n) elif self.mode == 'cache': self.compute_cache_size() self.__column.set_title( _('%s of disk space will be freed') % filesizeformat(self.size))
def __init__(self): TweakModule.__init__(self) cpumodel = _('Unknown') if os.uname()[4][0:3] == "ppc": for element in file("/proc/cpuinfo"): if element.split(":")[0][0:3] == "cpu": cpumodel = element.split(":")[1] else: for element in file("/proc/cpuinfo"): if element.split(":")[0] == "model name\t": cpumodel = element.split(":")[1] for element in file("/proc/meminfo"): if element.split(" ")[0] == "MemTotal:": raminfo = element.split(" ")[-2] hostname_label = gtk.Label(os.uname()[1]) hostname_button = gtk.Button(_('Change Hostname')) hostname_button.connect('clicked', self.on_hostname_button_clicked, hostname_label) box = TablePack(_("System information"), ( (gtk.Label(_("Hostname")), hostname_label, hostname_button), (gtk.Label(_("Distribution")), gtk.Label(system.DISTRO)), (gtk.Label( _("Desktop environment")), gtk.Label(system.DESKTOP_FULLNAME)), (gtk.Label( _("Kernel")), gtk.Label(os.uname()[0] + " " + os.uname()[2])), (gtk.Label(_("Platform")), gtk.Label(os.uname()[-1])), (gtk.Label(_("CPU")), gtk.Label(cpumodel.strip())), (gtk.Label(_("Memory")), gtk.Label(filesizeformat(str(int(raminfo) * 1024)))), )) self.add_start(box, False, False, 0) box = TablePack(_("User information"), ( (gtk.Label(_("Current user")), gtk.Label(os.getenv("USER"))), (gtk.Label(_("Home directory")), gtk.Label(os.getenv("HOME"))), (gtk.Label(_("Shell")), gtk.Label(os.getenv("SHELL"))), (gtk.Label(_("Language")), gtk.Label(os.getenv("LANG"))), )) self.add_start(box, False, False, 0)
def __init__(self): TweakModule.__init__(self) cpumodel = _('Unknown') if os.uname()[4][0:3] == "ppc": for element in file("/proc/cpuinfo"): if element.split(":")[0][0:3] == "cpu": cpumodel = element.split(":")[1] else: for element in file("/proc/cpuinfo"): if element.split(":")[0] == "model name\t": cpumodel = element.split(":")[1] for element in file("/proc/meminfo"): if element.split(" ")[0] == "MemTotal:": raminfo = element.split(" ")[-2] hostname_label = gtk.Label(os.uname()[1]) hostname_button = gtk.Button(_('Change Hostname')) hostname_button.connect('clicked', self.on_hostname_button_clicked, hostname_label) box = TablePack(_("System information"),( (gtk.Label(_("Hostname")), hostname_label, hostname_button), (gtk.Label(_("Distribution")), gtk.Label(SystemInfo.distro)), (gtk.Label(_("Desktop environment")), gtk.Label(SystemInfo.gnome)), (gtk.Label(_("Kernel")), gtk.Label(os.uname()[0]+" "+os.uname()[2])), (gtk.Label(_("Platform")), gtk.Label(os.uname()[-1])), (gtk.Label(_("CPU")), gtk.Label(cpumodel.strip())), (gtk.Label(_("Memory")), gtk.Label(filesizeformat(str(int(raminfo) * 1024)))), )) self.add_start(box, False, False, 0) box = TablePack(_("User information"),( (gtk.Label(_("Current user")), gtk.Label(os.getenv("USER"))), (gtk.Label(_("Home directory")), gtk.Label(os.getenv("HOME"))), (gtk.Label(_("Shell")), gtk.Label(os.getenv("SHELL"))), (gtk.Label(_("Language")), gtk.Label(os.getenv("LANG"))), )) self.add_start(box, False, False, 0)
def __init__(self): TweakModule.__init__(self) cpumodel = _('Unknown') if os.uname()[4][0:3] == "ppc": for element in file("/proc/cpuinfo"): if element.split(":")[0][0:3] == "cpu": cpumodel = element.split(":")[1] else: for element in file("/proc/cpuinfo"): if element.split(":")[0] == "model name\t": cpumodel = element.split(":")[1] for element in file("/proc/meminfo"): if element.split(" ")[0] == "MemTotal:": raminfo = element.split(" ")[-2] box = ListPack(_("System information"),( EntryBox(_("Hostname"), os.uname()[1]), EntryBox(_("Distribution"), SystemInfo.distro), EntryBox(_("Desktop environment"), SystemInfo.gnome), EntryBox(_("Kernel"), os.uname()[0]+" "+os.uname()[2]), EntryBox(_("Platform"), os.uname()[-1]), EntryBox(_("CPU"), cpumodel.strip()), EntryBox(_("Memory"), filesizeformat(str(int(raminfo) * 1024))), )) self.add_start(box, False, False, 0) box = ListPack(_("User information"),( EntryBox(_("Current user"), os.getenv("USER")), EntryBox(_("Home directory"), os.getenv("HOME")), EntryBox(_("Shell"), os.getenv("SHELL")), EntryBox(_("Language"), os.getenv("LANG")), )) self.add_start(box, False, False, 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, _('Delete thumbnail cache (Frees %s of disk space)') % filesizeformat(size))