Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
e7f1ab2a
Commit
e7f1ab2a
authored
Jun 11, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shift focus of a todo item within a column.
parent
4b1bbdb8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
10 deletions
+37
-10
topydo/ui/Main.py
topydo/ui/Main.py
+1
-0
topydo/ui/TodoListWidget.py
topydo/ui/TodoListWidget.py
+28
-6
topydo/ui/TodoWidget.py
topydo/ui/TodoWidget.py
+8
-4
No files found.
topydo/ui/Main.py
View file @
e7f1ab2a
...
...
@@ -102,6 +102,7 @@ class UIApplication(CLIApplicationBase):
item
=
(
todolist
,
options
)
self
.
columns
.
contents
.
append
(
item
)
self
.
columns
.
focus_position
=
len
(
self
.
columns
.
contents
)
-
1
def
run
(
self
):
self
.
todofile
=
TodoFile
.
TodoFile
(
config
().
todotxt
())
...
...
topydo/ui/TodoListWidget.py
View file @
e7f1ab2a
...
...
@@ -18,7 +18,7 @@ import urwid
from
topydo.ui.TodoWidget
import
TodoWidget
class
TodoListWidget
(
urwid
.
WidgetWrap
):
class
TodoListWidget
(
urwid
.
LineBox
):
def
__init__
(
self
,
p_view
,
p_title
):
self
.
view
=
p_view
...
...
@@ -27,17 +27,39 @@ class TodoListWidget(urwid.WidgetWrap):
todos
=
[]
for
todo
in
self
.
view
.
todos
:
todos
.
append
((
'pack'
,
TodoWidget
(
todo
)))
todowidget
=
TodoWidget
(
todo
)
todos
.
append
((
'pack'
,
todowidget
))
todos
.
append
(
urwid
.
Divider
(
u'-'
))
todo_pile
=
urwid
.
Pile
(
todos
)
self
.
todo_pile
=
urwid
.
Pile
(
todos
)
pile
=
urwid
.
Pile
([
(
1
,
title_widget
),
(
1
,
urwid
.
Filler
(
urwid
.
Divider
(
u'
\
u2500
'
))),
(
'weight'
,
1
,
urwid
.
Filler
(
todo_pile
,
valign
=
'top'
)),
(
'weight'
,
1
,
urwid
.
Filler
(
self
.
todo_pile
,
valign
=
'top'
)),
])
widget
=
urwid
.
LineBox
(
pile
)
pile
.
focus_position
=
2
super
(
TodoListWidget
,
self
).
__init__
(
pile
)
def
_focus_down
(
self
):
size
=
len
(
self
.
todo_pile
.
contents
)
if
self
.
todo_pile
.
focus_position
<
size
-
2
:
self
.
todo_pile
.
focus_position
+=
2
def
_focus_up
(
self
):
if
self
.
todo_pile
.
focus_position
>
1
:
self
.
todo_pile
.
focus_position
-=
2
def
keypress
(
self
,
p_size
,
p_key
):
if
p_key
==
'j'
or
p_key
==
'down'
:
self
.
_focus_down
()
elif
p_key
==
'k'
or
p_key
==
'up'
:
self
.
_focus_up
()
else
:
return
super
(
TodoListWidget
,
self
).
keypress
(
p_size
,
p_key
)
super
(
TodoListWidget
,
self
).
__init__
(
widget
)
def
selectable
(
self
):
return
True
topydo/ui/TodoWidget.py
View file @
e7f1ab2a
...
...
@@ -29,14 +29,18 @@ class TodoWidget(urwid.WidgetWrap):
todo_text
=
todo_text
[
4
:]
priority_widget
=
urwid
.
Text
(
priority_text
)
text_widget
=
urwid
.
Text
(
todo_text
)
self
.
text_widget
=
urwid
.
Text
(
todo_text
)
columns
=
urwid
.
Columns
(
self
.
columns
=
urwid
.
Columns
(
[
(
3
,
priority_widget
),
(
'weight'
,
1
,
text_widget
),
(
'weight'
,
1
,
self
.
text_widget
),
],
dividechars
=
1
)
super
(
TodoWidget
,
self
).
__init__
(
columns
)
attr
=
urwid
.
AttrSpec
(
'black'
,
'light gray'
,
16
)
self
.
widget
=
urwid
.
AttrMap
(
self
.
columns
,
{},
attr
)
super
(
TodoWidget
,
self
).
__init__
(
self
.
widget
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment