[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10079 - in gnuradio/trunk/grc: data/platforms/python/
From: |
jblum |
Subject: |
[Commit-gnuradio] r10079 - in gnuradio/trunk/grc: data/platforms/python/blocks src/gui src/platforms/gui |
Date: |
Thu, 27 Nov 2008 17:34:52 -0700 (MST) |
Author: jblum
Date: 2008-11-27 17:34:51 -0700 (Thu, 27 Nov 2008)
New Revision: 10079
Modified:
gnuradio/trunk/grc/data/platforms/python/blocks/preferences.xml
gnuradio/trunk/grc/src/gui/ActionHandler.py
gnuradio/trunk/grc/src/gui/BlockTreeWindow.py
gnuradio/trunk/grc/src/gui/Constants.py
gnuradio/trunk/grc/src/gui/MainWindow.py
gnuradio/trunk/grc/src/gui/Preferences.py
gnuradio/trunk/grc/src/platforms/gui/Param.py
Log:
blocks window position pref
Modified: gnuradio/trunk/grc/data/platforms/python/blocks/preferences.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/preferences.xml
2008-11-27 07:12:15 UTC (rev 10078)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/preferences.xml
2008-11-28 00:34:51 UTC (rev 10079)
@@ -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>
Modified: gnuradio/trunk/grc/src/gui/ActionHandler.py
===================================================================
--- gnuradio/trunk/grc/src/gui/ActionHandler.py 2008-11-27 07:12:15 UTC (rev
10078)
+++ gnuradio/trunk/grc/src/gui/ActionHandler.py 2008-11-28 00:34:51 UTC (rev
10079)
@@ -75,8 +75,12 @@
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():
Modified: gnuradio/trunk/grc/src/gui/BlockTreeWindow.py
===================================================================
--- gnuradio/trunk/grc/src/gui/BlockTreeWindow.py 2008-11-27 07:12:15 UTC
(rev 10078)
+++ gnuradio/trunk/grc/src/gui/BlockTreeWindow.py 2008-11-28 00:34:51 UTC
(rev 10079)
@@ -17,7 +17,7 @@
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 @@
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')
Modified: gnuradio/trunk/grc/src/gui/Constants.py
===================================================================
--- gnuradio/trunk/grc/src/gui/Constants.py 2008-11-27 07:12:15 UTC (rev
10078)
+++ gnuradio/trunk/grc/src/gui/Constants.py 2008-11-28 00:34:51 UTC (rev
10079)
@@ -39,8 +39,9 @@
##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
Modified: gnuradio/trunk/grc/src/gui/MainWindow.py
===================================================================
--- gnuradio/trunk/grc/src/gui/MainWindow.py 2008-11-27 07:12:15 UTC (rev
10078)
+++ gnuradio/trunk/grc/src/gui/MainWindow.py 2008-11-28 00:34:51 UTC (rev
10079)
@@ -19,7 +19,7 @@
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 @@
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 @@
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 @@
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
Modified: gnuradio/trunk/grc/src/gui/Preferences.py
===================================================================
--- gnuradio/trunk/grc/src/gui/Preferences.py 2008-11-27 07:12:15 UTC (rev
10078)
+++ gnuradio/trunk/grc/src/gui/Preferences.py 2008-11-28 00:34:51 UTC (rev
10079)
@@ -51,6 +51,7 @@
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 @@
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())
Modified: gnuradio/trunk/grc/src/platforms/gui/Param.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/Param.py 2008-11-27 07:12:15 UTC
(rev 10078)
+++ gnuradio/trunk/grc/src/platforms/gui/Param.py 2008-11-28 00:34:51 UTC
(rev 10079)
@@ -123,7 +123,7 @@
#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())
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10079 - in gnuradio/trunk/grc: data/platforms/python/blocks src/gui src/platforms/gui,
jblum <=