commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7728 - in grc/branches/grc_reloaded: notes src/grc sr


From: jblum
Subject: [Commit-gnuradio] r7728 - in grc/branches/grc_reloaded: notes src/grc src/grc/gui/elements
Date: Sun, 17 Feb 2008 22:13:42 -0700 (MST)

Author: jblum
Date: 2008-02-17 22:13:42 -0700 (Sun, 17 Feb 2008)
New Revision: 7728

Modified:
   grc/branches/grc_reloaded/notes/todo.txt
   grc/branches/grc_reloaded/src/grc/Constants.py
   grc/branches/grc_reloaded/src/grc/gui/elements/Block.py
   grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
Log:
auto block positioning fixing

Modified: grc/branches/grc_reloaded/notes/todo.txt
===================================================================
--- grc/branches/grc_reloaded/notes/todo.txt    2008-02-18 03:09:07 UTC (rev 
7727)
+++ grc/branches/grc_reloaded/notes/todo.txt    2008-02-18 05:13:42 UTC (rev 
7728)
@@ -13,7 +13,6 @@
 
 ############   Known Problems: ####################
 -packet threads block on close
--blocks need to fix themselves when they go out of bounds, like in a resize
 -socket controllers should be intelligent on shrinkage
 -usrp transmit dies in lock/unlock
 -audio dies lock/unlock

Modified: grc/branches/grc_reloaded/src/grc/Constants.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Constants.py      2008-02-18 03:09:07 UTC 
(rev 7727)
+++ grc/branches/grc_reloaded/src/grc/Constants.py      2008-02-18 05:13:42 UTC 
(rev 7728)
@@ -150,7 +150,7 @@
 
######################################################################################################
 
 ##How close can the mouse get to the window border before mouse events are 
ignored.
-BORDER_PROXIMITY_SENSITIVITY = 10
+BORDER_PROXIMITY_SENSITIVITY = 50
 
 ##How close the mouse can get to the edge of the visible window before 
scrolling is invoked.
 SCROLL_PROXIMITY_SENSITIVITY = 30

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/Block.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Block.py     2008-02-18 
03:09:07 UTC (rev 7727)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Block.py     2008-02-18 
05:13:42 UTC (rev 7728)
@@ -55,7 +55,17 @@
                """             
                try: #should evaluate to dict
                        position = eval(self.get_param('position').get_value())
-                       return (int(position['x']), int(position['y']))
+                       x, y = int(position['x']), int(position['y'])
+                       fgW,fgH = self.get_parent().get_size()
+                       if x <= 0:
+                               x = 0
+                       elif x >= fgW - BORDER_PROXIMITY_SENSITIVITY:
+                               x = fgW - BORDER_PROXIMITY_SENSITIVITY          
                        
+                       if y <= 0:
+                               y = 0
+                       elif y >= fgH - BORDER_PROXIMITY_SENSITIVITY:   
+                               y = fgH - BORDER_PROXIMITY_SENSITIVITY  
+                       return (x, y)
                except: return (0, 0)
                
        def set_coordinate(self, coor):
@@ -88,8 +98,7 @@
        
        def update(self):
                """Update the block, parameters, and ports when a change 
occurs."""
-               self.clear()
-               #TODO self._adjust_ports()              
+               self.clear()    
                self._create_labels()                           
                self.W = self.label_width + 2*LABEL_PADDING_WIDTH
                max_ports = max(len(self.get_sinks()), len(self.get_sources()), 
1)
@@ -101,7 +110,7 @@
        def _create_labels(self):
                """Create the labels for the signal block."""
                layouts = list()
-               #       create the main layout  #
+               #create the main layout
                layout = 
gtk.DrawingArea().create_pango_layout(Utils.xml_encode(self.get_name()))
                desc = pango.FontDescription(BLOCK_FONT)
                layout.set_font_description(desc) 

Modified: grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-18 
03:09:07 UTC (rev 7727)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-18 
05:13:42 UTC (rev 7728)
@@ -60,6 +60,8 @@
        
        def get_size(self): return self.drawing_area.get_size_request()
        
+       def set_size(self, *args): self.drawing_area.set_size_request(*args)
+       
        def get_window(self): return self.drawing_area.window
        
        def get_scroll_pane(self): return self.drawing_area.get_parent()
@@ -253,7 +255,7 @@
                old_x, old_y = self.get_size()
                try: new_x, new_y = self.get_option('window_size')
                except: new_x, new_y = old_x, old_y
-               if new_x != old_x or new_y != old_y: 
self.drawing_area.set_size_request(new_x, new_y)
+               if new_x != old_x or new_y != old_y: self.set_size(new_x, new_y)
                #draw the flow graph
                self.draw()
                
@@ -332,19 +334,11 @@
                        self.selected_element:
                        #The event coordinates must be within BPS pixels away 
from the bounds of the flow graph.
                        fgW,fgH = self.get_size()
-                       x,y = coordinate
-                       if x <= BORDER_PROXIMITY_SENSITIVITY:
-                               x = BORDER_PROXIMITY_SENSITIVITY
-                       elif    x >= fgW - BORDER_PROXIMITY_SENSITIVITY:
-                               x = fgW - BORDER_PROXIMITY_SENSITIVITY          
                        
-                       if y <= BORDER_PROXIMITY_SENSITIVITY:
-                               y = BORDER_PROXIMITY_SENSITIVITY
-                       elif    y >= fgH - BORDER_PROXIMITY_SENSITIVITY:        
-                               y = fgH - BORDER_PROXIMITY_SENSITIVITY  
+                       x,y = coordinate                        
                        #get the change in coordinates  
                        X,Y = self.get_coordinate()
                        deltaX = int(x - X)
-                       deltaY = int(y - Y)                                     
                                                
+                       deltaY = int(y - Y)                                     
        
                        vAdj = 
self.get_scroll_pane().get_vadjustment().get_value()
                        hAdj = 
self.get_scroll_pane().get_hadjustment().get_value()
                        width = 
self.get_scroll_pane().get_hadjustment().page_size
@@ -363,4 +357,4 @@
                                
self.get_scroll_pane().get_vadjustment().set_value(vAdj-SCROLL_DISTANCE)
                        #move the selected element and record the new 
coordinate                
                        self.move_selected((deltaX, deltaY))    
-                       self.set_coordinate(coordinate)
+                       self.set_coordinate((x, y))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]