Commit 84110a3c authored by Jacek Sowiński's avatar Jacek Sowiński

Don't focus back cmd-line until ':' is pressed

parent 2ece2812
......@@ -16,6 +16,7 @@
import urwid
class ConsoleWidget(urwid.LineBox):
def __init__(self, p_text=""):
urwid.register_signal(ConsoleWidget, ['close'])
......@@ -29,7 +30,10 @@ class ConsoleWidget(urwid.LineBox):
if p_key == 'enter' or p_key == 'q' or p_key == 'esc':
urwid.emit_signal(self, 'close')
# don't return the key, 'enter', 'escape' or 'q' are your only escape.
# don't return the key, 'enter', 'escape', 'q' or ':' are your only
# escape. ':' will reenter to the cmdline.
elif p_key == ':':
urwid.emit_signal(self, 'close', True)
def render(self, p_size, focus):
"""
......
......@@ -103,8 +103,10 @@ class UIApplication(CLIApplicationBase):
urwid.connect_signal(self.commandline, 'execute_command',
self._execute_handler)
def hide_console():
def hide_console(p_focus_commandline=False):
self._console_visible = False
if p_focus_commandline:
self._focus_commandline()
urwid.connect_signal(self.console, 'close', hide_console)
# view widget
......@@ -363,6 +365,7 @@ class UIApplication(CLIApplicationBase):
elif p_enabled == False and self._console_visible:
self.console.clear()
del contents[2]
self.mainwindow.focus_position = 0
@property
def _viewwidget_visible(self):
......
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