conduit r1624 - in trunk: . conduit/gtkui



Author: jstowers
Date: Sat Aug  2 07:32:32 2008
New Revision: 1624
URL: http://svn.gnome.org/viewvc/conduit?rev=1624&view=rev

Log:
	* conduit/gtkui/Canvas.py:
	* conduit/gtkui/Hints.py:
	* conduit/gtkui/Makefile.am: Move hints to their own file.


Added:
   trunk/conduit/gtkui/Hints.py
Modified:
   trunk/   (props changed)
   trunk/ChangeLog
   trunk/conduit/gtkui/Canvas.py
   trunk/conduit/gtkui/Makefile.am

Modified: trunk/conduit/gtkui/Canvas.py
==============================================================================
--- trunk/conduit/gtkui/Canvas.py	(original)
+++ trunk/conduit/gtkui/Canvas.py	Sat Aug  2 07:32:32 2008
@@ -20,19 +20,10 @@
 import conduit.Conduit as Conduit
 import conduit.gtkui.Tree
 import conduit.gtkui.Util as GtkUtil
+import conduit.gtkui.Hints as Hints
 
 log.info("Module Information: %s" % Utils.get_module_information(goocanvas, "pygoocanvas_version"))
 
-HINT_BLANK_CANVAS       = -100
-HINT_ADD_DATAPROVIDER   = -101
-HINT_ADD_CONDUIT        = -102
-
-HINT_TEXT = {
-    HINT_BLANK_CANVAS:      ("Drag a dataprovder to continue", None),
-    HINT_ADD_DATAPROVIDER:  ("Conduit Created", "Add additional dataprovider"),
-    HINT_ADD_CONDUIT:       ("Welcome","Create a conduit")
-}
-
 class _StyleMixin:
 
     def _get_colors_and_state(self, styleName, stateName):
@@ -208,15 +199,24 @@
         self._maybe_show_welcome()
         
     def _do_hint(self, msgarea, respid):
-        if respid == HINT_ADD_DATAPROVIDER:
-            print "ADD DATAPROVIDER"
-            
+        if respid == Hints.BLANK_CANVAS:
+            new = conduit.GLOBALS.moduleManager.get_module_wrapper_with_instance("FolderTwoWay")
+            self.add_dataprovider_to_canvas(
+                                "FolderTwoWay",
+                                new,
+                                1,1
+                                )
+
     def _make_hint(self, hint, timeout=4):
+        if Hints.HINT_TEXT[hint][2]:
+            buttons = [("Show me",hint)]
+        else:
+            buttons = []
         h = self.msg.new_from_text_and_icon(
                             gtk.STOCK_INFO,
-                            HINT_TEXT[hint][0],
-                            HINT_TEXT[hint][1],
-                            buttons=[("Show me",hint)],
+                            Hints.HINT_TEXT[hint][0],
+                            Hints.HINT_TEXT[hint][1],
+                            buttons=buttons,
                             timeout=timeout)
         h.connect("response", self._do_hint)
         h.show_all()    
@@ -226,9 +226,11 @@
             return
             
         if newItem == conduitCanvasItem:
-            self._make_hint(HINT_ADD_DATAPROVIDER)
+            self._make_hint(Hints.ADD_DATAPROVIDER)
         elif newItem == dataproviderCanvasItem:
-            pass
+            #check if we have a source and a sink
+            if conduitCanvasItem.model.can_sync():
+                self._make_hint(Hints.RIGHT_CLICK_CONFIGURE)
             
     def _update_for_theme(self, *args):
         if not self.get_gtk_style() or self._changing_style:
@@ -307,7 +309,7 @@
             if self.welcome == None:
                 self._create_welcome()
             if self.msg:
-                self._make_hint(HINT_BLANK_CANVAS, timeout=0)
+                self._make_hint(Hints.BLANK_CANVAS, timeout=0)
 
         elif self.welcome:
             self._delete_welcome()

Added: trunk/conduit/gtkui/Hints.py
==============================================================================
--- (empty file)
+++ trunk/conduit/gtkui/Hints.py	Sat Aug  2 07:32:32 2008
@@ -0,0 +1,15 @@
+BLANK_CANVAS           = -100
+ADD_DATAPROVIDER       = -101
+RIGHT_CLICK_CONFIGURE  = -102
+
+HINT_TEXT = {
+    BLANK_CANVAS:(              "What Do You Want to Synchronize?",
+                                "Drag and Drop a Data Provider on the Canvas",
+                                True),
+    ADD_DATAPROVIDER:(          "Synchronization Group Created",
+                                "Add Another Data Provider to Synchronize it.",
+                                False),
+    RIGHT_CLICK_CONFIGURE:(     "You Are Now Ready to Synchronize",
+                                "Right Click on Group for Options",
+                                False)
+}

Modified: trunk/conduit/gtkui/Makefile.am
==============================================================================
--- trunk/conduit/gtkui/Makefile.am	(original)
+++ trunk/conduit/gtkui/Makefile.am	Sat Aug  2 07:32:32 2008
@@ -3,7 +3,9 @@
 	Canvas.py \
 	ConflictResolver.py \
 	Database.py \
+	Hints.py \
 	__init__.py \
+	MsgArea.py \
 	SimpleConfigurator.py \
 	Tree.py \
 	Util.py \



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