quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
This commit is contained in:
parent
4d6d762aa8
commit
3cee372b02
2 changed files with 33 additions and 5 deletions
|
|
@ -275,6 +275,16 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
self.present_wid.deleteValue(nick)
|
||||
self.host.redraw()
|
||||
|
||||
def clearHistory(self):
|
||||
"""Clear the content of this chat."""
|
||||
del self.content[:]
|
||||
|
||||
def afterHistoryPrint(self):
|
||||
"""Refresh or scroll down the focus after the history is printed"""
|
||||
if len(self.content):
|
||||
self.text_list.focus_position = len(self.content) - 1 # scroll down
|
||||
self.host.redraw()
|
||||
|
||||
def printMessage(self, from_jid, msg, profile, timestamp=""):
|
||||
assert isinstance(from_jid, JID)
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ from sat_frontends.primitivus.progress import Progress
|
|||
from sat_frontends.primitivus.notify import Notify
|
||||
from sat_frontends.tools.misc import InputHistory
|
||||
from sat_frontends.constants import Const as commonConst # FIXME
|
||||
from sat.tools.jid import JID
|
||||
from sat.tools.jid import JID
|
||||
from os.path import join
|
||||
|
||||
|
||||
|
|
@ -133,6 +133,15 @@ class EditBar(sat_widgets.ModalEdit):
|
|||
self.app.status_bar.onChange(user_data=sat_widgets.AdvancedEdit(args[0]))
|
||||
else:
|
||||
self.app.status_bar.onStatusClick()
|
||||
elif command == 'history':
|
||||
try:
|
||||
limit = int(args[0])
|
||||
except (IndexError, ValueError):
|
||||
limit = 50
|
||||
win = self.app.chat_wins[JID(self.app.contact_list.selected).bare]
|
||||
win.clearHistory()
|
||||
if limit > 0:
|
||||
win.historyPrint(size=limit, profile=self.app.profile)
|
||||
else:
|
||||
return
|
||||
self.set_edit_text('')
|
||||
|
|
|
|||
Loading…
Reference in a new issue