conduit r1646 - in trunk: . conduit/gtkui conduit/hildonui



Author: jstowers
Date: Tue Aug  5 12:30:34 2008
New Revision: 1646
URL: http://svn.gnome.org/viewvc/conduit?rev=1646&view=rev

Log:
	* conduit/gtkui/Canvas.py:
	* conduit/hildonui/Canvas.py: Dont put a scrollbar on the
	canvas if its not needed. Fixes #546161


Added:
   trunk/   (props changed)
      - copied from r1644, /trunk/
Modified:
   trunk/ChangeLog
   trunk/conduit/gtkui/Canvas.py
   trunk/conduit/hildonui/Canvas.py

Modified: trunk/conduit/gtkui/Canvas.py
==============================================================================
--- /trunk/conduit/gtkui/Canvas.py	(original)
+++ trunk/conduit/gtkui/Canvas.py	Tue Aug  5 12:30:34 2008
@@ -294,6 +294,9 @@
         if idx != -1:
             self.root.remove_child(idx)
         self.welcome = None
+
+    def _resize_welcome(self, width):
+        self.welcome.set_width(width)
         
     def _create_welcome(self):
         c_x,c_y,c_w,c_h = self.get_bounds()
@@ -341,6 +344,10 @@
                     allocation.width,
                     self._get_minimum_canvas_size(allocation.height)
                     )
+
+        if self.welcome:
+            self._resize_welcome(allocation.width)
+
         for i in self._get_child_conduit_canvas_items():
             i.set_width(allocation.width)
 
@@ -427,7 +434,8 @@
             allocH = self.get_allocation().height
     
         bottom = self._get_bottom_of_conduits_coord()
-        return max(bottom + ConduitCanvasItem.WIDGET_HEIGHT + 20, allocH)
+        #return allocH-1 to stop vertical scroll bar
+        return max(bottom + ConduitCanvasItem.WIDGET_HEIGHT + 20, allocH-1)
         
     def _remove_overlap(self):
         """
@@ -837,6 +845,7 @@
     
 class ConduitCanvasItem(_CanvasItem):
 
+    BUTTONS = False
     DIVIDER = False
     FLAT_BOX = True
     WIDGET_HEIGHT = 63.0
@@ -865,6 +874,10 @@
         #goocanvas.Points need a list of tuples, not a list of lists. Yuck
         self.dividerPoints = [(),()]
 
+        #if self.BUTTONS, show sync and stop buttons
+        self.syncButton = None
+        self.stopButton = None
+
         #Build the widget
         self._build_widget(width)
 
@@ -938,6 +951,38 @@
                                     )
             self.add_child(self.divider)
 
+        if self.BUTTONS and self.model:
+            w = gtk.Button(label="")
+            w.set_image(
+                gtk.image_new_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)
+                )
+            w.set_relief(gtk.RELIEF_HALF)
+            self.syncButton = goocanvas.Widget(
+                                widget=w,
+                                x=true_width-19,
+                                y=22,
+                                width=28,
+                                height=28,
+                                anchor=gtk.ANCHOR_CENTER
+                                )
+            self.add_child(self.syncButton)
+
+            w = gtk.Button(label="")
+            w.set_image(
+                gtk.image_new_from_stock(gtk.STOCK_MEDIA_STOP, gtk.ICON_SIZE_MENU)
+                )
+            w.set_relief(gtk.RELIEF_HALF)
+            self.stopButton = goocanvas.Widget(
+                                widget=w,
+                                x=true_width-19,
+                                y=22+2+28,
+                                width=28,
+                                height=28,
+                                anchor=gtk.ANCHOR_CENTER
+                                )
+            self.add_child(self.stopButton)
+
+
     def _resize_height(self):
         sourceh =   0.0
         sinkh =     0.0
@@ -1155,7 +1200,7 @@
             self.dividerPoints[0] = (self.dividerPoints[0][0],h+10)
             self.dividerPoints[1] = (self.dividerPoints[0][0],h+10)
             self.divider.set_property("points", 
-                                goocanvas.Points(self.dividerPoints))        
+                                goocanvas.Points(self.dividerPoints))
 
     def set_width(self, w):
         true_width = w-self.LINE_WIDTH
@@ -1168,6 +1213,10 @@
             self.divider.set_property("points", 
                                 goocanvas.Points(self.dividerPoints))
 
+        #if self.BUTTONS:
+        #    self.syncButton.set_property("x", true_width-19)
+        #    self.stopButton.set_property("x", true_width-19)
+
         #resize the spacer
         p = goocanvas.Points([(0.0, 0.0), (true_width, 0.0)])
         self.l.set_property("points",p)

Modified: trunk/conduit/hildonui/Canvas.py
==============================================================================
--- /trunk/conduit/hildonui/Canvas.py	(original)
+++ trunk/conduit/hildonui/Canvas.py	Tue Aug  5 12:30:34 2008
@@ -47,6 +47,13 @@
         self.dataproviderMenu = DataProviderMenu(self)
         # conduit context menu
         self.conduitMenu = ConduitMenu(self)
+
+    def _resize_welcome(self, width):
+        self.welcome.set_properties(
+                            x=width/2, 
+                            y=width/3, 
+                            width=3*width/5
+                            )
         
     def _create_welcome(self):
         c_x,c_y,c_w,c_h = self.get_bounds()
@@ -330,6 +337,7 @@
 
 class ConduitCanvasItem(conduit.gtkui.Canvas.ConduitCanvasItem):
 
+    BUTTONS = False
     FLAT_BOX = False
     DIVIDER = False
     LINE_WIDTH = 3.0



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