diff options
author | Shane Wang <shane.wang@intel.com> | 2012-05-22 19:33:23 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-22 14:56:15 +0100 |
commit | e069e53536e4894507a72da79e7e8af55a0d31b1 (patch) | |
tree | 5180cb5e2a1443b52cced8ac42dfd6d17c2c0a8f | |
parent | 33c4bf2096effc850720009564e3d1adbda24452 (diff) | |
download | poky-e069e53536e4894507a72da79e7e8af55a0d31b1.tar.gz |
Hob: reimplement the proxy page
This patch is to reimplement the proxy page in the "Advanced Settings" dialog
per the new design in https://bugzilla.yoctoproject.org/attachment.cgi?id=442
and https://bugzilla.yoctoproject.org/attachment.cgi?id=443.
[Yocto #2247]
(Bitbake rev: 911a60c09c1539a3f10c2bcdb26d40e458c31303)
Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/builder.py | 143 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig.py | 273 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 4 |
3 files changed, 309 insertions, 111 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index 42d0f2ca0e..3282fdf52c 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -26,6 +26,7 @@ import copy | |||
26 | import os | 26 | import os |
27 | import subprocess | 27 | import subprocess |
28 | import shlex | 28 | import shlex |
29 | import re | ||
29 | from bb.ui.crumbs.template import TemplateMgr | 30 | from bb.ui.crumbs.template import TemplateMgr |
30 | from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage | 31 | from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage |
31 | from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage | 32 | from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage |
@@ -42,6 +43,44 @@ import bb.ui.crumbs.utils | |||
42 | class Configuration: | 43 | class Configuration: |
43 | '''Represents the data structure of configuration.''' | 44 | '''Represents the data structure of configuration.''' |
44 | 45 | ||
46 | @classmethod | ||
47 | def parse_proxy_string(cls, proxy): | ||
48 | pattern = "^\s*((http|https|ftp|git|cvs)://)?((\S+):(\S+)@)?(\S+):(\d+)/?" | ||
49 | match = re.search(pattern, proxy) | ||
50 | if match: | ||
51 | return match.group(2), match.group(4), match.group(5), match.group(6), match.group(7) | ||
52 | else: | ||
53 | return None, None, None, "", "" | ||
54 | |||
55 | @classmethod | ||
56 | def make_host_string(cls, prot, user, passwd, host, default_prot=""): | ||
57 | if host == None or host == "": | ||
58 | return "" | ||
59 | |||
60 | passwd = passwd or "" | ||
61 | |||
62 | if user != None and user != "": | ||
63 | if prot == None or prot == "": | ||
64 | prot = default_prot | ||
65 | return prot + "://" + user + ":" + passwd + "@" + host | ||
66 | else: | ||
67 | if prot == None or prot == "": | ||
68 | return host | ||
69 | else: | ||
70 | return prot + "://" + host | ||
71 | |||
72 | @classmethod | ||
73 | def make_port_string(cls, port): | ||
74 | port = port or "" | ||
75 | return port | ||
76 | |||
77 | @classmethod | ||
78 | def make_proxy_string(cls, prot, user, passwd, host, port, default_prot=""): | ||
79 | if host == None or host == "" or port == None or port == "": | ||
80 | return "" | ||
81 | |||
82 | return Configuration.make_host_string(prot, user, passwd, host, default_prot) + ":" + Configuration.make_port_string(port) | ||
83 | |||
45 | def __init__(self): | 84 | def __init__(self): |
46 | self.curr_mach = "" | 85 | self.curr_mach = "" |
47 | # settings | 86 | # settings |
@@ -67,15 +106,43 @@ class Configuration: | |||
67 | self.default_task = "build" | 106 | self.default_task = "build" |
68 | 107 | ||
69 | # proxy settings | 108 | # proxy settings |
70 | self.all_proxy = self.http_proxy = self.ftp_proxy = self.https_proxy = "" | 109 | self.enable_proxy = None |
71 | self.git_proxy_host = self.git_proxy_port = "" | 110 | self.same_proxy = False |
72 | self.cvs_proxy_host = self.cvs_proxy_port = "" | 111 | self.proxies = { |
112 | "http" : [None, None, None, "", ""], # protocol : [prot, user, passwd, host, port] | ||
113 | "https" : [None, None, None, "", ""], | ||
114 | "ftp" : [None, None, None, "", ""], | ||
115 | "git" : [None, None, None, "", ""], | ||
116 | "cvs" : [None, None, None, "", ""], | ||
117 | } | ||
73 | 118 | ||
74 | def clear_selection(self): | 119 | def clear_selection(self): |
75 | self.selected_image = None | 120 | self.selected_image = None |
76 | self.selected_recipes = [] | 121 | self.selected_recipes = [] |
77 | self.selected_packages = [] | 122 | self.selected_packages = [] |
78 | 123 | ||
124 | def split_proxy(self, protocol, proxy): | ||
125 | entry = [] | ||
126 | prot, user, passwd, host, port = Configuration.parse_proxy_string(proxy) | ||
127 | entry.append(prot) | ||
128 | entry.append(user) | ||
129 | entry.append(passwd) | ||
130 | entry.append(host) | ||
131 | entry.append(port) | ||
132 | self.proxies[protocol] = entry | ||
133 | |||
134 | def combine_proxy(self, protocol): | ||
135 | entry = self.proxies[protocol] | ||
136 | return Configuration.make_proxy_string(entry[0], entry[1], entry[2], entry[3], entry[4], protocol) | ||
137 | |||
138 | def combine_host_only(self, protocol): | ||
139 | entry = self.proxies[protocol] | ||
140 | return Configuration.make_host_string(entry[0], entry[1], entry[2], entry[3], protocol) | ||
141 | |||
142 | def combine_port_only(self, protocol): | ||
143 | entry = self.proxies[protocol] | ||
144 | return Configuration.make_port_string(entry[4]) | ||
145 | |||
79 | def update(self, params): | 146 | def update(self, params): |
80 | # settings | 147 | # settings |
81 | self.curr_distro = params["distro"] | 148 | self.curr_distro = params["distro"] |
@@ -99,14 +166,14 @@ class Configuration: | |||
99 | self.default_task = params["default_task"] | 166 | self.default_task = params["default_task"] |
100 | 167 | ||
101 | # proxy settings | 168 | # proxy settings |
102 | self.all_proxy = params["all_proxy"] | 169 | self.enable_proxy = params["http_proxy"] != "" or params["https_proxy"] != "" or params["ftp_proxy"] != "" \ |
103 | self.http_proxy = params["http_proxy"] | 170 | or params["git_proxy_host"] != "" or params["git_proxy_port"] != "" \ |
104 | self.ftp_proxy = params["ftp_proxy"] | 171 | or params["cvs_proxy_host"] != "" or params["cvs_proxy_port"] != "" |
105 | self.https_proxy = params["https_proxy"] | 172 | self.split_proxy("http", params["http_proxy"]) |
106 | self.git_proxy_host = params["git_proxy_host"] | 173 | self.split_proxy("https", params["https_proxy"]) |
107 | self.git_proxy_port = params["git_proxy_port"] | 174 | self.split_proxy("ftp", params["ftp_proxy"]) |
108 | self.cvs_proxy_host = params["cvs_proxy_host"] | 175 | self.split_proxy("git", params["git_proxy_host"] + ":" + params["git_proxy_port"]) |
109 | self.cvs_proxy_port = params["cvs_proxy_port"] | 176 | self.split_proxy("cvs", params["cvs_proxy_host"] + ":" + params["cvs_proxy_port"]) |
110 | 177 | ||
111 | def load(self, template): | 178 | def load(self, template): |
112 | self.curr_mach = template.getVar("MACHINE") | 179 | self.curr_mach = template.getVar("MACHINE") |
@@ -146,14 +213,13 @@ class Configuration: | |||
146 | self.selected_recipes = template.getVar("DEPENDS").split() | 213 | self.selected_recipes = template.getVar("DEPENDS").split() |
147 | self.selected_packages = template.getVar("IMAGE_INSTALL").split() | 214 | self.selected_packages = template.getVar("IMAGE_INSTALL").split() |
148 | # proxy | 215 | # proxy |
149 | self.all_proxy = template.getVar("all_proxy") | 216 | self.enable_proxy = eval(template.getVar("enable_proxy")) |
150 | self.http_proxy = template.getVar("http_proxy") | 217 | self.same_proxy = eval(template.getVar("use_same_proxy")) |
151 | self.ftp_proxy = template.getVar("ftp_proxy") | 218 | self.split_proxy("http", template.getVar("http_proxy")) |
152 | self.https_proxy = template.getVar("https_proxy") | 219 | self.split_proxy("https", template.getVar("https_proxy")) |
153 | self.git_proxy_host = template.getVar("GIT_PROXY_HOST") | 220 | self.split_proxy("ftp", template.getVar("ftp_proxy")) |
154 | self.git_proxy_port = template.getVar("GIT_PROXY_PORT") | 221 | self.split_proxy("git", template.getVar("GIT_PROXY_HOST") + ":" + template.getVar("GIT_PROXY_PORT")) |
155 | self.cvs_proxy_host = template.getVar("CVS_PROXY_HOST") | 222 | self.split_proxy("cvs", template.getVar("CVS_PROXY_HOST") + ":" + template.getVar("CVS_PROXY_PORT")) |
156 | self.cvs_proxy_port = template.getVar("CVS_PROXY_PORT") | ||
157 | 223 | ||
158 | def save(self, template, defaults=False): | 224 | def save(self, template, defaults=False): |
159 | # bblayers.conf | 225 | # bblayers.conf |
@@ -183,14 +249,15 @@ class Configuration: | |||
183 | template.setVar("DEPENDS", self.selected_recipes) | 249 | template.setVar("DEPENDS", self.selected_recipes) |
184 | template.setVar("IMAGE_INSTALL", self.user_selected_packages) | 250 | template.setVar("IMAGE_INSTALL", self.user_selected_packages) |
185 | # proxy | 251 | # proxy |
186 | template.setVar("all_proxy", self.all_proxy) | 252 | template.setVar("enable_proxy", self.enable_proxy) |
187 | template.setVar("http_proxy", self.http_proxy) | 253 | template.setVar("use_same_proxy", self.same_proxy) |
188 | template.setVar("ftp_proxy", self.ftp_proxy) | 254 | template.setVar("http_proxy", self.combine_proxy("http")) |
189 | template.setVar("https_proxy", self.https_proxy) | 255 | template.setVar("https_proxy", self.combine_proxy("https")) |
190 | template.setVar("GIT_PROXY_HOST", self.git_proxy_host) | 256 | template.setVar("ftp_proxy", self.combine_proxy("ftp")) |
191 | template.setVar("GIT_PROXY_PORT", self.git_proxy_port) | 257 | template.setVar("GIT_PROXY_HOST", self.combine_host_only("git")) |
192 | template.setVar("CVS_PROXY_HOST", self.cvs_proxy_host) | 258 | template.setVar("GIT_PROXY_PORT", self.combine_port_only("git")) |
193 | template.setVar("CVS_PROXY_PORT", self.cvs_proxy_port) | 259 | template.setVar("CVS_PROXY_HOST", self.combine_host_only("cvs")) |
260 | template.setVar("CVS_PROXY_PORT", self.combine_port_only("cvs")) | ||
194 | 261 | ||
195 | class Parameters: | 262 | class Parameters: |
196 | '''Represents other variables like available machines, etc.''' | 263 | '''Represents other variables like available machines, etc.''' |
@@ -212,7 +279,6 @@ class Parameters: | |||
212 | self.all_sdk_machines = [] | 279 | self.all_sdk_machines = [] |
213 | self.all_layers = [] | 280 | self.all_layers = [] |
214 | self.image_names = [] | 281 | self.image_names = [] |
215 | self.enable_proxy = False | ||
216 | 282 | ||
217 | # for build log to show | 283 | # for build log to show |
218 | self.bb_version = "" | 284 | self.bb_version = "" |
@@ -578,13 +644,18 @@ class Builder(gtk.Window): | |||
578 | self.handler.set_extra_inherit("packageinfo") | 644 | self.handler.set_extra_inherit("packageinfo") |
579 | self.handler.set_extra_inherit("image_types") | 645 | self.handler.set_extra_inherit("image_types") |
580 | # set proxies | 646 | # set proxies |
581 | if self.parameters.enable_proxy: | 647 | if self.configuration.enable_proxy == True: |
582 | self.handler.set_http_proxy(self.configuration.http_proxy) | 648 | self.handler.set_http_proxy(self.configuration.combine_proxy("http")) |
583 | self.handler.set_https_proxy(self.configuration.https_proxy) | 649 | self.handler.set_https_proxy(self.configuration.combine_proxy("https")) |
584 | self.handler.set_ftp_proxy(self.configuration.ftp_proxy) | 650 | self.handler.set_ftp_proxy(self.configuration.combine_proxy("ftp")) |
585 | self.handler.set_all_proxy(self.configuration.all_proxy) | 651 | self.handler.set_git_proxy(self.configuration.combine_host_only("git"), self.configuration.combine_port_only("git")) |
586 | self.handler.set_git_proxy(self.configuration.git_proxy_host, self.configuration.git_proxy_port) | 652 | self.handler.set_cvs_proxy(self.configuration.combine_host_only("cvs"), self.configuration.combine_port_only("cvs")) |
587 | self.handler.set_cvs_proxy(self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port) | 653 | elif self.configuration.enable_proxy == False: |
654 | self.handler.set_http_proxy("") | ||
655 | self.handler.set_https_proxy("") | ||
656 | self.handler.set_ftp_proxy("") | ||
657 | self.handler.set_git_proxy("", "") | ||
658 | self.handler.set_cvs_proxy("", "") | ||
588 | 659 | ||
589 | def update_recipe_model(self, selected_image, selected_recipes): | 660 | def update_recipe_model(self, selected_image, selected_recipes): |
590 | self.recipe_model.set_selected_image(selected_image) | 661 | self.recipe_model.set_selected_image(selected_image) |
@@ -996,7 +1067,6 @@ class Builder(gtk.Window): | |||
996 | all_distros = self.parameters.all_distros, | 1067 | all_distros = self.parameters.all_distros, |
997 | all_sdk_machines = self.parameters.all_sdk_machines, | 1068 | all_sdk_machines = self.parameters.all_sdk_machines, |
998 | max_threads = self.parameters.max_threads, | 1069 | max_threads = self.parameters.max_threads, |
999 | enable_proxy = self.parameters.enable_proxy, | ||
1000 | parent = self, | 1070 | parent = self, |
1001 | flags = gtk.DIALOG_MODAL | 1071 | flags = gtk.DIALOG_MODAL |
1002 | | gtk.DIALOG_DESTROY_WITH_PARENT | 1072 | | gtk.DIALOG_DESTROY_WITH_PARENT |
@@ -1008,7 +1078,6 @@ class Builder(gtk.Window): | |||
1008 | response = dialog.run() | 1078 | response = dialog.run() |
1009 | settings_changed = False | 1079 | settings_changed = False |
1010 | if response == gtk.RESPONSE_YES: | 1080 | if response == gtk.RESPONSE_YES: |
1011 | self.parameters.enable_proxy = dialog.enable_proxy | ||
1012 | self.configuration = dialog.configuration | 1081 | self.configuration = dialog.configuration |
1013 | self.save_defaults() # remember settings | 1082 | self.save_defaults() # remember settings |
1014 | settings_changed = dialog.settings_changed | 1083 | settings_changed = dialog.settings_changed |
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py index 721d145a6a..1bc155d008 100644 --- a/bitbake/lib/bb/ui/crumbs/hig.py +++ b/bitbake/lib/bb/ui/crumbs/hig.py | |||
@@ -172,6 +172,45 @@ class AdvancedSettingDialog (CrumbsDialog): | |||
172 | hbox.show_all() | 172 | hbox.show_all() |
173 | return hbox, entry | 173 | return hbox, entry |
174 | 174 | ||
175 | def details_cb(self, button, parent, protocol): | ||
176 | dialog = ProxyDetailsDialog(title = protocol.upper() + " Proxy Details", | ||
177 | user = self.configuration.proxies[protocol][1], | ||
178 | passwd = self.configuration.proxies[protocol][2], | ||
179 | parent = parent, | ||
180 | flags = gtk.DIALOG_MODAL | ||
181 | | gtk.DIALOG_DESTROY_WITH_PARENT | ||
182 | | gtk.DIALOG_NO_SEPARATOR) | ||
183 | dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_OK) | ||
184 | response = dialog.run() | ||
185 | if response == gtk.RESPONSE_OK: | ||
186 | self.configuration.proxies[protocol][1] = dialog.user | ||
187 | self.configuration.proxies[protocol][2] = dialog.passwd | ||
188 | self.refresh_proxy_components() | ||
189 | dialog.destroy() | ||
190 | |||
191 | def gen_proxy_entry_widget(self, protocol, parent, need_button=True): | ||
192 | hbox = gtk.HBox(False, 12) | ||
193 | |||
194 | label = gtk.Label(protocol.upper() + " proxy") | ||
195 | hbox.pack_start(label, expand=True, fill=False, padding=24) | ||
196 | |||
197 | proxy_entry = gtk.Entry() | ||
198 | proxy_entry.set_size_request(300, -1) | ||
199 | hbox.pack_start(proxy_entry, expand=False, fill=False) | ||
200 | |||
201 | hbox.pack_start(gtk.Label(":"), expand=False, fill=False) | ||
202 | |||
203 | port_entry = gtk.Entry() | ||
204 | port_entry.set_size_request(60, -1) | ||
205 | hbox.pack_start(port_entry, expand=False, fill=False) | ||
206 | |||
207 | details_button = HobAltButton("Details") | ||
208 | details_button.connect("clicked", self.details_cb, parent, protocol) | ||
209 | hbox.pack_start(details_button, expand=False, fill=False) | ||
210 | |||
211 | hbox.show_all() | ||
212 | return hbox, proxy_entry, port_entry, details_button | ||
213 | |||
175 | def rootfs_combo_changed_cb(self, rootfs_combo, all_package_format, check_hbox): | 214 | def rootfs_combo_changed_cb(self, rootfs_combo, all_package_format, check_hbox): |
176 | combo_item = self.rootfs_combo.get_active_text() | 215 | combo_item = self.rootfs_combo.get_active_text() |
177 | for child in check_hbox.get_children(): | 216 | for child in check_hbox.get_children(): |
@@ -309,7 +348,7 @@ class AdvancedSettingDialog (CrumbsDialog): | |||
309 | 348 | ||
310 | def __init__(self, title, configuration, all_image_types, | 349 | def __init__(self, title, configuration, all_image_types, |
311 | all_package_formats, all_distros, all_sdk_machines, | 350 | all_package_formats, all_distros, all_sdk_machines, |
312 | max_threads, enable_proxy, parent, flags, buttons=None): | 351 | max_threads, parent, flags, buttons=None): |
313 | super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons) | 352 | super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons) |
314 | 353 | ||
315 | # class members from other objects | 354 | # class members from other objects |
@@ -320,7 +359,6 @@ class AdvancedSettingDialog (CrumbsDialog): | |||
320 | self.all_distros = all_distros | 359 | self.all_distros = all_distros |
321 | self.all_sdk_machines = all_sdk_machines | 360 | self.all_sdk_machines = all_sdk_machines |
322 | self.max_threads = max_threads | 361 | self.max_threads = max_threads |
323 | self.enable_proxy = enable_proxy | ||
324 | 362 | ||
325 | # class members for internal use | 363 | # class members for internal use |
326 | self.distro_combo = None | 364 | self.distro_combo = None |
@@ -356,15 +394,10 @@ class AdvancedSettingDialog (CrumbsDialog): | |||
356 | data += ("SDK_MACHINE: " + self._get_sorted_value(self.configuration.curr_sdk_machine)) | 394 | data += ("SDK_MACHINE: " + self._get_sorted_value(self.configuration.curr_sdk_machine)) |
357 | data += ("TOOLCHAIN_BUILD: " + self._get_sorted_value(self.configuration.toolchain_build)) | 395 | data += ("TOOLCHAIN_BUILD: " + self._get_sorted_value(self.configuration.toolchain_build)) |
358 | data += ("IMAGE_FSTYPES: " + self._get_sorted_value(self.configuration.image_fstypes)) | 396 | data += ("IMAGE_FSTYPES: " + self._get_sorted_value(self.configuration.image_fstypes)) |
359 | if self.enable_proxy: | 397 | data += ("ENABLE_PROXY: " + self._get_sorted_value(self.configuration.enable_proxy)) |
360 | data += ("ALL_PROXY: " + self._get_sorted_value(self.configuration.all_proxy)) | 398 | if self.configuration.enable_proxy: |
361 | data += ("HTTP_PROXY: " + self._get_sorted_value(self.configuration.http_proxy)) | 399 | for protocol in self.configuration.proxies.keys(): |
362 | data += ("HTTPS_PROXY: " + self._get_sorted_value(self.configuration.https_proxy)) | 400 | data += (protocol + ": " + self._get_sorted_value(self.configuration.combine_proxy(protocol))) |
363 | data += ("FTP_PROXY: " + self._get_sorted_value(self.configuration.ftp_proxy)) | ||
364 | data += ("GIT_PROXY_HOST: " + self._get_sorted_value(self.configuration.git_proxy_host)) | ||
365 | data += ("GIT_PROXY_PORT: " + self._get_sorted_value(self.configuration.git_proxy_port)) | ||
366 | data += ("CVS_PROXY_HOST: " + self._get_sorted_value(self.configuration.cvs_proxy_host)) | ||
367 | data += ("CVS_PROXY_PORT: " + self._get_sorted_value(self.configuration.cvs_proxy_port)) | ||
368 | for key in self.configuration.extra_setting.keys(): | 401 | for key in self.configuration.extra_setting.keys(): |
369 | data += (key + ": " + self._get_sorted_value(self.configuration.extra_setting[key])) | 402 | data += (key + ": " + self._get_sorted_value(self.configuration.extra_setting[key])) |
370 | return hashlib.md5(data).hexdigest() | 403 | return hashlib.md5(data).hexdigest() |
@@ -529,60 +562,56 @@ class AdvancedSettingDialog (CrumbsDialog): | |||
529 | 562 | ||
530 | sub_vbox = gtk.VBox(False, 6) | 563 | sub_vbox = gtk.VBox(False, 6) |
531 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) | 564 | advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) |
532 | self.proxy_checkbox = gtk.CheckButton("Enable proxy") | 565 | label = self.gen_label_widget("<span weight=\"bold\">Set the proxies that will be used during fetching source code</span>") |
566 | tooltip = "Set the proxies that will be used during fetching source code or set none for direct the Internet connection" | ||
567 | info = HobInfoButton(tooltip, self) | ||
568 | hbox = gtk.HBox(False, 12) | ||
569 | hbox.pack_start(label, expand=True, fill=True) | ||
570 | hbox.pack_start(info, expand=False, fill=False) | ||
571 | sub_vbox.pack_start(hbox, expand=False, fill=False) | ||
572 | |||
573 | self.direct_checkbox = gtk.RadioButton(None, "Direct internet connection") | ||
574 | self.direct_checkbox.set_tooltip_text("Check this box to connect the Internet directly without any proxy") | ||
575 | self.direct_checkbox.set_active(not self.configuration.enable_proxy) | ||
576 | sub_vbox.pack_start(self.direct_checkbox, expand=False, fill=False) | ||
577 | |||
578 | self.proxy_checkbox = gtk.RadioButton(self.direct_checkbox, "Manual proxy configuration") | ||
533 | self.proxy_checkbox.set_tooltip_text("Check this box to setup the proxy you specified") | 579 | self.proxy_checkbox.set_tooltip_text("Check this box to setup the proxy you specified") |
534 | self.proxy_checkbox.set_active(self.enable_proxy) | 580 | self.proxy_checkbox.set_active(self.configuration.enable_proxy) |
535 | self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb) | ||
536 | sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False) | 581 | sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False) |
537 | 582 | ||
538 | label = self.gen_label_widget("<span weight=\"bold\">Set all proxy:</span>") | 583 | self.same_checkbox = gtk.CheckButton("Use the same proxy for all protocols") |
539 | tooltip = "Set the all proxy that will be used if the proxy for a URL isn't specified." | 584 | self.same_checkbox.set_tooltip_text("Use the same proxy as the first proxy i.e. http proxy for all protocols") |
540 | proxy_widget, self.all_proxy_text = self.gen_entry_widget(self.configuration.all_proxy, self, tooltip, False) | 585 | self.same_checkbox.set_active(self.configuration.same_proxy) |
541 | self.all_proxy_text.set_editable(self.enable_proxy) | 586 | hbox = gtk.HBox(False, 12) |
542 | self.all_proxy_text.set_sensitive(self.enable_proxy) | 587 | hbox.pack_start(self.same_checkbox, expand=False, fill=False, padding=24) |
543 | sub_vbox.pack_start(label, expand=False, fill=False) | 588 | sub_vbox.pack_start(hbox, expand=False, fill=False) |
544 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | ||
545 | 589 | ||
546 | label = self.gen_label_widget("<span weight=\"bold\">Set http proxy:</span>") | 590 | proxy_widget, self.http_proxy, self.http_proxy_port, self.http_proxy_details = self.gen_proxy_entry_widget( |
547 | tooltip = "Set the http proxy that will be used in do_fetch() source code" | 591 | "http", self, True) |
548 | proxy_widget, self.http_proxy_text = self.gen_entry_widget(self.configuration.http_proxy, self, tooltip, False) | ||
549 | self.http_proxy_text.set_editable(self.enable_proxy) | ||
550 | self.http_proxy_text.set_sensitive(self.enable_proxy) | ||
551 | sub_vbox.pack_start(label, expand=False, fill=False) | ||
552 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 592 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) |
553 | 593 | ||
554 | label = self.gen_label_widget("<span weight=\"bold\">Set https proxy:</span>") | 594 | proxy_widget, self.https_proxy, self.https_proxy_port, self.https_proxy_details = self.gen_proxy_entry_widget( |
555 | tooltip = "Set the https proxy that will be used in do_fetch() source code" | 595 | "https", self, True) |
556 | proxy_widget, self.https_proxy_text = self.gen_entry_widget(self.configuration.https_proxy, self, tooltip, False) | ||
557 | self.https_proxy_text.set_editable(self.enable_proxy) | ||
558 | self.https_proxy_text.set_sensitive(self.enable_proxy) | ||
559 | sub_vbox.pack_start(label, expand=False, fill=False) | ||
560 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 596 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) |
561 | 597 | ||
562 | label = self.gen_label_widget("<span weight=\"bold\">Set ftp proxy:</span>") | 598 | proxy_widget, self.ftp_proxy, self.ftp_proxy_port, self.ftp_proxy_details = self.gen_proxy_entry_widget( |
563 | tooltip = "Set the ftp proxy that will be used in do_fetch() source code" | 599 | "ftp", self, True) |
564 | proxy_widget, self.ftp_proxy_text = self.gen_entry_widget(self.configuration.ftp_proxy, self, tooltip, False) | ||
565 | self.ftp_proxy_text.set_editable(self.enable_proxy) | ||
566 | self.ftp_proxy_text.set_sensitive(self.enable_proxy) | ||
567 | sub_vbox.pack_start(label, expand=False, fill=False) | ||
568 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 600 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) |
569 | 601 | ||
570 | label = self.gen_label_widget("<span weight=\"bold\">Set git proxy:</span>") | 602 | proxy_widget, self.git_proxy, self.git_proxy_port, self.git_proxy_details = self.gen_proxy_entry_widget( |
571 | tooltip = "Set the git proxy that will be used in do_fetch() source code" | 603 | "git", self, True) |
572 | proxy_widget, self.git_proxy_text = self.gen_entry_widget(self.configuration.git_proxy_host + ':' + self.configuration.git_proxy_port, self, tooltip, False) | ||
573 | self.git_proxy_text.set_editable(self.enable_proxy) | ||
574 | self.git_proxy_text.set_sensitive(self.enable_proxy) | ||
575 | sub_vbox.pack_start(label, expand=False, fill=False) | ||
576 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 604 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) |
577 | 605 | ||
578 | label = self.gen_label_widget("<span weight=\"bold\">Set cvs proxy:</span>") | 606 | proxy_widget, self.cvs_proxy, self.cvs_proxy_port, self.cvs_proxy_details = self.gen_proxy_entry_widget( |
579 | tooltip = "Set the cvs proxy that will be used in do_fetch() source code" | 607 | "cvs", self, True) |
580 | proxy_widget, self.cvs_proxy_text = self.gen_entry_widget(self.configuration.cvs_proxy_host + ':' + self.configuration.cvs_proxy_port, self, tooltip, False) | ||
581 | self.cvs_proxy_text.set_editable(self.enable_proxy) | ||
582 | self.cvs_proxy_text.set_sensitive(self.enable_proxy) | ||
583 | sub_vbox.pack_start(label, expand=False, fill=False) | ||
584 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) | 608 | sub_vbox.pack_start(proxy_widget, expand=False, fill=False) |
585 | 609 | ||
610 | self.direct_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb) | ||
611 | self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb) | ||
612 | self.same_checkbox.connect("toggled", self.same_checkbox_toggled_cb) | ||
613 | |||
614 | self.refresh_proxy_components() | ||
586 | return advanced_vbox | 615 | return advanced_vbox |
587 | 616 | ||
588 | def create_others_page(self): | 617 | def create_others_page(self): |
@@ -599,20 +628,59 @@ class AdvancedSettingDialog (CrumbsDialog): | |||
599 | 628 | ||
600 | return advanced_vbox | 629 | return advanced_vbox |
601 | 630 | ||
631 | def refresh_proxy_components(self): | ||
632 | self.same_checkbox.set_sensitive(self.configuration.enable_proxy) | ||
633 | |||
634 | self.http_proxy.set_text(self.configuration.combine_host_only("http")) | ||
635 | self.http_proxy.set_editable(self.configuration.enable_proxy) | ||
636 | self.http_proxy.set_sensitive(self.configuration.enable_proxy) | ||
637 | self.http_proxy_port.set_text(self.configuration.combine_port_only("http")) | ||
638 | self.http_proxy_port.set_editable(self.configuration.enable_proxy) | ||
639 | self.http_proxy_port.set_sensitive(self.configuration.enable_proxy) | ||
640 | self.http_proxy_details.set_sensitive(self.configuration.enable_proxy) | ||
641 | |||
642 | self.https_proxy.set_text(self.configuration.combine_host_only("https")) | ||
643 | self.https_proxy.set_editable(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
644 | self.https_proxy.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
645 | self.https_proxy_port.set_text(self.configuration.combine_port_only("https")) | ||
646 | self.https_proxy_port.set_editable(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
647 | self.https_proxy_port.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
648 | self.https_proxy_details.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
649 | |||
650 | self.ftp_proxy.set_text(self.configuration.combine_host_only("ftp")) | ||
651 | self.ftp_proxy.set_editable(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
652 | self.ftp_proxy.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
653 | self.ftp_proxy_port.set_text(self.configuration.combine_port_only("ftp")) | ||
654 | self.ftp_proxy_port.set_editable(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
655 | self.ftp_proxy_port.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
656 | self.ftp_proxy_details.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
657 | |||
658 | self.git_proxy.set_text(self.configuration.combine_host_only("git")) | ||
659 | self.git_proxy.set_editable(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
660 | self.git_proxy.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
661 | self.git_proxy_port.set_text(self.configuration.combine_port_only("git")) | ||
662 | self.git_proxy_port.set_editable(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
663 | self.git_proxy_port.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
664 | self.git_proxy_details.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
665 | |||
666 | self.cvs_proxy.set_text(self.configuration.combine_host_only("cvs")) | ||
667 | self.cvs_proxy.set_editable(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
668 | self.cvs_proxy.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
669 | self.cvs_proxy_port.set_text(self.configuration.combine_port_only("cvs")) | ||
670 | self.cvs_proxy_port.set_editable(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
671 | self.cvs_proxy_port.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
672 | self.cvs_proxy_details.set_sensitive(self.configuration.enable_proxy and (not self.configuration.same_proxy)) | ||
673 | |||
602 | def proxy_checkbox_toggled_cb(self, button): | 674 | def proxy_checkbox_toggled_cb(self, button): |
603 | self.enable_proxy = self.proxy_checkbox.get_active() | 675 | self.configuration.enable_proxy = self.proxy_checkbox.get_active() |
604 | self.all_proxy_text.set_editable(self.enable_proxy) | 676 | if not self.configuration.enable_proxy: |
605 | self.all_proxy_text.set_sensitive(self.enable_proxy) | 677 | self.configuration.same_proxy = False |
606 | self.http_proxy_text.set_editable(self.enable_proxy) | 678 | self.same_checkbox.set_active(self.configuration.same_proxy) |
607 | self.http_proxy_text.set_sensitive(self.enable_proxy) | 679 | self.refresh_proxy_components() |
608 | self.https_proxy_text.set_editable(self.enable_proxy) | 680 | |
609 | self.https_proxy_text.set_sensitive(self.enable_proxy) | 681 | def same_checkbox_toggled_cb(self, button): |
610 | self.ftp_proxy_text.set_editable(self.enable_proxy) | 682 | self.configuration.same_proxy = self.same_checkbox.get_active() |
611 | self.ftp_proxy_text.set_sensitive(self.enable_proxy) | 683 | self.refresh_proxy_components() |
612 | self.git_proxy_text.set_editable(self.enable_proxy) | ||
613 | self.git_proxy_text.set_sensitive(self.enable_proxy) | ||
614 | self.cvs_proxy_text.set_editable(self.enable_proxy) | ||
615 | self.cvs_proxy_text.set_sensitive(self.enable_proxy) | ||
616 | 684 | ||
617 | def response_cb(self, dialog, response_id): | 685 | def response_cb(self, dialog, response_id): |
618 | package_format = [] | 686 | package_format = [] |
@@ -656,12 +724,17 @@ class AdvancedSettingDialog (CrumbsDialog): | |||
656 | self.configuration.extra_setting[key] = value | 724 | self.configuration.extra_setting[key] = value |
657 | it = self.setting_store.iter_next(it) | 725 | it = self.setting_store.iter_next(it) |
658 | 726 | ||
659 | self.configuration.all_proxy = self.all_proxy_text.get_text() | 727 | self.configuration.split_proxy("http", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) |
660 | self.configuration.http_proxy = self.http_proxy_text.get_text() | 728 | if self.configuration.same_proxy: |
661 | self.configuration.https_proxy = self.https_proxy_text.get_text() | 729 | self.configuration.split_proxy("https", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) |
662 | self.configuration.ftp_proxy = self.ftp_proxy_text.get_text() | 730 | self.configuration.split_proxy("ftp", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) |
663 | self.configuration.git_proxy_host, self.configuration.git_proxy_port = self.git_proxy_text.get_text().split(':') | 731 | self.configuration.split_proxy("git", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) |
664 | self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port = self.cvs_proxy_text.get_text().split(':') | 732 | self.configuration.split_proxy("cvs", self.http_proxy.get_text() + ":" + self.http_proxy_port.get_text()) |
733 | else: | ||
734 | self.configuration.split_proxy("https", self.https_proxy.get_text() + ":" + self.https_proxy_port.get_text()) | ||
735 | self.configuration.split_proxy("ftp", self.ftp_proxy.get_text() + ":" + self.ftp_proxy_port.get_text()) | ||
736 | self.configuration.split_proxy("git", self.git_proxy.get_text() + ":" + self.git_proxy_port.get_text()) | ||
737 | self.configuration.split_proxy("cvs", self.cvs_proxy.get_text() + ":" + self.cvs_proxy_port.get_text()) | ||
665 | 738 | ||
666 | md5 = self.config_md5() | 739 | md5 = self.config_md5() |
667 | self.settings_changed = (self.md5 != md5) | 740 | self.settings_changed = (self.md5 != md5) |
@@ -1150,3 +1223,63 @@ class ImageSelectionDialog (CrumbsDialog): | |||
1150 | self.image_names.append(f) | 1223 | self.image_names.append(f) |
1151 | break | 1224 | break |
1152 | iter = self.image_store.iter_next(iter) | 1225 | iter = self.image_store.iter_next(iter) |
1226 | |||
1227 | class ProxyDetailsDialog (CrumbsDialog): | ||
1228 | |||
1229 | def __init__(self, title, user, passwd, parent, flags, buttons=None): | ||
1230 | super(ProxyDetailsDialog, self).__init__(title, parent, flags, buttons) | ||
1231 | self.connect("response", self.response_cb) | ||
1232 | |||
1233 | self.auth = not (user == None or passwd == None or user == "") | ||
1234 | self.user = user or "" | ||
1235 | self.passwd = passwd or "" | ||
1236 | |||
1237 | # create visual elements on the dialog | ||
1238 | self.create_visual_elements() | ||
1239 | |||
1240 | def create_visual_elements(self): | ||
1241 | self.auth_checkbox = gtk.CheckButton("Use authentication") | ||
1242 | self.auth_checkbox.set_tooltip_text("Check this box to set the username and the password") | ||
1243 | self.auth_checkbox.set_active(self.auth) | ||
1244 | self.auth_checkbox.connect("toggled", self.auth_checkbox_toggled_cb) | ||
1245 | self.vbox.pack_start(self.auth_checkbox, expand=False, fill=False) | ||
1246 | |||
1247 | hbox = gtk.HBox(False, 6) | ||
1248 | self.user_label = gtk.Label("Username:") | ||
1249 | self.user_text = gtk.Entry() | ||
1250 | self.user_text.set_text(self.user) | ||
1251 | hbox.pack_start(self.user_label, expand=False, fill=False) | ||
1252 | hbox.pack_end(self.user_text, expand=False, fill=False) | ||
1253 | self.vbox.pack_start(hbox, expand=False, fill=False) | ||
1254 | |||
1255 | hbox = gtk.HBox(False, 6) | ||
1256 | self.passwd_label = gtk.Label("Password:") | ||
1257 | self.passwd_text = gtk.Entry() | ||
1258 | self.passwd_text.set_text(self.passwd) | ||
1259 | hbox.pack_start(self.passwd_label, expand=False, fill=False) | ||
1260 | hbox.pack_end(self.passwd_text, expand=False, fill=False) | ||
1261 | self.vbox.pack_start(hbox, expand=False, fill=False) | ||
1262 | |||
1263 | self.refresh_auth_components() | ||
1264 | self.show_all() | ||
1265 | |||
1266 | def refresh_auth_components(self): | ||
1267 | self.user_label.set_sensitive(self.auth) | ||
1268 | self.user_text.set_editable(self.auth) | ||
1269 | self.user_text.set_sensitive(self.auth) | ||
1270 | self.passwd_label.set_sensitive(self.auth) | ||
1271 | self.passwd_text.set_editable(self.auth) | ||
1272 | self.passwd_text.set_sensitive(self.auth) | ||
1273 | |||
1274 | def auth_checkbox_toggled_cb(self, button): | ||
1275 | self.auth = self.auth_checkbox.get_active() | ||
1276 | self.refresh_auth_components() | ||
1277 | |||
1278 | def response_cb(self, dialog, response_id): | ||
1279 | if response_id == gtk.RESPONSE_OK: | ||
1280 | if self.auth: | ||
1281 | self.user = self.user_text.get_text() | ||
1282 | self.passwd = self.passwd_text.get_text() | ||
1283 | else: | ||
1284 | self.user = None | ||
1285 | self.passwd = None | ||
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py index 624d7b55f3..d2f4589774 100644 --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py | |||
@@ -304,9 +304,6 @@ class HobHandler(gobject.GObject): | |||
304 | def set_ftp_proxy(self, ftp_proxy): | 304 | def set_ftp_proxy(self, ftp_proxy): |
305 | self.runCommand(["setVariable", "ftp_proxy", ftp_proxy]) | 305 | self.runCommand(["setVariable", "ftp_proxy", ftp_proxy]) |
306 | 306 | ||
307 | def set_all_proxy(self, all_proxy): | ||
308 | self.runCommand(["setVariable", "all_proxy", all_proxy]) | ||
309 | |||
310 | def set_git_proxy(self, host, port): | 307 | def set_git_proxy(self, host, port): |
311 | self.runCommand(["setVariable", "GIT_PROXY_HOST", host]) | 308 | self.runCommand(["setVariable", "GIT_PROXY_HOST", host]) |
312 | self.runCommand(["setVariable", "GIT_PROXY_PORT", port]) | 309 | self.runCommand(["setVariable", "GIT_PROXY_PORT", port]) |
@@ -496,7 +493,6 @@ class HobHandler(gobject.GObject): | |||
496 | params["http_proxy"] = self.runCommand(["getVariable", "http_proxy"]) or "" | 493 | params["http_proxy"] = self.runCommand(["getVariable", "http_proxy"]) or "" |
497 | params["ftp_proxy"] = self.runCommand(["getVariable", "ftp_proxy"]) or "" | 494 | params["ftp_proxy"] = self.runCommand(["getVariable", "ftp_proxy"]) or "" |
498 | params["https_proxy"] = self.runCommand(["getVariable", "https_proxy"]) or "" | 495 | params["https_proxy"] = self.runCommand(["getVariable", "https_proxy"]) or "" |
499 | params["all_proxy"] = self.runCommand(["getVariable", "all_proxy"]) or "" | ||
500 | 496 | ||
501 | params["cvs_proxy_host"] = self.runCommand(["getVariable", "CVS_PROXY_HOST"]) or "" | 497 | params["cvs_proxy_host"] = self.runCommand(["getVariable", "CVS_PROXY_HOST"]) or "" |
502 | params["cvs_proxy_port"] = self.runCommand(["getVariable", "CVS_PROXY_PORT"]) or "" | 498 | params["cvs_proxy_port"] = self.runCommand(["getVariable", "CVS_PROXY_PORT"]) or "" |