Commit b3f8fe36 authored by Jacek Sowiński's avatar Jacek Sowiński

Drop support for python2 in column-ui code

parent bbace860
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
# 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):
...@@ -23,7 +22,7 @@ class CommandLineWidget(urwid.Edit): ...@@ -23,7 +22,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("")
def _blur(self): def _blur(self):
self.clear() self.clear()
......
...@@ -15,10 +15,9 @@ ...@@ -15,10 +15,9 @@
# 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=u("")): def __init__(self, p_text=""):
urwid.register_signal(ConsoleWidget, ['close']) urwid.register_signal(ConsoleWidget, ['close'])
self.text = urwid.Text(p_text) self.text = urwid.Text(p_text)
...@@ -37,4 +36,4 @@ class ConsoleWidget(urwid.LineBox): ...@@ -37,4 +36,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(u("")) self.text.set_text("")
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
import shlex import shlex
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
...@@ -74,7 +73,7 @@ class UIApplication(CLIApplicationBase): ...@@ -74,7 +73,7 @@ class UIApplication(CLIApplicationBase):
self.todolist = TodoList.TodoList(self.todofile.read()) self.todolist = TodoList.TodoList(self.todofile.read())
self.columns = urwid.Columns([], dividechars=0, min_width=COLUMN_WIDTH) self.columns = urwid.Columns([], dividechars=0, min_width=COLUMN_WIDTH)
self.commandline = CommandLineWidget(u('topydo> ')) self.commandline = CommandLineWidget('topydo> ')
# console widget # console widget
self.console = ConsoleWidget() self.console = ConsoleWidget()
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
# 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, u
import urwid import urwid
from topydo.ui.TodoWidget import TodoWidget from topydo.ui.TodoWidget import TodoWidget
...@@ -34,7 +33,7 @@ class TodoListWidget(urwid.LineBox): ...@@ -34,7 +33,7 @@ class TodoListWidget(urwid.LineBox):
pile = urwid.Pile([ pile = urwid.Pile([
(1, urwid.Filler(self._title_widget)), (1, urwid.Filler(self._title_widget)),
(1, urwid.Filler(urwid.Divider(u('\u2500')))), (1, urwid.Filler(urwid.Divider('\u2500'))),
('weight', 1, self.listbox), ('weight', 1, self.listbox),
]) ])
...@@ -73,7 +72,7 @@ class TodoListWidget(urwid.LineBox): ...@@ -73,7 +72,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('-'))
if old_focus_position: if old_focus_position:
self.todolist.set_focus(old_focus_position) self.todolist.set_focus(old_focus_position)
...@@ -132,7 +131,7 @@ class TodoListWidget(urwid.LineBox): ...@@ -132,7 +131,7 @@ class TodoListWidget(urwid.LineBox):
self.view.todolist.number(todo) self.view.todolist.number(todo)
urwid.emit_signal(self, 'execute_command', "do {}".format( urwid.emit_signal(self, 'execute_command', "do {}".format(
text_type(self.view.todolist.number(todo)))) str(self.view.todolist.number(todo))))
except AttributeError: except AttributeError:
# No todo item selected # No todo item selected
pass pass
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
# 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, u
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_MAP
...@@ -26,7 +24,7 @@ class TodoWidget(urwid.WidgetWrap): ...@@ -26,7 +24,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 = ""
todo_text = self.todo.source() todo_text = self.todo.source()
if priority: if priority:
...@@ -35,7 +33,7 @@ class TodoWidget(urwid.WidgetWrap): ...@@ -35,7 +33,7 @@ class TodoWidget(urwid.WidgetWrap):
# strip the first characters off # strip the first characters off
todo_text = todo_text[4:] todo_text = todo_text[4:]
id_widget = urwid.Text(text_type(p_number), align='right') id_widget = urwid.Text(str(p_number), align='right')
priority_widget = urwid.Text(priority_text) priority_widget = urwid.Text(priority_text)
self.text_widget = urwid.Text(todo_text) self.text_widget = urwid.Text(todo_text)
......
...@@ -15,19 +15,18 @@ ...@@ -15,19 +15,18 @@
# 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 ViewWidget(urwid.LineBox): class ViewWidget(urwid.LineBox):
def __init__(self, p_todolist): def __init__(self, p_todolist):
self._todolist = p_todolist self._todolist = p_todolist
self.titleedit = urwid.Edit(u("Title: "), u("")) self.titleedit = urwid.Edit("Title: ", "")
self.sortedit = urwid.Edit(u("Sort expression: "), u("")) self.sortedit = urwid.Edit("Sort expression: ", "")
self.filteredit = urwid.Edit(u("Filter expression: "), u("")) self.filteredit = urwid.Edit("Filter expression: ", "")
group = [] group = []
self.relevantradio = urwid.RadioButton(group, u("Only show relevant todo items"), True) self.relevantradio = urwid.RadioButton(group, "Only show relevant todo items", True)
self.allradio = urwid.RadioButton(group, u("Show all todo items")) self.allradio = urwid.RadioButton(group, "Show all todo items")
self.pile = urwid.Pile([ self.pile = urwid.Pile([
self.titleedit, self.titleedit,
...@@ -35,8 +34,8 @@ class ViewWidget(urwid.LineBox): ...@@ -35,8 +34,8 @@ class ViewWidget(urwid.LineBox):
self.filteredit, self.filteredit,
self.relevantradio, self.relevantradio,
self.allradio, self.allradio,
urwid.Button(u("Save"), lambda _: urwid.emit_signal(self, 'save')), urwid.Button("Save", lambda _: urwid.emit_signal(self, 'save')),
urwid.Button(u("Cancel"), lambda _: self.close()), urwid.Button("Cancel", lambda _: self.close()),
]) ])
self.reset() self.reset()
...@@ -64,9 +63,9 @@ class ViewWidget(urwid.LineBox): ...@@ -64,9 +63,9 @@ class ViewWidget(urwid.LineBox):
def reset(self): def reset(self):
""" Resets the form. """ """ Resets the form. """
self.titleedit.set_edit_text(u("")) self.titleedit.set_edit_text("")
self.sortedit.set_edit_text(u("")) self.sortedit.set_edit_text("")
self.filteredit.set_edit_text(u("")) self.filteredit.set_edit_text("")
self.relevantradio.set_state(True) self.relevantradio.set_state(True)
self.pile.focus_item = 0 self.pile.focus_item = 0
......
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