changeset 596:9054793ab60d frontends_multi_profiles

browser side (base widget): added an iterator on WidgetsPanel to iterate throught contained widgets, fixed widget deletion, commented a base try/catch (without exception specified), should be uncommented once a good Exception is here
author Goffi <goffi@goffi.org>
date Fri, 06 Feb 2015 19:19:49 +0100
parents d78126d82ca0
children be2891462e63
files src/browser/sat_browser/base_widget.py
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/base_widget.py	Fri Feb 06 19:15:52 2015 +0100
+++ b/src/browser/sat_browser/base_widget.py	Fri Feb 06 19:19:49 2015 +0100
@@ -168,7 +168,7 @@
             log.warning("unmanaged item type")
             return
         if isinstance(self, LiberviaWidget):
-            self.host.unregisterWidget(self)
+            # self.host.unregisterWidget(self) # FIXME
             self.onQuit()
             if not isinstance(_new_panel, LiberviaWidget):
                 log.warning("droping an object which is not a class of LiberviaWidget")
@@ -184,7 +184,8 @@
         for panel in _unempty_panels:
             td_elt = panel.getElement().parentNode
             DOM.setStyleAttribute(td_elt, "width", "%s%%" % _width)"""
-        #FIXME: delete object ? Check the right way with pyjamas
+        if isinstance(self, quick_widgets.QuickWidget):
+            self.host.widgets.deleteWidget(self)
 
 
 class WidgetMenuBar(base_menu.GenericMenuBar):
@@ -574,7 +575,11 @@
                                                  # dropping a widget there will add a new row
         td_elt = _bottom.getElement().parentNode
         DOM.setStyleAttribute(td_elt, "height", "1px")  # needed so the cell adapt to the size of the border (specially in webkit)
-        self._max_cols = 1  # give the maximum number of columns i a raw
+        self._max_cols = 1  # give the maximum number of columns in a raw
+
+    @property
+    def widgets(self):
+        return iter(self.flextable)
 
     def isLocked(self):
         return self.locked
@@ -583,17 +588,16 @@
         """Change the widget in the given location, add row or columns when necessary"""
         log.debug("changing widget: %s %s %s" % (wid.getDebugName(), row, col))
         last_row = max(0, self.flextable.getRowCount() - 1)
-        try:
-            prev_wid = self.flextable.getWidget(row, col)
-        except:
-            log.error("Trying to change an unexisting widget !")
-            return
+        # try:  # FIXME: except without exception specified !
+        prev_wid = self.flextable.getWidget(row, col)
+        # except:
+        #     log.error("Trying to change an unexisting widget !")
+        #     return
 
         cellFormatter = self.flextable.getFlexCellFormatter()
 
         if isinstance(prev_wid, BorderWidget):
             # We are on a border, we must create a row and/or columns
-            log.debug("BORDER WIDGET")
             prev_wid.removeStyleName('dragover')
 
             if isinstance(prev_wid, BottomBorderWidget):