xmltab: Add some types.
This commit is contained in:
parent
cf58bceb55
commit
826fa779c4
1 changed files with 7 additions and 7 deletions
|
@ -25,7 +25,7 @@ from poezio.decorators import command_args_parser, refresh_wrapper
|
||||||
|
|
||||||
|
|
||||||
class MatchJID:
|
class MatchJID:
|
||||||
def __init__(self, jid, dest=''):
|
def __init__(self, jid: JID, dest: str = ''):
|
||||||
self.jid = jid
|
self.jid = jid
|
||||||
self.dest = dest
|
self.dest = dest
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ class XMLTab(Tab):
|
||||||
self.text_win.toggle_lock()
|
self.text_win.toggle_lock()
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
def match_stanza(self, stanza):
|
def match_stanza(self, stanza) -> bool:
|
||||||
for matcher_ in self.filters:
|
for matcher_ in self.filters:
|
||||||
if not matcher_.match(stanza):
|
if not matcher_.match(stanza):
|
||||||
return False
|
return False
|
||||||
|
@ -232,7 +232,7 @@ class XMLTab(Tab):
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
@command_args_parser.raw
|
@command_args_parser.raw
|
||||||
def command_filter_xpath(self, xpath):
|
def command_filter_xpath(self, xpath: str):
|
||||||
"""/filter_xpath <xpath>"""
|
"""/filter_xpath <xpath>"""
|
||||||
try:
|
try:
|
||||||
self.update_filters(
|
self.update_filters(
|
||||||
|
@ -289,7 +289,7 @@ class XMLTab(Tab):
|
||||||
self.input.do_command("/") # we add the slash
|
self.input.do_command("/") # we add the slash
|
||||||
|
|
||||||
@refresh_wrapper.always
|
@refresh_wrapper.always
|
||||||
def reset_help_message(self, _=None):
|
def reset_help_message(self, _=None) -> bool:
|
||||||
if self.closed:
|
if self.closed:
|
||||||
return True
|
return True
|
||||||
if self.core.tabs.current_tab is self:
|
if self.core.tabs.current_tab is self:
|
||||||
|
@ -297,10 +297,10 @@ class XMLTab(Tab):
|
||||||
self.input = self.default_help_message
|
self.input = self.default_help_message
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_scroll_up(self):
|
def on_scroll_up(self) -> bool:
|
||||||
return self.text_win.scroll_up(self.text_win.height - 1)
|
return self.text_win.scroll_up(self.text_win.height - 1)
|
||||||
|
|
||||||
def on_scroll_down(self):
|
def on_scroll_down(self) -> bool:
|
||||||
return self.text_win.scroll_down(self.text_win.height - 1)
|
return self.text_win.scroll_down(self.text_win.height - 1)
|
||||||
|
|
||||||
@command_args_parser.ignored
|
@command_args_parser.ignored
|
||||||
|
@ -314,7 +314,7 @@ class XMLTab(Tab):
|
||||||
self.refresh()
|
self.refresh()
|
||||||
self.core.doupdate()
|
self.core.doupdate()
|
||||||
|
|
||||||
def execute_slash_command(self, txt):
|
def execute_slash_command(self, txt: str) -> bool:
|
||||||
if txt.startswith('/'):
|
if txt.startswith('/'):
|
||||||
self.input.key_enter()
|
self.input.key_enter()
|
||||||
self.execute_command(txt)
|
self.execute_command(txt)
|
||||||
|
|
Loading…
Reference in a new issue