summaryrefslogtreecommitdiff
path: root/SoftwareProperties
diff options
context:
space:
mode:
Diffstat (limited to 'SoftwareProperties')
-rw-r--r--SoftwareProperties/Makefile359
-rw-r--r--SoftwareProperties/Makefile.am9
-rw-r--r--SoftwareProperties/SoftwareProperties.py1119
-rw-r--r--SoftwareProperties/__init__.py0
-rw-r--r--SoftwareProperties/dialog_add.py72
-rw-r--r--SoftwareProperties/dialog_add_sources_list.py127
-rw-r--r--SoftwareProperties/dialog_apt_key.py163
-rw-r--r--SoftwareProperties/dialog_cache_outdated.py72
-rw-r--r--SoftwareProperties/dialog_edit.py139
-rw-r--r--SoftwareProperties/utils.py10
10 files changed, 0 insertions, 2070 deletions
diff --git a/SoftwareProperties/Makefile b/SoftwareProperties/Makefile
deleted file mode 100644
index 1ecefbd9..00000000
--- a/SoftwareProperties/Makefile
+++ /dev/null
@@ -1,359 +0,0 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
-# SoftwareProperties/Makefile. Generated from Makefile.in by configure.
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-
-srcdir = .
-top_srcdir = ..
-
-pkgdatadir = $(datadir)/update-manager
-pkglibdir = $(libdir)/update-manager
-pkgincludedir = $(includedir)/update-manager
-top_builddir = ..
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = /usr/bin/install -c
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-subdir = SoftwareProperties
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/SoftwareProperties.py.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = SoftwareProperties.py
-SOURCES =
-DIST_SOURCES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(modulesdir)"
-modulesDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(modules_DATA)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /tmp/3/update-manager-0.37.1+svn20050404.15/missing --run aclocal-1.9
-AMDEP_FALSE = #
-AMDEP_TRUE =
-AMTAR = ${SHELL} /tmp/3/update-manager-0.37.1+svn20050404.15/missing --run tar
-AUTOCONF = ${SHELL} /tmp/3/update-manager-0.37.1+svn20050404.15/missing --run autoconf
-AUTOHEADER = ${SHELL} /tmp/3/update-manager-0.37.1+svn20050404.15/missing --run autoheader
-AUTOMAKE = ${SHELL} /tmp/3/update-manager-0.37.1+svn20050404.15/missing --run automake-1.9
-AWK = gawk
-CATALOGS = da.gmo de.gmo el.gmo en_CA.gmo es.gmo fi.gmo fr.gmo hu.gmo ja.gmo pl.gmo pt_BR.gmo ro.gmo rw.gmo sv.gmo zh_CN.gmo xh.gmo
-CATOBJEXT = .gmo
-CC = gcc
-CCDEPMODE = depmode=none
-CFLAGS = -g -O2
-CPP = gcc -E
-CPPFLAGS =
-CYGPATH_W = echo
-DATADIRNAME = share
-DEFS = -DHAVE_CONFIG_H
-DEPDIR = .deps
-ECHO_C =
-ECHO_N = -n
-ECHO_T =
-EGREP = grep -E
-EXEEXT =
-GETTEXT_PACKAGE = update-manager
-GMOFILES = da.gmo de.gmo el.gmo en_CA.gmo es.gmo fi.gmo fr.gmo hu.gmo ja.gmo pl.gmo pt_BR.gmo ro.gmo rw.gmo sv.gmo zh_CN.gmo xh.gmo
-GMSGFMT = /usr/bin/msgfmt
-INSTALL_DATA = ${INSTALL} -m 644
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_SCRIPT = ${INSTALL}
-INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
-INSTOBJEXT = .mo
-INTLLIBS =
-INTLTOOL_CAVES_RULE = %.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_DESKTOP_RULE = %.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_DIRECTORY_RULE = %.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_EXTRACT = $(top_builddir)/intltool-extract
-INTLTOOL_ICONV = /usr/bin/iconv
-INTLTOOL_KBD_RULE = %.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_KEYS_RULE = %.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_MERGE = $(top_builddir)/intltool-merge
-INTLTOOL_MSGFMT = /usr/bin/msgfmt
-INTLTOOL_MSGMERGE = /usr/bin/msgmerge
-INTLTOOL_OAF_RULE = %.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< $@
-INTLTOOL_PERL = /usr/bin/perl
-INTLTOOL_PONG_RULE = %.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_PROP_RULE = %.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_SCHEMAS_RULE = %.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_SERVER_RULE = %.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_SHEET_RULE = %.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_SOUNDLIST_RULE = %.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_THEME_RULE = %.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_UI_RULE = %.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_UPDATE = $(top_builddir)/intltool-update
-INTLTOOL_XAM_RULE = %.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-INTLTOOL_XGETTEXT = /usr/bin/xgettext
-INTLTOOL_XML_NOMERGE_RULE = %.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< $@
-INTLTOOL_XML_RULE = %.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
-LDFLAGS =
-LIBOBJS =
-LIBS =
-LTLIBOBJS =
-MAINT = #
-MAINTAINER_MODE_FALSE =
-MAINTAINER_MODE_TRUE = #
-MAKEINFO = ${SHELL} /tmp/3/update-manager-0.37.1+svn20050404.15/missing --run makeinfo
-MKINSTALLDIRS = ./mkinstalldirs
-MSGFMT = /usr/bin/msgfmt
-OBJEXT = o
-PACKAGE = update-manager
-PACKAGE_BUGREPORT =
-PACKAGE_NAME =
-PACKAGE_STRING =
-PACKAGE_TARNAME =
-PACKAGE_VERSION =
-PATH_SEPARATOR = :
-POFILES = da.po de.po el.po en_CA.po es.po fi.po fr.po hu.po ja.po pl.po pt_BR.po ro.po rw.po sv.po zh_CN.po xh.po
-POSUB = po
-PO_IN_DATADIR_FALSE =
-PO_IN_DATADIR_TRUE =
-SCROLLKEEPER_BUILD_REQUIRED = 0.3.5
-SCROLLKEEPER_CONFIG = /usr/bin/scrollkeeper-config
-SET_MAKE =
-SHELL = /bin/sh
-STRIP =
-USE_NLS = yes
-VERSION = 0.37.2
-XGETTEXT = /usr/bin/xgettext
-ac_ct_CC = gcc
-ac_ct_STRIP =
-am__fastdepCC_FALSE =
-am__fastdepCC_TRUE = #
-am__include = include
-am__leading_dot = .
-am__quote =
-am__tar = ${AMTAR} chof - "$$tardir"
-am__untar = ${AMTAR} xf -
-bindir = ${exec_prefix}/bin
-build_alias =
-datadir = ${prefix}/share
-exec_prefix = ${prefix}
-host_alias =
-includedir = ${prefix}/include
-infodir = ${prefix}/info
-install_sh = /tmp/3/update-manager-0.37.1+svn20050404.15/install-sh
-libdir = ${exec_prefix}/lib
-libexecdir = ${exec_prefix}/libexec
-localstatedir = ${prefix}/var
-mandir = ${prefix}/man
-mkdir_p = mkdir -p --
-oldincludedir = /usr/include
-prefix = /tmp/lala
-program_transform_name = s,x,x,
-sbindir = ${exec_prefix}/sbin
-sharedstatedir = ${prefix}/com
-sysconfdir = ${prefix}/etc
-target_alias =
-modules_DATA = SoftwareProperties.py \
- dialog_edit.py \
- dialog_add.py \
- dialog_apt_key.py \
- utils.py \
- aptsources.py
-
-modulesdir = $(datadir)/update-manager/python
-EXTRA_DIST = $(modules_DATA)
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu SoftwareProperties/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu SoftwareProperties/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: # $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-SoftwareProperties.py: $(top_builddir)/config.status $(srcdir)/SoftwareProperties.py.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-uninstall-info-am:
-install-modulesDATA: $(modules_DATA)
- @$(NORMAL_INSTALL)
- test -z "$(modulesdir)" || $(mkdir_p) "$(DESTDIR)$(modulesdir)"
- @list='$(modules_DATA)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
- echo " $(modulesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(modulesdir)/$$f'"; \
- $(modulesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(modulesdir)/$$f"; \
- done
-
-uninstall-modulesDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(modules_DATA)'; for p in $$list; do \
- f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(modulesdir)/$$f'"; \
- rm -f "$(DESTDIR)$(modulesdir)/$$f"; \
- done
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
- list='$(DISTFILES)'; for file in $$list; do \
- case $$file in \
- $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
- $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
- esac; \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test "$$dir" != "$$file" && test "$$dir" != "."; then \
- dir="/$$dir"; \
- $(mkdir_p) "$(distdir)$$dir"; \
- else \
- dir=''; \
- fi; \
- if test -d $$d/$$file; then \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(DATA)
-installdirs:
- for dir in "$(DESTDIR)$(modulesdir)"; do \
- test -z "$$dir" || $(mkdir_p) "$$dir"; \
- done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am: install-modulesDATA
-
-install-exec-am:
-
-install-info: install-info-am
-
-install-man:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-info-am uninstall-modulesDATA
-
-.PHONY: all all-am check check-am clean clean-generic distclean \
- distclean-generic distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-exec \
- install-exec-am install-info install-info-am install-man \
- install-modulesDATA install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
- uninstall-am uninstall-info-am uninstall-modulesDATA
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/SoftwareProperties/Makefile.am b/SoftwareProperties/Makefile.am
deleted file mode 100644
index e160d621..00000000
--- a/SoftwareProperties/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-modules_DATA = SoftwareProperties.py \
- dialog_edit.py \
- dialog_add.py \
- dialog_apt_key.py \
- utils.py \
- aptsources.py
-modulesdir = $(datadir)/update-manager/python
-
-EXTRA_DIST = $(modules_DATA)
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
deleted file mode 100644
index a3f0c340..00000000
--- a/SoftwareProperties/SoftwareProperties.py
+++ /dev/null
@@ -1,1119 +0,0 @@
-# gnome-software-properties.in - edit /etc/apt/sources.list
-#
-# Copyright (c) 2004,2005 Canonical
-# 2004-2005 Michiel Sikkes
-#
-# Author: Michiel Sikkes <michiel@eyesopened.nl>
-# Michael Vogt <mvo@debian.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-#import pdb
-import sys
-import apt
-import apt_pkg
-import gobject
-import shutil
-import gettext
-import tempfile
-from gettext import gettext as _
-import os
-import string
-import re
-from xml.sax.saxutils import escape
-
-from UpdateManager.Common.SimpleGladeApp import SimpleGladeApp
-from UpdateManager.Common.HelpViewer import HelpViewer
-import UpdateManager.Common.aptsources as aptsources
-import dialog_add
-import dialog_edit
-import dialog_cache_outdated
-import dialog_add_sources_list
-from dialog_apt_key import apt_key
-from utils import *
-
-
-(LIST_MARKUP, LIST_ENABLED, LIST_ENTRY_OBJ) = range(3)
-
-CONF_MAP = {
- "autoupdate" : "APT::Periodic::Update-Package-Lists",
- "autodownload" : "APT::Periodic::Download-Upgradeable-Packages",
- "autoclean" : "APT::Periodic::AutocleanInterval",
- "unattended" : "APT::Periodic::Unattended-Upgrade",
- "max_size" : "APT::Archives::MaxSize",
- "max_age" : "APT::Archives::MaxAge"
-}
-
-(
- COLUMN_ACTIVE,
- COLUMN_DESC
-) = range(2)
-
-RESPONSE_REPLACE = 1
-RESPONSE_ADD = 2
-
-# columns of the source_store
-(
- STORE_ACTIVE,
- STORE_DESCRIPTION,
- STORE_SOURCE,
- STORE_SEPARATOR,
- STORE_VISIBLE
-) = range(5)
-
-
-class SoftwareProperties(SimpleGladeApp):
-
- def __init__(self, datadir=None, options=None, parent=None, file=None):
- gtk.window_set_default_icon_name("software-properties")
- self.popconfile = "/etc/popularity-contest.conf"
-
- # FIXME: some saner way is needed here
- if datadir == None:
- datadir = "/usr/share/update-manager/"
- self.datadir = datadir
- SimpleGladeApp.__init__(self, datadir+"glade/SoftwareProperties.glade",
- None, domain="update-manager")
- self.modified = False
-
- self.file = file
-
- self.distro = aptsources.Distribution()
- cell = gtk.CellRendererText()
- self.combobox_server.pack_start(cell, True)
- self.combobox_server.add_attribute(cell, 'text', 0)
-
- # set up the handler id for the callbacks
- self.handler_server_changed = self.combobox_server.connect("changed",
- self.on_combobox_server_changed)
- self.handler_source_code_changed = self.checkbutton_source_code.connect(
- "toggled",
- self.on_checkbutton_source_code_toggled
- )
-
- if parent:
- self.window_main.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
- self.window_main.show()
- self.window_main.set_transient_for(parent)
-
- # If externally called, reparent to external application.
- self.options = options
- if options and options.toplevel != None:
- self.window_main.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
- self.window_main.show()
- toplevel = gtk.gdk.window_foreign_new(int(options.toplevel))
- self.window_main.window.set_transient_for(toplevel)
-
- self.init_sourceslist()
- self.reload_sourceslist()
- self.backup_sourceslist()
-
- self.window_main.show()
-
- # this maps the key (combo-box-index) to the auto-update-interval value
- # where (-1) means, no key
- self.combobox_interval_mapping = { 0 : 1,
- 1 : 2,
- 2 : 7,
- 3 : 14 }
- self.combobox_update_interval.set_active(0)
-
- update_days = apt_pkg.Config.FindI(CONF_MAP["autoupdate"])
-
- self.combobox_update_interval.append_text(_("Daily"))
- self.combobox_update_interval.append_text(_("Every two days"))
- self.combobox_update_interval.append_text(_("Weekly"))
- self.combobox_update_interval.append_text(_("Every two weeks"))
-
- # If a custom period is defined add an corresponding entry
- if not update_days in self.combobox_interval_mapping.values():
- if update_days > 0:
- self.combobox_update_interval.append_text(_("Every %s days")
- % update_days)
- self.combobox_interval_mapping[4] = update_days
-
- for key in self.combobox_interval_mapping:
- if self.combobox_interval_mapping[key] == update_days:
- self.combobox_update_interval.set_active(key)
- break
-
- if update_days >= 1:
- self.checkbutton_auto_update.set_active(True)
- self.combobox_update_interval.set_sensitive(True)
- else:
- self.checkbutton_auto_update.set_active(False)
- self.combobox_update_interval.set_sensitive(False)
-
- # Automatic removal of cached packages by age
- self.combobox_delete_interval_mapping = { 0 : 7,
- 1 : 14,
- 2 : 30 }
-
- delete_days = apt_pkg.Config.FindI(CONF_MAP["max_age"])
-
- self.combobox_delete_interval.append_text(_("After one week"))
- self.combobox_delete_interval.append_text(_("After two weeks"))
- self.combobox_delete_interval.append_text(_("After one month"))
-
- # If a custom period is defined add an corresponding entry
- if not delete_days in self.combobox_delete_interval_mapping.values():
- if delete_days > 0 and CONF_MAP["autoclean"] != 0:
- self.combobox_delete_interval.append_text(_("After %s days")
- % delete_days)
- self.combobox_delete_interval_mapping[3] = delete_days
-
- for key in self.combobox_delete_interval_mapping:
- if self.combobox_delete_interval_mapping[key] == delete_days:
- self.combobox_delete_interval.set_active(key)
- break
-
- if delete_days >= 1 and apt_pkg.Config.FindI(CONF_MAP["autoclean"]) != 0:
- self.checkbutton_auto_delete.set_active(True)
- self.combobox_delete_interval.set_sensitive(True)
- else:
- self.checkbutton_auto_delete.set_active(False)
- self.combobox_delete_interval.set_sensitive(False)
-
- # Autodownload
- if apt_pkg.Config.FindI(CONF_MAP["autodownload"]) == 1:
- self.checkbutton_auto_download.set_active(True)
- else:
- self.checkbutton_auto_download.set_active(False)
-
- # Unattended updates
- if os.path.exists("/usr/bin/unattended-upgrade"):
- # FIXME: we should always show the option. if unattended-upgrades is
- # not installed a dialog should popup and allow the user to install
- # unattended-upgrade
- #self.checkbutton_unattended.set_sensitive(True)
- self.checkbutton_unattended.show()
- else:
- #self.checkbutton_unattended.set_sensitive(False)
- self.checkbutton_unattended.hide()
- if apt_pkg.Config.FindI(CONF_MAP["unattended"]) == 1:
- self.checkbutton_unattended.set_active(True)
- else:
- self.checkbutton_unattended.set_active(False)
-
- self.help_viewer = HelpViewer("update-manager#setting-preferences")
- if self.help_viewer.check() == False:
- self.button_help.set_sensitive(False)
-
- # apt-key stuff
- self.apt_key = apt_key()
- self.init_keyslist()
- self.reload_keyslist()
-
- # drag and drop support for sources.list
- self.treeview_sources.drag_dest_set(gtk.DEST_DEFAULT_ALL, \
- [('text/uri-list',0, 0)], \
- gtk.gdk.ACTION_COPY)
- self.treeview_sources.connect("drag_data_received",\
- self.on_sources_drag_data_received)
-
- # popcon
- if os.path.exists(self.popconfile):
- # read it
- lines = open(self.popconfile).read().split("\n")
- active = False
- for line in lines:
- try:
- (key,value) = line.split("=")
- if key == "PARTICIPATE":
- if value.strip('"').lower() == "yes":
- active = True
- except ValueError:
- continue
- self.checkbutton_popcon.set_active(active)
-
-
- # call the add sources.list dialog if we got a file from the cli
- if self.file != None:
- self.open_file(file)
-
- def distro_to_widgets(self):
- """
- Represent the distro information in the user interface
- """
- # TRANS: %s stands for the distribution name e.g. Debian or Ubuntu
- self.label_updates.set_label("<b>%s</b>" % (_("%s updates") %\
- self.distro.id))
- # TRANS: %s stands for the distribution name e.g. Debian or Ubuntu
- self.label_dist_name.set_label("%s" % self.distro.description)
-
- # Setup the checkbuttons for the components
- for checkbutton in self.vbox_dist_comps.get_children():
- self.vbox_dist_comps.remove(checkbutton)
- for comp in self.distro.source_template.components.keys():
- # TRANSLATORS: Label for the components in the Internet section
- # first %s is the description of the component
- # second %s is the code name of the comp, eg main, universe
- label = _("%s (%s)") % (self.distro.source_template.components[comp][1],
- comp)
- checkbox = gtk.CheckButton(label)
- # check if the comp is enabled
- # FIXME: use inconsistence if there are main sources with not all comps
- if comp in self.distro.download_comps:
- checkbox.set_active(True)
- # setup the callback and show the checkbutton
- checkbox.connect("toggled", self.on_component_toggled, comp)
- self.vbox_dist_comps.add(checkbox)
- checkbox.show()
-
- # Setup the checkbuttons for the child repos / updates
- for checkbutton in self.vbox_updates.get_children():
- self.vbox_updates.remove(checkbutton)
- for template in self.distro.source_template.children:
- checkbox = gtk.CheckButton(label=template.description)
- comps = []
- for child in self.distro.child_sources:
- if child.template == template:
- comps.extend(child.comps)
- # check if all comps of the main source are also enabled
- # for the corresponding child sources
- if len(comps) > 0 and \
- len(self.distro.enabled_comps ^ set(comps)) == 0:
- # the cild source covers all components
- checkbox.set_active(True)
- elif len(comps) > 0 and\
- len(self.distro.enabled_comps ^ set(comps)) != 0:
- # the cild is enabled, but doesn't cover
- # all components
- checkbox.set_active(False)
- checkbox.set_inconsistent(True)
- else:
- # there is no corresponding child source at all
- checkbox.set_active(False)
- # setup the callback and show the checkbutton
- checkbox.connect("toggled", self.on_checkbutton_child_toggled,
- template)
- self.vbox_updates.add(checkbox)
- checkbox.show()
-
- if len(self.distro.enabled_comps) < 1:
- self.vbox_updates.set_sensitive(False)
- else:
- self.vbox_updates.set_sensitive(True)
-
- # Intiate the combobox which allows do specify a server for all
- # distro related sources
- self.combobox_server.handler_block(self.handler_server_changed)
- server_store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
- self.combobox_server.set_model(server_store)
- server_store.append([_("Main server"),
- self.distro.main_server])
- if self.distro.country != None:
- # TRANSLATORS: %s is a country
- server_store.append([_("Server for %s") % gettext.dgettext("iso_3166",
- self.distro.country.rstrip()).rstrip(),
- self.distro.nearest_server])
- else:
- server_store.append([_("Nearest server"),
- self.distro.nearest_server])
- if len(self.distro.used_servers) > 0:
- for server in self.distro.used_servers:
- if not re.match(server, self.distro.main_server) and \
- not re.match(server, self.distro.nearest_server):
- # FIXME: use regexp here instead of this
- country = ""
- i = server.find("://")
- l = server.find(".archive.ubuntu.com")
- if i != -1 and l != -1:
- country = server[i+len("://"):l]
- if self.distro.countries.has_key(country):
- # TRANSLATORS: %s is a country
- server_store.append([_("Server for %s") % \
- gettext.dgettext("iso-3166",
- self.distro.countries[country].rstrip()),
- server])
- else:
- server_store.append(["%s" % server, server])
- if len(self.distro.used_servers) > 1:
- server_store.append([_("Custom servers"), None])
- self.combobox_server.set_active(2)
- elif self.distro.used_servers[0] == self.distro.main_server:
- self.combobox_server.set_active(0)
- elif self.distro.used_servers[0] == self.distro.nearest_server:
- self.combobox_server.set_active(1)
- elif len(self.distro.used_servers) == 1:
- self.combobox_server.set_active(2)
-
- else:
- self.combobox_server.set_active(0)
-
- self.combobox_server.handler_unblock(self.handler_server_changed)
-
- # Check for source code sources
- self.checkbutton_source_code.handler_block(self.handler_source_code_changed)
- self.checkbutton_source_code.set_inconsistent(False)
- if len(self.distro.source_code_sources) < 1:
- # we don't have any source code sources, so
- # uncheck the button
- self.checkbutton_source_code.set_active(False)
- self.distro.get_source_code = False
- else:
- # there are source code sources, so we check the button
- self.checkbutton_source_code.set_active(True)
- self.distro.get_source_code = True
- # check if there is a corresponding source code source for
- # every binary source. if not set the checkbutton to inconsistent
- templates = {}
- sources = []
- sources.extend(self.distro.main_sources)
- sources.extend(self.distro.child_sources)
- for source in sources:
- if templates.has_key(source.template):
- for comp in source.comps:
- templates[source.template].add(comp)
- else:
- templates[source.template] = set(source.comps)
- # add fake http sources for the cdrom, since the sources
- # for the cdrom are only available in the internet
- if len(self.distro.cdrom_sources) > 0:
- templates[self.distro.source_template] = self.distro.cdrom_comps
- for source in self.distro.source_code_sources:
- if not templates.has_key(source.template) or \
- (templates.has_key(source.template) and not \
- (len(set(templates[source.template]) ^ set(source.comps)) == 0\
- or (len(set(source.comps) ^ self.distro.enabled_comps) == 0))):
- self.checkbutton_source_code.set_inconsistent(True)
- self.distro.get_source_code = False
- break
- self.checkbutton_source_code.handler_unblock(self.handler_source_code_changed)
-
- if len(self.cdrom_store) == 0:
- self.treeview_cdroms.set_sensitive(False)
- else:
- self.treeview_cdroms.set_sensitive(True)
-
- if self.options.debug == True or self.options.massive_debug == True:
- print "ENABLED COMPS: %s" % self.distro.enabled_comps
- print "INTERNET COMPS: %s" % self.distro.download_comps
- print "MAIN SOURCES"
- for source in self.distro.main_sources:
- self.print_source_entry(source)
- print "CHILD SOURCES"
- for source in self.distro.child_sources:
- self.print_source_entry(source)
- print "CDROM SOURCES"
- for source in self.distro.cdrom_sources:
- self.print_source_entry(source)
- print "SOURCE CODE SOURCES"
- for source in self.distro.source_code_sources:
- self.print_source_entry(source)
- print "DISABLED SOURCES"
- for source in self.distro.disabled_sources:
- self.print_source_entry(source)
- print "ISV"
- for source in self.sourceslist_visible:
- self.print_source_entry(source)
-
- def print_source_entry(self, source):
- """Print the data of a source entry to the command line"""
- print source.dist
- for (label, value) in [("URI:", source.uri),
- ("Comps:", source.comps),
- ("Enabled:", not source.disabled),
- ("Valid:", not source.invalid)]:
- print " %s %s" % (label, value)
- if source.template:
- for (label, value) in [("MatchURI:", source.template.match_uri),
- ("BaseURI:", source.template.base_uri)]:
- print " %s %s" % (label, value)
- print "\n"
-
- def on_combobox_server_changed(self, combobox):
- """
- Replace the servers used by the main and update sources with
- the selected one
- """
- server_store = combobox.get_model()
- iter = combobox.get_active_iter()
- uri_selected = server_store.get_value(iter, 1)
- sources = []
- sources.extend(self.distro.main_sources)
- sources.extend(self.distro.child_sources)
- sources.extend(self.distro.source_code_sources)
- for source in sources:
- # FIXME: ugly
- if not "security.ubuntu.com" in source.uri:
- source.uri = uri_selected
- self.distro.ddefault_server = uri_selected
- self.modified_sourceslist()
-
- def on_component_toggled(self, checkbutton, comp):
- """
- Sync the components of all main sources (excluding cdroms),
- child sources and source code sources
- """
- if checkbutton.get_active() == True:
- self.distro.enable_component(self.sourceslist, comp)
- else:
- self.distro.disable_component(self.sourceslist, comp)
- self.modified_sourceslist()
-
- def massive_debug_output(self):
- """
- do not write our changes yet - just print them to std_out
- """
- print "START SOURCES.LIST:"
- for source in self.sourceslist:
- print source.str()
- print "END SOURCES.LIST\n"
-
- def on_checkbutton_child_toggled(self, checkbutton, template):
- """
- Enable or disable a child repo of the distribution main repository
- """
- if checkbutton.get_active() == False:
- for source in self.distro.child_sources:
- if source.template == template:
- self.sourceslist.remove(source)
- for source in self.distro.source_code_sources:
- if source.template == template:
- self.sourceslist.remove(source)
- else:
- self.distro.add_source(self.sourceslist,
- uri=template.base_uri,
- dist=template.name)
- self.modified_sourceslist()
-
- def on_checkbutton_source_code_toggled(self, checkbutton):
- """
- Disable or enable the source code for all sources
- """
- self.distro.get_source_code = checkbutton.get_active()
- sources = []
- sources.extend(self.distro.main_sources)
- sources.extend(self.distro.child_sources)
-
- # remove all exisiting sources
- for source in self.distro.source_code_sources:
- self.sourceslist.remove(source)
-
- if checkbutton.get_active() == True:
- for source in sources:
- self.sourceslist.add("deb-src",
- source.uri,
- source.dist,
- source.comps,
- "Added by software-properties",
- self.sourceslist.list.index(source)+1,
- source.file)
- for source in self.distro.cdrom_sources:
- self.sourceslist.add("deb-src",
- self.distro.source_template.base_uri,
- self.distro.source_template.name,
- source.comps,
- "Added by software-properties",
- self.sourceslist.list.index(source)+1,
- source.file)
- self.modified_sourceslist()
-
- def on_checkbutton_popcon_toggled(self, widget):
- """ The user clicked on the popcon paritipcation button """
- if widget.get_active():
- new_value = "yes"
- else:
- new_value = "no"
- if os.path.exists(self.popconfile):
- # read it
- lines = open(self.popconfile).read().split("\n")
- for line in lines:
- try:
- (key,value) = line.split("=")
- if key == "PARTICIPATE":
- lines[lines.index(line)] = 'PARTICIPATE=\"%s"' % new_value
- except ValueError:
- continue
- # write it
- open(self.popconfile,"w").write("\n".join(lines))
-
-
- def open_file(self, file):
- """Show an confirmation for adding the channels of the specified file"""
- dialog = dialog_add_sources_list.AddSourcesList(self.window_main,
- self.sourceslist,
- self.render_source,
- self.get_comparable,
- self.datadir,
- file)
- (res, new_sources) = dialog.run()
- if res == RESPONSE_REPLACE:
- self.sourceslist.list = []
- if res in (RESPONSE_ADD, RESPONSE_REPLACE):
- for source in new_sources:
- self.sourceslist.add(source.type,
- source.uri,
- source.dist,
- source.comps,
- source.comment)
- self.modified_sourceslist()
-
- def on_sources_drag_data_received(self, widget, context, x, y,
- selection, target_type, timestamp):
- """Extract the dropped file pathes and open the first file, only"""
- uri = selection.data.strip()
- uri_splitted = uri.split()
- if len(uri_splitted)>0:
- self.open_file(uri_splitted[0])
-
- def hide(self):
- self.window_main.hide()
-
- def init_sourceslist(self):
- """
- Read all valid sources into our ListStore
- """
- # STORE_ACTIVE - is the source enabled or disabled
- # STORE_DESCRIPTION - description of the source entry
- # STORE_SOURCE - the source entry object
- # STORE_SEPARATOR - if the entry is a separator
- # STORE_VISIBLE - if the entry is shown or hidden
- self.cdrom_store = gtk.ListStore(gobject.TYPE_BOOLEAN,
- gobject.TYPE_STRING,
- gobject.TYPE_PYOBJECT,
- gobject.TYPE_BOOLEAN,
- gobject.TYPE_BOOLEAN)
- self.treeview_cdroms.set_model(self.cdrom_store)
- self.source_store = gtk.ListStore(gobject.TYPE_BOOLEAN,
- gobject.TYPE_STRING,
- gobject.TYPE_PYOBJECT,
- gobject.TYPE_BOOLEAN,
- gobject.TYPE_BOOLEAN)
- self.treeview_sources.set_model(self.source_store)
- self.treeview_sources.set_row_separator_func(self.is_separator,
- STORE_SEPARATOR)
-
- cell_desc = gtk.CellRendererText()
- cell_desc.set_property("xpad", 2)
- cell_desc.set_property("ypad", 2)
- col_desc = gtk.TreeViewColumn(_("Software Channel"), cell_desc,
- markup=COLUMN_DESC)
- col_desc.set_max_width(1000)
-
- cell_toggle = gtk.CellRendererToggle()
- cell_toggle.set_property("xpad", 2)
- cell_toggle.set_property("ypad", 2)
- cell_toggle.connect('toggled', self.on_channel_toggled, self.cdrom_store)
- col_active = gtk.TreeViewColumn(_("Active"), cell_toggle,
- active=COLUMN_ACTIVE)
-
- self.treeview_cdroms.append_column(col_active)
- self.treeview_cdroms.append_column(col_desc)
-
- cell_desc = gtk.CellRendererText()
- cell_desc.set_property("xpad", 2)
- cell_desc.set_property("ypad", 2)
- col_desc = gtk.TreeViewColumn(_("Software Channel"), cell_desc,
- markup=COLUMN_DESC)
- col_desc.set_max_width(1000)
-
- cell_toggle = gtk.CellRendererToggle()
- cell_toggle.set_property("xpad", 2)
- cell_toggle.set_property("ypad", 2)
- cell_toggle.connect('toggled', self.on_channel_toggled, self.source_store)
- col_active = gtk.TreeViewColumn(_("Active"), cell_toggle,
- active=COLUMN_ACTIVE)
-
- self.treeview_sources.append_column(col_active)
- self.treeview_sources.append_column(col_desc)
-
- self.sourceslist = aptsources.SourcesList()
-
- def backup_sourceslist(self):
- """
- Duplicate the list of sources
- """
- self.sourceslist_backup = []
- for source in self.sourceslist.list:
- source_bkp = aptsources.SourceEntry(line=source.line,file=source.file)
- self.sourceslist_backup.append(source_bkp)
-
- def on_channel_activate(self, treeview, path, column):
- """Open the edit dialog if a channel was double clicked"""
- self.on_edit_clicked(treeview)
-
- def on_treeview_sources_cursor_changed(self, treeview):
- """Enable the buttons remove and edit if a channel is selected"""
- sel = self.treeview_sources.get_selection()
- (model, iter) = sel.get_selected()
- if iter:
- self.button_edit.set_sensitive(True)
- self.button_remove.set_sensitive(True)
- else:
- self.button_edit.set_sensitive(False)
- self.button_remove.set_sensitive(False)
-
- def on_channel_toggled(self, cell_toggle, path, store):
- """Enable or disable the selected channel"""
- #FIXME cdroms need to disable the comps in the childs and sources
- iter = store.get_iter((int(path),))
- source_entry = store.get_value(iter, STORE_SOURCE)
- source_entry.disabled = not source_entry.disabled
- store.set_value(iter, STORE_ACTIVE, not source_entry.disabled)
- self.modified_sourceslist()
-
- def init_keyslist(self):
- self.keys_store = gtk.ListStore(str)
- self.treeview2.set_model(self.keys_store)
-
- tr = gtk.CellRendererText()
-
- keys_col = gtk.TreeViewColumn("Key", tr, text=0)
- self.treeview2.append_column(keys_col)
-
- def on_button_revert_clicked(self, button):
- """Restore the source list from the startup of the dialog"""
- self.sourceslist.list = []
- for source in self.sourceslist_backup:
- source_reset = aptsources.SourceEntry(line=source.line,file=source.file)
- self.sourceslist.list.append(source_reset)
- self.save_sourceslist()
- self.reload_sourceslist()
- self.button_revert.set_sensitive(False)
- self.modified = False
-
- def modified_sourceslist(self):
- """The sources list was changed and now needs to be saved and reloaded"""
- if self.options.massive_debug == True:
- self.massive_debug_output()
- self.modified = True
- self.button_revert.set_sensitive(True)
- self.save_sourceslist()
- self.reload_sourceslist()
-
- def render_source(self, source):
- """Render a nice output to show the source in a treeview"""
-
- if source.template == None:
- if source.comment:
- contents = "<b>%s</b>" % escape(source.comment)
- # Only show the components if there are more than one
- if len(source.comps) > 1:
- for c in source.comps:
- contents += " %s" % c
- else:
- contents = "<b>%s %s</b>" % (source.uri, source.dist)
- for c in source.comps:
- contents += " %s" % c
- if source.type in ("deb-src", "rpm-src"):
- contents += " %s" % _("(Source Code)")
- return contents
- else:
- # try to make use of an corresponding template
- contents = "<b>%s</b>" % source.template.description
- if source.type in ("deb-src", "rpm-src"):
- contents += " (%s)" % _("Source Code")
- if source.comment:
- contents +=" %s" % source.comment
- if source.template.child == False:
- for comp in source.comps:
- if source.template.components.has_key(comp):
- print source.template.components[comp]
- (desc, desc_long) = source.template.components[comp]
- contents += "\n%s" % desc
- else:
- contents += "\n%s" % comp
- return contents
-
- def get_comparable(self, source):
- """extract attributes to sort the sources"""
- cur_sys = 1
- has_template = 1
- has_comment = 1
- is_source = 1
- revert_numbers = string.maketrans("0123456789", "9876543210")
- if source.template:
- has_template = 0
- desc = source.template.description
- if source.template.distribution == self.distro:
- cur_sys = 0
- else:
- desc = "%s %s %s" % (source.uri, source.dist, source.comps)
- if source.comment:
- has_comment = 0
- if source.type.find("src"):
- is_source = 0
- return (cur_sys, has_template, has_comment, is_source,
- desc.translate(revert_numbers))
-
- def reload_sourceslist(self):
- (path_x, path_y) = self.treeview_sources.get_cursor()
- self.source_store.clear()
- self.cdrom_store.clear()
- self.sourceslist.refresh()
- self.sourceslist_visible=[]
- self.distro.get_sources(self.sourceslist)
- # Only show sources that are no binary or source code repos for
- # the current distribution, but show cdrom based repos
- for source in self.sourceslist.list:
- if not source.invalid and\
- (source not in self.distro.main_sources and\
- source not in self.distro.cdrom_sources and\
- source not in self.distro.child_sources and\
- source not in self.distro.disabled_sources) and\
- source not in self.distro.source_code_sources:
- self.sourceslist_visible.append(source)
- elif not source.invalid and source in self.distro.cdrom_sources:
- contents = self.render_source(source)
- self.cdrom_store.append([not source.disabled, contents,
- source, False, True])
-
- # Sort the sources list
- self.sourceslist_visible.sort(key=self.get_comparable)
-
- for source in self.sourceslist_visible:
- contents = self.render_source(source)
-
- self.source_store.append([not source.disabled, contents,
- source, False, True])
-
- (path_x, path_y) = self.treeview_sources.get_cursor()
- if len(self.source_store) < 1 or path_x <0:
- self.button_remove.set_sensitive(False)
- self.button_edit.set_sensitive(False)
- self.distro.get_sources(self.sourceslist)
- self.distro_to_widgets()
-
- def is_separator(self, model, iter, column):
- return model.get_value(iter, column)
-
- def reload_keyslist(self):
- self.keys_store.clear()
- for key in self.apt_key.list():
- self.keys_store.append([key])
-
- def on_combobox_update_interval_changed(self, widget):
- i = self.combobox_update_interval.get_active()
- if i != -1:
- value = self.combobox_interval_mapping[i]
- # Only write the key if it has changed
- if not value == apt_pkg.Config.FindI(CONF_MAP["autoupdate"]):
- apt_pkg.Config.Set(CONF_MAP["autoupdate"], str(value))
- self.write_config()
-
- def on_opt_autoupdate_toggled(self, widget):
- if self.checkbutton_auto_update.get_active():
- self.combobox_update_interval.set_sensitive(True)
- # if no frequency was specified use daily
- i = self.combobox_update_interval.get_active()
- if i == -1:
- i = 0
- self.combobox_update_interval.set_active(i)
- value = self.combobox_interval_mapping[i]
- else:
- self.combobox_update_interval.set_sensitive(False)
- value = 0
- apt_pkg.Config.Set(CONF_MAP["autoupdate"], str(value))
- # FIXME: Write config options, apt_pkg should be able to do this.
- self.write_config()
-
- def on_opt_unattended_toggled(self, widget):
- if self.checkbutton_unattended.get_active():
- self.checkbutton_unattended.set_active(True)
- apt_pkg.Config.Set(CONF_MAP["unattended"], str(1))
- else:
- self.checkbutton_unattended.set_active(False)
- apt_pkg.Config.Set(CONF_MAP["unattended"], str(0))
- # FIXME: Write config options, apt_pkg should be able to do this.
- self.write_config()
-
- def on_opt_autodownload_toggled(self, widget):
- if self.checkbutton_auto_download.get_active():
- self.checkbutton_auto_download.set_active(True)
- apt_pkg.Config.Set(CONF_MAP["autodownload"], str(1))
- else:
- self.checkbutton_auto_download.set_active(False)
- apt_pkg.Config.Set(CONF_MAP["autodownload"], str(0))
- # FIXME: Write config options, apt_pkg should be able to do this.
- self.write_config()
-
- def on_combobox_delete_interval_changed(self, widget):
- i = self.combobox_delete_interval.get_active()
- if i != -1:
- value = self.combobox_delete_interval_mapping[i]
- # Only write the key if it has changed
- if not value == apt_pkg.Config.FindI(CONF_MAP["max_age"]):
- apt_pkg.Config.Set(CONF_MAP["max_age"], str(value))
- self.write_config()
-
- def on_opt_autodelete_toggled(self, widget):
- if self.checkbutton_auto_delete.get_active():
- self.combobox_delete_interval.set_sensitive(True)
- # if no frequency was specified use the first default value
- i = self.combobox_delete_interval.get_active()
- if i == -1:
- i = 0
- self.combobox_delete_interval.set_active(i)
- value_maxage = self.combobox_delete_interval_mapping[i]
- value_clean = 1
- apt_pkg.Config.Set(CONF_MAP["max_age"], str(value_maxage))
- else:
- self.combobox_delete_interval.set_sensitive(False)
- value_clean = 0
- apt_pkg.Config.Set(CONF_MAP["autoclean"], str(value_clean))
- # FIXME: Write config options, apt_pkg should be able to do this.
- self.write_config()
-
- def write_config(self):
- # update the adept file as well if it is there
- conffiles = ["/etc/apt/apt.conf.d/10periodic",
- "/etc/apt/apt.conf.d/15adept-periodic-update"]
-
- # check (beforehand) if one exists, if not create one
- for f in conffiles:
- if os.path.isfile(f):
- break
- else:
- print "No config found, creating one"
- open(conffiles[0], "w")
-
- # now update them
- for periodic in conffiles:
- # read the old content first
- content = []
- if os.path.isfile(periodic):
- content = open(periodic, "r").readlines()
- cnf = apt_pkg.Config.SubTree("APT::Periodic")
-
- # then write a new file without the updated keys
- f = open(periodic, "w")
- for line in content:
- for key in cnf.List():
- if line.find("APT::Periodic::%s" % (key)) >= 0:
- break
- else:
- f.write(line)
-
- # and append the updated keys
- for i in cnf.List():
- f.write("APT::Periodic::%s \"%s\";\n" % (i, cnf.FindI(i)))
- f.close()
-
- def save_sourceslist(self):
- #location = "/etc/apt/sources.list"
- #shutil.copy(location, location + ".save")
- self.sourceslist.backup(".save")
- self.sourceslist.save()
-
- def on_add_clicked(self, widget):
- dialog = dialog_add.dialog_add(self.window_main, self.sourceslist,
- self.datadir)
- line = dialog.run()
- if line != None:
- self.sourceslist.list.append(aptsources.SourceEntry(line))
- self.modified_sourceslist()
-
- def on_edit_clicked(self, widget):
- sel = self.treeview_sources.get_selection()
- (model, iter) = sel.get_selected()
- if not iter:
- return
- source_entry = model.get_value(iter, LIST_ENTRY_OBJ)
- dialog = dialog_edit.dialog_edit(self.window_main, self.sourceslist,
- source_entry, self.datadir)
- if dialog.run() == gtk.RESPONSE_OK:
- self.modified_sourceslist()
-
- # FIXME:outstanding from merge
- def on_channel_activated(self, treeview, path, column):
- """Open the edit dialog if a channel was double clicked"""
- # check if the channel can be edited
- if self.button_edit.get_property("sensitive") == True:
- self.on_edit_clicked(treeview)
-
- # FIXME:outstanding from merge
- def on_treeview_sources_cursor_changed(self, treeview):
- """set the sensitiveness of the edit and remove button
- corresponding to the selected channel"""
- sel = self.treeview_sources.get_selection()
- (model, iter) = sel.get_selected()
- if not iter:
- # No channel is selected, so disable edit and remove
- self.button_edit.set_sensitive(False)
- self.button_remove.set_sensitive(False)
- return
- # allow to remove the selected channel
- self.button_remove.set_sensitive(True)
- # disable editing of cdrom sources
- source_entry = model.get_value(iter, LIST_ENTRY_OBJ)
- if source_entry.uri.startswith("cdrom:"):
- self.button_edit.set_sensitive(False)
- else:
- self.button_edit.set_sensitive(True)
-
- def on_remove_clicked(self, widget):
- model = self.treeview_sources.get_model()
- (path, column) = self.treeview_sources.get_cursor()
- iter = model.get_iter(path)
- if iter:
- source = model.get_value(iter, LIST_ENTRY_OBJ)
- self.sourceslist.remove(source)
- self.modified_sourceslist()
-
- def add_key_clicked(self, widget):
- chooser = gtk.FileChooserDialog(title=_("Import key"),
- parent=self.window_main,
- buttons=(gtk.STOCK_CANCEL,
- gtk.RESPONSE_REJECT,
- gtk.STOCK_OK,gtk.RESPONSE_ACCEPT))
- res = chooser.run()
- chooser.hide()
- if res == gtk.RESPONSE_ACCEPT:
- if not self.apt_key.add(chooser.get_filename()):
- error(self.window_main,
- _("Error importing selected file"),
- _("The selected file may not be a GPG key file " \
- "or it might be corrupt."))
- self.reload_keyslist()
-
- def remove_key_clicked(self, widget):
- selection = self.treeview2.get_selection()
- (model,a_iter) = selection.get_selected()
- if a_iter == None:
- return
- key = model.get_value(a_iter,0)
- if not self.apt_key.rm(key[:8]):
- error(self.main,
- _("Error removing the key"),
- _("The key you selected could not be removed. "
- "Please report this as a bug."))
- self.reload_keyslist()
-
- def on_restore_clicked(self, widget):
- self.apt_key.update()
- self.reload_keyslist()
-
- def on_delete_event(self, widget, args):
- self.on_close_button(widget)
-
- def on_close_button(self, widget):
- # show a dialog that a reload of the channel information is required
- # only if there is no parent defined
- if self.modified == True and \
- self.options.toplevel == None:
- d = dialog_cache_outdated.DialogCacheOutdated(self.window_main,
- self.datadir)
- res = d.run()
- self.quit()
-
- def on_help_button(self, widget):
- self.help_viewer.run()
-
- def on_button_add_cdrom_clicked(self, widget):
- #print "on_button_add_cdrom_clicked()"
-
- # testing
- #apt_pkg.Config.Set("APT::CDROM::Rename","true")
-
- saved_entry = apt_pkg.Config.Find("Dir::Etc::sourcelist")
- tmp = tempfile.NamedTemporaryFile()
- apt_pkg.Config.Set("Dir::Etc::sourcelist",tmp.name)
- progress = GtkCdromProgress(self.datadir,self.window_main)
- cdrom = apt_pkg.GetCdrom()
- # if nothing was found just return
- try:
- res = cdrom.Add(progress)
- except SystemError, msg:
- #print "aiiiieeee, exception from cdrom.Add() [%s]" % msg
- progress.close()
- dialog = gtk.MessageDialog(parent=self.window_main,
- flags=gtk.DIALOG_MODAL,
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_OK,
- message_format=None)
- dialog.set_markup(_("<big><b>Error scanning the CD</b></big>\n\n%s"%msg))
- res = dialog.run()
- dialog.destroy()
- return
- apt_pkg.Config.Set("Dir::Etc::sourcelist",saved_entry)
- if res == False:
- progress.close()
- return
- # read tmp file with source name (read only last line)
- line = ""
- for x in open(tmp.name):
- line = x
- if line != "":
- full_path = "%s%s" % (apt_pkg.Config.FindDir("Dir::Etc"),saved_entry)
- self.sourceslist.list.append(aptsources.SourceEntry(line,full_path))
- self.reload_sourceslist()
- self.modified = True
-
- # def on_channel_toggled(self, cell_toggle, path, store):
- # """Enable or disable the selected channel"""
- # iter = store.get_iter((int(path),))
- # source_entry = store.get_value(iter, LIST_ENTRY_OBJ)
- # source_entry.disabled = not source_entry.disabled
- # self.reload_sourceslist()
- # self.modified = True
-
-# FIXME: move this into a different file
-class GtkCdromProgress(apt.progress.CdromProgress, SimpleGladeApp):
- def __init__(self,datadir, parent):
- SimpleGladeApp.__init__(self,
- datadir+"glade/SoftwarePropertiesDialogs.glade",
- "dialog_cdrom_progress",
- domain="update-manager")
- self.dialog_cdrom_progress.show()
- self.dialog_cdrom_progress.set_transient_for(parent)
- self.parent = parent
- self.button_cdrom_close.set_sensitive(False)
- def close(self):
- self.dialog_cdrom_progress.hide()
- def on_button_cdrom_close_clicked(self, widget):
- self.close()
- def update(self, text, step):
- """ update is called regularly so that the gui can be redrawn """
- if step > 0:
- self.progressbar_cdrom.set_fraction(step/float(self.totalSteps))
- if step == self.totalSteps:
- self.button_cdrom_close.set_sensitive(True)
- if text != "":
- self.label_cdrom.set_text(text)
- while gtk.events_pending():
- gtk.main_iteration()
- def askCdromName(self):
- dialog = gtk.MessageDialog(parent=self.dialog_cdrom_progress,
- flags=gtk.DIALOG_MODAL,
- type=gtk.MESSAGE_QUESTION,
- buttons=gtk.BUTTONS_OK_CANCEL,
- message_format=None)
- dialog.set_markup(_("Please enter a name for the disc"))
- entry = gtk.Entry()
- entry.show()
- dialog.vbox.pack_start(entry)
- res = dialog.run()
- dialog.destroy()
- if res == gtk.RESPONSE_OK:
- name = entry.get_text()
- return (True,name)
- return (False,"")
- def changeCdrom(self):
- dialog = gtk.MessageDialog(parent=self.dialog_cdrom_progress,
- flags=gtk.DIALOG_MODAL,
- type=gtk.MESSAGE_QUESTION,
- buttons=gtk.BUTTONS_OK_CANCEL,
- message_format=None)
- dialog.set_markup(_("Please insert a disc in the drive:"))
- res = dialog.run()
- dialog.destroy()
- if res == gtk.RESPONSE_OK:
- return True
- return False
-
-
diff --git a/SoftwareProperties/__init__.py b/SoftwareProperties/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/SoftwareProperties/__init__.py
+++ /dev/null
diff --git a/SoftwareProperties/dialog_add.py b/SoftwareProperties/dialog_add.py
deleted file mode 100644
index cf9e22c2..00000000
--- a/SoftwareProperties/dialog_add.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# dialog_add.py.in - dialog to add a new repository
-#
-# Copyright (c) 2004-2005 Canonical
-# 2005 Michiel Sikkes
-#
-# Authors:
-# Michael Vogt <mvo@debian.org>
-# Michiel Sikkes <michiels@gnome.org>
-# Sebastian Heinlein <glatzor@ubuntu.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-import os
-import gobject
-import gtk
-import gtk.glade
-from gettext import gettext as _
-
-import UpdateManager.Common.aptsources as aptsources
-
-class dialog_add:
- def __init__(self, parent, sourceslist, datadir):
- """
- Initialize the dialog that allows to add a new source entering the
- raw apt line
- """
- self.sourceslist = sourceslist
- self.parent = parent
- self.datadir = datadir
- # gtk stuff
- self.gladexml = gtk.glade.XML("%s/glade/SoftwarePropertiesDialogs.glade" %\
- datadir)
- self.dialog = self.gladexml.get_widget("dialog_add_custom")
- self.dialog.set_transient_for(self.parent)
- self.entry = self.gladexml.get_widget("entry_source_line")
- self.button_add = self.gladexml.get_widget("button_add_source")
- self.entry.connect("changed", self.check_line)
-
- def run(self):
- res = self.dialog.run()
- self.dialog.hide()
- if res == gtk.RESPONSE_OK:
- line = self.entry.get_text() + "\n"
- else:
- line = None
- return line
-
- def check_line(self, *args):
- """
- Check for a valid apt line and set the sensitiveness of the
- button 'add' accordingly
- """
- line = self.entry.get_text() + "\n"
- source_entry = aptsources.SourceEntry(line)
- if source_entry.invalid == True or source_entry.disabled == True:
- self.button_add.set_sensitive(False)
- else:
- self.button_add.set_sensitive(True)
-
diff --git a/SoftwareProperties/dialog_add_sources_list.py b/SoftwareProperties/dialog_add_sources_list.py
deleted file mode 100644
index 509a77b2..00000000
--- a/SoftwareProperties/dialog_add_sources_list.py
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/env python
-import pygtk
-import gtk
-import gtk.glade
-import gobject
-import os
-from optparse import OptionParser
-from gettext import gettext as _
-import gettext
-import urllib
-from utils import *
-
-from UpdateManager.Common.aptsources import SourcesList, SourceEntryMatcher
-
-
-class AddSourcesList:
- def __init__(self, parent, sourceslist, source_renderer,
- get_comparable, datadir, file):
- print file
- self.parent = parent
- self.source_renderer = source_renderer
- self.sourceslist = sourceslist
- self.get_comparable = get_comparable
- self.file = self.format_uri(file)
- self.glade = gtk.glade.XML(os.path.join(datadir,
- "glade/SoftwarePropertiesDialogs.glade"))
- self.glade.signal_autoconnect(self)
- self.dialog = self.glade.get_widget("dialog_add_sources_list")
- self.label = self.glade.get_widget("label_sources")
- self.button_add = self.glade.get_widget("button_add")
- self.button_cancel = self.glade.get_widget("button_cancel")
- self.button_replace = self.glade.get_widget("button_replace")
- self.treeview = self.glade.get_widget("treeview_sources")
- self.scrolled = self.glade.get_widget("scrolled_window")
- self.image = self.glade.get_widget("image_sources_list")
-
- self.dialog.realize()
- if self.parent != None:
- self.dialog.set_transient_for(parent)
- else:
- self.dialog.set_title(_("Add Software Channels"))
- self.dialog.window.set_functions(gtk.gdk.FUNC_MOVE)
-
- # Setup the treeview
- self.store = gtk.ListStore(gobject.TYPE_STRING)
- self.treeview.set_model(self.store)
- cell = gtk.CellRendererText()
- cell.set_property("xpad", 2)
- cell.set_property("ypad", 2)
- column = gtk.TreeViewColumn("Software Channel", cell, markup=0)
- column.set_max_width(500)
- self.treeview.append_column(column)
-
- # Parse the source.list file
- try:
- self.new_sources = SingleSourcesList(self.file)
- except:
- self.error()
- return
-
- # show the found channels or an error message
- if len(self.new_sources.list) > 0:
- counter = 0
-
- for source in self.new_sources.list:
- if source.invalid or source.disabled:
- continue
- self.new_sources.matcher.match(source)
- # sort the list
- self.new_sources.list.sort(key=self.get_comparable)
-
- for source in self.new_sources.list:
- if source.invalid or source.disabled:
- continue
- counter = counter +1
- line = self.source_renderer(source)
- self.store.append([line])
- if counter == 0:
- self.error()
- return
-
- header = gettext.ngettext("Install software additionally or "
- "only from this source?",
- "Install software additionally or "
- "only from these sources?",
- counter)
- body = _("You can either add the following sources or replace your "
- "current sources by them. Only install software from "
- "trusted sources.")
- self.label.set_markup("<big><b>%s</b></big>\n\n%s" % (header, body))
- else:
- self.error()
- return
-
- def error(self):
- self.button_add.hide()
- self.button_cancel.set_use_stock(True)
- self.button_cancel.set_label("gtk-close")
- self.button_replace.hide()
- self.scrolled.hide()
- self.image.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_DIALOG)
- header = _("There are no sources to install software from")
- body = _("The file '%s' does not contain any valid "
- "software sources." % self.file)
- self.label.set_markup("<big><b>%s</b></big>\n\n%s" % (header, body))
-
- def run(self):
- res = self.dialog.run()
- self.dialog.destroy()
- return res, self.new_sources
-
- def format_uri(self, uri):
- path = urllib.url2pathname(uri) # escape special chars
- path = path.strip('\r\n\x00') # remove \r\n and NULL
- if path.startswith('file:\\\\\\'): # windows
- path = path[8:] # 8 is len('file:///')
- elif path.startswith('file://'): #nautilus, rox
- path = path[7:] # 7 is len('file://')
- elif path.startswith('file:'): # xffm
- path = path[5:] # 5 is len('file:')
- return path
-
-class SingleSourcesList(SourcesList):
- def __init__(self, file):
- self.matcher = SourceEntryMatcher("/usr/share/update-manager/channels/")
- self.list = []
- self.load(file)
diff --git a/SoftwareProperties/dialog_apt_key.py b/SoftwareProperties/dialog_apt_key.py
deleted file mode 100644
index 67aa60ce..00000000
--- a/SoftwareProperties/dialog_apt_key.py
+++ /dev/null
@@ -1,163 +0,0 @@
-# dialog_apt_key.py.in - edit the apt keys
-#
-# Copyright (c) 2004 Canonical
-#
-# Author: Michael Vogt <mvo@debian.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-import os
-import gobject
-import gtk
-import gtk.glade
-import subprocess
-import gettext
-from utils import *
-from subprocess import PIPE
-
-# gettext convenient
-_ = gettext.gettext
-def dummy(e): return e
-N_ = dummy
-
-# some known keys
-N_("Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>")
-N_("Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>")
-
-class apt_key:
- def __init__(self):
- self.gpg = ["/usr/bin/gpg"]
- self.base_opt = self.gpg + ["--no-options", "--no-default-keyring",
- "--secret-keyring", "/etc/apt/secring.gpg",
- "--trustdb-name", "/etc/apt/trustdb.gpg",
- "--keyring", "/etc/apt/trusted.gpg"]
- self.list_opt = self.base_opt + ["--with-colons", "--batch",
- "--list-keys"]
- self.rm_opt = self.base_opt + ["--quiet", "--batch",
- "--delete-key", "--yes"]
- self.add_opt = self.base_opt + ["--quiet", "--batch",
- "--import"]
-
-
- def list(self):
- res = []
- #print self.list_opt
- p = subprocess.Popen(self.list_opt,stdout=PIPE).stdout
- for line in p.readlines():
- fields = line.split(":")
- if fields[0] == "pub":
- name = fields[9]
- res.append("%s %s\n%s" %((fields[4])[-8:],fields[5], _(name)))
- return res
-
- def add(self, filename):
- #print "request to add " + filename
- cmd = self.add_opt[:]
- cmd.append(filename)
- p = subprocess.Popen(cmd)
- return (p.wait() == 0)
-
- def update(self):
- cmd = ["/usr/bin/apt-key", "update"]
- p = subprocess.Popen(cmd)
- return (p.wait() == 0)
-
- def rm(self, key):
- #print "request to remove " + key
- cmd = self.rm_opt[:]
- cmd.append(key)
- p = subprocess.Popen(cmd)
- return (p.wait() == 0)
-
-class dialog_apt_key:
- def __init__(self, parent, datadir):
- # gtk stuff
- if os.path.exists("../data/SoftwarePropertiesDialogs.glade"):
- self.gladexml = gtk.glade.XML("../data/SoftwarePropertiesDialogs.glade")
- else:
- self.gladexml = gtk.glade.XML("%s/SoftwarePropertiesDialogs.glade", datadir)
- self.main = self.gladexml.get_widget("dialog_apt_key")
- self.main.set_transient_for(parent)
-
- self.gladexml.signal_connect("on_button_key_add_clicked",
- self.on_button_key_add_clicked)
- self.gladexml.signal_connect("on_button_key_remove_clicked",
- self.on_button_key_remove_clicked)
- self.gladexml.signal_connect("on_button_apt_key_update_clicked",
- self.on_button_apt_key_update_clicked)
-
- # create apt-key object (abstraction for the apt-key command)
- self.apt_key = apt_key()
-
- # get some widgets
- self.treeview_apt_key = self.gladexml.get_widget("treeview_apt_key")
- self.liststore_apt_key = gtk.ListStore(str)
- self.treeview_apt_key.set_model(self.liststore_apt_key)
- # Create columns and append them.
- tr = gtk.CellRendererText()
- tr.set_property("xpad", 10)
- tr.set_property("ypad", 10)
- c0 = gtk.TreeViewColumn("Key", tr, text=0)
- self.treeview_apt_key.append_column(c0)
- self.update_key_list()
-
- def on_button_apt_key_update_clicked(self, widget):
- self.apt_key.update()
- self.update_key_list()
-
- def on_button_key_add_clicked(self, widget):
- chooser = gtk.FileChooserDialog(title=_("Choose a key-file"),
- parent=self.main,
- buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_REJECT,
- gtk.STOCK_OK,gtk.RESPONSE_ACCEPT))
- res = chooser.run()
- chooser.hide()
- if res == gtk.RESPONSE_ACCEPT:
- #print chooser.get_filename()
- if not self.apt_key.add(chooser.get_filename()):
- dialog_error(self.main,
- _("Error importing selected file"),
- _("The selected file may not be a GPG key file "
- "or it might be corrupt."))
- self.update_key_list()
-
- def on_button_key_remove_clicked(self, widget):
- selection = self.treeview_apt_key.get_selection()
- (model,a_iter) = selection.get_selected()
- if a_iter == None:
- return
- key = model.get_value(a_iter,0)
- if not self.apt_key.rm(key[:8]):
- error(self.main,
- _("Error removing the key"),
- _("The key you selected could not be removed. "
- "Please report this as a bug."))
- self.update_key_list()
-
- def update_key_list(self):
- self.liststore_apt_key.clear()
- for key in self.apt_key.list():
- self.liststore_apt_key.append([key])
-
- def run(self):
- res = self.main.run()
- self.main.hide()
-
-
-if __name__ == "__main__":
- ui = dialog_apt_key(None)
- ui.run()
-
diff --git a/SoftwareProperties/dialog_cache_outdated.py b/SoftwareProperties/dialog_cache_outdated.py
deleted file mode 100644
index de85cc2e..00000000
--- a/SoftwareProperties/dialog_cache_outdated.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# dialog_cache_outdated.py - inform the user to update the apt cache
-#
-# Copyright (c) 2006 Canonical
-#
-# Authors:
-# Sebastian Heinlein <sebastian.heinlein@web.de>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-import os
-import subprocess
-import thread
-import time
-import gobject
-import gtk
-import gtk.glade
-import apt_pkg
-
-class DialogCacheOutdated:
- def __init__(self, parent, datadir):
- """setup up the gtk dialog"""
- self.parent = parent
-
- if os.path.exists("../data/SoftwarePropertiesDialogs.glade"):
- self.gladexml = gtk.glade.XML("../data/SoftwarePropertiesDialogs.glade")
- else:
- self.gladexml = gtk.glade.XML("%s/glade/SoftwarePropertiesDialogs.glade" % datadir)
- self.dialog = self.gladexml.get_widget("dialog_cache_outofdate")
- self.dialog.set_transient_for(parent)
-
- def update_cache(self, window_id, lock):
- """start synaptic to update the package cache"""
- try:
- apt_pkg.PkgSystemUnLock()
- except SystemError:
- pass
- cmd = ["/usr/sbin/synaptic", "--hide-main-window",
- "--non-interactive",
- "--parent-window-id", "%s" % (window_id),
- "--update-at-startup"]
- subprocess.call(cmd)
- lock.release()
-
- def run(self):
- """run the dialog, and if reload was pressed run synaptic"""
- res = self.dialog.run()
- self.dialog.hide()
- if res == gtk.RESPONSE_APPLY:
- self.parent.set_sensitive(False)
- lock = thread.allocate_lock()
- lock.acquire()
- t = thread.start_new_thread(self.update_cache,
- (self.parent.window.xid, lock))
- while lock.locked():
- while gtk.events_pending():
- gtk.main_iteration()
- time.sleep(0.05)
- self.parent.set_sensitive(True)
- return res
diff --git a/SoftwareProperties/dialog_edit.py b/SoftwareProperties/dialog_edit.py
deleted file mode 100644
index 0eedd3b8..00000000
--- a/SoftwareProperties/dialog_edit.py
+++ /dev/null
@@ -1,139 +0,0 @@
-# dialog_edit.py.in - edit a existing repository
-#
-# Copyright (c) 2004-2005 Canonical
-# 2005 Michiel Sikkes
-#
-# Authors:
-# Michael Vogt <mvo@debian.org>
-# Michiel Sikkes <michiels@gnome.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-import os
-import gobject
-import gtk
-import gtk.glade
-
-import UpdateManager.Common.aptsources as aptsources
-
-class dialog_edit:
- def __init__(self, parent, sourceslist, source_entry, datadir):
- self.sourceslist = sourceslist
- self.source_entry = source_entry
-
- # gtk stuff
- if os.path.exists("../data/SoftwarePropertiesDialogs.glade"):
- self.gladexml = gtk.glade.XML("../data/SoftwarePropertiesDialogs.glade")
- else:
- self.gladexml = gtk.glade.XML("%s/glade/SoftwarePropertiesDialogs.glade" % datadir)
- self.main = self.gladexml.get_widget("dialog_edit")
- self.main.set_transient_for(parent)
- self.button_edit_ok = self.gladexml.get_widget("button_edit_ok")
-
- # type
- combo_type = self.gladexml.get_widget("combobox_type")
- if source_entry.type == "deb":
- combo_type.set_active(0)
- elif source_entry.type == "deb-src":
- combo_type.set_active(1)
- else:
- print "Error, unknown source type: '%s'" % source_enrty.type
-
- # uri
- entry = self.gladexml.get_widget("entry_uri")
- entry.set_text(source_entry.uri)
-
- entry = self.gladexml.get_widget("entry_dist")
- entry.set_text(source_entry.dist)
-
- entry = self.gladexml.get_widget("entry_comps")
- comps = ""
- for c in source_entry.comps:
- if len(comps) > 0:
- comps = comps + " " + c
- else:
- comps = c
- entry.set_text(comps)
-
- entry = self.gladexml.get_widget("entry_comment")
- entry.set_text(source_entry.comment)
-
- # finally set the signal so that the check function is not tiggered
- # during initialisation
- self.gladexml.signal_connect("on_entry_source_line_changed",
- self.check_line)
-
- def check_line(self, *args):
- """Check for a valid apt line and set the sensitiveness of the
- button 'add' accordingly"""
- line = self.get_line()
- if line == False:
- self.button_edit_ok.set_sensitive(False)
- return
- source_entry = aptsources.SourceEntry(line)
- if (source_entry.invalid == True or source_entry.disabled == True):
- self.button_edit_ok.set_sensitive(False)
- else:
- self.button_edit_ok.set_sensitive(True)
-
- def get_line(self):
- """Collect all values from the entries and create an apt line"""
- combo_type = self.gladexml.get_widget("combobox_type")
- if combo_type.get_active() == 0:
- line = "deb"
- else:
- line = "deb-src"
-
- entry = self.gladexml.get_widget("entry_uri")
- text = entry.get_text()
- if len(text) < 1 or text.find(" ") != -1 or text.find("#") != -1:
- return False
- line = line + " " + entry.get_text()
-
- entry = self.gladexml.get_widget("entry_dist")
- text = entry.get_text()
- if len(text) < 1 or text.find(" ") != -1 or text.find("#") != -1:
- return False
- line = line + " " + entry.get_text()
-
- entry = self.gladexml.get_widget("entry_comps")
- text = entry.get_text()
- if len(text) < 1 or text.find("#") != -1:
- return False
- line = line + " " + entry.get_text()
-
- entry = self.gladexml.get_widget("entry_comment")
- if entry.get_text() != "":
- line = line + " #" + entry.get_text() + "\n"
- else:
- line = line + "\n"
- return line
-
- def run(self):
- res = self.main.run()
- if res == gtk.RESPONSE_OK:
- line = self.get_line()
-
- # change repository
- index = self.sourceslist.list.index(self.source_entry)
- file = self.sourceslist.list[index].file
- self.sourceslist.list[index] = aptsources.SourceEntry(line,file)
- #self.sourceslist.add(self.selected.type,
- # self.selected.uri,
- # self.selected.dist,
- # self.selected_comps)
- self.main.hide()
- return res
diff --git a/SoftwareProperties/utils.py b/SoftwareProperties/utils.py
deleted file mode 100644
index cf9a3343..00000000
--- a/SoftwareProperties/utils.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import gtk
-
-def dialog_error(parent, primary, secondary):
- p = "<span weight=\"bold\" size=\"larger\">%s</span>" % primary
- dialog = gtk.MessageDialog(parent,gtk.DIALOG_MODAL,
- gtk.MESSAGE_ERROR,gtk.BUTTONS_OK,"")
- dialog.set_markup(p);
- dialog.format_secondary_text(secondary);
- dialog.run()
- dialog.hide()