[conduit] Dont show multiple messages on the canvas



commit 3d979df1e942ff518737c322b8e1ae6c885b4a5b
Author: John Stowers <john stowers gmail com>
Date:   Wed Sep 22 16:17:20 2010 +1200

    Dont show multiple messages on the canvas

 conduit/gtkui/Canvas.py  |   18 ++++++++++--------
 conduit/gtkui/MsgArea.py |    3 +++
 2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/conduit/gtkui/Canvas.py b/conduit/gtkui/Canvas.py
index 1d9315c..f5dd644 100644
--- a/conduit/gtkui/Canvas.py
+++ b/conduit/gtkui/Canvas.py
@@ -214,6 +214,15 @@ class Canvas(goocanvas.Canvas, _StyleMixin):
         self.msg.remove(msgarea)
 
     def _make_hint(self, hint, timeout=4):
+        if not self.msg:
+            return
+
+        if not conduit.GLOBALS.settings.get("gui_show_hints"):
+            return
+
+        if self.msg.is_showing_message():
+            return
+
         if Knowledge.HINT_TEXT[hint][2]:
             buttons = [(_("Show me"), hint)]
         else:
@@ -228,12 +237,6 @@ class Canvas(goocanvas.Canvas, _StyleMixin):
         h.show_all()    
         
     def _show_hint(self, conduitCanvasItem, dataproviderCanvasItem, newItem):
-        if not self.msg:
-            return
-            
-        if not conduit.GLOBALS.settings.get("gui_show_hints"):
-            return
-            
         if newItem == conduitCanvasItem:
             if conduitCanvasItem.model.can_sync():
                 self._make_hint(Knowledge.HINT_RIGHT_CLICK_CONFIGURE)
@@ -316,8 +319,7 @@ class Canvas(goocanvas.Canvas, _StyleMixin):
         if self.model == None or (self.model != None and self.model.num_conduits() == 0):
             if self.welcome == None:
                 self._create_welcome()
-            if self.msg and conduit.GLOBALS.settings.get("gui_show_hints"):
-                self._make_hint(Knowledge.HINT_BLANK_CANVAS, timeout=0)
+            self._make_hint(Knowledge.HINT_BLANK_CANVAS, timeout=0)
 
         elif self.welcome:
             self._delete_welcome()
diff --git a/conduit/gtkui/MsgArea.py b/conduit/gtkui/MsgArea.py
index 026a260..3f5b8cf 100644
--- a/conduit/gtkui/MsgArea.py
+++ b/conduit/gtkui/MsgArea.py
@@ -51,6 +51,9 @@ class MsgAreaController(gtk.VBox):
         for i in self.get_children():
             if type(i) == InfoBar:
                 self.remove(i)
+
+    def is_showing_message(self):
+        return len(self.get_children()) > 0
         
     def new_from_text_and_icon(self, primary, secondary=None, message_type=gtk.MESSAGE_INFO, buttons=(), timeout=0):
         infobar = InfoBar(primary, secondary, message_type, buttons)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]