/[gli]/branches/overhaul/src/fe/gtk/PortageTree.py
Gentoo

Contents of /branches/overhaul/src/fe/gtk/PortageTree.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1691 - (show annotations) (download) (as text)
Mon Feb 12 07:05:56 2007 UTC (7 years, 8 months ago) by agaffney
File MIME type: text/x-python
File size: 7806 byte(s)
change padding to line up options
1 # Copyright 1999-2005 Gentoo Foundation
2 # This source code is distributed under the terms of version 2 of the GNU
3 # General Public License as published by the Free Software Foundation, a copy
4 # of which can be found in the main directory of this project.
5
6 import gtk
7 from GLIScreen import *
8 import GLIUtility
9 import URIBrowser
10 from ProgressDialog import *
11
12 class Panel(GLIScreen):
13
14 title = "Portage Tree"
15 active_selection = None
16 radio_syncs = {}
17 _helptext = """
18 <b><u>Portage Tree</u></b>
19
20 Portage is probably Gentoo's most notable innovation in software management.
21 When we talk about packages, we often mean software titles that are available
22 to the Gentoo users through the Portage tree. The Portage tree is a collection
23 of ebuilds, files that contain all information Portage needs to maintain
24 software (install, search, query, ...). These ebuilds reside in /usr/portage by
25 default.
26
27 Whenever you ask Portage to perform some action regarding software titles, it
28 will use the ebuilds on your system as a base. It is therefore important that
29 you regularly update the ebuilds on your system so Portage knows about new
30 software, security updates, etc.
31
32 There are several ways of obtaining an initial Portage tree.
33
34 Normal: This is the normal method of downloading and syncing the Portage tree
35 from the Internet. It will give you the most up-to-date tree.
36
37 Webrsync: This is similar to Normal. It will download via http a dialy Portage
38 snapshot and sync that.
39
40 Snapshot: This is if you have a specially-built portage snapshot you want to use
41 or if you want to use the copy on the Livecd to save downloading the tree
42 (useful for those on dial-up). This is the least up-to-date way to get an
43 initial Portage tree. It is necessary to choose the Livecd snapshot if you are
44 doing a Dynamic or GRP install.
45 """
46
47 def __init__(self, controller):
48 GLIScreen.__init__(self, controller)
49 vert = gtk.VBox(False, 0)
50 vert.set_border_width(10)
51
52 if self.controller.install_profile.get_dynamic_stage3():
53 hbox = gtk.HBox(False, 0)
54 label = gtk.Label()
55 label_markup = '<b>Your portage tree will be extracted from the release snapshot included on the LiveCD.</b>'
56 label.set_markup(label_markup)
57 label.set_line_wrap(True)
58 hbox.pack_start(label, expand=False, fill=False, padding=5)
59 vert.pack_start(hbox, expand=False, fill=False, padding=10)
60 else:
61 hbox = gtk.HBox(False)
62 label = gtk.Label()
63 label.set_markup('<b>Choose your portage tree sync method</b>')
64 hbox.pack_start(label, expand=False, fill=False, padding=0)
65 vert.pack_start(hbox, expand=False, fill=False, padding=20)
66
67 hbox = gtk.HBox(False, 0)
68 self.radio_syncs['sync'] = gtk.RadioButton(None, "Normal")
69 self.radio_syncs['sync'].set_name("sync")
70 self.radio_syncs['sync'].connect("toggled", self.sync_selected, "sync")
71 hbox.pack_start(self.radio_syncs['sync'], expand=False, fill=False, padding=20)
72 vert.pack_start(hbox, expand=False, fill=False, padding=20)
73
74 hbox = gtk.HBox(False, 0)
75 self.radio_syncs['webrsync'] = gtk.RadioButton(self.radio_syncs['sync'], "Webrsync")
76 self.radio_syncs['webrsync'].set_name("webrsync")
77 self.radio_syncs['webrsync'].connect("toggled", self.sync_selected, "webrsync")
78 hbox.pack_start(self.radio_syncs['webrsync'], expand=False, fill=False, padding=20)
79 vert.pack_start(hbox, expand=False, fill=True, padding=20)
80
81 hbox = gtk.HBox(False, 0)
82 self.radio_syncs['snapshot'] = gtk.RadioButton(self.radio_syncs['sync'], "Snapshot")
83 self.radio_syncs['snapshot'].set_name("snapshot")
84 self.radio_syncs['snapshot'].connect("toggled", self.sync_selected, "snapshot")
85 hbox.pack_start(self.radio_syncs['snapshot'], expand=False, fill=False, padding=20)
86 vert.pack_start(hbox, expand=False, fill=True, padding=20)
87
88 hbox = gtk.HBox(False, 0)
89 hbox.pack_start(gtk.Label(" "), expand=False, fill=False, padding=15)
90 hbox.pack_start(gtk.Label("URI:"), expand=False, fill=False, padding=5)
91 self.entry_portage_snapshot_uri = gtk.Entry()
92 self.entry_portage_snapshot_uri.set_width_chars(50)
93 self.entry_portage_snapshot_uri.set_sensitive(False)
94 hbox.pack_start(self.entry_portage_snapshot_uri, expand=False, fill=False, padding=0)
95 self.browse_uri = gtk.Button("Browse")
96 self.browse_uri.connect("clicked", self.browse_uri_clicked)
97 self.browse_uri.set_sensitive(False)
98 hbox.pack_start(self.browse_uri, expand=False, fill=False, padding=5)
99 vert.pack_start(hbox, expand=False, fill=False, padding=0)
100
101 hbox = gtk.HBox(False, 0)
102 self.radio_syncs['none'] = gtk.RadioButton(self.radio_syncs['sync'], "None")
103 self.radio_syncs['none'].set_name("none")
104 self.radio_syncs['none'].connect("toggled", self.sync_selected, "none")
105 hbox.pack_start(self.radio_syncs['none'], expand=False, fill=False, padding=20)
106 vert.pack_start(hbox, expand=False, fill=True, padding=40)
107
108 self.add_content(vert)
109
110 def browse_uri_clicked(self, widget):
111 uribrowser = URIBrowser.URIBrowser(self, self.entry_portage_snapshot_uri)
112 uribrowser.run(self.entry_portage_snapshot_uri.get_text())
113
114 def sync_selected(self, widget, data=None):
115 self.active_selection = data
116 if data == "snapshot":
117 self.entry_portage_snapshot_uri.set_sensitive(True)
118 self.browse_uri.set_sensitive(True)
119 else:
120 self.entry_portage_snapshot_uri.set_sensitive(False)
121 self.browse_uri.set_sensitive(False)
122
123 def activate(self):
124 self.controller.SHOW_BUTTON_BACK = True
125 self.controller.SHOW_BUTTON_FORWARD = True
126 if not self.controller.install_profile.get_dynamic_stage3():
127 # for radio in self.radio_syncs:
128 # self.radio_syncs[radio].set_sensitive(True)
129 # self.entry_portage_snapshot_uri.set_sensitive(True)
130 # self.browse_uri.set_sensitive(True)
131 self.active_selection = self.controller.install_profile.get_portage_tree_sync_type() or "sync"
132 self.radio_syncs[self.active_selection].set_active(True)
133 self.sync_selected(self.radio_syncs[self.active_selection], self.active_selection)
134 self.entry_portage_snapshot_uri.set_text(self.controller.install_profile.get_portage_tree_snapshot_uri())
135 if not self.entry_portage_snapshot_uri.get_text():
136 self.entry_portage_snapshot_uri.set_text(GLIUtility.get_cd_snapshot_uri())
137
138 def next(self):
139 if self.controller.install_profile.get_dynamic_stage3():
140 self.controller.install_profile.set_portage_tree_snapshot_uri(GLIUtility.get_cd_snapshot_uri())
141 self.controller.install_profile.set_portage_tree_sync_type(None, "snapshot", None)
142 else:
143 if self.active_selection == "snapshot":
144 if not self.entry_portage_snapshot_uri.get_text():
145 msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format="You did not enter a portage snapshot URI. You cannot continue until you enter a snapshot URI or choose a different sync method.")
146 msgdlg.run()
147 msgdlg.destroy()
148 return
149 elif not GLIUtility.validate_uri(self.entry_portage_snapshot_uri.get_text()):
150 msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format="The portage snapshot URI you entered does not exist or is not a valid URI. You cannot continue unless you enter a valid URI or choose another sync method.")
151 msgdlg.run()
152 msgdlg.destroy()
153 return
154 self.controller.install_profile.set_portage_tree_sync_type(None, self.active_selection, None)
155 self.controller.install_profile.set_portage_tree_snapshot_uri(None, self.entry_portage_snapshot_uri.get_text(), None)
156 progress = ProgressDialog(self.controller, ("install_portage_tree", ), self.progress_callback)
157 progress.run()
158
159 def progress_callback(self, result, data=None):
160 if result == PROGRESS_DONE:
161 self.controller.load_screen("Kernel")
162 else:
163 GLIScreen.progress_callback(self, result, data)

Properties

Name Value
svn:eol-style native

  ViewVC Help
Powered by ViewVC 1.1.20