summaryrefslogtreecommitdiff
path: root/grc/gui/ActionHandler.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/gui/ActionHandler.py')
-rw-r--r--grc/gui/ActionHandler.py40
1 files changed, 24 insertions, 16 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 1db333fc5a..6ad2d5576f 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -49,7 +49,7 @@ class ActionHandler:
ActionHandler constructor.
Create the main window, setup the message handler, import the preferences,
and connect all of the action handlers. Finally, enter the gtk main loop and block.
-
+
Args:
file_paths: a list of flow graph file passed from command line
platform: platform module
@@ -81,7 +81,7 @@ class ActionHandler:
* some keys are ignored by the accelerators like the direction keys,
* some keys are not registered to any accelerators but are still used.
When not in focus, gtk and the accelerators handle the the key press.
-
+
Returns:
false to let gtk handle the key action
"""
@@ -95,7 +95,7 @@ class ActionHandler:
Handle the delete event from the main window.
Generated by pressing X to close, alt+f4, or right click+close.
This method in turns calls the state handler to quit.
-
+
Returns:
true
"""
@@ -117,7 +117,7 @@ class ActionHandler:
Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY,
Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW,
Actions.TOGGLE_REPORTS_WINDOW, Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
- Actions.TOOLS_RUN_FDESIGN,
+ Actions.TOOLS_RUN_FDESIGN, Actions.TOGGLE_SCROLL_LOCK, Actions.CLEAR_REPORTS,
): action.set_sensitive(True)
if ParseXML.xml_failures:
Messages.send_xml_errors_if_any(ParseXML.xml_failures)
@@ -135,6 +135,7 @@ class ActionHandler:
self.main_window.btwin.search_entry.hide()
Actions.TOGGLE_REPORTS_WINDOW.set_active(Preferences.reports_window_visibility())
Actions.TOGGLE_BLOCKS_WINDOW.set_active(Preferences.blocks_window_visibility())
+ Actions.TOGGLE_SCROLL_LOCK.set_active(Preferences.scroll_lock())
elif action == Actions.APPLICATION_QUIT:
if self.main_window.close_pages():
gtk.main_quit()
@@ -174,14 +175,14 @@ class ActionHandler:
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
##################################################
- # Create heir block
+ # Create heir block
##################################################
elif action == Actions.BLOCK_CREATE_HIER:
# keeping track of coordinates for pasting later
coords = self.get_flow_graph().get_selected_blocks()[0].get_coordinate()
x,y = coords
- x_min = x
+ x_min = x
y_min = y
pads = [];
@@ -200,9 +201,9 @@ class ActionHandler:
# If a block parameter exists that is a parameter, create a parameter for it
if param.get_value() == flow_param.get_id():
params.append(param.get_value())
-
-
- # keep track of x,y mins for pasting later
+
+
+ # keep track of x,y mins for pasting later
(x,y) = block.get_coordinate()
if x < x_min:
x_min = x
@@ -214,8 +215,8 @@ class ActionHandler:
# Get id of connected blocks
source_id = connection.get_source().get_parent().get_id()
sink_id = connection.get_sink().get_parent().get_id()
-
- # If connected block is not in the list of selected blocks create a pad for it
+
+ # If connected block is not in the list of selected blocks create a pad for it
if self.get_flow_graph().get_block(source_id) not in self.get_flow_graph().get_selected_blocks():
pads.append({'key': connection.get_sink().get_key(), 'coord': connection.get_source().get_coordinate(), 'block_id' : block.get_id(), 'direction': 'source'})
@@ -241,7 +242,7 @@ class ActionHandler:
# Remove the default samp_rate variable block that is created
remove_me = self.get_flow_graph().get_block("samp_rate")
- self.get_flow_graph().remove_element(remove_me)
+ self.get_flow_graph().remove_element(remove_me)
# Add the param blocks along the top of the window
@@ -297,9 +298,9 @@ class ActionHandler:
# Connect the pad to the proper sinks
new_connection = self.get_flow_graph().connect(pad_source,sink)
- # update the new heir block flow graph
+ # update the new heir block flow graph
self.get_flow_graph().update()
-
+
##################################################
# Move/Rotate/Delete/Create
@@ -373,6 +374,13 @@ class ActionHandler:
else:
self.main_window.btwin.hide()
Preferences.blocks_window_visibility(visible)
+ elif action == Actions.TOGGLE_SCROLL_LOCK:
+ visible = action.get_active()
+ self.main_window.text_display.scroll_lock = visible
+ if visible:
+ self.main_window.text_display.scroll_to_end()
+ elif action == Actions.CLEAR_REPORTS:
+ self.main_window.text_display.clear()
elif action == Actions.TOGGLE_HIDE_DISABLED_BLOCKS:
Actions.NOTHING_SELECT()
##################################################
@@ -495,7 +503,7 @@ class ActionHandler:
self.get_flow_graph()._old_selected_port = None
self.get_flow_graph()._new_selected_port = None
Actions.ELEMENT_CREATE()
-
+
elif action == Actions.BUSSIFY_SINKS:
n = {'name':'bus', 'type':'bus'}
for b in self.get_flow_graph().get_selected_blocks():
@@ -563,7 +571,7 @@ class ExecFlowGraphThread(Thread):
def __init__ (self, action_handler):
"""
ExecFlowGraphThread constructor.
-
+
Args:
action_handler: an instance of an ActionHandler
"""