diff options
| author | Cristiana Voicu <cristiana.voicu@intel.com> | 2012-09-26 13:44:08 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-27 16:45:25 +0100 |
| commit | 4c229615eaedb6b7af6efa7d4d70848a8027594a (patch) | |
| tree | 23f02504c789def80de05197f481e37246a43395 /bitbake/lib/bb/ui/crumbs/hig.py | |
| parent | d658f48efad5dd9e7d74c8f607f5b5d893b589dd (diff) | |
| download | poky-4c229615eaedb6b7af6efa7d4d70848a8027594a.tar.gz | |
bitbake: hob/settings: implement a new tab in settings dialog to show SSTATE_MIRRORS
Add a new tab to show correctly SSTATE_MIRRORS variable. Now you can add new
mirrors or delete mirror. "info" image was also changed( it is smaller, so it
can be next to labels).
>From "Build environment" tab, SSTATE_DIR and SSTATE_MIRRORS vars were removed.
[YOCTO #2893]
(Bitbake rev: 1a81e27365d969e4ad4b4f0aec290aa967a8a35f)
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hig.py')
| -rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig.py | 180 |
1 files changed, 167 insertions, 13 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py index f304a686e1..31747b325c 100644 --- a/bitbake/lib/bb/ui/crumbs/hig.py +++ b/bitbake/lib/bb/ui/crumbs/hig.py | |||
| @@ -51,6 +51,14 @@ class SettingsUIHelper(): | |||
| 51 | label.show() | 51 | label.show() |
| 52 | return label | 52 | return label |
| 53 | 53 | ||
| 54 | def gen_label_info_widget(self, content, tooltip): | ||
| 55 | table = gtk.Table(1, 10, False) | ||
| 56 | label = self.gen_label_widget(content) | ||
| 57 | info = HobInfoButton(tooltip, self) | ||
| 58 | table.attach(label, 0, 1, 0, 1, xoptions=gtk.FILL) | ||
| 59 | table.attach(info, 1, 2, 0, 1, xoptions=gtk.FILL, xpadding=10) | ||
| 60 | return table | ||
| 61 | |||
| 54 | def gen_spinner_widget(self, content, lower, upper, tooltip=""): | 62 | def gen_spinner_widget(self, content, lower, upper, tooltip=""): |
| 55 | hbox = gtk.HBox(False, 12) | 63 | hbox = gtk.HBox(False, 12) |
| 56 | adjust = gtk.Adjustment(value=content, lower=lower, upper=upper, step_incr=1) | 64 | adjust = gtk.Adjustment(value=content, lower=lower, upper=upper, step_incr=1) |
| @@ -117,12 +125,94 @@ class SettingsUIHelper(): | |||
| 117 | else: | 125 | else: |
| 118 | hbox.pack_start(entry, expand=True, fill=True) | 126 | hbox.pack_start(entry, expand=True, fill=True) |
| 119 | 127 | ||
| 120 | info = HobInfoButton(tooltip, self) | 128 | if tooltip != "": |
| 121 | hbox.pack_start(info, expand=False, fill=False) | 129 | info = HobInfoButton(tooltip, self) |
| 130 | hbox.pack_start(info, expand=False, fill=False) | ||
| 122 | 131 | ||
| 123 | hbox.show_all() | 132 | hbox.show_all() |
| 124 | return hbox, entry | 133 | return hbox, entry |
| 125 | 134 | ||
| 135 | def gen_mirror_entry_widget(self, content, index, match_content=""): | ||
| 136 | hbox = gtk.HBox(False, 12) | ||
| 137 | entry = gtk.Entry() | ||
| 138 | content = content[:-2] | ||
| 139 | entry.set_text(content) | ||
| 140 | entry_match = gtk.Entry() | ||
| 141 | entry_match.set_text(match_content) | ||
| 142 | |||
| 143 | table = gtk.Table(2, 6, True) | ||
| 144 | hbox.pack_start(table, expand=True, fill=True) | ||
| 145 | label_configuration = gtk.Label("Configuration") | ||
| 146 | label_mirror_url = gtk.Label("Mirror URL") | ||
| 147 | label_match = gtk.Label("Match") | ||
| 148 | label_replace_with = gtk.Label("Replace with") | ||
| 149 | |||
| 150 | combo = gtk.combo_box_new_text() | ||
| 151 | combo.append_text("Standard") | ||
| 152 | combo.append_text("Custom") | ||
| 153 | if match_content == "": | ||
| 154 | combo.set_active(0) | ||
| 155 | else: | ||
| 156 | combo.set_active(1) | ||
| 157 | combo.connect("changed", self.on_combo_changed, index) | ||
| 158 | |||
| 159 | delete_button = HobAltButton("Delete") | ||
| 160 | delete_button.connect("clicked", self.delete_cb, index, entry) | ||
| 161 | if content == "": | ||
| 162 | delete_button.set_sensitive(False) | ||
| 163 | |||
| 164 | entry_match.connect("changed", self.insert_entry_match_cb, index) | ||
| 165 | entry.connect("changed", self.insert_entry_cb, index, delete_button) | ||
| 166 | |||
| 167 | if match_content == "": | ||
| 168 | table.attach(label_configuration, 0, 1, 0, 1) | ||
| 169 | table.attach(label_mirror_url, 1, 2, 0, 1) | ||
| 170 | table.attach(combo, 0, 1, 1, 2) | ||
| 171 | table.attach(entry, 1, 5, 1, 2) | ||
| 172 | table.attach(delete_button, 5, 6, 1, 2) | ||
| 173 | else: | ||
| 174 | table.attach(label_configuration, 0, 1, 0, 1) | ||
| 175 | table.attach(label_match, 1, 2, 0, 1) | ||
| 176 | table.attach(label_replace_with, 2, 3, 0, 1) | ||
| 177 | table.attach(combo, 0, 1, 1, 2) | ||
| 178 | table.attach(entry_match, 1, 2, 1, 2) | ||
| 179 | table.attach(entry, 2, 5, 1, 2) | ||
| 180 | table.attach(delete_button, 5, 6, 1, 2) | ||
| 181 | |||
| 182 | hbox.show_all() | ||
| 183 | return hbox | ||
| 184 | |||
| 185 | def insert_entry_match_cb(self, entry_match, index): | ||
| 186 | self.sstatemirrors_list[index][2] = entry_match.get_text() | ||
| 187 | |||
| 188 | def insert_entry_cb(self, entry, index, button): | ||
| 189 | self.sstatemirrors_list[index][1] = entry.get_text() | ||
| 190 | if entry.get_text() == "": | ||
| 191 | button.set_sensitive(False) | ||
| 192 | else: | ||
| 193 | button.set_sensitive(True) | ||
| 194 | |||
| 195 | def on_combo_changed(self, combo, index): | ||
| 196 | if combo.get_active_text() == "Standard": | ||
| 197 | self.sstatemirrors_list[index][0] = 0 | ||
| 198 | else: | ||
| 199 | self.sstatemirrors_list[index][0] = 1 | ||
| 200 | self.refresh_shared_state_page() | ||
| 201 | |||
| 202 | def delete_cb(self, button, index, entry): | ||
| 203 | if index == 0 and len(self.sstatemirrors_list)==1: | ||
| 204 | entry.set_text("") | ||
| 205 | else: | ||
| 206 | self.sstatemirrors_list.pop(index) | ||
| 207 | self.refresh_shared_state_page() | ||
| 208 | |||
| 209 | def add_mirror(self, button): | ||
| 210 | tooltip = "Select the pre-built mirror that will speed your build" | ||
| 211 | index = len(self.sstatemirrors_list) | ||
| 212 | sm_list = [0, "", "file://(.*)"] | ||
| 213 | self.sstatemirrors_list.append(sm_list) | ||
| 214 | self.refresh_shared_state_page() | ||
| 215 | |||
| 126 | # | 216 | # |
| 127 | # CrumbsDialog | 217 | # CrumbsDialog |
| 128 | # | 218 | # |
| @@ -197,7 +287,8 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
| 197 | # class members for internal use | 287 | # class members for internal use |
| 198 | self.dldir_text = None | 288 | self.dldir_text = None |
| 199 | self.sstatedir_text = None | 289 | self.sstatedir_text = None |
| 200 | self.sstatemirror_text = None | 290 | self.sstatemirrors_list = [] |
| 291 | self.sstatemirrors_changed = 0 | ||
| 201 | self.bb_spinner = None | 292 | self.bb_spinner = None |
| 202 | self.pmake_spinner = None | 293 | self.pmake_spinner = None |
| 203 | self.rootfs_size_spinner = None | 294 | self.rootfs_size_spinner = None |
| @@ -331,7 +422,14 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
| 331 | def response_cb(self, dialog, response_id): | 422 | def response_cb(self, dialog, response_id): |
| 332 | self.configuration.dldir = self.dldir_text.get_text() | 423 | self.configuration.dldir = self.dldir_text.get_text() |
| 333 | self.configuration.sstatedir = self.sstatedir_text.get_text() | 424 | self.configuration.sstatedir = self.sstatedir_text.get_text() |
| 334 | self.configuration.sstatemirror = self.sstatemirror_text.get_text() | 425 | self.configuration.sstatemirror = "" |
| 426 | for mirror in self.sstatemirrors_list: | ||
| 427 | if mirror[1] != "" or len(self.sstatemirrors_list)==1: | ||
| 428 | if mirror[1].endswith("\\1"): | ||
| 429 | smirror = mirror[2] + " " + mirror[1] + " \\n " | ||
| 430 | else: | ||
| 431 | smirror = mirror[2] + " " + mirror[1] + "\\1 \\n " | ||
| 432 | self.configuration.sstatemirror += smirror | ||
| 335 | self.configuration.bbthread = self.bb_spinner.get_value_as_int() | 433 | self.configuration.bbthread = self.bb_spinner.get_value_as_int() |
| 336 | self.configuration.pmake = self.pmake_spinner.get_value_as_int() | 434 | self.configuration.pmake = self.pmake_spinner.get_value_as_int() |
| 337 | 435 | ||
| @@ -382,24 +480,79 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
| 382 | sub_vbox.pack_start(label, expand=False, fill=False) | 480 | sub_vbox.pack_start(label, expand=False, fill=False) |
| 383 | sub_vbox.pack_start(dldir_widget, expand=False, fill=False) | 481 | sub_vbox.pack_start(dldir_widget, expand=False, fill=False) |
| 384 | 482 | ||
| 483 | return advanced_vbox | ||
| 484 | |||
| 485 | def create_shared_state_page(self): | ||
| 486 | advanced_vbox = gtk.VBox(False, 6) | ||
| 487 | advanced_vbox.set_border_width(6) | ||
| 488 | |||
| 385 | sub_vbox = gtk.VBox(False, 6) | 489 | sub_vbox = gtk.VBox(False, 6) |
| 386 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) | 490 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) |
| 387 | label = self.gen_label_widget("<span weight=\"bold\">Select SSTATE directory:</span>") | 491 | content = "<span weight=\"bold\">Shared state directory</span>" |
| 388 | tooltip = "Select a folder that caches your prebuilt results" | 492 | tooltip = "Select a folder that caches your prebuilt results" |
| 389 | sstatedir_widget, self.sstatedir_text = self.gen_entry_widget(self.configuration.sstatedir, self, tooltip) | 493 | label = self.gen_label_info_widget(content, tooltip) |
| 494 | sstatedir_widget, self.sstatedir_text = self.gen_entry_widget(self.configuration.sstatedir, self) | ||
| 390 | sub_vbox.pack_start(label, expand=False, fill=False) | 495 | sub_vbox.pack_start(label, expand=False, fill=False) |
| 391 | sub_vbox.pack_start(sstatedir_widget, expand=False, fill=False) | 496 | sub_vbox.pack_start(sstatedir_widget, expand=False, fill=False) |
| 392 | 497 | ||
| 393 | sub_vbox = gtk.VBox(False, 6) | 498 | sub_vbox = gtk.VBox(False, 6) |
| 394 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) | 499 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) |
| 395 | label = self.gen_label_widget("<span weight=\"bold\">Select SSTATE mirror:</span>") | 500 | content = "<span weight=\"bold\">Shared state mirrors</span>" |
| 396 | tooltip = "Select the pre-built mirror that will speed your build" | 501 | tooltip = "URLs pointing to pre-built mirrors that will speed your build. " |
| 397 | sstatemirror_widget, self.sstatemirror_text = self.gen_entry_widget(self.configuration.sstatemirror, self, tooltip) | 502 | tooltip += "Select the \'Standard\' configuration if the structure of your " |
| 398 | sub_vbox.pack_start(label, expand=False, fill=False) | 503 | tooltip += "mirror replicates the structure of your local shared state directory. " |
| 399 | sub_vbox.pack_start(sstatemirror_widget, expand=False, fill=False) | 504 | tooltip += "For more information on shared state mirrors, check the <a href=\"" |
| 505 | tooltip += "http://www.yoctoproject.org/docs/current/poky-ref-manual/" | ||
| 506 | tooltip += "poky-ref-manual.html#shared-state\">Yocto Project Reference Manual</a>." | ||
| 507 | table = self.gen_label_info_widget(content, tooltip) | ||
| 508 | sub_vbox.pack_start(table, expand=False, fill=False) | ||
| 509 | |||
| 510 | searched_string = "file://" | ||
| 511 | |||
| 512 | if self.sstatemirrors_changed == 0: | ||
| 513 | self.sstatemirrors_changed = 1 | ||
| 514 | sstatemirrors = self.configuration.sstatemirror | ||
| 515 | while sstatemirrors.find(searched_string) != -1: | ||
| 516 | if sstatemirrors.find(searched_string,1) != -1: | ||
| 517 | sstatemirror = sstatemirrors[:sstatemirrors.find(searched_string,1)] | ||
| 518 | sstatemirrors = sstatemirrors[sstatemirrors.find(searched_string,1):] | ||
| 519 | else: | ||
| 520 | sstatemirror = sstatemirrors | ||
| 521 | sstatemirrors = sstatemirrors[1:] | ||
| 522 | |||
| 523 | sstatemirror_fields = [x for x in sstatemirror.split(' ') if x.strip()] | ||
| 524 | if sstatemirror_fields[0] == "file://(.*)": | ||
| 525 | sm_list = [ 0, sstatemirror_fields[1], "file://(.*)"] | ||
| 526 | else: | ||
| 527 | sm_list = [ 1, sstatemirror_fields[1], sstatemirror_fields[0]] | ||
| 528 | self.sstatemirrors_list.append(sm_list) | ||
| 529 | |||
| 530 | index = 0 | ||
| 531 | for mirror in self.sstatemirrors_list: | ||
| 532 | if mirror[0] == 0: | ||
| 533 | sstatemirror_widget = self.gen_mirror_entry_widget(mirror[1], index) | ||
| 534 | else: | ||
| 535 | sstatemirror_widget = self.gen_mirror_entry_widget(mirror[1], index, mirror[2]) | ||
| 536 | sub_vbox.pack_start(sstatemirror_widget, expand=False, fill=False) | ||
| 537 | index += 1 | ||
| 538 | |||
| 539 | sub_vbox = gtk.VBox(False, 6) | ||
| 540 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) | ||
| 541 | add_mirror_button = HobAltButton("Add another mirror") | ||
| 542 | add_mirror_button.set_size_request(100, -1) | ||
| 543 | add_mirror_button.connect("clicked", self.add_mirror) | ||
| 544 | sub_vbox.pack_start(add_mirror_button, expand=False, fill=False) | ||
| 400 | 545 | ||
| 401 | return advanced_vbox | 546 | return advanced_vbox |
| 402 | 547 | ||
| 548 | def refresh_shared_state_page(self): | ||
| 549 | page_num = self.nb.get_current_page() | ||
| 550 | self.nb.remove_page(page_num); | ||
| 551 | self.nb.insert_page(self.create_shared_state_page(), gtk.Label("Shared state"),page_num) | ||
| 552 | self.show_all() | ||
| 553 | self.nb.set_current_page(page_num) | ||
| 554 | |||
| 555 | |||
| 403 | def create_proxy_page(self): | 556 | def create_proxy_page(self): |
| 404 | advanced_vbox = gtk.VBox(False, 6) | 557 | advanced_vbox = gtk.VBox(False, 6) |
| 405 | advanced_vbox.set_border_width(6) | 558 | advanced_vbox.set_border_width(6) |
| @@ -461,9 +614,10 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
| 461 | 614 | ||
| 462 | def create_visual_elements(self): | 615 | def create_visual_elements(self): |
| 463 | self.nb = gtk.Notebook() | 616 | self.nb = gtk.Notebook() |
| 464 | self.nb.set_show_tabs(True) | 617 | self.nb.set_show_tabs(True) |
| 465 | self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment")) | 618 | self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment")) |
| 466 | self.nb.append_page(self.create_proxy_page(), gtk.Label("Proxies")) | 619 | self.nb.append_page(self.create_shared_state_page(), gtk.Label("Shared state")) |
| 620 | self.nb.append_page(self.create_proxy_page(), gtk.Label("Proxies")) | ||
| 467 | self.nb.set_current_page(0) | 621 | self.nb.set_current_page(0) |
| 468 | self.vbox.pack_start(self.nb, expand=True, fill=True) | 622 | self.vbox.pack_start(self.nb, expand=True, fill=True) |
| 469 | self.vbox.pack_end(gtk.HSeparator(), expand=True, fill=True) | 623 | self.vbox.pack_end(gtk.HSeparator(), expand=True, fill=True) |
