[Dextrose] [PATCH 51/54] au#687: Add network proxy config extension to CP

Aleksey Lim alsroot at activitycentral.org
Sat Nov 19 17:06:06 EST 2011


On Sat, Nov 19, 2011 at 10:25:02PM +0100, Sascha Silbe wrote:
> Excerpts from Anish Mangal's message of 2011-11-08 19:18:02 +0100:
> > This work has been done and maintained by:
> > 
> > Aleksey Lim <alsroot at activitycentral.org>
> > 
> > here:
> > 
> > http://git.sugarlabs.org/alsroot/proxy_cp
> 
> This is rather complicated, both code- and UI-wise. Let's check where we
> can simplify:
> 
> 1. Direct connection is equivalent to configuring no proxy at all.
> 2. Does anybody seriously use different proxies for HTTP, HTTPS and/or
>    FTP?
> 3. Does OLPC AU need SOCKS proxies? On a non-standard port?
> 4. The example given for automatic configuration
>    ("http://wpad.ntschools.net/wpad.dat") suggests WPAD is supported. We
>    should use that (by not setting autoconfig_url [1]) instead of
>    letting the user enter proxy configuration settings manually. Should
>    be the default, i.e. the behaviour in absence of manual configuration.
> 5. Is authentication support required?
> 
> 
> Ideally the proxy settings would be bound to a NetworkManager connection
> (and even be managed by NM), but as that won't happen in the short term
> users will want a way to temporarily disable the proxy settings (e.g. if
> they're at home), in contrast to #1/#4.
> 
> Similarly, I don't think what most users want is a list of host names to
> bypass the proxy for (what you call "Ignore Host List"), but rather have
> it connect to hosts on the same LAN directly. Unfortunately Gnome (and
> thus the gconf settings we're using) doesn't seem to support that.

This CP section is a trying to exactly reimplement the UI in gnome/mozilla
proxy configurator, i.e., would be useful to not invent new users'
experince in that case.

> [configure.ac, data/icons/Makefile.am, extensions/cpsection/Makefile.am]
> 
> Please keep the lists sorted.
> 
> 
> [data/icons/module-proxy.svg]
> 
> Interesting icon for proxy settings. But I don't have any idea myself
> and the gnome-control-center choice of icon for the proxy settings isn't
> really any better.
> 
> What's the license for this file and where did it come from? There are
> Creative Commons tags in that file, but none that give a source, author
> or license.

initially I didn't added any icons to Feature/ implementation
(btw, the source of this feature is exactly
http://wiki.sugarlabs.org/go/Features/Proxy_Settings),
i.e., might be useful to exclude icons the the patch at all and ask
designers, who work on that last time, to implement it.
> 
> [extensions/cpsection/proxy/__init__.py]
> [...]
> > +CLASS = 'Proxy'
> > +ICON = 'module-proxy'
> > +TITLE = _('Proxy')
> 
> I wonder whether this would be better suited as an additional "page" in
> the existing "Network" control panel section. We should ask Gary for
> advice.

The initial reason was exactly because there is a special proxy UI in
gnome/mozilla. At least, having huge Network dialog might be not useful
and having tabs in these dialogs might be also an overkill (two levels of
entities instead of only one, CP page).

> > diff --git a/extensions/cpsection/proxy/model.py b/extensions/cpsection/proxy/model.py
> > new file mode 100644
> > index 0000000..c88b116
> > --- /dev/null
> > +++ b/extensions/cpsection/proxy/model.py
> > @@ -0,0 +1,14 @@
> > +# Copyright (C) 2011, Aleksey Lim
> > +#
> > +# This program is free software: you can redistribute it and/or modify
> > +# it under the terms of the GNU General Public License as published by
> > +# the Free Software Foundation, either version 3 of the License, or
> > +# (at your option) any later version.
> > +#
> > +# This program is distributed in the hope that it will be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> [no further content in this file]
> 
> If you add a real model file, you can get rid of some of your code, e.g.
> the undo stuff. jarabe.controlpanel.gui.ModelWrapper has generic undo
> support that gets used if you follow the Control Panel programming
> conventions. I don't really like the way it does things and there's a
> lot we could do better, but we should at least make use of what we have.

I didn't check if Shell won't fail for absent model files. If it won't,
yes, would be useful to get rid of this file at all.

> [extensions/cpsection/proxy/view.py]
> [...]
> > +def _register_bool_key(key, widget, reverse=False):
> [...]
> > +def _register_string_key(key, widget):
> [...]
> > +def _register_int_key(key, widget):
> [...]
> 
> This looks like it could be simplified by using a mapping (dictionary)
> from type to constants etc..

It will make code more curly and less unified (there are also funcitons
like _register_selector_key)

> Bug: On first usage, switching to "Manual proxy configuration" did not
> enable the settings grouped below it. The following Tracebacks appeared
> in shell.log:
> 
> === Begin ===
> Traceback (most recent call last):
>   File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar/extensions/cpsection/proxy/view.py", line 363, in signal_cb
>     value = get_cb()
> NameError: free variable 'get_cb' referenced before assignment in enclosing scope
> Traceback (most recent call last):
>   File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar/extensions/cpsection/proxy/view.py", line 363, in signal_cb
>     value = get_cb()
> NameError: free variable 'get_cb' referenced before assignment in enclosing scope
> Traceback (most recent call last):
>   File "/home/sascha.silbe/sugar-jhbuild/install/share/sugar/extensions/cpsection/proxy/view.py", line 363, in signal_cb
>     value = get_cb()
> NameError: free variable 'get_cb' referenced before assignment in enclosing scope
> === End ===

hmm, it is something weird...
get_cb is declared as an argument of the top function and python somehow
manged to forget about it... it needs investigation.

-- 
Aleksey


More information about the Dextrose mailing list