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
466e5793
Commit
466e5793
authored
Jun 20, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for multikey shortcuts, assign 'gg' to scroll-to-top.
parent
951784a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
topydo/ui/TodoListWidget.py
topydo/ui/TodoListWidget.py
+14
-0
No files found.
topydo/ui/TodoListWidget.py
View file @
466e5793
...
@@ -23,6 +23,9 @@ class TodoListWidget(urwid.LineBox):
...
@@ -23,6 +23,9 @@ class TodoListWidget(urwid.LineBox):
def
__init__
(
self
,
p_view
,
p_title
):
def
__init__
(
self
,
p_view
,
p_title
):
self
.
view
=
p_view
self
.
view
=
p_view
# store a state for multi-key shortcuts (e.g. 'gg')
self
.
keystate
=
None
title_widget
=
urwid
.
Filler
(
urwid
.
Text
(
p_title
,
align
=
'center'
))
title_widget
=
urwid
.
Filler
(
urwid
.
Text
(
p_title
,
align
=
'center'
))
self
.
todolist
=
urwid
.
SimpleFocusListWalker
([])
self
.
todolist
=
urwid
.
SimpleFocusListWalker
([])
...
@@ -75,6 +78,15 @@ class TodoListWidget(urwid.LineBox):
...
@@ -75,6 +78,15 @@ class TodoListWidget(urwid.LineBox):
self
.
listbox
.
calculate_visible
(
p_size
)
self
.
listbox
.
calculate_visible
(
p_size
)
def
keypress
(
self
,
p_size
,
p_key
):
def
keypress
(
self
,
p_size
,
p_key
):
# first check whether 'g' was pressed previously
if
self
.
keystate
==
'g'
:
if
p_key
==
'g'
:
self
.
_scroll_to_top
(
p_size
)
# make sure to accept normal shortcuts again
self
.
keystate
=
None
return
if
p_key
==
'x'
:
if
p_key
==
'x'
:
self
.
_complete_selected_item
()
self
.
_complete_selected_item
()
elif
p_key
==
'j'
:
elif
p_key
==
'j'
:
...
@@ -85,6 +97,8 @@ class TodoListWidget(urwid.LineBox):
...
@@ -85,6 +97,8 @@ class TodoListWidget(urwid.LineBox):
self
.
_scroll_to_top
(
p_size
)
self
.
_scroll_to_top
(
p_size
)
elif
p_key
==
'G'
or
p_key
==
'end'
:
elif
p_key
==
'G'
or
p_key
==
'end'
:
self
.
_scroll_to_bottom
(
p_size
)
self
.
_scroll_to_bottom
(
p_size
)
elif
p_key
==
'g'
:
self
.
keystate
=
'g'
else
:
else
:
if
self
.
listbox
.
keypress
(
p_size
,
p_key
):
if
self
.
listbox
.
keypress
(
p_size
,
p_key
):
return
super
(
TodoListWidget
,
self
).
keypress
(
p_size
,
p_key
)
return
super
(
TodoListWidget
,
self
).
keypress
(
p_size
,
p_key
)
...
...
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