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
8fadc4b5
Commit
8fadc4b5
authored
Dec 26, 2015
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use 256-color map in column-ui
parent
78850e9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
topydo/ui/Colors.py
topydo/ui/Colors.py
+14
-0
topydo/ui/TodoWidget.py
topydo/ui/TodoWidget.py
+4
-3
No files found.
topydo/ui/Colors.py
View file @
8fadc4b5
...
@@ -34,3 +34,17 @@ COLOR_MAP = {
...
@@ -34,3 +34,17 @@ COLOR_MAP = {
'light-cyan'
:
'light cyan'
,
'light-cyan'
:
'light cyan'
,
'white'
:
'white'
,
'white'
:
'white'
,
}
}
def
color_map256
():
"""
Returns dict where topydo colorscheme config values are linked to values
supported by urwid. 16 standard color names and 256-color indexes are
supported.
"""
color_map
=
dict
()
for
i
in
range
(
256
):
color_map
[
str
(
i
)]
=
'h'
+
str
(
i
)
color_map
.
update
(
COLOR_MAP
)
return
color_map
topydo/ui/TodoWidget.py
View file @
8fadc4b5
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
topydo.lib.Config
import
config
from
topydo.lib.Config
import
config
from
topydo.ui.Colors
import
COLOR_MAP
from
topydo.ui.Colors
import
color_map256
import
urwid
import
urwid
...
@@ -56,19 +56,20 @@ class TodoWidget(urwid.WidgetWrap):
...
@@ -56,19 +56,20 @@ class TodoWidget(urwid.WidgetWrap):
def
_markup
(
self
,
p_todo
,
p_focus
):
def
_markup
(
self
,
p_todo
,
p_focus
):
priority_colors
=
config
().
priority_colors
()
priority_colors
=
config
().
priority_colors
()
color_map
=
color_map256
()
try
:
try
:
# retrieve the assigned value in the config file
# retrieve the assigned value in the config file
fg_color
=
priority_colors
[
p_todo
.
priority
()]
fg_color
=
priority_colors
[
p_todo
.
priority
()]
# convert to a color that urwid understands
# convert to a color that urwid understands
fg_color
=
COLOR_MAP
[
fg_color
]
fg_color
=
color_map
[
fg_color
]
except
KeyError
:
except
KeyError
:
fg_color
=
'black'
if
p_focus
else
'default'
fg_color
=
'black'
if
p_focus
else
'default'
bg_color
=
'light gray'
if
p_focus
else
'default'
bg_color
=
'light gray'
if
p_focus
else
'default'
return
urwid
.
AttrSpec
(
fg_color
,
bg_color
,
1
6
)
return
urwid
.
AttrSpec
(
fg_color
,
bg_color
,
25
6
)
def
keypress
(
self
,
p_size
,
p_key
):
def
keypress
(
self
,
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