summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
Diffstat (limited to 'grc')
-rw-r--r--grc/data/platforms/python/blocks/preferences.xml5
-rw-r--r--grc/src/gui/ActionHandler.py8
-rw-r--r--grc/src/gui/BlockTreeWindow.py4
-rw-r--r--grc/src/gui/Constants.py5
-rw-r--r--grc/src/gui/MainWindow.py13
-rw-r--r--grc/src/gui/Preferences.py7
-rw-r--r--grc/src/platforms/gui/Param.py2
7 files changed, 32 insertions, 12 deletions
diff --git a/grc/data/platforms/python/blocks/preferences.xml b/grc/data/platforms/python/blocks/preferences.xml
index 9e97f8faf..366675c94 100644
--- a/grc/data/platforms/python/blocks/preferences.xml
+++ b/grc/data/platforms/python/blocks/preferences.xml
@@ -125,4 +125,9 @@
<key>reports_window_position</key>
<type>string</type>
</param>
+ <param>
+ <name>Blocks Window Position</name>
+ <key>blocks_window_position</key>
+ <type>string</type>
+ </param>
</block>
diff --git a/grc/src/gui/ActionHandler.py b/grc/src/gui/ActionHandler.py
index cb31b3756..85bfcb34e 100644
--- a/grc/src/gui/ActionHandler.py
+++ b/grc/src/gui/ActionHandler.py
@@ -75,8 +75,12 @@ class ActionHandler:
def _handle_key_press(self, widget, event):
"""
- Handle key presses from the keyboard.
- Translate key combos into actions.
+ Handle key presses from the keyboard and translate key combos into actions.
+ This key press handler is called before the gtk accelerators kick in.
+ This handler ensures that key presses without a mod mask, only pass to the accelerators
+ if the flow graph is in focus and something is selected.
+ This function also handles keys that accelerators refuse to handle: left/right,
+ and keys that are not registered with an accelerator: +/-.
@return false to let the accelerators handle the key action
"""
if self.get_focus_flag() and self.get_flow_graph().is_selected():
diff --git a/grc/src/gui/BlockTreeWindow.py b/grc/src/gui/BlockTreeWindow.py
index 291cc6f3b..94b9476c5 100644
--- a/grc/src/gui/BlockTreeWindow.py
+++ b/grc/src/gui/BlockTreeWindow.py
@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from Constants import BLOCK_SELECTION_WINDOW_WIDTH
+from Constants import DEFAULT_BLOCKS_WINDOW_WIDTH
import pygtk
pygtk.require('2.0')
import gtk
@@ -57,7 +57,7 @@ class BlockTreeWindow(gtk.VBox):
scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scrolled_window.add_with_viewport(self.treeview)
- scrolled_window.set_size_request(BLOCK_SELECTION_WINDOW_WIDTH, -1)
+ scrolled_window.set_size_request(DEFAULT_BLOCKS_WINDOW_WIDTH, -1)
self.pack_start(scrolled_window)
#add button
self.add_button = gtk.Button(None, 'gtk-add')
diff --git a/grc/src/gui/Constants.py b/grc/src/gui/Constants.py
index 853572217..ccee7aa60 100644
--- a/grc/src/gui/Constants.py
+++ b/grc/src/gui/Constants.py
@@ -39,8 +39,9 @@ MIN_WINDOW_HEIGHT = 400
##dialog constraints
MIN_DIALOG_WIDTH = 500
MIN_DIALOG_HEIGHT = 500
-##static width of block selection window
-BLOCK_SELECTION_WINDOW_WIDTH = 200
+##default sizes
+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
diff --git a/grc/src/gui/MainWindow.py b/grc/src/gui/MainWindow.py
index 1976fb436..474da4f33 100644
--- a/grc/src/gui/MainWindow.py
+++ b/grc/src/gui/MainWindow.py
@@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
from Constants import \
MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT, \
- NEW_FLOGRAPH_TITLE
+ NEW_FLOGRAPH_TITLE, DEFAULT_REPORTS_WINDOW_WIDTH
from Actions import \
APPLICATION_QUIT, FLOW_GRAPH_KILL, \
FLOW_GRAPH_SAVE, get_accel_group
@@ -52,12 +52,13 @@ class MainWindow(gtk.Window):
self.handle_states = handle_states
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
vbox = gtk.VBox()
- hbox = gtk.HBox()
+ self.hpaned = gtk.HPaned()
self.add(vbox)
#create the menu bar and toolbar
self.add_accel_group(get_accel_group())
vbox.pack_start(Bars.MenuBar(), False)
vbox.pack_start(Bars.Toolbar(), False)
+ vbox.pack_start(self.hpaned)
#setup scrolled window
self.scrolled_window = gtk.ScrolledWindow()
self.scrolled_window.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT)
@@ -77,20 +78,21 @@ class MainWindow(gtk.Window):
flow_graph_box.pack_start(self.notebook, False, False, 0)
flow_graph_box.pack_start(self.scrolled_window)
self.flow_graph_vpaned.pack1(flow_graph_box)
- hbox.pack_start(self.flow_graph_vpaned)
- vbox.pack_start(hbox)
- hbox.pack_start(BlockTreeWindow(platform, self.get_flow_graph), False) #dont allow resize
+ self.hpaned.pack1(self.flow_graph_vpaned)
+ self.hpaned.pack2(BlockTreeWindow(platform, self.get_flow_graph), False) #dont allow resize
#create the reports window
self.text_display = TextDisplay()
#house the reports in a scrolled window
self.reports_scrolled_window = gtk.ScrolledWindow()
self.reports_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.reports_scrolled_window.add_with_viewport(self.text_display)
+ self.reports_scrolled_window.set_size_request(-1, DEFAULT_REPORTS_WINDOW_WIDTH)
self.flow_graph_vpaned.pack2(self.reports_scrolled_window, False) #dont allow resize
#load preferences and show the main window
Preferences.load(platform)
self.resize(*Preferences.window_size())
self.flow_graph_vpaned.set_position(Preferences.reports_window_position())
+ self.hpaned.set_position(Preferences.blocks_window_position())
self.show_all()
############################################################
@@ -190,6 +192,7 @@ class MainWindow(gtk.Window):
Preferences.file_open(open_file)
Preferences.window_size(self.get_size())
Preferences.reports_window_position(self.flow_graph_vpaned.get_position())
+ Preferences.blocks_window_position(self.hpaned.get_position())
Preferences.save()
return True
diff --git a/grc/src/gui/Preferences.py b/grc/src/gui/Preferences.py
index 741ed8ca7..d6533586f 100644
--- a/grc/src/gui/Preferences.py
+++ b/grc/src/gui/Preferences.py
@@ -51,6 +51,7 @@ class _Preferences(object):
self.grid_size_param = self._prefs_block.get_param('grid_size')
self.show_grid_param = self._prefs_block.get_param('show_grid')
self.reports_window_position_param = self._prefs_block.get_param('reports_window_position')
+ self.blocks_window_position_param = self._prefs_block.get_param('blocks_window_position')
self.restore_files_param = self._prefs_block.get_param('restore_files')
self.window_size_param = self._prefs_block.get_param('window_size')
self.file_open_param = self._prefs_block.get_param('file_open')
@@ -118,6 +119,12 @@ def reports_window_position(pos=None):
try: return int(_get_prefs().reports_window_position_param.get_value()) or 1 #greater than 0
except: return -1
+def blocks_window_position(pos=None):
+ if pos is not None: _get_prefs().blocks_window_position_param.set_value('%d'%pos)
+ else:
+ try: return int(_get_prefs().blocks_window_position_param.get_value()) or 1 #greater than 0
+ except: return -1
+
def get_grid_size():
return int(_get_prefs().grid_size_param.get_value())
diff --git a/grc/src/platforms/gui/Param.py b/grc/src/platforms/gui/Param.py
index 925f20657..43265f274 100644
--- a/grc/src/platforms/gui/Param.py
+++ b/grc/src/platforms/gui/Param.py
@@ -123,7 +123,7 @@ class Param(Element):
#truncate
max_len = max(27 - len(self.get_name()), 3)
if len(dt_str) > max_len:
- dt_str = dt_str[:max_len-3] + '...'
+ dt_str = dt_str[:max_len/2 -3] + '...' + dt_str[-max_len/2:]
return '<b>%s:</b> %s'%(Utils.xml_encode(self.get_name()), Utils.xml_encode(dt_str))
else: return '<span foreground="red"><b>%s:</b> error</span>'%Utils.xml_encode(self.get_name())