Gentoo Archives: gentoo-commits

From: Wiktor W Brodlo <wiktor@××××××.net>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/anaconda:master commit in: /, ui/, iw/
Date: Mon, 04 Jul 2011 12:34:21
Message-Id: 5945d5ebc8f4977d94c5e848e15984de29013c84.wiktor@gentoo
1 commit: 5945d5ebc8f4977d94c5e848e15984de29013c84
2 Author: wiktor w brodlo <wiktor <AT> brodlo <DOT> net>
3 AuthorDate: Mon Jul 4 12:33:50 2011 +0000
4 Commit: Wiktor W Brodlo <wiktor <AT> brodlo <DOT> net>
5 CommitDate: Mon Jul 4 12:33:50 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/anaconda.git;a=commit;h=5945d5eb
7
8 First version of USE flag selection screen
9
10 ---
11 dispatch.py | 2 +-
12 gui.py | 1 +
13 installclass.py | 1 +
14 iw/use_gui.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 ui/use.glade | 51 +++++++++++++++++++++++++++-----------
16 5 files changed, 112 insertions(+), 16 deletions(-)
17
18 diff --git a/dispatch.py b/dispatch.py
19 index 55064ea..ff469d9 100644
20 --- a/dispatch.py
21 +++ b/dispatch.py
22 @@ -99,7 +99,7 @@ installSteps = [
23 ("mirrorselect", ),
24 ("mirrorselect-sync", ),
25 ("profile", ),
26 - # use
27 + ("use", ),
28
29 # Configuring the Kernel
30 ("timezone", ),
31
32 diff --git a/gui.py b/gui.py
33 index 8c9bf17..0a5b161 100755
34 --- a/gui.py
35 +++ b/gui.py
36 @@ -83,6 +83,7 @@ stepToClass = {
37 "mirrorselect": ("mirrorselect_gui", "MirrorselectWindow"),
38 "mirrorselect-sync": ("mirrorselect-sync_gui", "MirrorselectSyncWindow"),
39 "profile": ("profile_gui", "ProfileWindow"),
40 + "use": ("use_gui", "UseWindow"),
41
42 # Configuring the Kernel
43 "timezone" : ("timezone_gui", "TimezoneWindow"),
44
45 diff --git a/installclass.py b/installclass.py
46 index 5db02f2..fe39e3a 100644
47 --- a/installclass.py
48 +++ b/installclass.py
49 @@ -106,6 +106,7 @@ class BaseInstallClass(object):
50 "mirrorselect",
51 "mirrorselect-sync",
52 "profile",
53 + "use",
54
55 # Configuring the Kernel
56 "timezone",
57
58 diff --git a/iw/use_gui.py b/iw/use_gui.py
59 new file mode 100644
60 index 0000000..1004686
61 --- /dev/null
62 +++ b/iw/use_gui.py
63 @@ -0,0 +1,73 @@
64 +#
65 +#use_gui.py: gui USE flags selection.
66 +#
67 +# Copyright (C) 2011 wiktor w brodlo
68 +# Copyright (C) 2011 Gentoo Foundation
69 +#
70 +# This program is free software; you can redistribute it and/or modify
71 +# it under the terms of the GNU General Public License as published by
72 +# the Free Software Foundation; either version 2 of the License, or
73 +# (at your option) any later version.
74 +#
75 +# This program is distributed in the hope that it will be useful,
76 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
77 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78 +# GNU General Public License for more details.
79 +#
80 +# You should have received a copy of the GNU General Public License
81 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
82 +#
83 +
84 +import string
85 +import gtk
86 +import gtk.glade
87 +import gtk.gdk
88 +import gobject
89 +import pango
90 +import sys
91 +import gui
92 +import subprocess
93 +
94 +from iw_gui import *
95 +
96 +from constants import *
97 +import gettext
98 +_ = lambda x: gettext.ldgettext("anaconda", x)
99 +
100 +class UseWindow(InstallWindow):
101 + def getNext(self):
102 + return None
103 +
104 + def getScreen(self, anaconda):
105 + self.anaconda = anaconda
106 + self.intf = anaconda.intf
107 +
108 + (self.xml, self.align) = gui.getGladeWidget("use.glade", "use_align")
109 +
110 + usef = open("/usr/portage/profiles/use.desc")
111 + lines = usef.read().split("\n")
112 +
113 + use = {}
114 + use_list = [] # Keep them sorted
115 + for line in lines:
116 + comment = re.search("#", line)
117 + if comment:
118 + # Truncate the line where the comment starts
119 + line = line[:comment.start()]
120 + s = line.split(" - ")
121 + if s[0] and s[1]:
122 + use[s[0]] = s[1]
123 + use.append(s[0])
124 +
125 + table = self.xml.get_widget("use_table")
126 +
127 + for flag in use_list:
128 + cols = table.get_property("n-columns")
129 + rows = table.get_property("n-rows")
130 + table.resize(rows+1, cols)
131 +
132 + table.attach(gtk.CheckButton(label=flag), 0, 1, rows, rows+1, gtk.FILL)
133 + table.attach(gtk.Label(use[flag]), 1, 2, rows, rows+1)
134 +
135 + return self.align
136 +
137
138 diff --git a/ui/use.glade b/ui/use.glade
139 index d74d401..7ad672d 100644
140 --- a/ui/use.glade
141 +++ b/ui/use.glade
142 @@ -19,11 +19,20 @@
143 <child>
144 <widget class="GtkLabel" id="label1">
145 <property name="visible">True</property>
146 - <property name="label" translatable="yes">USE is one of the most powerful variables Gentoo provides to its users. Several programs can be compiled with or without optional support for certain items. For instance, some programs can be compiled with gtk-support, or with qt-support. Others can be compiled with or without SSL support. Some programs can even be compiled with framebuffer support (svgalib) instead of X11 support (X-server).
147 + <property name="xalign">0</property>
148 + <property name="yalign">0</property>
149 + <property name="label" translatable="yes">USE is one of the most powerful variables Gentoo provides to its users.
150 +Several programs can be compiled with or without optional support for certain items.
151 +
152 +For instance, some programs can be compiled with gtk-support, or with qt-support.
153 +Others can be compiled with or without SSL support.
154 +Some programs can even be compiled with framebuffer support (svgalib) instead of X11 support (X-server).
155 +
156 Pick your flags by selecting them. Your profile already set some of the flags, but you can override them if you wish.</property>
157 <property name="justify">center</property>
158 </widget>
159 <packing>
160 + <property name="expand">False</property>
161 <property name="position">0</property>
162 </packing>
163 </child>
164 @@ -34,25 +43,37 @@ Pick your flags by selecting them. Your profile already set some of the flags, b
165 <property name="hscrollbar_policy">automatic</property>
166 <property name="vscrollbar_policy">automatic</property>
167 <child>
168 - <widget class="GtkTable" id="table1">
169 + <widget class="GtkViewport" id="viewport1">
170 <property name="visible">True</property>
171 - <property name="n_columns">2</property>
172 + <property name="resize_mode">queue</property>
173 <child>
174 - <widget class="GtkLabel" id="label2">
175 + <widget class="GtkTable" id="table1">
176 <property name="visible">True</property>
177 - <property name="label" translatable="yes">Flag</property>
178 + <property name="n_columns">2</property>
179 + <child>
180 + <widget class="GtkLabel" id="label2">
181 + <property name="visible">True</property>
182 + <property name="label" translatable="yes">Flag</property>
183 + </widget>
184 + <packing>
185 + <property name="x_options">GTK_FILL</property>
186 + <property name="y_options">GTK_FILL</property>
187 + </packing>
188 + </child>
189 + <child>
190 + <widget class="GtkLabel" id="label3">
191 + <property name="visible">True</property>
192 + <property name="label" translatable="yes">Description</property>
193 + </widget>
194 + <packing>
195 + <property name="left_attach">1</property>
196 + <property name="right_attach">2</property>
197 + <property name="x_options">GTK_FILL</property>
198 + <property name="y_options">GTK_FILL</property>
199 + </packing>
200 + </child>
201 </widget>
202 </child>
203 - <child>
204 - <widget class="GtkLabel" id="label3">
205 - <property name="visible">True</property>
206 - <property name="label" translatable="yes">Description</property>
207 - </widget>
208 - <packing>
209 - <property name="left_attach">1</property>
210 - <property name="right_attach">2</property>
211 - </packing>
212 - </child>
213 </widget>
214 </child>
215 </widget>