changeset 1185:6184779544c7

Primitivus (xmlui): fixed window closing on save params + removed now unused onConfigureRoom in Chat
author Goffi <goffi@goffi.org>
date Mon, 08 Sep 2014 18:32:36 +0200
parents 62cba918cc63
children 9cc858acae91
files frontends/src/primitivus/chat.py frontends/src/primitivus/primitivus frontends/src/primitivus/xmlui.py
diffstat 3 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Mon Sep 08 18:15:15 2014 +0200
+++ b/frontends/src/primitivus/chat.py	Mon Sep 08 18:32:36 2014 +0200
@@ -26,7 +26,6 @@
 from sat_frontends.quick_frontend.quick_chat import QuickChat
 from sat_frontends.primitivus.card_game import CardGame
 from sat_frontends.quick_frontend.quick_utils import escapePrivate, unescapePrivate
-from sat_frontends.primitivus import xmlui
 from sat_frontends.primitivus.constants import Const as C
 from sat_frontends.primitivus.keys import action_key_map as a_key
 import time
@@ -372,13 +371,6 @@
         else:
             self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile)
 
-    def onConfigureRoom(self, menu):
-        def gotUI(xml_ui):
-            self.host.addWindow(xmlui.create(self.host, xml_ui))
-        def configureError(failure):
-            self.host.showPopUp(sat_widgets.Alert(failure.fullname, failure.message, ok_cb=self.host.removePopUp))
-        self.host.bridge.configureRoom(self.id, self.host.profile, callback=gotUI, errback=configureError)
-
     def onSendFileRequest(self, menu):
         # TODO: move this to core with dynamic menus
         dialog = FileDialog(ok_cb=self.onFileSelected, cancel_cb=self.host.removePopUp)
--- a/frontends/src/primitivus/primitivus	Mon Sep 08 18:15:15 2014 +0200
+++ b/frontends/src/primitivus/primitivus	Mon Sep 08 18:32:36 2014 +0200
@@ -657,7 +657,8 @@
 
     def onParam(self, menu):
         def success(params):
-            self.addWindow(xmlui.create(self, xml_data=params))
+            ui = xmlui.create(self, xml_data=params)
+            ui.show()
 
         def failure(error):
             self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get parameters (%s)") % error, ok_cb=self.removePopUp))
--- a/frontends/src/primitivus/xmlui.py	Mon Sep 08 18:15:15 2014 +0200
+++ b/frontends/src/primitivus/xmlui.py	Mon Sep 08 18:32:36 2014 +0200
@@ -20,6 +20,7 @@
 from sat.core.i18n import _
 import urwid
 import copy
+from sat.core import exceptions
 from urwid_satext import sat_widgets
 from urwid_satext import files_management
 from sat.core.log import getLogger
@@ -405,8 +406,10 @@
     def _xmluiClose(self):
         if self._dest == 'window':
             self.host.removeWindow()
+        elif self._dest == 'popup':
+            self.host.removePopUp()
         else:
-            self.host.removePopUp()
+            raise exceptions.InternalError("self._dest unknown, are you sure you have called XMLUI.show ?")
 
 
 class XMLUIDialog(xmlui.XMLUIDialog):