diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hig.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig.py | 258 |
1 files changed, 207 insertions, 51 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py index ccd9f39a00..b3aea92fa8 100644 --- a/bitbake/lib/bb/ui/crumbs/hig.py +++ b/bitbake/lib/bb/ui/crumbs/hig.py | |||
@@ -319,9 +319,16 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
319 | PROXIES_PAGE_ID, | 319 | PROXIES_PAGE_ID, |
320 | OTHERS_PAGE_ID) = range(4) | 320 | OTHERS_PAGE_ID) = range(4) |
321 | 321 | ||
322 | (TEST_NETWORK_NONE, | ||
323 | TEST_NETWORK_INITIAL, | ||
324 | TEST_NETWORK_RUNNING, | ||
325 | TEST_NETWORK_PASSED, | ||
326 | TEST_NETWORK_FAILED, | ||
327 | TEST_NETWORK_CANCELED) = range(6) | ||
328 | |||
322 | def __init__(self, title, configuration, all_image_types, | 329 | def __init__(self, title, configuration, all_image_types, |
323 | all_package_formats, all_distros, all_sdk_machines, | 330 | all_package_formats, all_distros, all_sdk_machines, |
324 | max_threads, parent, flags, buttons=None): | 331 | max_threads, parent, flags, handler, buttons=None): |
325 | super(SimpleSettingsDialog, self).__init__(title, parent, flags, buttons) | 332 | super(SimpleSettingsDialog, self).__init__(title, parent, flags, buttons) |
326 | 333 | ||
327 | # class members from other objects | 334 | # class members from other objects |
@@ -348,7 +355,11 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
348 | self.image_types_checkbuttons = {} | 355 | self.image_types_checkbuttons = {} |
349 | 356 | ||
350 | self.md5 = self.config_md5() | 357 | self.md5 = self.config_md5() |
358 | self.proxy_md5 = self.config_proxy_md5() | ||
351 | self.settings_changed = False | 359 | self.settings_changed = False |
360 | self.proxy_settings_changed = False | ||
361 | self.handler = handler | ||
362 | self.proxy_test_ran = False | ||
352 | 363 | ||
353 | # create visual elements on the dialog | 364 | # create visual elements on the dialog |
354 | self.create_visual_elements() | 365 | self.create_visual_elements() |
@@ -357,12 +368,15 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
357 | def _get_sorted_value(self, var): | 368 | def _get_sorted_value(self, var): |
358 | return " ".join(sorted(str(var).split())) + "\n" | 369 | return " ".join(sorted(str(var).split())) + "\n" |
359 | 370 | ||
360 | def config_md5(self): | 371 | def config_proxy_md5(self): |
361 | data = "" | 372 | data = ("ENABLE_PROXY: " + self._get_sorted_value(self.configuration.enable_proxy)) |
362 | data += ("ENABLE_PROXY: " + self._get_sorted_value(self.configuration.enable_proxy)) | ||
363 | if self.configuration.enable_proxy: | 373 | if self.configuration.enable_proxy: |
364 | for protocol in self.configuration.proxies.keys(): | 374 | for protocol in self.configuration.proxies.keys(): |
365 | data += (protocol + ": " + self._get_sorted_value(self.configuration.combine_proxy(protocol))) | 375 | data += (protocol + ": " + self._get_sorted_value(self.configuration.combine_proxy(protocol))) |
376 | return hashlib.md5(data).hexdigest() | ||
377 | |||
378 | def config_md5(self): | ||
379 | data = "" | ||
366 | for key in self.configuration.extra_setting.keys(): | 380 | for key in self.configuration.extra_setting.keys(): |
367 | data += (key + ": " + self._get_sorted_value(self.configuration.extra_setting[key])) | 381 | data += (key + ": " + self._get_sorted_value(self.configuration.extra_setting[key])) |
368 | return hashlib.md5(data).hexdigest() | 382 | return hashlib.md5(data).hexdigest() |
@@ -383,28 +397,25 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
383 | self.refresh_proxy_components() | 397 | self.refresh_proxy_components() |
384 | dialog.destroy() | 398 | dialog.destroy() |
385 | 399 | ||
386 | def gen_proxy_entry_widget(self, protocol, parent, need_button=True): | 400 | def gen_proxy_entry_widget(self, protocol, parent, need_button=True, line=0): |
387 | hbox = gtk.HBox(False, 12) | ||
388 | |||
389 | label = gtk.Label(protocol.upper() + " proxy") | 401 | label = gtk.Label(protocol.upper() + " proxy") |
390 | hbox.pack_start(label, expand=True, fill=False, padding=24) | 402 | self.proxy_table.attach(label, 0, 1, line, line+1, xpadding=24) |
391 | 403 | ||
392 | proxy_entry = gtk.Entry() | 404 | proxy_entry = gtk.Entry() |
393 | proxy_entry.set_size_request(300, -1) | 405 | proxy_entry.set_size_request(300, -1) |
394 | hbox.pack_start(proxy_entry, expand=False, fill=False) | 406 | self.proxy_table.attach(proxy_entry, 1, 2, line, line+1, ypadding=4) |
395 | 407 | ||
396 | hbox.pack_start(gtk.Label(":"), expand=False, fill=False) | 408 | self.proxy_table.attach(gtk.Label(":"), 2, 3, line, line+1, xpadding=12, ypadding=4) |
397 | 409 | ||
398 | port_entry = gtk.Entry() | 410 | port_entry = gtk.Entry() |
399 | port_entry.set_size_request(60, -1) | 411 | port_entry.set_size_request(60, -1) |
400 | hbox.pack_start(port_entry, expand=False, fill=False) | 412 | self.proxy_table.attach(port_entry, 3, 4, line, line+1, ypadding=4) |
401 | 413 | ||
402 | details_button = HobAltButton("Details") | 414 | details_button = HobAltButton("Details") |
403 | details_button.connect("clicked", self.details_cb, parent, protocol) | 415 | details_button.connect("clicked", self.details_cb, parent, protocol) |
404 | hbox.pack_start(details_button, expand=False, fill=False) | 416 | self.proxy_table.attach(details_button, 4, 5, line, line+1, xpadding=4, yoptions=gtk.EXPAND) |
405 | 417 | ||
406 | hbox.show_all() | 418 | return proxy_entry, port_entry, details_button |
407 | return hbox, proxy_entry, port_entry, details_button | ||
408 | 419 | ||
409 | def refresh_proxy_components(self): | 420 | def refresh_proxy_components(self): |
410 | self.same_checkbox.set_sensitive(self.configuration.enable_proxy) | 421 | self.same_checkbox.set_sensitive(self.configuration.enable_proxy) |
@@ -449,18 +460,53 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
449 | self.cvs_proxy_port.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | 460 | self.cvs_proxy_port.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) |
450 | self.cvs_proxy_details.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | 461 | self.cvs_proxy_details.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) |
451 | 462 | ||
463 | if self.configuration.same_proxy: | ||
464 | if self.http_proxy.get_text(): | ||
465 | [w.set_text(self.http_proxy.get_text()) for w in self.same_proxy_addresses] | ||
466 | if self.http_proxy_port.get_text(): | ||
467 | [w.set_text(self.http_proxy_port.get_text()) for w in self.same_proxy_ports] | ||
468 | |||
452 | def proxy_checkbox_toggled_cb(self, button): | 469 | def proxy_checkbox_toggled_cb(self, button): |
453 | self.configuration.enable_proxy = self.proxy_checkbox.get_active() | 470 | self.configuration.enable_proxy = self.proxy_checkbox.get_active() |
454 | if not self.configuration.enable_proxy: | 471 | if not self.configuration.enable_proxy: |
455 | self.configuration.same_proxy = False | 472 | self.configuration.same_proxy = False |
456 | self.same_checkbox.set_active(self.configuration.same_proxy) | 473 | self.same_checkbox.set_active(self.configuration.same_proxy) |
474 | self.save_proxy_data() | ||
457 | self.refresh_proxy_components() | 475 | self.refresh_proxy_components() |
458 | 476 | ||
459 | def same_checkbox_toggled_cb(self, button): | 477 | def same_checkbox_toggled_cb(self, button): |
460 | self.configuration.same_proxy = self.same_checkbox.get_active() | 478 | self.configuration.same_proxy = self.same_checkbox.get_active() |
479 | self.save_proxy_data() | ||
461 | self.refresh_proxy_components() | 480 | self.refresh_proxy_components() |
462 | 481 | ||
463 | def response_cb(self, dialog, response_id): | 482 | def save_proxy_data(self): |
483 | self.configuration.split_proxy("http", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
484 | if self.configuration.same_proxy: | ||
485 | self.configuration.split_proxy("https", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
486 | self.configuration.split_proxy("ftp", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
487 | self.configuration.split_proxy("git", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
488 | self.configuration.split_proxy("cvs", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
489 | else: | ||
490 | self.configuration.split_proxy("https", self.https_proxy.get_text() + ":" + self.https_proxy_port.get_text()) | ||
491 | self.configuration.split_proxy("ftp", self.ftp_proxy.get_text() + ":" + self.ftp_proxy_port.get_text()) | ||
492 | self.configuration.split_proxy("git", self.git_proxy.get_text() + ":" + self.git_proxy_port.get_text()) | ||
493 | self.configuration.split_proxy("cvs", self.cvs_proxy.get_text() + ":" + self.cvs_proxy_port.get_text()) | ||
494 | |||
495 | def response_cb(self, dialog, response_id): | ||
496 | if response_id == gtk.RESPONSE_YES: | ||
497 | # Check that all proxy entries have a corresponding port | ||
498 | for proxy, port in zip(self.all_proxy_addresses, self.all_proxy_ports): | ||
499 | if proxy.get_text() and not port.get_text(): | ||
500 | lbl = "<b>Enter all port numbers</b>\n\n" | ||
501 | msg = "Proxy servers require a port number. Please make sure you have entered a port number for each proxy server." | ||
502 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING, msg) | ||
503 | button = dialog.add_button("Close", gtk.RESPONSE_OK) | ||
504 | HobButton.style_button(button) | ||
505 | response = dialog.run() | ||
506 | dialog.destroy() | ||
507 | self.emit_stop_by_name("response") | ||
508 | return | ||
509 | |||
464 | self.configuration.dldir = self.dldir_text.get_text() | 510 | self.configuration.dldir = self.dldir_text.get_text() |
465 | self.configuration.sstatedir = self.sstatedir_text.get_text() | 511 | self.configuration.sstatedir = self.sstatedir_text.get_text() |
466 | self.configuration.sstatemirror = "" | 512 | self.configuration.sstatemirror = "" |
@@ -473,19 +519,7 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
473 | self.configuration.sstatemirror += smirror | 519 | self.configuration.sstatemirror += smirror |
474 | self.configuration.bbthread = self.bb_spinner.get_value_as_int() | 520 | self.configuration.bbthread = self.bb_spinner.get_value_as_int() |
475 | self.configuration.pmake = self.pmake_spinner.get_value_as_int() | 521 | self.configuration.pmake = self.pmake_spinner.get_value_as_int() |
476 | 522 | self.save_proxy_data() | |
477 | self.configuration.split_proxy("http", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
478 | if self.configuration.same_proxy: | ||
479 | self.configuration.split_proxy("https", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
480 | self.configuration.split_proxy("ftp", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
481 | self.configuration.split_proxy("git", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
482 | self.configuration.split_proxy("cvs", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) | ||
483 | else: | ||
484 | self.configuration.split_proxy("https", self.https_proxy.get_text() + ":" + self.https_proxy_port.get_text()) | ||
485 | self.configuration.split_proxy("ftp", self.ftp_proxy.get_text() + ":" + self.ftp_proxy_port.get_text()) | ||
486 | self.configuration.split_proxy("git", self.git_proxy.get_text() + ":" + self.git_proxy_port.get_text()) | ||
487 | self.configuration.split_proxy("cvs", self.cvs_proxy.get_text() + ":" + self.cvs_proxy_port.get_text()) | ||
488 | |||
489 | self.configuration.extra_setting = {} | 523 | self.configuration.extra_setting = {} |
490 | it = self.setting_store.get_iter_first() | 524 | it = self.setting_store.get_iter_first() |
491 | while it: | 525 | while it: |
@@ -496,6 +530,7 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
496 | 530 | ||
497 | md5 = self.config_md5() | 531 | md5 = self.config_md5() |
498 | self.settings_changed = (self.md5 != md5) | 532 | self.settings_changed = (self.md5 != md5) |
533 | self.proxy_settings_changed = (self.proxy_md5 != self.config_proxy_md5()) | ||
499 | 534 | ||
500 | def create_build_environment_page(self): | 535 | def create_build_environment_page(self): |
501 | advanced_vbox = gtk.VBox(False, 6) | 536 | advanced_vbox = gtk.VBox(False, 6) |
@@ -608,10 +643,91 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
608 | self.show_all() | 643 | self.show_all() |
609 | self.nb.set_current_page(page_num) | 644 | self.nb.set_current_page(page_num) |
610 | 645 | ||
646 | def test_proxy_ended(self, passed): | ||
647 | self.proxy_test_running = False | ||
648 | self.set_test_proxy_state(self.TEST_NETWORK_PASSED if passed else self.TEST_NETWORK_FAILED) | ||
649 | self.set_sensitive(True) | ||
650 | self.refresh_proxy_components() | ||
611 | 651 | ||
612 | def create_proxy_page(self): | 652 | def timer_func(self): |
653 | self.test_proxy_progress.pulse() | ||
654 | return self.proxy_test_running | ||
655 | |||
656 | def test_network_button_cb(self, b): | ||
657 | self.set_test_proxy_state(self.TEST_NETWORK_RUNNING) | ||
658 | self.set_sensitive(False) | ||
659 | self.save_proxy_data() | ||
660 | if self.configuration.enable_proxy == True: | ||
661 | self.handler.set_http_proxy(self.configuration.combine_proxy("http")) | ||
662 | self.handler.set_https_proxy(self.configuration.combine_proxy("https")) | ||
663 | self.handler.set_ftp_proxy(self.configuration.combine_proxy("ftp")) | ||
664 | self.handler.set_git_proxy(self.configuration.combine_host_only("git"), self.configuration.combine_port_only("git")) | ||
665 | self.handler.set_cvs_proxy(self.configuration.combine_host_only("cvs"), self.configuration.combine_port_only("cvs")) | ||
666 | elif self.configuration.enable_proxy == False: | ||
667 | self.handler.set_http_proxy("") | ||
668 | self.handler.set_https_proxy("") | ||
669 | self.handler.set_ftp_proxy("") | ||
670 | self.handler.set_git_proxy("", "") | ||
671 | self.handler.set_cvs_proxy("", "") | ||
672 | self.proxy_test_ran = True | ||
673 | self.proxy_test_running = True | ||
674 | gobject.timeout_add(100, self.timer_func) | ||
675 | self.handler.trigger_network_test() | ||
676 | |||
677 | def test_proxy_focus_event(self, w, direction): | ||
678 | if self.test_proxy_state in [self.TEST_NETWORK_PASSED, self.TEST_NETWORK_FAILED]: | ||
679 | self.set_test_proxy_state(self.TEST_NETWORK_INITIAL) | ||
680 | return False | ||
681 | |||
682 | def http_proxy_changed(self, e): | ||
683 | if not self.configuration.same_proxy: | ||
684 | return | ||
685 | if e == self.http_proxy: | ||
686 | [w.set_text(self.http_proxy.get_text()) for w in self.same_proxy_addresses] | ||
687 | else: | ||
688 | [w.set_text(self.http_proxy_port.get_text()) for w in self.same_proxy_ports] | ||
689 | |||
690 | def proxy_address_focus_out_event(self, w, direction): | ||
691 | text = w.get_text() | ||
692 | if not text: | ||
693 | return False | ||
694 | if text.find("//") == -1: | ||
695 | w.set_text("http://" + text) | ||
696 | return False | ||
697 | |||
698 | def set_test_proxy_state(self, state): | ||
699 | if self.test_proxy_state == state: | ||
700 | return | ||
701 | [self.proxy_table.remove(w) for w in self.test_gui_elements] | ||
702 | if state == self.TEST_NETWORK_INITIAL: | ||
703 | self.proxy_table.attach(self.test_network_button, 1, 2, 5, 6) | ||
704 | self.test_network_button.show() | ||
705 | elif state == self.TEST_NETWORK_RUNNING: | ||
706 | self.test_proxy_progress.set_rcstyle("running") | ||
707 | self.test_proxy_progress.set_text("Testing network configuration") | ||
708 | self.proxy_table.attach(self.test_proxy_progress, 0, 5, 5, 6, xpadding=4) | ||
709 | self.test_proxy_progress.show() | ||
710 | else: # passed or failed | ||
711 | self.dummy_progress.update(1.0) | ||
712 | if state == self.TEST_NETWORK_PASSED: | ||
713 | self.dummy_progress.set_text("Your network is properly configured") | ||
714 | self.dummy_progress.set_rcstyle("running") | ||
715 | else: | ||
716 | self.dummy_progress.set_text("Network test failed") | ||
717 | self.dummy_progress.set_rcstyle("fail") | ||
718 | self.proxy_table.attach(self.dummy_progress, 0, 4, 5, 6) | ||
719 | self.proxy_table.attach(self.retest_network_button, 4, 5, 5, 6, xpadding=4) | ||
720 | self.dummy_progress.show() | ||
721 | self.retest_network_button.show() | ||
722 | self.test_proxy_state = state | ||
723 | |||
724 | def create_network_page(self): | ||
613 | advanced_vbox = gtk.VBox(False, 6) | 725 | advanced_vbox = gtk.VBox(False, 6) |
614 | advanced_vbox.set_border_width(6) | 726 | advanced_vbox.set_border_width(6) |
727 | self.same_proxy_addresses = [] | ||
728 | self.same_proxy_ports = [] | ||
729 | self.all_proxy_ports = [] | ||
730 | self.all_proxy_addresses = [] | ||
615 | 731 | ||
616 | sub_vbox = gtk.VBox(False, 6) | 732 | sub_vbox = gtk.VBox(False, 6) |
617 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) | 733 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) |
@@ -623,42 +739,77 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
623 | hbox.pack_start(info, expand=False, fill=False) | 739 | hbox.pack_start(info, expand=False, fill=False) |
624 | sub_vbox.pack_start(hbox, expand=False, fill=False) | 740 | sub_vbox.pack_start(hbox, expand=False, fill=False) |
625 | 741 | ||
626 | self.direct_checkbox = gtk.RadioButton(None, "Direct internet connection") | 742 | proxy_test_focus = [] |
743 | self.direct_checkbox = gtk.RadioButton(None, "Direct network connection") | ||
744 | proxy_test_focus.append(self.direct_checkbox) | ||
627 | self.direct_checkbox.set_tooltip_text("Check this box to use a direct internet connection with no proxy") | 745 | self.direct_checkbox.set_tooltip_text("Check this box to use a direct internet connection with no proxy") |
628 | self.direct_checkbox.set_active(not self.configuration.enable_proxy) | 746 | self.direct_checkbox.set_active(not self.configuration.enable_proxy) |
629 | sub_vbox.pack_start(self.direct_checkbox, expand=False, fill=False) | 747 | sub_vbox.pack_start(self.direct_checkbox, expand=False, fill=False) |
630 | 748 | ||
631 | self.proxy_checkbox = gtk.RadioButton(self.direct_checkbox, "Manual proxy configuration") | 749 | self.proxy_checkbox = gtk.RadioButton(self.direct_checkbox, "Manual proxy configuration") |
750 | proxy_test_focus.append(self.proxy_checkbox) | ||
632 | self.proxy_checkbox.set_tooltip_text("Check this box to manually set up a specific proxy") | 751 | self.proxy_checkbox.set_tooltip_text("Check this box to manually set up a specific proxy") |
633 | self.proxy_checkbox.set_active(self.configuration.enable_proxy) | 752 | self.proxy_checkbox.set_active(self.configuration.enable_proxy) |
634 | sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False) | 753 | sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False) |
635 | 754 | ||
636 | self.same_checkbox = gtk.CheckButton("Use the same proxy for all protocols") | 755 | self.same_checkbox = gtk.CheckButton("Use the HTTP proxy for all protocols") |
756 | proxy_test_focus.append(self.same_checkbox) | ||
637 | self.same_checkbox.set_tooltip_text("Check this box to use the HTTP proxy for all five proxies") | 757 | self.same_checkbox.set_tooltip_text("Check this box to use the HTTP proxy for all five proxies") |
638 | self.same_checkbox.set_active(self.configuration.same_proxy) | 758 | self.same_checkbox.set_active(self.configuration.same_proxy) |
639 | hbox = gtk.HBox(False, 12) | 759 | hbox = gtk.HBox(False, 12) |
640 | hbox.pack_start(self.same_checkbox, expand=False, fill=False, padding=24) | 760 | hbox.pack_start(self.same_checkbox, expand=False, fill=False, padding=24) |
641 | sub_vbox.pack_start(hbox, expand=False, fill=False) | 761 | sub_vbox.pack_start(hbox, expand=False, fill=False) |
642 | 762 | ||
643 | proxy_widget, self.http_proxy, self.http_proxy_port, self.http_proxy_details = self.gen_proxy_entry_widget( | 763 | self.proxy_table = gtk.Table(6, 5, False) |
644 | "http", self, True) | 764 | self.http_proxy, self.http_proxy_port, self.http_proxy_details = self.gen_proxy_entry_widget( |
645 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 765 | "http", self, True, 0) |
646 | 766 | proxy_test_focus +=[self.http_proxy, self.http_proxy_port] | |
647 | proxy_widget, self.https_proxy, self.https_proxy_port, self.https_proxy_details = self.gen_proxy_entry_widget( | 767 | self.http_proxy.connect("changed", self.http_proxy_changed) |
648 | "https", self, True) | 768 | self.http_proxy_port.connect("changed", self.http_proxy_changed) |
649 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 769 | |
650 | 770 | self.https_proxy, self.https_proxy_port, self.https_proxy_details = self.gen_proxy_entry_widget( | |
651 | proxy_widget, self.ftp_proxy, self.ftp_proxy_port, self.ftp_proxy_details = self.gen_proxy_entry_widget( | 771 | "https", self, True, 1) |
652 | "ftp", self, True) | 772 | proxy_test_focus += [self.https_proxy, self.https_proxy_port] |
653 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 773 | self.same_proxy_addresses.append(self.https_proxy) |
654 | 774 | self.same_proxy_ports.append(self.https_proxy_port) | |
655 | proxy_widget, self.git_proxy, self.git_proxy_port, self.git_proxy_details = self.gen_proxy_entry_widget( | 775 | |
656 | "git", self, True) | 776 | self.ftp_proxy, self.ftp_proxy_port, self.ftp_proxy_details = self.gen_proxy_entry_widget( |
657 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 777 | "ftp", self, True, 2) |
658 | 778 | proxy_test_focus += [self.ftp_proxy, self.ftp_proxy_port] | |
659 | proxy_widget, self.cvs_proxy, self.cvs_proxy_port, self.cvs_proxy_details = self.gen_proxy_entry_widget( | 779 | self.same_proxy_addresses.append(self.ftp_proxy) |
660 | "cvs", self, True) | 780 | self.same_proxy_ports.append(self.ftp_proxy_port) |
661 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 781 | |
782 | self.git_proxy, self.git_proxy_port, self.git_proxy_details = self.gen_proxy_entry_widget( | ||
783 | "git", self, True, 3) | ||
784 | proxy_test_focus += [self.git_proxy, self.git_proxy_port] | ||
785 | self.same_proxy_addresses.append(self.git_proxy) | ||
786 | self.same_proxy_ports.append(self.git_proxy_port) | ||
787 | |||
788 | self.cvs_proxy, self.cvs_proxy_port, self.cvs_proxy_details = self.gen_proxy_entry_widget( | ||
789 | "cvs", self, True, 4) | ||
790 | proxy_test_focus += [self.cvs_proxy, self.cvs_proxy_port] | ||
791 | self.same_proxy_addresses.append(self.cvs_proxy) | ||
792 | self.same_proxy_ports.append(self.cvs_proxy_port) | ||
793 | self.all_proxy_ports = self.same_proxy_ports + [self.http_proxy_port] | ||
794 | self.all_proxy_addresses = self.same_proxy_addresses + [self.http_proxy] | ||
795 | sub_vbox.pack_start(self.proxy_table, expand=False, fill=False) | ||
796 | self.proxy_table.show_all() | ||
797 | |||
798 | # Create the graphical elements for the network test feature, but don't display them yet | ||
799 | self.test_network_button = HobAltButton("Test network configuration") | ||
800 | self.test_network_button.connect("clicked", self.test_network_button_cb) | ||
801 | self.test_proxy_progress = HobProgressBar() | ||
802 | self.dummy_progress = HobProgressBar() | ||
803 | self.retest_network_button = HobAltButton("Retest") | ||
804 | self.retest_network_button.connect("clicked", self.test_network_button_cb) | ||
805 | self.test_gui_elements = [self.test_network_button, self.test_proxy_progress, self.dummy_progress, self.retest_network_button] | ||
806 | # Initialize the network tester | ||
807 | self.test_proxy_state = self.TEST_NETWORK_NONE | ||
808 | self.set_test_proxy_state(self.TEST_NETWORK_INITIAL) | ||
809 | self.proxy_test_passed_id = self.handler.connect("network-passed", lambda h:self.test_proxy_ended(True)) | ||
810 | self.proxy_test_failed_id = self.handler.connect("network-failed", lambda h:self.test_proxy_ended(False)) | ||
811 | [w.connect("focus-in-event", self.test_proxy_focus_event) for w in proxy_test_focus] | ||
812 | [w.connect("focus-out-event", self.proxy_address_focus_out_event) for w in self.all_proxy_addresses] | ||
662 | 813 | ||
663 | self.direct_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb) | 814 | self.direct_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb) |
664 | self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb) | 815 | self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb) |
@@ -840,7 +991,7 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
840 | self.nb.set_show_tabs(True) | 991 | self.nb.set_show_tabs(True) |
841 | self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment")) | 992 | self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment")) |
842 | self.nb.append_page(self.create_shared_state_page(), gtk.Label("Shared state")) | 993 | self.nb.append_page(self.create_shared_state_page(), gtk.Label("Shared state")) |
843 | self.nb.append_page(self.create_proxy_page(), gtk.Label("Proxies")) | 994 | self.nb.append_page(self.create_network_page(), gtk.Label("Network")) |
844 | self.nb.append_page(self.create_others_page(), gtk.Label("Others")) | 995 | self.nb.append_page(self.create_others_page(), gtk.Label("Others")) |
845 | self.nb.set_current_page(0) | 996 | self.nb.set_current_page(0) |
846 | self.vbox.pack_start(self.nb, expand=True, fill=True) | 997 | self.vbox.pack_start(self.nb, expand=True, fill=True) |
@@ -848,6 +999,11 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): | |||
848 | 999 | ||
849 | self.show_all() | 1000 | self.show_all() |
850 | 1001 | ||
1002 | def destroy(self): | ||
1003 | self.handler.disconnect(self.proxy_test_passed_id) | ||
1004 | self.handler.disconnect(self.proxy_test_failed_id) | ||
1005 | super(SimpleSettingsDialog, self).destroy() | ||
1006 | |||
851 | 1007 | ||
852 | # | 1008 | # |
853 | # AdvancedSettings Dialog | 1009 | # AdvancedSettings Dialog |