1
# dialog_edit.py.in - edit a existing repository
3
# Copyright (c) 2004 Canonical
5
# Author: Michael Vogt <mvo@debian.org>
7
# This program is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU General Public License as
9
# published by the Free Software Foundation; either version 2 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
30
def __init__(self,parent,sourceslist,source_entry):
31
self.sourceslist = sourceslist
32
self.source_entry = source_entry
35
if os.path.exists("../data/gnome-software-properties.glade"):
36
self.gladexml = gtk.glade.XML("../data/gnome-software-properties.glade")
38
self.gladexml = gtk.glade.XML("@prefix@/share/update-manager/gnome-software-properties.glade")
39
self.main = self.gladexml.get_widget("dialog_edit")
40
self.main.set_transient_for(parent)
43
combo_type = self.gladexml.get_widget("combobox_type")
44
if source_entry.type == "deb":
45
combo_type.set_active(0)
46
elif source_entry.type == "deb-src":
47
combo_type.set_active(1)
49
print "Error, unknown source type: '%s'" % source_enrty.type
52
entry = self.gladexml.get_widget("entry_uri")
53
entry.set_text(source_entry.uri)
55
entry = self.gladexml.get_widget("entry_dist")
56
entry.set_text(source_entry.dist)
58
entry = self.gladexml.get_widget("entry_comps")
60
for c in source_entry.comps:
62
comps = comps + " " + c
67
entry = self.gladexml.get_widget("entry_comment")
68
entry.set_text(source_entry.comment)
72
if res == gtk.RESPONSE_OK:
74
combo_type = self.gladexml.get_widget("combobox_type")
75
if combo_type.get_active() == 0:
79
entry = self.gladexml.get_widget("entry_uri")
80
line = line + " " + entry.get_text()
82
entry = self.gladexml.get_widget("entry_dist")
83
line = line + " " + entry.get_text()
85
entry = self.gladexml.get_widget("entry_comps")
86
line = line + " " + entry.get_text()
88
entry = self.gladexml.get_widget("entry_comment")
89
if entry.get_text() != "":
90
line = line + " #" + entry.get_text() + "\n"
95
index = self.sourceslist.list.index(self.source_entry)
96
self.sourceslist.list[index] = aptsources.SourceEntry(line)
97
#self.sourceslist.add(self.selected.type,
100
# self.selected_comps)