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
74288f2c
Commit
74288f2c
authored
Jun 13, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete the highlighted todo by pressing 'x'.
parent
06c2223a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
topydo/ui/Main.py
topydo/ui/Main.py
+4
-3
topydo/ui/TodoListWidget.py
topydo/ui/TodoListWidget.py
+21
-5
No files found.
topydo/ui/Main.py
View file @
74288f2c
...
...
@@ -39,7 +39,7 @@ class UIApplication(CLIApplicationBase):
urwid
.
connect_signal
(
self
.
commandline
,
'blur'
,
self
.
_blur_commandline
)
urwid
.
connect_signal
(
self
.
commandline
,
'execute_command'
,
self
.
_execute_
input
)
self
.
_execute_
handler
)
urwid
.
connect_signal
(
self
.
console
,
'close'
,
self
.
_hide_console
)
self
.
mainwindow
=
urwid
.
Pile
([
...
...
@@ -56,9 +56,9 @@ class UIApplication(CLIApplicationBase):
pop_ups
=
True
)
def
_execute_
input
(
self
,
p_command
):
def
_execute_
handler
(
self
,
p_command
):
"""
Callback for executing a command that was entered on the command line box
.
Executes a command, given as a string
.
"""
(
subcommand
,
args
)
=
get_subcommand
(
p_command
.
split
())
...
...
@@ -110,6 +110,7 @@ class UIApplication(CLIApplicationBase):
def
_add_column
(
self
,
p_view
,
p_title
):
todolist
=
TodoListWidget
(
p_view
,
p_title
)
urwid
.
connect_signal
(
todolist
,
'execute_command'
,
self
.
_execute_handler
)
options
=
self
.
columns
.
options
(
width_type
=
'given'
,
...
...
topydo/ui/TodoListWidget.py
View file @
74288f2c
...
...
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
six
import
text_type
import
urwid
from
topydo.ui.TodoWidget
import
TodoWidget
...
...
@@ -37,6 +38,8 @@ class TodoListWidget(urwid.LineBox):
super
(
TodoListWidget
,
self
).
__init__
(
pile
)
urwid
.
register_signal
(
TodoListWidget
,
[
'execute_command'
])
def
update
(
self
):
"""
Updates the todo list according to the todos in the view associated
...
...
@@ -67,12 +70,25 @@ class TodoListWidget(urwid.LineBox):
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
:
dispatch
=
{
'j'
:
self
.
_focus_down
,
'down'
:
self
.
_focus_down
,
'k'
:
self
.
_focus_up
,
'up'
:
self
.
_focus_up
,
'x'
:
self
.
_complete_selected_item
,
}
try
:
dispatch
[
p_key
]()
except
KeyError
:
return
super
(
TodoListWidget
,
self
).
keypress
(
p_size
,
p_key
)
def
selectable
(
self
):
return
True
def
_complete_selected_item
(
self
):
todo
=
self
.
todo_pile
.
focus
.
todo
self
.
view
.
todolist
.
number
(
todo
)
urwid
.
emit_signal
(
self
,
'execute_command'
,
"do {}"
.
format
(
text_type
(
self
.
view
.
todolist
.
number
(
todo
))))
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