Commit 4c8390ea authored by Bram Schoenmakers's avatar Bram Schoenmakers

Use Unicode strings, and use the six compatibility library for that.

parent afadc39a
...@@ -15,6 +15,7 @@ ...@@ -15,6 +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/>.
import urwid import urwid
from six import u
class CommandLineWidget(urwid.Edit): class CommandLineWidget(urwid.Edit):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
...@@ -22,7 +23,7 @@ class CommandLineWidget(urwid.Edit): ...@@ -22,7 +23,7 @@ class CommandLineWidget(urwid.Edit):
urwid.register_signal(CommandLineWidget, ['blur', 'execute_command']) urwid.register_signal(CommandLineWidget, ['blur', 'execute_command'])
def clear(self): def clear(self):
self.set_edit_text(u"") self.set_edit_text(u(""))
def _blur(self): def _blur(self):
self.clear() self.clear()
......
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import urwid import urwid
from six import u
class ConsoleWidget(urwid.LineBox): class ConsoleWidget(urwid.LineBox):
def __init__(self, p_text=""): def __init__(self, p_text=u("")):
urwid.register_signal(ConsoleWidget, ['close']) urwid.register_signal(ConsoleWidget, ['close'])
self.text = urwid.Text(p_text) self.text = urwid.Text(p_text)
...@@ -36,4 +37,4 @@ class ConsoleWidget(urwid.LineBox): ...@@ -36,4 +37,4 @@ class ConsoleWidget(urwid.LineBox):
self.text.set_text(self.text.text + p_text) self.text.set_text(self.text.text + p_text)
def clear(self): def clear(self):
self.text.set_text("") self.text.set_text(u(""))
...@@ -15,6 +15,7 @@ ...@@ -15,6 +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/>.
import urwid import urwid
from six import u
from topydo.cli.CLIApplicationBase import CLIApplicationBase from topydo.cli.CLIApplicationBase import CLIApplicationBase
from topydo.Commands import get_subcommand from topydo.Commands import get_subcommand
...@@ -33,7 +34,7 @@ class UIApplication(CLIApplicationBase): ...@@ -33,7 +34,7 @@ class UIApplication(CLIApplicationBase):
super(UIApplication, self).__init__() super(UIApplication, self).__init__()
self.columns = urwid.Columns([], dividechars=0, min_width=COLUMN_WIDTH) self.columns = urwid.Columns([], dividechars=0, min_width=COLUMN_WIDTH)
self.commandline = CommandLineWidget('topydo> ') self.commandline = CommandLineWidget(u('topydo> '))
self.console = ConsoleWidget() self.console = ConsoleWidget()
urwid.connect_signal(self.commandline, 'blur', urwid.connect_signal(self.commandline, 'blur',
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# 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 six import text_type from six import text_type, u
import urwid import urwid
from topydo.ui.TodoWidget import TodoWidget from topydo.ui.TodoWidget import TodoWidget
...@@ -34,7 +34,7 @@ class TodoListWidget(urwid.LineBox): ...@@ -34,7 +34,7 @@ class TodoListWidget(urwid.LineBox):
pile = urwid.Pile([ pile = urwid.Pile([
(1, title_widget), (1, title_widget),
(1, urwid.Filler(urwid.Divider(u'\u2500'))), (1, urwid.Filler(urwid.Divider(u('\u2500')))),
('weight', 1, self.listbox), ('weight', 1, self.listbox),
]) ])
...@@ -56,7 +56,7 @@ class TodoListWidget(urwid.LineBox): ...@@ -56,7 +56,7 @@ class TodoListWidget(urwid.LineBox):
for todo in self.view.todos: for todo in self.view.todos:
todowidget = TodoWidget(todo, self.view.todolist.number(todo)) todowidget = TodoWidget(todo, self.view.todolist.number(todo))
self.todolist.append(todowidget) self.todolist.append(todowidget)
self.todolist.append(urwid.Divider(u'-')) self.todolist.append(urwid.Divider(u('-')))
if old_focus_position: if old_focus_position:
self.todolist.set_focus(old_focus_position) self.todolist.set_focus(old_focus_position)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# 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 six import text_type from six import text_type, u
import urwid import urwid
...@@ -23,7 +23,7 @@ class TodoWidget(urwid.WidgetWrap): ...@@ -23,7 +23,7 @@ class TodoWidget(urwid.WidgetWrap):
self.todo = p_todo self.todo = p_todo
priority = self.todo.priority() priority = self.todo.priority()
priority_text = u"" priority_text = u("")
todo_text = self.todo.source() todo_text = self.todo.source()
if priority: if priority:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment