summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobprefs.py
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-07-01 15:58:50 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-05 14:40:30 +0100
commit4cc291c007103c19779f995e852b37dbad122293 (patch)
tree3447d62ef1ba2eca08137b8e13df58f8a337a453 /bitbake/lib/bb/ui/crumbs/hobprefs.py
parent7fc9c3488f7865111ec052d1cab213d216d2b414 (diff)
downloadpoky-4cc291c007103c19779f995e852b37dbad122293.tar.gz
hob: re-designed interaction and implementation
Highlights include: * Atempted GNOME HIG compliance * Simplified UI and interaction model * Sorting and type to find in tree views * Preferences dialog to modify local settings * Dialog to add and remove layers * Search in packages list * Save/Load image recipes The build model has been changed, hob will attempt to build all dependent packages of an image and then use the buildFile server method to build the created image. (Bitbake rev: 48e64acaae4a741b9f5630f426fb4e6142755c2c) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobprefs.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobprefs.py293
1 files changed, 293 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobprefs.py b/bitbake/lib/bb/ui/crumbs/hobprefs.py
new file mode 100644
index 0000000000..f186410720
--- /dev/null
+++ b/bitbake/lib/bb/ui/crumbs/hobprefs.py
@@ -0,0 +1,293 @@
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
21import gtk
22from bb.ui.crumbs.configurator import Configurator
23
24class HobPrefs(gtk.Dialog):
25 """
26 """
27 def empty_combo_text(self, combo_text):
28 model = combo_text.get_model()
29 if model:
30 model.clear()
31
32 def output_type_changed_cb(self, combo, handler):
33 ot = combo.get_active_text()
34 if ot != self.curr_output_type:
35 self.curr_output_type = ot
36 handler.set_image_output_type(ot)
37
38 def sdk_machine_combo_changed_cb(self, combo, handler):
39 sdk_mach = combo.get_active_text()
40 if sdk_mach != self.curr_sdk_mach:
41 self.curr_sdk_mach = sdk_mach
42 self.configurator.setLocalConfVar('SDKMACHINE', sdk_mach)
43 handler.set_sdk_machine(sdk_mach)
44
45 def update_sdk_machines(self, handler, sdk_machines):
46 active = 0
47 # disconnect the signal handler before updating the combo model
48 if self.sdk_machine_handler_id:
49 self.sdk_machine_combo.disconnect(self.sdk_machine_handler_id)
50 self.sdk_machine_handler_id = None
51
52 self.empty_combo_text(self.sdk_machine_combo)
53 for sdk_machine in sdk_machines:
54 self.sdk_machine_combo.append_text(sdk_machine)
55 if sdk_machine == self.curr_sdk_mach:
56 self.sdk_machine_combo.set_active(active)
57 active = active + 1
58
59 self.sdk_machine_handler_id = self.sdk_machine_combo.connect("changed", self.sdk_machine_combo_changed_cb, handler)
60
61 def distro_combo_changed_cb(self, combo, handler):
62 distro = combo.get_active_text()
63 if distro != self.curr_distro:
64 self.curr_distro = distro
65 self.configurator.setLocalConfVar('DISTRO', distro)
66 handler.set_distro(distro)
67 self.reload_required = True
68
69 def update_distros(self, handler, distros):
70 active = 0
71 # disconnect the signal handler before updating combo model
72 if self.distro_handler_id:
73 self.distro_combo.disconnect(self.distro_handler_id)
74 self.distro_handler_id = None
75
76 self.empty_combo_text(self.distro_combo)
77 for distro in distros:
78 self.distro_combo.append_text(distro)
79 if distro == self.curr_distro:
80 self.distro_combo.set_active(active)
81 active = active + 1
82
83 self.distro_handler_id = self.distro_combo.connect("changed", self.distro_combo_changed_cb, handler)
84
85 def package_format_combo_changed_cb(self, combo, handler):
86 package_format = combo.get_active_text()
87 if package_format != self.curr_package_format:
88 self.curr_package_format = package_format
89 self.configurator.setLocalConfVar('PACKAGE_CLASSES', 'package_%s' % package_format)
90 handler.set_package_format(package_format)
91
92 def update_package_formats(self, handler, formats):
93 active = 0
94 # disconnect the signal handler before updating the model
95 if self.package_handler_id:
96 self.package_combo.disconnect(self.package_handler_id)
97 self.package_handler_id = None
98
99 self.empty_combo_text(self.package_combo)
100 for format in formats:
101 self.package_combo.append_text(format)
102 if format == self.curr_package_format:
103 self.package_combo.set_active(active)
104 active = active + 1
105
106 self.package_handler_id = self.package_combo.connect("changed", self.package_format_combo_changed_cb, handler)
107
108 def include_gplv3_cb(self, toggle):
109 excluded = toggle.get_active()
110 self.handler.toggle_gplv3(excluded)
111 if excluded:
112 self.configurator.setLocalConfVar('INCOMPATIBLE_LICENSE', 'GPLv3')
113 else:
114 self.configurator.setLocalConfVar('INCOMPATIBLE_LICENSE', '')
115 self.reload_required = True
116
117 def change_bb_threads_cb(self, spinner):
118 val = spinner.get_value_as_int()
119 self.handler.set_bbthreads(val)
120 self.configurator.setLocalConfVar('BB_NUMBER_THREADS', val)
121
122 def change_make_threads_cb(self, spinner):
123 val = spinner.get_value_as_int()
124 self.handler.set_pmake(val)
125 self.configurator.setLocalConfVar('PARALLEL_MAKE', "-j %s" % val)
126
127 def toggle_toolchain_cb(self, check):
128 enabled = check.get_active()
129 self.handler.toggle_toolchain(enabled)
130
131 def toggle_headers_cb(self, check):
132 enabled = check.get_active()
133 self.handler.toggle_toolchain_headers(enabled)
134
135 def set_parent_window(self, parent):
136 self.set_transient_for(parent)
137
138 def write_changes(self):
139 self.configurator.writeLocalConf()
140
141 def prefs_response_cb(self, dialog, response):
142 if self.reload_required:
143 glib.idle_add(self.handler.reload_data)
144
145 def __init__(self, configurator, handler, curr_sdk_mach, curr_distro, pclass,
146 cpu_cnt, pmake, bbthread, image_types):
147 """
148 """
149 gtk.Dialog.__init__(self, "Preferences", None,
150 gtk.DIALOG_DESTROY_WITH_PARENT,
151 (gtk.STOCK_CLOSE, gtk.RESPONSE_OK))
152
153 self.set_border_width(6)
154 self.vbox.set_property("spacing", 12)
155 self.action_area.set_property("spacing", 12)
156 self.action_area.set_property("border-width", 6)
157
158 self.handler = handler
159 self.configurator = configurator
160
161 self.curr_sdk_mach = curr_sdk_mach
162 self.curr_distro = curr_distro
163 self.curr_package_format = pclass
164 self.curr_output_type = None
165 self.cpu_cnt = cpu_cnt
166 self.pmake = pmake
167 self.bbthread = bbthread
168 self.reload_required = False
169 self.distro_handler_id = None
170 self.sdk_machine_handler_id = None
171 self.package_handler_id = None
172
173 left = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
174 right = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
175
176 label = gtk.Label()
177 label.set_markup("<b>Policy</b>")
178 label.show()
179 frame = gtk.Frame()
180 frame.set_label_widget(label)
181 frame.set_shadow_type(gtk.SHADOW_NONE)
182 frame.show()
183 self.vbox.pack_start(frame)
184 pbox = gtk.VBox(False, 12)
185 pbox.show()
186 frame.add(pbox)
187 hbox = gtk.HBox(False, 12)
188 hbox.show()
189 pbox.pack_start(hbox, expand=False, fill=False, padding=6)
190 # Distro selector
191 label = gtk.Label("Distribution:")
192 label.show()
193 hbox.pack_start(label, expand=False, fill=False, padding=6)
194 self.distro_combo = gtk.combo_box_new_text()
195 self.distro_combo.set_tooltip_text("Select the Yocto distribution you would like to use")
196 self.distro_combo.show()
197 hbox.pack_start(self.distro_combo, expand=False, fill=False, padding=6)
198 # Exclude GPLv3
199 check = gtk.CheckButton("Exclude GPLv3 packages")
200 check.set_tooltip_text("Check this box to prevent GPLv3 packages from being included in your image")
201 check.show()
202 check.connect("toggled", self.include_gplv3_cb)
203 hbox.pack_start(check, expand=False, fill=False, padding=6)
204 hbox = gtk.HBox(False, 12)
205 hbox.show()
206 pbox.pack_start(hbox, expand=False, fill=False, padding=6)
207 # Package format selector
208 label = gtk.Label("Package format:")
209 label.show()
210 hbox.pack_start(label, expand=False, fill=False, padding=6)
211 self.package_combo = gtk.combo_box_new_text()
212 self.package_combo.set_tooltip_text("Select the package format you would like to use in your image")
213 self.package_combo.show()
214 hbox.pack_start(self.package_combo, expand=False, fill=False, padding=6)
215 # Image output type selector
216 label = gtk.Label("Image output type:")
217 label.show()
218 hbox.pack_start(label, expand=False, fill=False, padding=6)
219 output_combo = gtk.combo_box_new_text()
220 if image_types:
221 for it in image_types.split(" "):
222 output_combo.append_text(it)
223 output_combo.connect("changed", self.output_type_changed_cb, handler)
224 else:
225 output_combo.set_sensitive(False)
226 output_combo.show()
227 hbox.pack_start(output_combo)
228 # BitBake
229 label = gtk.Label()
230 label.set_markup("<b>BitBake</b>")
231 label.show()
232 frame = gtk.Frame()
233 frame.set_label_widget(label)
234 frame.set_shadow_type(gtk.SHADOW_NONE)
235 frame.show()
236 self.vbox.pack_start(frame)
237 pbox = gtk.VBox(False, 12)
238 pbox.show()
239 frame.add(pbox)
240 hbox = gtk.HBox(False, 12)
241 hbox.show()
242 pbox.pack_start(hbox, expand=False, fill=False, padding=6)
243 label = gtk.Label("BitBake threads:")
244 label.show()
245 spin_max = 9 #self.cpu_cnt * 3
246 hbox.pack_start(label, expand=False, fill=False, padding=6)
247 bbadj = gtk.Adjustment(value=self.bbthread, lower=1, upper=spin_max, step_incr=1)
248 bbspinner = gtk.SpinButton(adjustment=bbadj, climb_rate=1, digits=0)
249 bbspinner.show()
250 bbspinner.connect("value-changed", self.change_bb_threads_cb)
251 hbox.pack_start(bbspinner, expand=False, fill=False, padding=6)
252 label = gtk.Label("Make threads:")
253 label.show()
254 hbox.pack_start(label, expand=False, fill=False, padding=6)
255 madj = gtk.Adjustment(value=self.pmake, lower=1, upper=spin_max, step_incr=1)
256 makespinner = gtk.SpinButton(adjustment=madj, climb_rate=1, digits=0)
257 makespinner.connect("value-changed", self.change_make_threads_cb)
258 makespinner.show()
259 hbox.pack_start(makespinner, expand=False, fill=False, padding=6)
260 # Toolchain
261 label = gtk.Label()
262 label.set_markup("<b>External Toolchain</b>")
263 label.show()
264 frame = gtk.Frame()
265 frame.set_label_widget(label)
266 frame.set_shadow_type(gtk.SHADOW_NONE)
267 frame.show()
268 self.vbox.pack_start(frame)
269 pbox = gtk.VBox(False, 12)
270 pbox.show()
271 frame.add(pbox)
272 hbox = gtk.HBox(False, 12)
273 hbox.show()
274 pbox.pack_start(hbox, expand=False, fill=False, padding=6)
275 toolcheck = gtk.CheckButton("Build external development toolchain with image")
276 toolcheck.show()
277 toolcheck.connect("toggled", self.toggle_toolchain_cb)
278 hbox.pack_start(toolcheck, expand=False, fill=False, padding=6)
279 hbox = gtk.HBox(False, 12)
280 hbox.show()
281 pbox.pack_start(hbox, expand=False, fill=False, padding=6)
282 label = gtk.Label("Toolchain host:")
283 label.show()
284 hbox.pack_start(label, expand=False, fill=False, padding=6)
285 self.sdk_machine_combo = gtk.combo_box_new_text()
286 self.sdk_machine_combo.set_tooltip_text("Select the host architecture of the external machine")
287 self.sdk_machine_combo.show()
288 hbox.pack_start(self.sdk_machine_combo, expand=False, fill=False, padding=6)
289 headerscheck = gtk.CheckButton("Include development headers with toolchain")
290 headerscheck.show()
291 headerscheck.connect("toggled", self.toggle_headers_cb)
292 hbox.pack_start(headerscheck, expand=False, fill=False, padding=6)
293 self.connect("response", self.prefs_response_cb)