Unverified Commit 5e3f2ab1 authored by mathieui's avatar mathieui

Fix #3511 (fix traceback on first bookmark added)

parent 4703c850
...@@ -15,7 +15,7 @@ from poezio.bookmarks import Bookmark, BookmarkList ...@@ -15,7 +15,7 @@ from poezio.bookmarks import Bookmark, BookmarkList
class BookmarkNameInput(FieldInput, Input): class BookmarkNameInput(FieldInput, Input):
def __init__(self, field) -> None: def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field) FieldInput.__init__(self, field)
Input.__init__(self) Input.__init__(self)
self.text = field.name self.text = field.name
...@@ -30,7 +30,7 @@ class BookmarkNameInput(FieldInput, Input): ...@@ -30,7 +30,7 @@ class BookmarkNameInput(FieldInput, Input):
class BookmarkJIDInput(FieldInput, Input): class BookmarkJIDInput(FieldInput, Input):
def __init__(self, field) -> None: def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field) FieldInput.__init__(self, field)
Input.__init__(self) Input.__init__(self)
jid = safeJID(field.jid) jid = safeJID(field.jid)
...@@ -49,7 +49,7 @@ class BookmarkJIDInput(FieldInput, Input): ...@@ -49,7 +49,7 @@ class BookmarkJIDInput(FieldInput, Input):
class BookmarkMethodInput(FieldInputMixin): class BookmarkMethodInput(FieldInputMixin):
def __init__(self, field) -> None: def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field) FieldInput.__init__(self, field)
Win.__init__(self) Win.__init__(self)
self.options = ('local', 'remote') self.options = ('local', 'remote')
...@@ -89,7 +89,7 @@ class BookmarkMethodInput(FieldInputMixin): ...@@ -89,7 +89,7 @@ class BookmarkMethodInput(FieldInputMixin):
class BookmarkPasswordInput(FieldInput, Input): class BookmarkPasswordInput(FieldInput, Input):
def __init__(self, field) -> None: def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field) FieldInput.__init__(self, field)
Input.__init__(self) Input.__init__(self)
self.text = field.password or '' self.text = field.password or ''
...@@ -119,7 +119,7 @@ class BookmarkPasswordInput(FieldInput, Input): ...@@ -119,7 +119,7 @@ class BookmarkPasswordInput(FieldInput, Input):
class BookmarkAutojoinWin(FieldInputMixin): class BookmarkAutojoinWin(FieldInputMixin):
def __init__(self, field) -> None: def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field) FieldInput.__init__(self, field)
Win.__init__(self) Win.__init__(self)
self.last_key = 'KEY_RIGHT' self.last_key = 'KEY_RIGHT'
...@@ -190,11 +190,13 @@ class BookmarksWin(Win): ...@@ -190,11 +190,13 @@ class BookmarksWin(Win):
BookmarkPasswordInput(bookmark), BookmarkPasswordInput(bookmark),
BookmarkAutojoinWin(bookmark), BookmarkAutojoinWin(bookmark),
BookmarkMethodInput(bookmark))) BookmarkMethodInput(bookmark)))
self.lines[self.current_input][ if len(self.lines) > 1:
self.current_horizontal_input].set_color( self.lines[self.current_input][
get_theme().COLOR_NORMAL_TEXT) self.current_horizontal_input].set_color(
get_theme().COLOR_NORMAL_TEXT)
self.current_horizontal_input = 0 self.current_horizontal_input = 0
self.current_input = len(self.lines) - 1 if len(self.lines) > 1:
self.current_input = len(self.lines) - 1
if self.current_input - self.scroll_pos > self.height - 1: if self.current_input - self.scroll_pos > self.height - 1:
self.scroll_pos = self.current_input - self.height + 1 self.scroll_pos = self.current_input - self.height + 1
self.refresh() self.refresh()
......
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