core, bridge, frontends: removed deprecated bridge method askConfirmation, confirmationAnswer, actionResult, actionResultExt and getWaitingConf
This commit is contained in:
parent
fb827ad023
commit
55357178ef
1 changed files with 6 additions and 309 deletions
|
|
@ -28,7 +28,6 @@ from sat.tools import config as sat_config
|
|||
import urwid
|
||||
from urwid.util import is_wide_char
|
||||
from urwid_satext import sat_widgets
|
||||
from urwid_satext.files_management import FileDialog
|
||||
from sat_frontends.bridge.DBus import DBusBridgeFrontend
|
||||
from sat_frontends.quick_frontend.quick_app import QuickApp
|
||||
from sat_frontends.quick_frontend import quick_utils
|
||||
|
|
@ -43,7 +42,6 @@ from sat_frontends.primitivus.keys import action_key_map as a_key
|
|||
from sat_frontends.primitivus import config
|
||||
from sat_frontends.tools.misc import InputHistory
|
||||
from sat_frontends.tools import jid
|
||||
from os.path import join
|
||||
import signal
|
||||
import sys
|
||||
|
||||
|
|
@ -744,78 +742,6 @@ class PrimitivusApp(QuickApp, InputHistory):
|
|||
def _actionManagerUnknownError(self):
|
||||
self.alert(_("Error"), _(u"Unmanaged action"))
|
||||
|
||||
def askConfirmationHandler(self, confirmation_id, confirmation_type, data, profile):
|
||||
answer_data = {}
|
||||
|
||||
def dir_selected_cb(path):
|
||||
dest_path = join(path, data['filename'])
|
||||
answer_data["dest_path"] = quick_utils.getNewPath(dest_path)
|
||||
self.addProgress(confirmation_id, dest_path)
|
||||
accept_cb(None)
|
||||
|
||||
def accept_file_transfer_cb(widget):
|
||||
self.removePopUp()
|
||||
pop_up_widget = FileDialog(dir_selected_cb, refuse_cb, title=_(u"Where do you want to save the file ?"), style=['dir'])
|
||||
self.showPopUp(pop_up_widget)
|
||||
|
||||
def accept_cb(widget):
|
||||
self.removePopUp()
|
||||
self.bridge.confirmationAnswer(confirmation_id, True, answer_data, profile)
|
||||
|
||||
def refuse_cb(widget):
|
||||
self.removePopUp()
|
||||
self.bridge.confirmationAnswer(confirmation_id, False, answer_data, profile)
|
||||
|
||||
if confirmation_type == "FILE_TRANSFER":
|
||||
pop_up_widget = sat_widgets.ConfirmDialog(_("The contact %(jid)s wants to send you the file %(filename)s\nDo you accept ?") % {'jid':data["from"], 'filename':data["filename"]}, no_cb=refuse_cb, yes_cb=accept_file_transfer_cb)
|
||||
self.showPopUp(pop_up_widget)
|
||||
|
||||
elif confirmation_type == "YES/NO":
|
||||
pop_up_widget = sat_widgets.ConfirmDialog(data["message"], no_cb=refuse_cb, yes_cb=accept_cb)
|
||||
self.showPopUp(pop_up_widget)
|
||||
|
||||
def actionResultHandler(self, type_, id, data, profile):
|
||||
# FIXME: to be removed
|
||||
|
||||
if not id in self.current_action_ids:
|
||||
log.debug (_('unknown id, ignoring'))
|
||||
return
|
||||
if type_ == "SUPPRESS":
|
||||
self.current_action_ids.remove(id)
|
||||
elif type_ == "XMLUI":
|
||||
self.current_action_ids.remove(id)
|
||||
log.debug (_("XML user interface received"))
|
||||
misc = {}
|
||||
#FIXME FIXME FIXME: must clean all this crap !
|
||||
title = _('Form')
|
||||
if data['type'] == 'registration':
|
||||
title = _('Registration')
|
||||
misc['target'] = data['target']
|
||||
misc['action_back'] = self.bridge.gatewayRegister
|
||||
ui = xmlui.create(self, title=title, xml_data=data['xml'], misc=misc, profile=profile)
|
||||
if data['type'] == 'registration':
|
||||
ui.show('popup')
|
||||
else:
|
||||
ui.show('window')
|
||||
elif type_ == "ERROR":
|
||||
self.current_action_ids.remove(id)
|
||||
self.alert(_("Error"), unicode(data["message"])) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore
|
||||
elif type_ == "RESULT":
|
||||
self.current_action_ids.remove(id)
|
||||
if self.current_action_ids_cb.has_key(id):
|
||||
callback = self.current_action_ids_cb[id]
|
||||
del self.current_action_ids_cb[id]
|
||||
callback(data)
|
||||
elif type_ == "DICT_DICT":
|
||||
self.current_action_ids.remove(id)
|
||||
if self.current_action_ids_cb.has_key(id):
|
||||
callback = self.current_action_ids_cb[id]
|
||||
del self.current_action_ids_cb[id]
|
||||
callback(data)
|
||||
else:
|
||||
log.error (_("FIXME FIXME FIXME: type [%s] not implemented") % type_)
|
||||
raise NotImplementedError
|
||||
|
||||
def roomJoinedHandler(self, room_jid_s, room_nicks, user_nick, subject, profile):
|
||||
super(PrimitivusApp, self).roomJoinedHandler(room_jid_s, room_nicks, user_nick, subject, profile)
|
||||
# if self.selected_widget is None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue