primitivus group chat & misc
primitivus: new widget: SurroundedText (text with a character repeated around it) primitivus: new decorator LabelLine (like lineBox, but with a label on the top line) wix & primitivus & quick_app: group chat method move to quick_chat wix: when new message, window is not raised anymore, but RequestUserAttention is called instead
This commit is contained in:
parent
a21a658c33
commit
dbb3520a4f
1 changed files with 113 additions and 31 deletions
|
|
@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
import urwid
|
||||
from quick_frontend.quick_contact_list import QuickContactList
|
||||
from quick_frontend.quick_chat import QuickChat
|
||||
from custom_widgets import Password,List,InputDialog,ConfirmDialog,Alert,SelectableText
|
||||
from custom_widgets import Password,List,InputDialog,ConfirmDialog,Alert,SelectableText,LabelLine,SurroundedText
|
||||
|
||||
|
||||
class Chat(urwid.WidgetWrap, QuickChat):
|
||||
|
|
@ -31,8 +31,8 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
QuickChat.__init__(self, target, host, type)
|
||||
self.content = urwid.SimpleListWalker([])
|
||||
self.text_list = urwid.ListBox(self.content)
|
||||
main_widget = urwid.LineBox(
|
||||
urwid.Frame(self.text_list, urwid.AttrMap(urwid.Text(str(target),'center'),'title'))
|
||||
main_widget = LabelLine(
|
||||
urwid.Frame(self.text_list), SurroundedText(str(target))
|
||||
)
|
||||
urwid.WidgetWrap.__init__(self, main_widget)
|
||||
self.setType(type)
|
||||
|
|
@ -41,6 +41,12 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
QuickChat.setType(self, type)
|
||||
if type == 'one2one':
|
||||
self.historyPrint(profile=self.host.profile)
|
||||
|
||||
def setSubject(self, subject):
|
||||
"""Set title for a group chat"""
|
||||
QuickChat.setSubject(self, subject)
|
||||
self._w.base_widget.header = urwid.AttrMap(urwid.Text(unicode(subject),align='center'),'title')
|
||||
|
||||
|
||||
def printMessage(self, from_jid, msg, profile, timestamp=""):
|
||||
self.content.append(SelectableText("[%s] " % from_jid + msg))
|
||||
|
|
|
|||
Loading…
Reference in a new issue