core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
- added profile argument to askConfirmation, actionResult, actionResultExt, entityDataUpdated, confirmationAnswer, getProgress
- core, frontends: fixed calls/signals according to new bridge API
- user of proper profile namespace for progression indicators and dialogs
- memory: getParam* now return bool when param type is bool
- memory: added getStringParam* to return string instead of typed value
- core, memory, storage, quick_frontend: getHistory now manage properly multi-profiles
- plugins XEP-0047, XEP-0054, XEP-0065, XEP-0077, XEP-0096; multi-profiles proper handling
This commit is contained in:
parent
49437fd9c3
commit
fa38394401
1 changed files with 570 additions and 400 deletions
|
|
@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
import urwid
|
||||
from urwid_satext import sat_widgets
|
||||
from sat.tools.jid import JID
|
||||
|
||||
|
||||
class Progress(urwid.WidgetWrap):
|
||||
|
|
@ -38,47 +37,48 @@ class Progress(urwid.WidgetWrap):
|
|||
main_wid = sat_widgets.FocusFrame(listbox, footer=buttons_wid)
|
||||
urwid.WidgetWrap.__init__(self, main_wid)
|
||||
|
||||
def addProgress(self, id, message):
|
||||
def addProgress(self, progress_id, message):
|
||||
profile = self.host.profile # TODO: manage multiple profiles
|
||||
mess_wid = urwid.Text(message)
|
||||
progr_wid = urwid.ProgressBar('progress_normal', 'progress_complete')
|
||||
column = urwid.Columns([mess_wid, progr_wid])
|
||||
self.progress_dict[id] = {'full':column,'progress':progr_wid,'state':'init'}
|
||||
self.progress_dict[(progress_id, profile)] = {'full':column,'progress':progr_wid,'state':'init'}
|
||||
self.progress_list.append(column)
|
||||
self.progressCB(self.host.loop, (id, message))
|
||||
self.progressCB(self.host.loop, (progress_id, message, profile))
|
||||
|
||||
def progressCB(self, loop, data):
|
||||
id, message = data
|
||||
data = self.host.bridge.getProgress(id)
|
||||
pbar = self.progress_dict[id]['progress']
|
||||
progress_id, message, profile = data
|
||||
data = self.host.bridge.getProgress(progress_id, profile)
|
||||
pbar = self.progress_dict[(progress_id, profile)]['progress'] #FIXME: must manage profiles
|
||||
if data:
|
||||
if self.progress_dict[id]['state'] == 'init':
|
||||
if self.progress_dict[(progress_id, profile)]['state'] == 'init':
|
||||
#first answer, we must construct the bar
|
||||
self.progress_dict[id]['state'] = 'progress'
|
||||
self.progress_dict[(progress_id, profile)]['state'] = 'progress'
|
||||
pbar.done = float(data['size'])
|
||||
|
||||
pbar.set_completion(float(data['position']))
|
||||
self.updateNotBar()
|
||||
else:
|
||||
if self.progress_dict[id]['state'] == 'progress':
|
||||
self.progress_dict[id]['state'] = 'done'
|
||||
if self.progress_dict[(progress_id, profile)]['state'] == 'progress':
|
||||
self.progress_dict[(progress_id, profile)]['state'] = 'done'
|
||||
pbar.set_completion(pbar.done)
|
||||
self.updateNotBar()
|
||||
return
|
||||
|
||||
loop.set_alarm_in(1,self.progressCB, (id, message))
|
||||
loop.set_alarm_in(1,self.progressCB, (progress_id, message, profile))
|
||||
|
||||
def __removeBar(self, id):
|
||||
wid = self.progress_dict[id]['full']
|
||||
def __removeBar(self, progress_id, profile):
|
||||
wid = self.progress_dict[(progress_id, profile)]['full']
|
||||
self.progress_list.remove(wid)
|
||||
del(self.progress_dict[id])
|
||||
del(self.progress_dict[(progress_id, profile)])
|
||||
|
||||
def __onClear(self, button):
|
||||
to_remove = []
|
||||
for id in self.progress_dict:
|
||||
if self.progress_dict[id]['state'] == 'done':
|
||||
to_remove.append(id)
|
||||
for id in to_remove:
|
||||
self.__removeBar(id)
|
||||
for progress_id, profile in self.progress_dict:
|
||||
if self.progress_dict[(progress_id, profile)]['state'] == 'done':
|
||||
to_remove.append((progress_id, profile))
|
||||
for progress_id, profile in to_remove:
|
||||
self.__removeBar(progress_id, profile)
|
||||
self.updateNotBar()
|
||||
|
||||
def updateNotBar(self):
|
||||
|
|
@ -87,8 +87,8 @@ class Progress(urwid.WidgetWrap):
|
|||
return
|
||||
progress = 0
|
||||
nb_bars = 0
|
||||
for id in self.progress_dict:
|
||||
pbar = self.progress_dict[id]['progress']
|
||||
for progress_id, profile in self.progress_dict:
|
||||
pbar = self.progress_dict[(progress_id, profile)]['progress']
|
||||
progress += pbar.current/pbar.done*100
|
||||
nb_bars+=1
|
||||
av_progress = progress/float(nb_bars)
|
||||
|
|
|
|||
Loading…
Reference in a new issue