[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #18708 [Core Tor/Nyx]: Welcome page
#18708: Welcome page
--------------------------+------------------------
Reporter: atagar | Owner: atagar
Type: enhancement | Status: new
Priority: Medium | Milestone:
Component: Core Tor/Nyx | Version:
Severity: Normal | Resolution:
Keywords: | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
--------------------------+------------------------
Comment (by aegis2501):
Replying to [comment:4 atagar]:
> Looks good! Thanks aegis2501, only thoughts are...
>
> > if CONFIG!['shown_welcome'] is False:
>
> This works, but rather be "if not CONFIG!['shown_welcome']". For a
description of what's up (and why you should generally avoid the 'is'
keyword) please see...
>
> https://trac.torproject.org/projects/tor/ticket/27350#comment:3
>
> Also, this should not be done in draw's while loop since this is a one-
time notice. Please also invert this so the preference is 'show_welcome'.
This way users can set 'show_welcome true' in their nyxrc if they'd like
to always see the prompt.
>
> > config.set('shown_welcome', 'true')
>
> We also need to save the configuration, otherwise this won't be a one-
time prompt (this flag will always be 'false' when starting). This will
take a little work because we presently have two configurations...
>
> * User configuration (~/.nyx/conifg). This usually isn't present.
> * Built in configuration defaults
(https://gitweb.torproject.org/nyx.git/tree/nyx/settings). These are read-
only.
>
> This flag is going to necessitate a third category.
>
> * Persisted settings from Nyx's last run (~/.nyx/runtime_cache).
>
> Besides this flag we will likely end up using this to remember changes
made as we run (for instance sort ordering, logging filters, etc).
>
> One complication is that we'll need to keep these separate from the
other settings. Presently we load user and built-in preferences into the
same configuration object. This works because built-in preferences are
read-only...
>
> built-in preference loading:
https://gitweb.torproject.org/nyx.git/tree/nyx/__init__.py#n167
> user preference loading:
https://gitweb.torproject.org/nyx.git/tree/nyx/starter.py#n73
>
> As such we'll want a new pair of helper methods in nyx/!__init!__.py,
their rough psudo code looking something like...
>
> {{{
> RUNTIME_PREFERNCES = stem.util.conf.Config()
>
> @uses_settings
> def runtime_preference(user_config, key):
> if key in user_config:
> # if the user explicitly specifies this in their user configuration
> # it always takes precedence
>
> return user_config.get(key)
> else:
> return RUNTIME_PREFERNCES.get(key)
>
> def save_runtime_preference(key, value):
> runtime_preference_path = data_directory(runtime_cache)
>
> RUNTIME_PREFERNCES.set(key, value)
> RUNTIME_PREFERNCES.save(runtime_preference_path)
> }}}
>
> One last thing is that we'll want to add test coverage for this popup
when it's fully implemented (test/popups.py has examples we can follow).
>
> Sorry! Kinda silly this reply is longer than the code ya wrote. I
completely forgot we'd need runtime preferences for this. :P
>
> If this gives you any trouble or you'd prefer for me to take care of
that side of it just say the word and I'll whip it up.
\\
No need to apologise, I'll work on it.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18708#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs