diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobprefs.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobprefs.py | 335 |
1 files changed, 0 insertions, 335 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobprefs.py b/bitbake/lib/bb/ui/crumbs/hobprefs.py deleted file mode 100644 index 3f6f128808..0000000000 --- a/bitbake/lib/bb/ui/crumbs/hobprefs.py +++ /dev/null | |||
@@ -1,335 +0,0 @@ | |||
1 | # | ||
2 | # BitBake Graphical GTK User Interface | ||
3 | # | ||
4 | # Copyright (C) 2011 Intel Corporation | ||
5 | # | ||
6 | # Authored by Joshua Lock <josh@linux.intel.com> | ||
7 | # | ||
8 | # This program is free software; you can redistribute it and/or modify | ||
9 | # it under the terms of the GNU General Public License version 2 as | ||
10 | # published by the Free Software Foundation. | ||
11 | # | ||
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. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License along | ||
18 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
20 | |||
21 | import gtk | ||
22 | import glib | ||
23 | from bb.ui.crumbs.configurator import Configurator | ||
24 | |||
25 | class HobPrefs(gtk.Dialog): | ||
26 | """ | ||
27 | """ | ||
28 | def empty_combo_text(self, combo_text): | ||
29 | model = combo_text.get_model() | ||
30 | if model: | ||
31 | model.clear() | ||
32 | |||
33 | def output_type_toggled_cb(self, check, handler): | ||
34 | ot = check.get_label() | ||
35 | enabled = check.get_active() | ||
36 | if enabled: | ||
37 | self.selected_image_types = handler.add_image_output_type(ot) | ||
38 | else: | ||
39 | self.selected_image_types = handler.remove_image_output_type(ot) | ||
40 | |||
41 | self.configurator.setConfVar('IMAGE_FSTYPES', "%s" % " ".join(self.selected_image_types).lstrip(" ")) | ||
42 | self.reload_required = True | ||
43 | |||
44 | def sdk_machine_combo_changed_cb(self, combo, handler): | ||
45 | sdk_mach = combo.get_active_text() | ||
46 | if sdk_mach != self.curr_sdk_mach: | ||
47 | self.curr_sdk_mach = sdk_mach | ||
48 | self.configurator.setConfVar('SDKMACHINE', sdk_mach) | ||
49 | handler.set_sdk_machine(sdk_mach) | ||
50 | |||
51 | def update_sdk_machines(self, handler, sdk_machines): | ||
52 | active = 0 | ||
53 | # disconnect the signal handler before updating the combo model | ||
54 | if self.sdk_machine_handler_id: | ||
55 | self.sdk_machine_combo.disconnect(self.sdk_machine_handler_id) | ||
56 | self.sdk_machine_handler_id = None | ||
57 | |||
58 | self.empty_combo_text(self.sdk_machine_combo) | ||
59 | for sdk_machine in sdk_machines: | ||
60 | self.sdk_machine_combo.append_text(sdk_machine) | ||
61 | if sdk_machine == self.curr_sdk_mach: | ||
62 | self.sdk_machine_combo.set_active(active) | ||
63 | active = active + 1 | ||
64 | |||
65 | self.sdk_machine_handler_id = self.sdk_machine_combo.connect("changed", self.sdk_machine_combo_changed_cb, handler) | ||
66 | |||
67 | def distro_combo_changed_cb(self, combo, handler): | ||
68 | distro = combo.get_active_text() | ||
69 | if distro != self.curr_distro: | ||
70 | self.curr_distro = distro | ||
71 | self.configurator.setConfVar('DISTRO', distro) | ||
72 | handler.set_distro(distro) | ||
73 | self.reload_required = True | ||
74 | |||
75 | def update_distros(self, handler, distros): | ||
76 | active = 0 | ||
77 | # disconnect the signal handler before updating combo model | ||
78 | if self.distro_handler_id: | ||
79 | self.distro_combo.disconnect(self.distro_handler_id) | ||
80 | self.distro_handler_id = None | ||
81 | |||
82 | self.empty_combo_text(self.distro_combo) | ||
83 | for distro in distros: | ||
84 | self.distro_combo.append_text(distro) | ||
85 | if distro == self.curr_distro: | ||
86 | self.distro_combo.set_active(active) | ||
87 | active = active + 1 | ||
88 | |||
89 | self.distro_handler_id = self.distro_combo.connect("changed", self.distro_combo_changed_cb, handler) | ||
90 | |||
91 | def package_format_combo_changed_cb(self, combo, handler): | ||
92 | package_format = combo.get_active_text() | ||
93 | if package_format != self.curr_package_format: | ||
94 | self.curr_package_format = package_format | ||
95 | self.configurator.setConfVar('PACKAGE_CLASSES', 'package_%s' % package_format) | ||
96 | handler.set_package_format(package_format) | ||
97 | self.reload_required = True | ||
98 | |||
99 | def update_package_formats(self, handler, formats): | ||
100 | active = 0 | ||
101 | # disconnect the signal handler before updating the model | ||
102 | if self.package_handler_id: | ||
103 | self.package_combo.disconnect(self.package_handler_id) | ||
104 | self.package_handler_id = None | ||
105 | |||
106 | self.empty_combo_text(self.package_combo) | ||
107 | for format in formats: | ||
108 | self.package_combo.append_text(format) | ||
109 | if format == self.curr_package_format: | ||
110 | self.package_combo.set_active(active) | ||
111 | active = active + 1 | ||
112 | |||
113 | self.package_handler_id = self.package_combo.connect("changed", self.package_format_combo_changed_cb, handler) | ||
114 | |||
115 | def include_gplv3_cb(self, toggle): | ||
116 | excluded = toggle.get_active() | ||
117 | orig_incompatible = self.configurator.getConfVar('INCOMPATIBLE_LICENSE') | ||
118 | new_incompatible = "" | ||
119 | if excluded: | ||
120 | if not orig_incompatible: | ||
121 | new_incompatible = "GPLv3" | ||
122 | elif not orig_incompatible.find('GPLv3'): | ||
123 | new_incompatible = "%s GPLv3" % orig_incompatible | ||
124 | else: | ||
125 | new_incompatible = orig_incompatible.replace('GPLv3', '') | ||
126 | |||
127 | if new_incompatible != orig_incompatible: | ||
128 | self.handler.set_incompatible_license(new_incompatible) | ||
129 | self.configurator.setConfVar('INCOMPATIBLE_LICENSE', new_incompatible) | ||
130 | self.reload_required = True | ||
131 | |||
132 | def change_bb_threads_cb(self, spinner): | ||
133 | val = spinner.get_value_as_int() | ||
134 | self.handler.set_bbthreads(val) | ||
135 | self.configurator.setConfVar('BB_NUMBER_THREADS', val) | ||
136 | |||
137 | def change_make_threads_cb(self, spinner): | ||
138 | val = spinner.get_value_as_int() | ||
139 | self.handler.set_pmake(val) | ||
140 | self.configurator.setConfVar('PARALLEL_MAKE', "-j %s" % val) | ||
141 | |||
142 | def toggle_toolchain_cb(self, check): | ||
143 | enabled = check.get_active() | ||
144 | toolchain = '0' | ||
145 | if enabled: | ||
146 | toolchain = '1' | ||
147 | self.handler.toggle_toolchain(enabled) | ||
148 | self.configurator.setConfVar('HOB_BUILD_TOOLCHAIN', toolchain) | ||
149 | |||
150 | def toggle_headers_cb(self, check): | ||
151 | enabled = check.get_active() | ||
152 | headers = '0' | ||
153 | if enabled: | ||
154 | headers = '1' | ||
155 | self.handler.toggle_toolchain_headers(enabled) | ||
156 | self.configurator.setConfVar('HOB_BUILD_TOOLCHAIN_HEADERS', headers) | ||
157 | |||
158 | def set_parent_window(self, parent): | ||
159 | self.set_transient_for(parent) | ||
160 | |||
161 | def write_changes(self): | ||
162 | self.configurator.writeConf() | ||
163 | |||
164 | def prefs_response_cb(self, dialog, response): | ||
165 | if self.reload_required: | ||
166 | glib.idle_add(self.handler.reload_data) | ||
167 | self.reload_required = False | ||
168 | |||
169 | def __init__(self, configurator, handler, curr_sdk_mach, curr_distro, pclass, | ||
170 | pmake, bbthread, selected_image_types, all_image_types, | ||
171 | gplv3disabled, build_toolchain, build_toolchain_headers): | ||
172 | """ | ||
173 | """ | ||
174 | gtk.Dialog.__init__(self, "Preferences", None, | ||
175 | gtk.DIALOG_DESTROY_WITH_PARENT, | ||
176 | (gtk.STOCK_CLOSE, gtk.RESPONSE_OK)) | ||
177 | |||
178 | self.set_border_width(6) | ||
179 | self.vbox.set_property("spacing", 12) | ||
180 | self.action_area.set_property("spacing", 12) | ||
181 | self.action_area.set_property("border-width", 6) | ||
182 | |||
183 | self.handler = handler | ||
184 | self.configurator = configurator | ||
185 | |||
186 | self.curr_sdk_mach = curr_sdk_mach | ||
187 | self.curr_distro = curr_distro | ||
188 | self.curr_package_format = pclass | ||
189 | self.pmake = pmake | ||
190 | self.bbthread = bbthread | ||
191 | self.selected_image_types = selected_image_types.split(" ") | ||
192 | self.gplv3disabled = gplv3disabled | ||
193 | self.build_toolchain = build_toolchain | ||
194 | self.build_toolchain_headers = build_toolchain_headers | ||
195 | |||
196 | self.reload_required = False | ||
197 | self.distro_handler_id = None | ||
198 | self.sdk_machine_handler_id = None | ||
199 | self.package_handler_id = None | ||
200 | |||
201 | left = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) | ||
202 | right = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) | ||
203 | |||
204 | label = gtk.Label() | ||
205 | label.set_markup("<b>Policy</b>") | ||
206 | label.show() | ||
207 | frame = gtk.Frame() | ||
208 | frame.set_label_widget(label) | ||
209 | frame.set_shadow_type(gtk.SHADOW_NONE) | ||
210 | frame.show() | ||
211 | self.vbox.pack_start(frame) | ||
212 | pbox = gtk.VBox(False, 12) | ||
213 | pbox.show() | ||
214 | frame.add(pbox) | ||
215 | hbox = gtk.HBox(False, 12) | ||
216 | hbox.show() | ||
217 | pbox.pack_start(hbox, expand=False, fill=False, padding=6) | ||
218 | # Distro selector | ||
219 | label = gtk.Label("Distribution:") | ||
220 | label.show() | ||
221 | hbox.pack_start(label, expand=False, fill=False, padding=6) | ||
222 | self.distro_combo = gtk.combo_box_new_text() | ||
223 | self.distro_combo.set_tooltip_text("Select the Yocto distribution you would like to use") | ||
224 | self.distro_combo.show() | ||
225 | hbox.pack_start(self.distro_combo, expand=False, fill=False, padding=6) | ||
226 | # Exclude GPLv3 | ||
227 | check = gtk.CheckButton("Exclude GPLv3 packages") | ||
228 | check.set_tooltip_text("Check this box to prevent GPLv3 packages from being included in your image") | ||
229 | check.show() | ||
230 | check.set_active(self.gplv3disabled) | ||
231 | check.connect("toggled", self.include_gplv3_cb) | ||
232 | hbox.pack_start(check, expand=False, fill=False, padding=6) | ||
233 | hbox = gtk.HBox(False, 12) | ||
234 | hbox.show() | ||
235 | pbox.pack_start(hbox, expand=False, fill=False, padding=6) | ||
236 | # Package format selector | ||
237 | label = gtk.Label("Package format:") | ||
238 | label.show() | ||
239 | hbox.pack_start(label, expand=False, fill=False, padding=6) | ||
240 | self.package_combo = gtk.combo_box_new_text() | ||
241 | self.package_combo.set_tooltip_text("""The package format is that used in creation | ||
242 | of the root filesystem and also dictates the package manager used in your image""") | ||
243 | self.package_combo.show() | ||
244 | hbox.pack_start(self.package_combo, expand=False, fill=False, padding=6) | ||
245 | if all_image_types: | ||
246 | # Image output type selector | ||
247 | label = gtk.Label("Image output types:") | ||
248 | label.show() | ||
249 | hbox.pack_start(label, expand=False, fill=False, padding=6) | ||
250 | chk_cnt = 3 | ||
251 | for it in all_image_types.split(" "): | ||
252 | chk_cnt = chk_cnt + 1 | ||
253 | if chk_cnt % 6 == 0: | ||
254 | hbox = gtk.HBox(False, 12) | ||
255 | hbox.show() | ||
256 | pbox.pack_start(hbox, expand=False, fill=False, padding=6) | ||
257 | chk = gtk.CheckButton(it) | ||
258 | if it in self.selected_image_types: | ||
259 | chk.set_active(True) | ||
260 | chk.set_tooltip_text("Build an %s image" % it) | ||
261 | chk.connect("toggled", self.output_type_toggled_cb, handler) | ||
262 | chk.show() | ||
263 | hbox.pack_start(chk, expand=False, fill=False, padding=3) | ||
264 | # BitBake | ||
265 | label = gtk.Label() | ||
266 | label.set_markup("<b>BitBake</b>") | ||
267 | label.show() | ||
268 | frame = gtk.Frame() | ||
269 | frame.set_label_widget(label) | ||
270 | frame.set_shadow_type(gtk.SHADOW_NONE) | ||
271 | frame.show() | ||
272 | self.vbox.pack_start(frame) | ||
273 | pbox = gtk.VBox(False, 12) | ||
274 | pbox.show() | ||
275 | frame.add(pbox) | ||
276 | hbox = gtk.HBox(False, 12) | ||
277 | hbox.show() | ||
278 | pbox.pack_start(hbox, expand=False, fill=False, padding=6) | ||
279 | label = gtk.Label("BitBake threads:") | ||
280 | label.show() | ||
281 | # NOTE: may be a good idea in future to intelligently cap the maximum | ||
282 | # values but we need more data to make an educated decision, for now | ||
283 | # set a high maximum as a value for upper bounds is required by the | ||
284 | # gtk.Adjustment | ||
285 | spin_max = 30 # seems like a high enough arbitrary number | ||
286 | hbox.pack_start(label, expand=False, fill=False, padding=6) | ||
287 | bbadj = gtk.Adjustment(value=self.bbthread, lower=1, upper=spin_max, step_incr=1) | ||
288 | bbspinner = gtk.SpinButton(adjustment=bbadj, climb_rate=1, digits=0) | ||
289 | bbspinner.show() | ||
290 | bbspinner.connect("value-changed", self.change_bb_threads_cb) | ||
291 | hbox.pack_start(bbspinner, expand=False, fill=False, padding=6) | ||
292 | label = gtk.Label("Make threads:") | ||
293 | label.show() | ||
294 | hbox.pack_start(label, expand=False, fill=False, padding=6) | ||
295 | madj = gtk.Adjustment(value=self.pmake, lower=1, upper=spin_max, step_incr=1) | ||
296 | makespinner = gtk.SpinButton(adjustment=madj, climb_rate=1, digits=0) | ||
297 | makespinner.connect("value-changed", self.change_make_threads_cb) | ||
298 | makespinner.show() | ||
299 | hbox.pack_start(makespinner, expand=False, fill=False, padding=6) | ||
300 | # Toolchain | ||
301 | label = gtk.Label() | ||
302 | label.set_markup("<b>External Toolchain</b>") | ||
303 | label.show() | ||
304 | frame = gtk.Frame() | ||
305 | frame.set_label_widget(label) | ||
306 | frame.set_shadow_type(gtk.SHADOW_NONE) | ||
307 | frame.show() | ||
308 | self.vbox.pack_start(frame) | ||
309 | pbox = gtk.VBox(False, 12) | ||
310 | pbox.show() | ||
311 | frame.add(pbox) | ||
312 | hbox = gtk.HBox(False, 12) | ||
313 | hbox.show() | ||
314 | pbox.pack_start(hbox, expand=False, fill=False, padding=6) | ||
315 | toolcheck = gtk.CheckButton("Build external development toolchain with image") | ||
316 | toolcheck.show() | ||
317 | toolcheck.set_active(self.build_toolchain) | ||
318 | toolcheck.connect("toggled", self.toggle_toolchain_cb) | ||
319 | hbox.pack_start(toolcheck, expand=False, fill=False, padding=6) | ||
320 | hbox = gtk.HBox(False, 12) | ||
321 | hbox.show() | ||
322 | pbox.pack_start(hbox, expand=False, fill=False, padding=6) | ||
323 | label = gtk.Label("Toolchain host:") | ||
324 | label.show() | ||
325 | hbox.pack_start(label, expand=False, fill=False, padding=6) | ||
326 | self.sdk_machine_combo = gtk.combo_box_new_text() | ||
327 | self.sdk_machine_combo.set_tooltip_text("Select the host architecture of the external machine") | ||
328 | self.sdk_machine_combo.show() | ||
329 | hbox.pack_start(self.sdk_machine_combo, expand=False, fill=False, padding=6) | ||
330 | # headerscheck = gtk.CheckButton("Include development headers with toolchain") | ||
331 | # headerscheck.show() | ||
332 | # headerscheck.set_active(self.build_toolchain_headers) | ||
333 | # headerscheck.connect("toggled", self.toggle_headers_cb) | ||
334 | # hbox.pack_start(headerscheck, expand=False, fill=False, padding=6) | ||
335 | self.connect("response", self.prefs_response_cb) | ||