diff options
| author | Sebastian Heinlein <sebastian.heinlein@web.de> | 2006-03-10 18:00:16 +0100 |
|---|---|---|
| committer | Sebastian Heinlein <sebastian.heinlein@web.de> | 2006-03-10 18:00:16 +0100 |
| commit | cfcbc7905a2c296fa4da1cb7345cebb44f80fdb1 (patch) | |
| tree | 672da010293c26d252eb939a8d180cf569a16df4 /SoftwareProperties | |
| parent | ecf47b2870eb77302aceb82644109bd183587dc0 (diff) | |
| download | python-apt-cfcbc7905a2c296fa4da1cb7345cebb44f80fdb1.tar.gz | |
* remove the dialog_sources_list: it's not part of the dapper release
* set the msgid report address to me - since most of the string errors are
done by me. :)
* update the language files
* start working on the german translation
* use a shorter desc in the desktop file
Diffstat (limited to 'SoftwareProperties')
| -rw-r--r-- | SoftwareProperties/dialog_sources_list.py | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/SoftwareProperties/dialog_sources_list.py b/SoftwareProperties/dialog_sources_list.py deleted file mode 100644 index d35b9b51..00000000 --- a/SoftwareProperties/dialog_sources_list.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python -import pygtk -import gtk -import gtk.glade -import gobject -import os -from optparse import OptionParser -from aptsources import SourcesList, SourceEntryMatcher -from gettext import gettext as _ -import gettext -import urllib -from utils import * - -class AddSourcesList: - def __init__(self, parent, sourceslist, source_renderer, datadir, file): - print file - self.parent = parent - self.source_renderer = source_renderer - self.sources_old = sourceslist - 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_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.treeview = self.glade.get_widget("treeview_sources") - self.button_close = self.glade.get_widget("button_close") - 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.sources = SingleSourcesList(self.file) - except: - self.error() - return - - # show the found channels or an error message - if len(self.sources.list) > 0: - self.button_close.hide() - counter = 0 - for source in self.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("Add the following software channel?", - "Add the following software channels?", - counter) - body = _("You can install software from a channel. Use "\ - "trusted channels, only.") - self.label.set_markup("<big><b>%s</b></big>\n\n%s" % (header, body)) - self.button_add.set_use_underline(True) - self.button_add.set_label(gettext.ngettext("_Add Channel", - "_Add Channels", - counter)) - else: - self.error() - return - - def error(self): - self.button_add.hide() - self.button_cancel.hide() - self.scrolled.hide() - self.button_close.show() - self.image.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_DIALOG) - header = _("Could not add any software channels") - body = _("The file '%s' does not contain any valid " - "software channels." % self.file) - self.label.set_markup("<big><b>%s</b></big>\n\n%s" % (header, body)) - - def run(self): - res = self.dialog.run() - if res == gtk.RESPONSE_OK: - for source in self.sources: - self.sources_old.add(source.type, - source.uri, - source.dist, - source.comps, - source.comment) - self.dialog.destroy() - return res - - 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() - self.list = [] - self.load(file) |
