[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10863 - in gnuradio/branches/developers/jblum/grc/grc
From: |
jblum |
Subject: |
[Commit-gnuradio] r10863 - in gnuradio/branches/developers/jblum/grc/grc/src: gui platforms/gui |
Date: |
Fri, 17 Apr 2009 01:19:25 -0600 (MDT) |
Author: jblum
Date: 2009-04-17 01:19:24 -0600 (Fri, 17 Apr 2009)
New Revision: 10863
Modified:
gnuradio/branches/developers/jblum/grc/grc/src/gui/ActionHandler.py
gnuradio/branches/developers/jblum/grc/grc/src/gui/Actions.py
gnuradio/branches/developers/jblum/grc/grc/src/gui/Bars.py
gnuradio/branches/developers/jblum/grc/grc/src/gui/Constants.py
gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Block.py
gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Constants.py
gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Element.py
gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/FlowGraph.py
Log:
tweaks, and renamed rotate left/right to counter/clockwise
Modified: gnuradio/branches/developers/jblum/grc/grc/src/gui/ActionHandler.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/src/gui/ActionHandler.py
2009-04-17 02:58:41 UTC (rev 10862)
+++ gnuradio/branches/developers/jblum/grc/grc/src/gui/ActionHandler.py
2009-04-17 07:19:24 UTC (rev 10863)
@@ -19,7 +19,7 @@
import os
import signal
-from Constants import DIR_LEFT, DIR_RIGHT, IMAGE_FILE_EXTENSION
+from Constants import IMAGE_FILE_EXTENSION
import Actions
import pygtk
pygtk.require('2.0')
@@ -86,8 +86,8 @@
if self.get_focus_flag():
try:
self.handle_states({
- 'Left': Actions.BLOCK_ROTATE_LEFT,
- 'Right': Actions.BLOCK_ROTATE_RIGHT,
+ 'Left': Actions.BLOCK_ROTATE_CCW,
+ 'Right': Actions.BLOCK_ROTATE_CW,
'Up': Actions.BLOCK_DEC_TYPE,
'Down': Actions.BLOCK_INC_TYPE,
'equal': Actions.PORT_CONTROLLER_INC,
@@ -196,13 +196,13 @@
elif state == Actions.BLOCK_MOVE:
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == Actions.BLOCK_ROTATE_LEFT:
- if self.get_flow_graph().rotate_selected(DIR_LEFT):
+ elif state == Actions.BLOCK_ROTATE_CCW:
+ if self.get_flow_graph().rotate_selected(90):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == Actions.BLOCK_ROTATE_RIGHT:
- if self.get_flow_graph().rotate_selected(DIR_RIGHT):
+ elif state == Actions.BLOCK_ROTATE_CW:
+ if self.get_flow_graph().rotate_selected(-90):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
@@ -339,8 +339,8 @@
#update general buttons
Actions.get_action_from_name(Actions.ELEMENT_DELETE).set_sensitive(bool(self.get_flow_graph().get_selected_elements()))
Actions.get_action_from_name(Actions.BLOCK_PARAM_MODIFY).set_sensitive(bool(self.get_flow_graph().get_selected_block()))
-
Actions.get_action_from_name(Actions.BLOCK_ROTATE_RIGHT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
-
Actions.get_action_from_name(Actions.BLOCK_ROTATE_LEFT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+
Actions.get_action_from_name(Actions.BLOCK_ROTATE_CCW).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+
Actions.get_action_from_name(Actions.BLOCK_ROTATE_CW).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
#update cut/copy/paste
Actions.get_action_from_name(Actions.BLOCK_CUT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
Actions.get_action_from_name(Actions.BLOCK_COPY).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
Modified: gnuradio/branches/developers/jblum/grc/grc/src/gui/Actions.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/src/gui/Actions.py
2009-04-17 02:58:41 UTC (rev 10862)
+++ gnuradio/branches/developers/jblum/grc/grc/src/gui/Actions.py
2009-04-17 07:19:24 UTC (rev 10863)
@@ -28,8 +28,8 @@
APPLICATION_QUIT = 'app quit'
PARAM_MODIFY = 'param modify'
BLOCK_MOVE = 'block move'
-BLOCK_ROTATE_LEFT = 'block rotate left'
-BLOCK_ROTATE_RIGHT = 'block rotate right'
+BLOCK_ROTATE_CCW = 'block rotate ccw'
+BLOCK_ROTATE_CW = 'block rotate cw'
BLOCK_PARAM_MODIFY = 'block param modify'
BLOCK_INC_TYPE = 'block increment type'
BLOCK_DEC_TYPE = 'block decrement type'
@@ -66,13 +66,14 @@
FLOW_GRAPH_NEW: ('n', gtk.gdk.CONTROL_MASK),
FLOW_GRAPH_OPEN: ('o', gtk.gdk.CONTROL_MASK),
FLOW_GRAPH_SAVE: ('s', gtk.gdk.CONTROL_MASK),
+ FLOW_GRAPH_SAVE_AS: ('s', gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK),
FLOW_GRAPH_CLOSE: ('w', gtk.gdk.CONTROL_MASK),
APPLICATION_QUIT: ('q', gtk.gdk.CONTROL_MASK),
FLOW_GRAPH_UNDO: ('z', gtk.gdk.CONTROL_MASK),
FLOW_GRAPH_REDO: ('y', gtk.gdk.CONTROL_MASK),
ELEMENT_DELETE: ('Delete', 0),
- BLOCK_ROTATE_LEFT: ('Left', 0),
- BLOCK_ROTATE_RIGHT: ('Right', 0),
+ BLOCK_ROTATE_CCW: ('Left', 0),
+ BLOCK_ROTATE_CW: ('Right', 0),
BLOCK_PARAM_MODIFY: ('Return', 0),
BLOCK_ENABLE: ('e', 0),
BLOCK_DISABLE: ('d', 0),
@@ -99,8 +100,8 @@
gtk.Action(FLOW_GRAPH_UNDO, '_Undo', 'Undo a change to the flow graph',
gtk.STOCK_UNDO),
gtk.Action(FLOW_GRAPH_REDO, '_Redo', 'Redo a change to the flow graph',
gtk.STOCK_REDO),
gtk.Action(ELEMENT_DELETE, '_Delete', 'Delete the selected blocks',
gtk.STOCK_DELETE),
- gtk.Action(BLOCK_ROTATE_LEFT, 'Rotate _Left', 'Rotate the selected
blocks 90 degrees', gtk.STOCK_GO_BACK),
- gtk.Action(BLOCK_ROTATE_RIGHT, 'Rotate _Right', 'Rotate the selected
blocks -90 degrees', gtk.STOCK_GO_FORWARD),
+ gtk.Action(BLOCK_ROTATE_CCW, 'Rotate Counterclockwise', 'Rotate the
selected blocks 90 degrees to the left', gtk.STOCK_GO_BACK),
+ gtk.Action(BLOCK_ROTATE_CW, 'Rotate Clockwise', 'Rotate the selected
blocks 90 degrees to the right', gtk.STOCK_GO_FORWARD),
gtk.Action(BLOCK_PARAM_MODIFY, '_Properties', 'Modify params for the
selected block', gtk.STOCK_PROPERTIES),
gtk.Action(BLOCK_ENABLE, 'E_nable', 'Enable the selected blocks',
gtk.STOCK_CONNECT),
gtk.Action(BLOCK_DISABLE, 'D_isable', 'Disable the selected blocks',
gtk.STOCK_DISCONNECT),
Modified: gnuradio/branches/developers/jblum/grc/grc/src/gui/Bars.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/src/gui/Bars.py 2009-04-17
02:58:41 UTC (rev 10862)
+++ gnuradio/branches/developers/jblum/grc/grc/src/gui/Bars.py 2009-04-17
07:19:24 UTC (rev 10863)
@@ -43,8 +43,8 @@
Actions.FLOW_GRAPH_EXEC,
Actions.FLOW_GRAPH_KILL,
None,
- Actions.BLOCK_ROTATE_LEFT,
- Actions.BLOCK_ROTATE_RIGHT,
+ Actions.BLOCK_ROTATE_CCW,
+ Actions.BLOCK_ROTATE_CW,
None,
Actions.BLOCK_ENABLE,
Actions.BLOCK_DISABLE,
@@ -73,8 +73,8 @@
Actions.BLOCK_PASTE,
Actions.ELEMENT_DELETE,
None,
- Actions.BLOCK_ROTATE_LEFT,
- Actions.BLOCK_ROTATE_RIGHT,
+ Actions.BLOCK_ROTATE_CCW,
+ Actions.BLOCK_ROTATE_CW,
None,
Actions.BLOCK_ENABLE,
Actions.BLOCK_DISABLE,
Modified: gnuradio/branches/developers/jblum/grc/grc/src/gui/Constants.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/src/gui/Constants.py
2009-04-17 02:58:41 UTC (rev 10862)
+++ gnuradio/branches/developers/jblum/grc/grc/src/gui/Constants.py
2009-04-17 07:19:24 UTC (rev 10863)
@@ -31,10 +31,6 @@
##name for new/unsaved flow graphs
NEW_FLOGRAPH_TITLE = 'untitled'
-##rotation constants
-DIR_LEFT = 'left'
-DIR_RIGHT = 'right'
-
##main window constraints
MIN_WINDOW_WIDTH = 600
MIN_WINDOW_HEIGHT = 400
@@ -45,15 +41,6 @@
DEFAULT_BLOCKS_WINDOW_WIDTH = 100
DEFAULT_REPORTS_WINDOW_WIDTH = 100
-##How close can the mouse get to the window border before mouse events are
ignored.
-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
-##When the window has to be scrolled, move it this distance in the required
direction.
-SCROLL_DISTANCE = 15
-##How close the mouse click can be to a connection and register a connection
select.
-CONNECTION_SELECT_SENSITIVITY = 5
-
##The size of the state saving cache in the flow graph (for undo/redo
functionality)
STATE_CACHE_SIZE = 42
Modified: gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Block.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Block.py
2009-04-17 02:58:41 UTC (rev 10862)
+++ gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Block.py
2009-04-17 07:19:24 UTC (rev 10863)
@@ -21,7 +21,7 @@
import Utils
import Colors
from ... utils import odict
-from ... gui.Constants import BORDER_PROXIMITY_SENSITIVITY
+from Constants import BORDER_PROXIMITY_SENSITIVITY
from Constants import \
BLOCK_LABEL_PADDING, \
PORT_SEPARATION, LABEL_SEPARATION, \
Modified:
gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Constants.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Constants.py
2009-04-17 02:58:41 UTC (rev 10862)
+++ gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Constants.py
2009-04-17 07:19:24 UTC (rev 10863)
@@ -34,3 +34,11 @@
CONNECTOR_ARROW_HEIGHT = 17
#possible rotations in degrees
POSSIBLE_ROTATIONS = (0, 90, 180, 270)
+#How close can the mouse get to the window border before mouse events are
ignored.
+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
+#When the window has to be scrolled, move it this distance in the required
direction.
+SCROLL_DISTANCE = 15
+#How close the mouse click can be to a line and register a connection select.
+LINE_SELECT_SENSITIVITY = 5
Modified:
gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Element.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Element.py
2009-04-17 02:58:41 UTC (rev 10862)
+++ gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/Element.py
2009-04-17 07:19:24 UTC (rev 10863)
@@ -22,7 +22,7 @@
pygtk.require('2.0')
import gtk
import pango
-from ... gui.Constants import CONNECTION_SELECT_SENSITIVITY
+from Constants import LINE_SELECT_SENSITIVITY
from Constants import POSSIBLE_ROTATIONS
class Element(object):
@@ -81,12 +81,12 @@
gc.foreground = self.is_highlighted() and
Colors.H_COLOR or FG_color
window.draw_line(gc, X+x1, Y+y1, X+x2, Y+y2)
- def rotate(self, direction):
+ def rotate(self, rotation):
"""
Rotate all of the areas by 90 degrees.
- @param direction 90 or 270 degrees
+ @param rotation multiple of 90 degrees
"""
- self.set_rotation((self.get_rotation() + direction)%360)
+ self.set_rotation((self.get_rotation() + rotation)%360)
def clear(self):
"""Empty the lines and areas."""
@@ -201,8 +201,8 @@
if in_between(x, x1, x1+w) and in_between(y,
y1, y1+h): return self
#handle horizontal or vertical lines
for (x1, y1), (x2, y2) in
self.lines_dict[self.get_rotation()]:
- if x1 == x2: x1, x2 =
x1-CONNECTION_SELECT_SENSITIVITY, x2+CONNECTION_SELECT_SENSITIVITY
- if y1 == y2: y1, y2 =
y1-CONNECTION_SELECT_SENSITIVITY, y2+CONNECTION_SELECT_SENSITIVITY
+ if x1 == x2: x1, x2 =
x1-LINE_SELECT_SENSITIVITY, x2+LINE_SELECT_SENSITIVITY
+ if y1 == y2: y1, y2 =
y1-LINE_SELECT_SENSITIVITY, y2+LINE_SELECT_SENSITIVITY
if in_between(x, x1, x2) and in_between(y, y1,
y2): return self
return None
Modified:
gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/FlowGraph.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/FlowGraph.py
2009-04-17 02:58:41 UTC (rev 10862)
+++ gnuradio/branches/developers/jblum/grc/grc/src/platforms/gui/FlowGraph.py
2009-04-17 07:19:24 UTC (rev 10863)
@@ -17,9 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from ... gui.Constants import \
- DIR_LEFT, DIR_RIGHT, \
- SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE
+from Constants import SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE
from ... gui.Actions import \
ELEMENT_CREATE, ELEMENT_SELECT, \
BLOCK_PARAM_MODIFY, BLOCK_MOVE, \
@@ -206,15 +204,13 @@
selected_block.move(delta_coordinate)
self.element_moved = True
- def rotate_selected(self, direction):
+ def rotate_selected(self, rotation):
"""
- Rotate the selected blocks by 90 degrees.
- @param direction DIR_LEFT or DIR_RIGHT
+ Rotate the selected blocks by multiples of 90 degrees.
+ @param rotation the rotation in degrees
@return true if changed, otherwise false.
"""
if not self.get_selected_blocks(): return False
- #determine the number of degrees to rotate
- rotation = {DIR_LEFT: 90, DIR_RIGHT:270}[direction]
#initialize min and max coordinates
min_x, min_y = self.get_selected_block().get_coordinate()
max_x, max_y = self.get_selected_block().get_coordinate()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10863 - in gnuradio/branches/developers/jblum/grc/grc/src: gui platforms/gui,
jblum <=