/[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 1623 - (show annotations) (download) (as text)
Fri Jan 19 10:19:38 2007 UTC (7 years, 11 months ago) by agaffney
File MIME type: text/x-python
File size: 8366 byte(s)
remove Help button
rearrange Stage screen
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 import GLIScreen
8 import GLIUtility
9 import URIBrowser
10
11 class Panel(GLIScreen.GLIScreen):
12
13 title = "Portage Tree"
14 active_selection = None
15 radio_syncs = {}
16 _helptext = """
17 <b><u>Portage Tree</u></b>
18
19 Portage is probably Gentoo's most notable innovation in software management.
20 When we talk about packages, we often mean software titles that are available
21 to the Gentoo users through the Portage tree. The Portage tree is a collection
22 of ebuilds, files that contain all information Portage needs to maintain
23 software (install, search, query, ...). These ebuilds reside in /usr/portage by
24 default.
25
26 Whenever you ask Portage to perform some action regarding software titles, it
27 will use the ebuilds on your system as a base. It is therefore important that
28 you regularly update the ebuilds on your system so Portage knows about new
29 software, security updates, etc.
30
31 There are several ways of obtaining an initial Portage tree.
32
33 Normal: This is the normal method of downloading and syncing the Portage tree
34 from the Internet. It will give you the most up-to-date tree.
35
36 Webrsync: This is similar to Normal. It will download via http a dialy Portage
37 snapshot and sync that.
38
39 Snapshot: This is if you have a specially-built portage snapshot you want to use
40 or if you want to use the copy on the Livecd to save downloading the tree
41 (useful for those on dial-up). This is the least up-to-date way to get an
42 initial Portage tree. It is necessary to choose the Livecd snapshot if you are
43 doing a Dynamic or GRP install.
44 """
45
46 def __init__(self, controller):
47 GLIScreen.GLIScreen.__init__(self, controller)
48 vert = gtk.VBox(False, 0)
49 vert.set_border_width(10)
50
51 content_str = """Here, you will select how you would like to obtain a portage tree. Each option has
52 a brief description beside it.
53 """
54 content_label = gtk.Label(content_str)
55 vert.pack_start(content_label, expand=False, fill=False, padding=0)
56 self.radio_syncs['sync'] = gtk.RadioButton(None, "Normal")
57 self.radio_syncs['sync'].set_name("sync")
58 self.radio_syncs['sync'].connect("toggled", self.stage_selected, "sync")
59 self.radio_syncs['sync'].set_size_request(100, -1)
60 # self.radio_syncs['sync'].set_sensitive(False) # temporary
61 hbox = gtk.HBox(False, 0)
62 hbox.pack_start(self.radio_syncs['sync'], expand=False, fill=False, padding=5)
63 tmplabel = gtk.Label("This will run 'emerge sync' to get a local copy of the portage tree")
64 tmplabel.set_line_wrap(True)
65 hbox.pack_start(tmplabel, expand=False, fill=False, padding=20)
66 vert.pack_start(hbox, expand=False, fill=False, padding=15)
67 self.radio_syncs['webrsync'] = gtk.RadioButton(self.radio_syncs['sync'], "Webrsync")
68 self.radio_syncs['webrsync'].set_name("webrsync")
69 self.radio_syncs['webrsync'].connect("toggled", self.stage_selected, "webrsync")
70 self.radio_syncs['webrsync'].set_size_request(100, -1)
71 hbox = gtk.HBox(False, 0)
72 hbox.pack_start(self.radio_syncs['webrsync'], expand=False, fill=False, padding=5)
73 tmplabel = gtk.Label("This will download a portage snapshot from a Gentoo mirror and sync it locally. Use this option if you are behind a restrictive firewall that blocks outgoing rsync traffic")
74 tmplabel.set_line_wrap(True)
75 hbox.pack_start(tmplabel, expand=False, fill=False, padding=20)
76 vert.pack_start(hbox, expand=False, fill=False, padding=15)
77 self.radio_syncs['snapshot'] = gtk.RadioButton(self.radio_syncs['sync'], "Snapshot")
78 self.radio_syncs['snapshot'].set_name("snapshot")
79 self.radio_syncs['snapshot'].connect("toggled", self.stage_selected, "snapshot")
80 self.radio_syncs['snapshot'].set_size_request(100, -1)
81 hbox = gtk.HBox(False, 0)
82 hbox.pack_start(self.radio_syncs['snapshot'], expand=False, fill=False, padding=5)
83 tmplabel = gtk.Label("Use this option to if you have a portage snapshot. You will need to enter the URI below")
84 tmplabel.set_line_wrap(True)
85 hbox.pack_start(tmplabel, expand=False, fill=False, padding=20)
86 vert.pack_start(hbox, expand=False, fill=False, padding=15)
87 self.radio_syncs['none'] = gtk.RadioButton(self.radio_syncs['sync'], "None")
88 self.radio_syncs['none'].set_name("none")
89 self.radio_syncs['none'].connect("toggled", self.stage_selected, "none")
90 self.radio_syncs['none'].set_size_request(100, -1)
91 hbox = gtk.HBox(False, 0)
92 hbox.pack_start(self.radio_syncs['none'], expand=False, fill=False, padding=5)
93 tmplabel = gtk.Label("This option leaves /usr/portage untouched. Use this if you are NFS mounting the tree.")
94 tmplabel.set_line_wrap(True)
95 hbox.pack_start(tmplabel, expand=False, fill=False, padding=20)
96 vert.pack_start(hbox, expand=False, fill=False, padding=15)
97
98 hbox = gtk.HBox(False, 0)
99 hbox.pack_start(gtk.Label("Portage snapshot URI:"), expand=False, fill=False, padding=5)
100 self.entry_portage_snapshot_uri = gtk.Entry()
101 self.entry_portage_snapshot_uri.set_width_chars(50)
102 self.entry_portage_snapshot_uri.set_sensitive(False)
103 hbox.pack_start(self.entry_portage_snapshot_uri, expand=False, fill=False, padding=10)
104 self.browse_uri = gtk.Button(" ... ")
105 self.browse_uri.connect("clicked", self.browse_uri_clicked)
106 self.browse_uri.set_sensitive(False)
107 hbox.pack_start(self.browse_uri, expand=False, fill=False, padding=5)
108 vert.pack_end(hbox, expand=False, fill=False, padding=0)
109
110 self.add_content(vert)
111
112 def browse_uri_clicked(self, widget):
113 uribrowser = URIBrowser.URIBrowser(self, self.entry_portage_snapshot_uri)
114 uribrowser.run(self.entry_portage_snapshot_uri.get_text())
115
116 def stage_selected(self, widget, data=None):
117 self.active_selection = data
118 if data == "snapshot":
119 self.entry_portage_snapshot_uri.set_sensitive(True)
120 self.browse_uri.set_sensitive(True)
121 else:
122 self.entry_portage_snapshot_uri.set_sensitive(False)
123 self.browse_uri.set_sensitive(False)
124
125 def activate(self):
126 self.controller.SHOW_BUTTON_EXIT = True
127 # self.controller.SHOW_BUTTON_HELP = True
128 self.controller.SHOW_BUTTON_BACK = True
129 self.controller.SHOW_BUTTON_FORWARD = True
130 self.controller.SHOW_BUTTON_FINISH = False
131 if self.controller.install_profile.get_dynamic_stage3():
132 self.entry_portage_snapshot_uri.set_text(GLIUtility.get_cd_snapshot_uri())
133 self.radio_syncs["snapshot"].set_active(True)
134 self.active_selection = "snapshot"
135 for radio in self.radio_syncs:
136 self.radio_syncs[radio].set_sensitive(False)
137 self.entry_portage_snapshot_uri.set_sensitive(False)
138 self.browse_uri.set_sensitive(False)
139 else:
140 for radio in self.radio_syncs:
141 self.radio_syncs[radio].set_sensitive(True)
142 self.entry_portage_snapshot_uri.set_sensitive(True)
143 self.browse_uri.set_sensitive(True)
144 self.active_selection = self.controller.install_profile.get_portage_tree_sync_type() or "sync"
145 self.radio_syncs[self.active_selection].set_active(True)
146 self.stage_selected(self.radio_syncs[self.active_selection], self.active_selection)
147 self.entry_portage_snapshot_uri.set_text(self.controller.install_profile.get_portage_tree_snapshot_uri())
148 if not self.entry_portage_snapshot_uri.get_text():
149 self.entry_portage_snapshot_uri.set_text(GLIUtility.get_cd_snapshot_uri())
150
151 def deactivate(self):
152 if self.active_selection == "snapshot":
153 if not self.entry_portage_snapshot_uri.get_text():
154 msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_YES_NO, message_format="You did not enter a portage snapshot URI. Continue?")
155 resp = msgdlg.run()
156 msgdlg.destroy()
157 if resp == gtk.RESPONSE_NO:
158 return False
159 elif not GLIUtility.validate_uri(self.entry_portage_snapshot_uri.get_text()):
160 msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_YES_NO, message_format="The portage snapshot URI you entered does not exist. Continue?")
161 resp = msgdlg.run()
162 msgdlg.destroy()
163 if resp == gtk.RESPONSE_NO:
164 return False
165 self.controller.install_profile.set_portage_tree_sync_type(None, self.active_selection, None)
166 try: self.controller.install_profile.set_portage_tree_snapshot_uri(None, self.entry_portage_snapshot_uri.get_text(), None)
167 except: pass
168 return True

Properties

Name Value
svn:eol-style native

  ViewVC Help
Powered by ViewVC 1.1.20