1
# dialog_edit.py.in - edit a existing repository
3
# Copyright (c) 2004 Canonical
7
# Michael Vogt <mvo@debian.org>
8
# Michiel Sikkes <michiels@gnome.org>
10
# This program is free software; you can redistribute it and/or
11
# modify it under the terms of the GNU General Public License as
12
# published by the Free Software Foundation; either version 2 of the
13
# License, or (at your option) any later version.
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU General Public License for more details.
20
# You should have received a copy of the GNU General Public License
21
# along with this program; if not, write to the Free Software
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
33
def __init__(self, parent, sourceslist, source_entry, datadir):
34
self.sourceslist = sourceslist
35
self.source_entry = source_entry
38
if os.path.exists("../data/SoftwarePropertiesDialogs.glade"):
39
self.gladexml = gtk.glade.XML("../data/SoftwarePropertiesDialogs.glade")
41
self.gladexml = gtk.glade.XML("%s/SoftwarePropertiesDialogs.glade" % datadir)
42
self.main = self.gladexml.get_widget("dialog_edit")
43
self.main.set_transient_for(parent)
46
combo_type = self.gladexml.get_widget("combobox_type")
47
if source_entry.type == "deb":
48
combo_type.set_active(0)
49
elif source_entry.type == "deb-src":
50
combo_type.set_active(1)
52
print "Error, unknown source type: '%s'" % source_enrty.type
55
entry = self.gladexml.get_widget("entry_uri")
56
entry.set_text(source_entry.uri)
58
entry = self.gladexml.get_widget("entry_dist")
59
entry.set_text(source_entry.dist)
61
entry = self.gladexml.get_widget("entry_comps")
63
for c in source_entry.comps:
65
comps = comps + " " + c
70
entry = self.gladexml.get_widget("entry_comment")
71
entry.set_text(source_entry.comment)
75
if res == gtk.RESPONSE_OK:
77
combo_type = self.gladexml.get_widget("combobox_type")
78
if combo_type.get_active() == 0:
82
entry = self.gladexml.get_widget("entry_uri")
83
line = line + " " + entry.get_text()
85
entry = self.gladexml.get_widget("entry_dist")
86
line = line + " " + entry.get_text()
88
entry = self.gladexml.get_widget("entry_comps")
89
line = line + " " + entry.get_text()
91
entry = self.gladexml.get_widget("entry_comment")
92
if entry.get_text() != "":
93
line = line + " #" + entry.get_text() + "\n"
98
index = self.sourceslist.list.index(self.source_entry)
99
file = self.sourceslist.list[index].file
100
self.sourceslist.list[index] = aptsources.SourceEntry(line,file)
101
#self.sourceslist.add(self.selected.type,
103
# self.selected.dist,
104
# self.selected_comps)