Mercurial > libervia-backend
diff frontends/primitivus/primitivus @ 180:fdb961f27ae9
Primitivus: file sending and progress management
- added "send file" in one2one chat's menu
- new progress widget which is linked to the notification bar
- the notification bar show the average progress of all the current progress bars, and is used to show progress details
- if present, pudb is used for debugging (can continue without breaking terminal's setting)
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 16 Aug 2010 21:16:43 +0800 |
parents | a50953ac6191 |
children | a566f654929e |
line wrap: on
line diff
--- a/frontends/primitivus/primitivus Mon Aug 16 21:11:00 2010 +0800 +++ b/frontends/primitivus/primitivus Mon Aug 16 21:16:43 2010 +0800 @@ -30,12 +30,12 @@ from chat import Chat from gateways import GatewaysManager import custom_widgets -import pdb import logging from logging import debug, info, error import sys, os from tools.jid import JID from xmlui import XMLUI +from progress import Progress ### logging configuration FIXME: put this elsewhere ### @@ -59,6 +59,7 @@ ('menuitem', 'light gray,bold', 'dark red'), ('menuitem_focus', 'light gray,bold', 'dark green'), ('notifs', 'black,bold', 'yellow'), + ('notifs_focus', 'dark red', 'yellow'), ('card_neutral', 'dark gray', 'white', 'standout,underline'), ('card_neutral_selected', 'dark gray', 'dark green', 'standout,underline'), ('card_special', 'brown', 'white', 'standout,underline'), @@ -67,6 +68,12 @@ ('card_red_selected', 'dark red', 'dark green', 'standout,underline'), ('card_black', 'black', 'white', 'standout,underline'), ('card_black_selected', 'black', 'dark green', 'standout,underline'), + ('directory', 'dark cyan, bold', 'default'), + ('directory_focus', 'dark cyan, bold', 'dark green'), + ('separator', 'brown', 'default'), + ('warning', 'light red', 'default'), + ('progress_normal', 'default', 'black'), + ('progress_complete', 'default', 'light red'), ] class ChatList(QuickChatList): @@ -92,16 +99,22 @@ self.chat_wins=ChatList(self) self.notBar = custom_widgets.NotificationBar() urwid.connect_signal(self.notBar,'change',self.onNotification) + self.progress_wid = Progress(self) + urwid.connect_signal(self.notBar.progress,'click',lambda x:self.addWindow(self.progress_wid)) self.__saved_overlay = None def debug(self): - """convenient method to reset screen and launch pdb""" - import os - os.system('reset') - print 'Entered debug mode' - pdb.set_trace() + """convenient method to reset screen and launch p(u)db""" + try: + import pudb + pudb.set_trace() + except: + import os,pdb + os.system('reset') + print 'Entered debug mode' + pdb.set_trace() - def write_log(self, log, file_name='/tmp/primitivus_log'): + def writeLog(self, log, file_name='/tmp/primitivus_log'): """method to write log in a temporary file, useful for debugging""" with open(file_name, 'a') as f: f.write(log+"\n") @@ -261,7 +274,17 @@ self.center_part.widget_list[wid_idx] = urwid.Filler(urwid.Text('')) self.center_part.set_focus(0) self.redraw() - + + def addProgress (self, id, message): + """Follow a SàT progress bar + @param id: SàT id of the progression + @param message: message to show to identify the progression""" + self.progress_wid.addProgress(id, message) + + def setProgress(self, percentage): + """Set the progression shown in notification bar""" + self.notBar.setProgress(percentage) + def contactSelected(self, contact_list): contact = contact_list.get_contact() if contact: