This branch implements a way to start
Urwid interactive sessions in quickstart.
This infrastructure will be used in
future branches to implement the
quickstart environment management system.
My apologies for the long diff, but you
can safely ignore all the file headers,
and the code includes long module
docstrings which can help reviewing the
branch.
Tests: `make check`.
QA:
run `make` and then `./cli-app-demo.py`:
this will start a demo application using
the views infrastructure.
https://codereview.appspot.com/42600044/diff/1/quickstart/cli/base.py#newcode111
quickstart/cli/base.py:111: def set_contents(listbox):
On 2013/12/17 14:30:47, bac wrote:
> In the docstring you call the param a generic 'widget'. They should
match. If
> not generic then should you validate that the param is a listbox? I
think using
> a generic widget is better.
https://codereview.appspot.com/42600044/diff/1/quickstart/cli/ui.py#newcode28
quickstart/cli/ui.py:28: # Define the color palette used by the Urwid
application.
On 2013/12/17 14:00:43, gary.poster wrote:
> Might be nice to describe the columns. I assume they are class name
(or None
> for default), text style, background style.
Done.
https://codereview.appspot.com/42600044/diff/1/quickstart/cli/ui.py#newcode70
quickstart/cli/ui.py:70: def bind(function, *args):
On 2013/12/17 14:00:43, gary.poster wrote:
> Huh. So...this effectively produces a thunk that discards/ignores the
argument.
> You could call it that, I guess. This functionality is really
generic. If you
> didn't need to discard the argument, you could just use
functools.partial.
> Perhaps we include at the top the copyright statement from tornado
with the
> reference to ObjectDict.
> # The ObjectDict code:
> #
> # Copyright 2009 Facebook
> #
> # Licensed under the Apache License, Version 2.0 (the "License"); you
may
> # not use this file except in compliance with the License. You may
obtain
> # a copy of the License at
> #
> # http://www.apache.org/licenses/LICENSE-2.0
> #
> # Unless required by applicable law or agreed to in writing, software
> # distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
> # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
the
> # License for the specific language governing permissions and
limitations
> # under the License.
*** Submitted:
Quickstart base structure for views.
This branch implements a way to start
Urwid interactive sessions in quickstart.
This infrastructure will be used in
future branches to implement the
quickstart environment management system.
My apologies for the long diff, but you
can safely ignore all the file headers,
and the code includes long module
docstrings which can help reviewing the
branch.
Tests: `make check`.
QA: app-demo. py`:
run `make` and then `./cli-
this will start a demo application using
the views infrastructure.
Thank you!
R=gary.poster, bac /codereview. appspot. com/42600044
CC=
https:/
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/base. py cli/base. py (right):
File quickstart/
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/base. py#newcode19 cli/base. py:19: A collection of objects which help building a
quickstart/
Quickstart CLI application
On 2013/12/17 14:30:47, bac wrote:
> change 'building' -> 'in building' or 'build'
Done.
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/base. py#newcode55 cli/base. py:55: Improve the level of event loop introspection
quickstart/
so that code and tests
On 2013/12/17 14:30:47, bac wrote:
> Improves
Done.
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/base. py#newcode111 cli/base. py:111: def set_contents( listbox) :
quickstart/
On 2013/12/17 14:30:47, bac wrote:
> In the docstring you call the param a generic 'widget'. They should
match. If
> not generic then should you validate that the param is a listbox? I
think using
> a generic widget is better.
Done.
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/base. py#newcode112 cli/base. py:112: contents. original_ widget = listbox
quickstart/
On 2013/12/17 14:30:47, bac wrote:
> original_widget seems like an odd name since it is really just the
current
> widget.
Unfortunately this is how the wrapped widget is named in Urwid.
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/ui. py cli/ui. py (right):
File quickstart/
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/ui. py#newcode28 cli/ui. py:28: # Define the color palette used by the Urwid
quickstart/
application.
On 2013/12/17 14:00:43, gary.poster wrote:
> Might be nice to describe the columns. I assume they are class name
(or None
> for default), text style, background style.
Done.
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/ui. py#newcode70 cli/ui. py:70: def bind(function, *args):
quickstart/
On 2013/12/17 14:00:43, gary.poster wrote:
> Huh. So...this effectively produces a thunk that discards/ignores the
argument.
> You could call it that, I guess. This functionality is really
generic. If you
> didn't need to discard the argument, you could just use
functools.partial.
> def make_aggressive _thunk( function, *args, **kwargs):
> def thunk(*ignored, **ignored_kwargs):
> return function(*args, **kwargs)
> return thunk
> <shrug> :-)
Renamed to thunk.
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/views. py cli/views. py (right):
File quickstart/
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ cli/views. py#newcode51 cli/views. py:51: pressing a keyboard shortcut;
quickstart/
On 2013/12/17 14:30:47, bac wrote:
> by pressing
Done.
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ utils.py
File quickstart/utils.py (right):
https:/ /codereview. appspot. com/42600044/ diff/1/ quickstart/ utils.py# newcode194 utils.py: 194: www.tornadoweb. org/en/ stable/ _modules/ tornado/ util.html# ObjectDict
quickstart/
http://
On 2013/12/17 14:30:47, bac wrote:
> Does the use here complicate our copyright statement above? You've
given
> attribution but it looks like Canonical is claiming copyright to it.
> Perhaps we include at the top the copyright statement from tornado
with the
> reference to ObjectDict.
> # The ObjectDict code: www.apache. org/licenses/ LICENSE- 2.0
> #
> # Copyright 2009 Facebook
> #
> # Licensed under the Apache License, Version 2.0 (the "License"); you
may
> # not use this file except in compliance with the License. You may
obtain
> # a copy of the License at
> #
> # http://
> #
> # Unless required by applicable law or agreed to in writing, software
> # distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
> # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
the
> # License for the specific language governing permissions and
limitations
> # under the License.
Very good point, done, thank you.
https:/ /codereview. appspot. com/42600044/