[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10081 - in gnuradio/trunk/grc: . data/platforms/pytho
From: |
jblum |
Subject: |
[Commit-gnuradio] r10081 - in gnuradio/trunk/grc: . data/platforms/python data/platforms/python/blocks scripts src/gui src/platforms/gui src/platforms/python |
Date: |
Thu, 27 Nov 2008 23:51:23 -0700 (MST) |
Author: jblum
Date: 2008-11-27 23:51:21 -0700 (Thu, 27 Nov 2008)
New Revision: 10081
Removed:
gnuradio/trunk/grc/data/platforms/python/blocks/preferences.xml
Modified:
gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am
gnuradio/trunk/grc/data/platforms/python/flow_graph.tmpl
gnuradio/trunk/grc/scripts/grc
gnuradio/trunk/grc/src/gui/ActionHandler.py
gnuradio/trunk/grc/src/gui/Actions.py
gnuradio/trunk/grc/src/gui/Bars.py
gnuradio/trunk/grc/src/gui/Constants.py
gnuradio/trunk/grc/src/gui/Dialogs.py
gnuradio/trunk/grc/src/gui/FileDialogs.py
gnuradio/trunk/grc/src/gui/MainWindow.py
gnuradio/trunk/grc/src/gui/Preferences.py
gnuradio/trunk/grc/src/platforms/gui/Block.py
gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py
gnuradio/trunk/grc/src/platforms/python/Platform.py
gnuradio/trunk/grc/todo.txt
Log:
new preferences
Modified: gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am 2008-11-28
04:50:23 UTC (rev 10080)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am 2008-11-28
06:51:21 UTC (rev 10081)
@@ -183,7 +183,6 @@
pad_sink.xml \
pad_source.xml \
parameter.xml \
- preferences.xml \
probe_function.xml \
random_source_x.xml \
trellis_encoder_xx.xml \
Deleted: gnuradio/trunk/grc/data/platforms/python/blocks/preferences.xml
Modified: gnuradio/trunk/grc/data/platforms/python/flow_graph.tmpl
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/flow_graph.tmpl 2008-11-28
04:50:23 UTC (rev 10080)
+++ gnuradio/trunk/grc/data/platforms/python/flow_graph.tmpl 2008-11-28
06:51:21 UTC (rev 10081)
@@ -41,7 +41,6 @@
#set $class_name = $flow_graph.get_option('id')
#set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(),
param.get_make()) for param in $parameters])
#if $generate_options == 'wx_gui'
- #from gnuradio.grc.gui import Preferences
#import gtk
#set $icon = gtk.IconTheme().lookup_icon('gnuradio-grc', 32, 0)
class $(class_name)(grc_wxgui.top_block_gui):
@@ -49,7 +48,7 @@
def __init__($param_str):
grc_wxgui.top_block_gui.__init__(
self,
- title="$Preferences.window_prefix() - Executing:
$flow_graph.get_option('title')",
+ title="$flow_graph.get_parent().get_name() - Executing:
$flow_graph.get_option('title')",
#if $icon
icon="$icon.get_filename()",
#end if
Modified: gnuradio/trunk/grc/scripts/grc
===================================================================
--- gnuradio/trunk/grc/scripts/grc 2008-11-28 04:50:23 UTC (rev 10080)
+++ gnuradio/trunk/grc/scripts/grc 2008-11-28 06:51:21 UTC (rev 10081)
@@ -18,12 +18,11 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from gnuradio.grc.gui.Constants import FLOW_GRAPH_FILE_EXTENSION
from gnuradio.grc.platforms.base.Constants import VERSION
from optparse import OptionParser
if __name__ == "__main__":
- usage = 'usage: %%prog [options]
[optional_flow_graphs%s]'%FLOW_GRAPH_FILE_EXTENSION
+ usage = 'usage: %prog [options] [saved flow graphs]'
version = """
GNU Radio Companion %s
Modified: gnuradio/trunk/grc/src/gui/ActionHandler.py
===================================================================
--- gnuradio/trunk/grc/src/gui/ActionHandler.py 2008-11-28 04:50:23 UTC (rev
10080)
+++ gnuradio/trunk/grc/src/gui/ActionHandler.py 2008-11-28 06:51:21 UTC (rev
10081)
@@ -32,7 +32,7 @@
import random
from .. platforms.gui.Platform import Platform
from MainWindow import MainWindow
-from Dialogs import PreferencesDialog, AboutDialog
+from Dialogs import AboutDialog
from FileDialogs import OpenFlowGraphFileDialog, SaveFlowGraphFileDialog,
SaveImageFileDialog
gobject.threads_init()
@@ -77,13 +77,13 @@
"""
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 handler ensures that key presses without a mod mask,
+ only pass to the accelerators if the flow graph is in focus.
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():
+ if self.get_focus_flag():
try:
self.handle_states({
'Left': Actions.BLOCK_ROTATE_LEFT,
@@ -97,9 +97,9 @@
'KP_Subtract':
Actions.PORT_CONTROLLER_DEC,
}[gtk.gdk.keyval_name(event.keyval)])
return True
- #focus + selection: always return false for accelerator
to handle
+ #focus: always return false for accelerator to handle
except: return False
- #no focus + selection: only allow accelerator to handle when a
mod is used
+ #no focus: only allow accelerator to handle when a mod is used
return not event.state
def _quit(self, window, event):
@@ -141,9 +141,9 @@
Actions.APPLICATION_QUIT,
Actions.FLOW_GRAPH_NEW,
Actions.FLOW_GRAPH_OPEN,
Actions.FLOW_GRAPH_SAVE_AS,
Actions.FLOW_GRAPH_CLOSE,
Actions.ABOUT_WINDOW_DISPLAY,
- Actions.PREFS_WINDOW_DISPLAY,
Actions.FLOW_GRAPH_SCREEN_CAPTURE,
+ Actions.FLOW_GRAPH_SCREEN_CAPTURE,
):
Actions.get_action_from_name(action).set_sensitive(True)
- if not self.init_file_paths and
Preferences.restore_files():
+ if not self.init_file_paths:
self.init_file_paths = Preferences.files_open()
if not self.init_file_paths: self.init_file_paths = ['']
for file_path in self.init_file_paths:
@@ -240,9 +240,6 @@
##################################################
# Window stuff
##################################################
- elif state == Actions.PREFS_WINDOW_DISPLAY:
- PreferencesDialog()
- self.get_flow_graph().update()
elif state == Actions.ABOUT_WINDOW_DISPLAY:
AboutDialog()
##################################################
Modified: gnuradio/trunk/grc/src/gui/Actions.py
===================================================================
--- gnuradio/trunk/grc/src/gui/Actions.py 2008-11-28 04:50:23 UTC (rev
10080)
+++ gnuradio/trunk/grc/src/gui/Actions.py 2008-11-28 06:51:21 UTC (rev
10081)
@@ -56,7 +56,6 @@
FLOW_GRAPH_KILL = 'flow graph kill'
FLOW_GRAPH_SCREEN_CAPTURE = 'flow graph screen capture'
ABOUT_WINDOW_DISPLAY = 'about window display'
-PREFS_WINDOW_DISPLAY = 'prefs window display'
######################################################################################################
# Action Key Map
@@ -106,7 +105,6 @@
gtk.Action(BLOCK_CUT, 'Cu_t', 'Cut', 'gtk-cut'),
gtk.Action(BLOCK_COPY, '_Copy', 'Copy', 'gtk-copy'),
gtk.Action(BLOCK_PASTE, '_Paste', 'Paste', 'gtk-paste'),
- gtk.Action(PREFS_WINDOW_DISPLAY, '_Preferences', 'Configure
Preferences', 'gtk-preferences'),
gtk.Action(ABOUT_WINDOW_DISPLAY, '_About', 'About this program',
'gtk-about'),
gtk.Action(FLOW_GRAPH_GEN, '_Generate', 'Generate the flow graph',
'gtk-convert'),
gtk.Action(FLOW_GRAPH_EXEC, '_Execute', 'Execute the flow graph',
'gtk-execute'),
Modified: gnuradio/trunk/grc/src/gui/Bars.py
===================================================================
--- gnuradio/trunk/grc/src/gui/Bars.py 2008-11-28 04:50:23 UTC (rev 10080)
+++ gnuradio/trunk/grc/src/gui/Bars.py 2008-11-28 06:51:21 UTC (rev 10081)
@@ -86,9 +86,6 @@
Actions.FLOW_GRAPH_EXEC,
Actions.FLOW_GRAPH_KILL,
]),
- (gtk.Action('Options', '_Options', None, None), [
- Actions.PREFS_WINDOW_DISPLAY,
- ]),
(gtk.Action('Help', '_Help', None, None), [
Actions.ABOUT_WINDOW_DISPLAY,
]),
Modified: gnuradio/trunk/grc/src/gui/Constants.py
===================================================================
--- gnuradio/trunk/grc/src/gui/Constants.py 2008-11-28 04:50:23 UTC (rev
10080)
+++ gnuradio/trunk/grc/src/gui/Constants.py 2008-11-28 06:51:21 UTC (rev
10081)
@@ -23,7 +23,6 @@
DEFAULT_FILE_PATH = os.getcwd()
##file extensions
-FLOW_GRAPH_FILE_EXTENSION = '.grc'
IMAGE_FILE_EXTENSION = '.png'
##name for new/unsaved flow graphs
Modified: gnuradio/trunk/grc/src/gui/Dialogs.py
===================================================================
--- gnuradio/trunk/grc/src/gui/Dialogs.py 2008-11-28 04:50:23 UTC (rev
10080)
+++ gnuradio/trunk/grc/src/gui/Dialogs.py 2008-11-28 06:51:21 UTC (rev
10081)
@@ -41,27 +41,6 @@
self.set_cursor_visible(False)
self.set_wrap_mode(gtk.WRAP_WORD_CHAR)
-class PreferencesDialog(gtk.Dialog):
- """A dialog box to display the preferences."""
-
- def __init__(self):
- """PreferencesDialog constructor."""
- gtk.Dialog.__init__(self, buttons=('gtk-close',
gtk.RESPONSE_CLOSE))
- self.set_title("Preferences")
- self.set_size_request(MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT)
- notebook = gtk.Notebook()
- for title,desc,params in Preferences.get_preferences():
- vbox = gtk.VBox()
- vbox.pack_start(gtk.Label(''), False) #blank label for
spacing
- for param in params:
vbox.pack_start(param.get_input_object(), False)
- desc = desc.strip('\n')
- if desc: vbox.pack_start(TextDisplay(desc), False,
padding=5)
- notebook.append_page(vbox, gtk.Label(title))
- self.vbox.pack_start(notebook, True)
- self.show_all()
- self.run()
- self.destroy()
-
def MessageDialogHelper(type, buttons, title=None, markup=None):
"""
Create a modal message dialog and run it.
Modified: gnuradio/trunk/grc/src/gui/FileDialogs.py
===================================================================
--- gnuradio/trunk/grc/src/gui/FileDialogs.py 2008-11-28 04:50:23 UTC (rev
10080)
+++ gnuradio/trunk/grc/src/gui/FileDialogs.py 2008-11-28 06:51:21 UTC (rev
10081)
@@ -22,8 +22,9 @@
import gtk
from Dialogs import MessageDialogHelper
from Constants import \
- DEFAULT_FILE_PATH, FLOW_GRAPH_FILE_EXTENSION, \
- IMAGE_FILE_EXTENSION, NEW_FLOGRAPH_TITLE
+ DEFAULT_FILE_PATH, IMAGE_FILE_EXTENSION, \
+ NEW_FLOGRAPH_TITLE
+import Preferences
from os import path
OPEN_FLOW_GRAPH = 'open flow graph'
@@ -31,20 +32,26 @@
SAVE_IMAGE = 'save image'
##the filter for flow graph files
-FLOW_GRAPH_FILE_FILTER = gtk.FileFilter()
-FLOW_GRAPH_FILE_FILTER.set_name('GRC Files')
-FLOW_GRAPH_FILE_FILTER.add_pattern('*'+FLOW_GRAPH_FILE_EXTENSION)
-FLOW_GRAPH_FILE_FILTER.add_pattern('*.xml') #TEMP
+def get_flow_graph_files_filter():
+ filter = gtk.FileFilter()
+ filter.set_name('Flow Graph Files')
+ filter.add_pattern('*'+Preferences.file_extension())
+ filter.add_pattern('*.xml') #TEMP
+ return filter
##the filter for image files
-IMAGE_FILE_FILTER = gtk.FileFilter()
-IMAGE_FILE_FILTER.set_name('Image Files')
-IMAGE_FILE_FILTER.add_pattern('*'+IMAGE_FILE_EXTENSION)
+def get_image_files_filter():
+ filter = gtk.FileFilter()
+ filter.set_name('Image Files')
+ filter.add_pattern('*'+IMAGE_FILE_EXTENSION)
+ return filter
##the filter for all files
-ALL_FILE_FILTER = gtk.FileFilter()
-ALL_FILE_FILTER.set_name('All Files')
-ALL_FILE_FILTER.add_pattern('*')
+def get_all_files_filter():
+ filter = gtk.FileFilter()
+ filter.set_name('All Files')
+ filter.add_pattern('*')
+ return filter
class FileDialogHelper(gtk.FileChooserDialog):
"""
@@ -64,7 +71,7 @@
gtk.FileChooserDialog.__init__(self, title, None, action,
('gtk-cancel', gtk.RESPONSE_CANCEL, ok_stock, gtk.RESPONSE_OK))
self.set_select_multiple(False)
self.set_local_only(True)
- self.add_filter(ALL_FILE_FILTER)
+ self.add_filter(get_all_files_filter())
class FileDialog(FileDialogHelper):
"""A dialog box to save or open flow graph files. This is a base class,
do not use."""
@@ -74,18 +81,18 @@
FileDialog constructor.
@param current_file_path the current directory or path to the
open flow graph
"""
- if not current_file_path: current_file_path =
path.join(DEFAULT_FILE_PATH, NEW_FLOGRAPH_TITLE + FLOW_GRAPH_FILE_EXTENSION)
+ if not current_file_path: current_file_path =
path.join(DEFAULT_FILE_PATH, NEW_FLOGRAPH_TITLE + Preferences.file_extension())
if self.type == OPEN_FLOW_GRAPH:
FileDialogHelper.__init__(self,
gtk.FILE_CHOOSER_ACTION_OPEN, 'Open a Flow Graph from a File...')
- self.add_and_set_filter(FLOW_GRAPH_FILE_FILTER)
+ self.add_and_set_filter(get_flow_graph_files_filter())
self.set_select_multiple(True)
elif self.type == SAVE_FLOW_GRAPH:
FileDialogHelper.__init__(self,
gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph to a File...')
- self.add_and_set_filter(FLOW_GRAPH_FILE_FILTER)
+ self.add_and_set_filter(get_flow_graph_files_filter())
self.set_current_name(path.basename(current_file_path))
#show the current filename
elif self.type == SAVE_IMAGE:
FileDialogHelper.__init__(self,
gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph Screen Shot...')
- self.add_and_set_filter(IMAGE_FILE_FILTER)
+ self.add_and_set_filter(get_image_files_filter())
current_file_path = current_file_path +
IMAGE_FILE_EXTENSION
self.set_current_name(path.basename(current_file_path))
#show the current filename
self.set_current_folder(path.dirname(current_file_path))
#current directory
@@ -113,8 +120,8 @@
if self.type in (SAVE_FLOW_GRAPH, SAVE_IMAGE):
filename = self.get_filename()
for extension, filter in (
- (FLOW_GRAPH_FILE_EXTENSION,
FLOW_GRAPH_FILE_FILTER),
- (IMAGE_FILE_EXTENSION, IMAGE_FILE_FILTER),
+ (FLOW_GRAPH_FILE_EXTENSION,
get_flow_graph_files_filter()),
+ (IMAGE_FILE_EXTENSION,
get_image_files_filter()),
): #append the missing file extension if the filter
matches
if filename[len(filename)-len(extension):] !=
extension \
and filter == self.get_filter():
filename += extension
Modified: gnuradio/trunk/grc/src/gui/MainWindow.py
===================================================================
--- gnuradio/trunk/grc/src/gui/MainWindow.py 2008-11-28 04:50:23 UTC (rev
10080)
+++ gnuradio/trunk/grc/src/gui/MainWindow.py 2008-11-28 06:51:21 UTC (rev
10081)
@@ -90,7 +90,7 @@
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.resize(*Preferences.main_window_size())
self.flow_graph_vpaned.set_position(Preferences.reports_window_position())
self.hpaned.set_position(Preferences.blocks_window_position())
self.show_all()
@@ -190,7 +190,7 @@
#save state before closing
Preferences.files_open(open_files)
Preferences.file_open(open_file)
- Preferences.window_size(self.get_size())
+ Preferences.main_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()
@@ -231,16 +231,14 @@
Show/hide the reports window.
@param title the window title
"""
- if self.get_page():
- title = ''.join((
- Preferences.window_prefix(),
- ' - Editing: ',
- (self.get_page().get_file_path() or
NEW_FLOGRAPH_TITLE),
- (self.get_page().get_saved() and ' ' or
'*'), #blank must be non empty
- (self.get_page().get_read_only() and '
(read-only)' or ''),
- )
+ title = ''.join((
+ self._platform.get_name(),
+ ' - Editing: ',
+ (self.get_page().get_file_path() or
NEW_FLOGRAPH_TITLE),
+ (self.get_page().get_saved() and ' ' or '*'),
#blank must be non empty
+ (self.get_page().get_read_only() and '
(read-only)' or ''),
)
- else: title = MAIN_WINDOW_PREFIX + ' - Editor '
+ )
gtk.Window.set_title(self, title)
#set tab titles
for page in self._get_pages():
Modified: gnuradio/trunk/grc/src/gui/Preferences.py
===================================================================
--- gnuradio/trunk/grc/src/gui/Preferences.py 2008-11-28 04:50:23 UTC (rev
10080)
+++ gnuradio/trunk/grc/src/gui/Preferences.py 2008-11-28 06:51:21 UTC (rev
10081)
@@ -17,122 +17,70 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from .. platforms.base.Constants import FLOW_GRAPH_DTD
-from .. utils import ParseXML
-import Messages
+import ConfigParser
import os
-##Access the loaded preferences in this module
-_prefs = list()
-def _set_prefs(prefs): _prefs.append(prefs)
-def _get_prefs(): return _prefs[0]
-def load(platform): _Preferences(platform)
-def save(): _get_prefs().save()
-def get_preferences(): return _get_prefs().get_preferences()
+_platform = None
+_config_parser = ConfigParser.ConfigParser()
-class _Preferences(object):
+def file_extension(): return '.'+_platform.get_key()
+def _prefs_file(): return os.path.join(os.path.expanduser('~'),
file_extension())
- def __init__(self, platform):
- #make self available to module
- _set_prefs(self)
- #get prefs block
- self._prefs_block = platform.get_prefs_block()
- #prefs file path
- self._prefs_file_path = os.path.join(os.path.expanduser('~'),
self._prefs_block.get_param('prefs_file').get_value())
- #load
- try:
- ParseXML.validate_dtd(self._prefs_file_path,
FLOW_GRAPH_DTD)
- n = ParseXML.from_file(self._prefs_file_path)
- self._prefs_block.import_data(n['block'])
- except:
Messages.send_fail_load_preferences(self._prefs_file_path)
- ##all params
- self.window_prefix_param =
self._prefs_block.get_param('window_prefix')
- self.snap_to_grid_param =
self._prefs_block.get_param('snap_to_grid')
- 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')
- self.files_open_param =
self._prefs_block.get_param('files_open')
- self.show_params_param =
self._prefs_block.get_param('show_params')
+def load(platform):
+ global _platform
+ _platform = platform
+ #create sections
+ _config_parser.add_section('main')
+ _config_parser.add_section('files_open')
+ try: _config_parser.read(_prefs_file())
+ except: pass
+def save():
+ try: _config_parser.write(open(_prefs_file(), 'w'))
+ except: pass
- def save(self):
- try: ParseXML.to_file({'block':
self._prefs_block.export_data()}, self._prefs_file_path)
- except IOError:
Messages.send_fail_save_preferences(self._prefs_file_path)
-
- def get_preferences(self):
- ##Preferences: title, notes, params
- return [
- (
- 'Grid',
- '''
-Show grid will draw a square grid onto the flow graph with grid points
separated by grid size pixels. \
-Snap to Grid forces the upper right corner of the signal block to align with a
grid point.
-''',
- [self.snap_to_grid_param, self.grid_size_param,
self.show_grid_param],
- ),
- (
- 'Appearance',
- '''
-Show or hide all paramater labels in the signal blocks.
-''',
- [self.show_params_param],
- ),
- (
- 'Misc',
- '''
-Restore previously opened files on start-up.
-''',
- [self.restore_files_param],
- ),
- ]
-
###########################################################################
# Special methods for specific program functionalities
###########################################################################
-def window_prefix():
- return _get_prefs().window_prefix_param.get_value()
-
-def window_size(size=None):
- if size: _get_prefs().window_size_param.set_value(size)
+def main_window_size(size=None):
+ if size is not None:
+ _config_parser.set('main', 'main_window_width', size[0])
+ _config_parser.set('main', 'main_window_height', size[1])
else:
- try: return eval(_get_prefs().window_size_param.get_value())
- except: return (-1, -1)
+ try: return (
+ _config_parser.getint('main', 'main_window_width'),
+ _config_parser.getint('main', 'main_window_height'),
+ )
+ except: return (1, 1)
-def restore_files():
- return _get_prefs().restore_files_param.get_value() == 'yes'
-
def file_open(file=None):
- if file is not None: _get_prefs().file_open_param.set_value(file)
- else: return _get_prefs().file_open_param.get_value()
+ if file is not None: _config_parser.set('main', 'file_open', file)
+ else:
+ try: return _config_parser.get('main', 'file_open')
+ except: return ''
def files_open(files=None):
- if files is not None:
_get_prefs().files_open_param.set_value('\n'.join(files))
- else: return _get_prefs().files_open_param.get_value().split('\n')
+ if files is not None:
+ _config_parser.remove_section('files_open') #clear section
+ _config_parser.add_section('files_open')
+ for i, file in enumerate(files):
+ _config_parser.set('files_open', 'file_open_%d'%i, file)
+ else:
+ files = list()
+ i = 0
+ while True:
+ try: files.append(_config_parser.get('files_open',
'file_open_%d'%i))
+ except: return files
+ i = i + 1
def reports_window_position(pos=None):
- if pos is not None:
_get_prefs().reports_window_position_param.set_value('%d'%pos)
+ if pos is not None: _config_parser.set('main',
'reports_window_position', pos)
else:
- try: return
int(_get_prefs().reports_window_position_param.get_value()) or 1 #greater than 0
+ try: return _config_parser.getint('main',
'reports_window_position') 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)
+ if pos is not None: _config_parser.set('main',
'blocks_window_position', pos)
else:
- try: return
int(_get_prefs().blocks_window_position_param.get_value()) or 1 #greater than 0
+ try: return _config_parser.getint('main',
'blocks_window_position') or 1 #greater than 0
except: return -1
-
-def get_grid_size():
- return int(_get_prefs().grid_size_param.get_value())
-
-def snap_to_grid():
- return _get_prefs().snap_to_grid_param.get_value() == 'on'
-
-def show_grid():
- return _get_prefs().show_grid_param.get_value() == 'show'
-
-def show_params():
- return _get_prefs().show_params_param.get_value() == 'show'
Modified: gnuradio/trunk/grc/src/platforms/gui/Block.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/Block.py 2008-11-28 04:50:23 UTC
(rev 10080)
+++ gnuradio/trunk/grc/src/platforms/gui/Block.py 2008-11-28 06:51:21 UTC
(rev 10081)
@@ -17,7 +17,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from ... gui import Preferences
from Element import Element
import Utils
import Colors
@@ -137,13 +136,12 @@
layout.set_font_description(desc)
self.label_width, self.label_height = layout.get_pixel_size()
#display the params
- if Preferences.show_params():
- for param in filter(lambda p: p.get_hide() not in
('all', 'part'), self.get_params()):
- layout = param.get_layout()
- layouts.append(layout)
- w,h = layout.get_pixel_size()
- self.label_width = max(w, self.label_width)
- self.label_height = self.label_height + h +
LABEL_SEPARATION
+ for param in filter(lambda p: p.get_hide() not in ('all',
'part'), self.get_params()):
+ layout = param.get_layout()
+ layouts.append(layout)
+ w,h = layout.get_pixel_size()
+ self.label_width = max(w, self.label_width)
+ self.label_height = self.label_height + h +
LABEL_SEPARATION
width = self.label_width
height = self.label_height
#setup the pixmap
Modified: gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py 2008-11-28 04:50:23 UTC
(rev 10080)
+++ gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py 2008-11-28 06:51:21 UTC
(rev 10081)
@@ -17,7 +17,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from ... gui import Preferences
from ... gui.Constants import \
DIR_LEFT, DIR_RIGHT, \
SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE, \
@@ -302,15 +301,6 @@
#draw the background
self.get_gc().foreground = Colors.BACKGROUND_COLOR
self.get_pixmap().draw_rectangle(self.get_gc(), True,
0, 0, W, H)
- #draw grid (depends on prefs)
- if Preferences.show_grid():
- grid_size = Preferences.get_grid_size()
- points = list()
- for i in range(W/grid_size):
- for j in range(H/grid_size):
- points.append((i*grid_size,
j*grid_size))
- self.get_gc().foreground = Colors.TXT_COLOR
- self.get_pixmap().draw_points(self.get_gc(),
points)
#draw multi select rectangle
if self.mouse_pressed and (not
self.get_selected_elements() or self.get_ctrl_mask()):
#coordinates
@@ -507,16 +497,6 @@
self.time = 0
self.mouse_pressed = False
if self.element_moved:
- if Preferences.snap_to_grid():
- grid_size = Preferences.get_grid_size()
- X,Y =
self.get_selected_element().get_coordinate()
- deltaX = X%grid_size
- if deltaX < grid_size/2: deltaX = -1 * deltaX
- else: deltaX = grid_size - deltaX
- deltaY = Y%grid_size
- if deltaY < grid_size/2: deltaY = -1 * deltaY
- else: deltaY = grid_size - deltaY
- self.move_selected((deltaX, deltaY))
self.handle_states(BLOCK_MOVE)
self.element_moved = False
self.update_selected_elements()
Modified: gnuradio/trunk/grc/src/platforms/python/Platform.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/python/Platform.py 2008-11-28 04:50:23 UTC
(rev 10080)
+++ gnuradio/trunk/grc/src/platforms/python/Platform.py 2008-11-28 06:51:21 UTC
(rev 10081)
@@ -52,8 +52,8 @@
#init
_Platform.__init__(
self,
- name='GNURadio Python',
- key='gnuradio_python',
+ name='GRC',
+ key='grc',
block_paths=block_paths,
block_dtd=BLOCK_DTD,
block_tree=BLOCK_TREE,
Modified: gnuradio/trunk/grc/todo.txt
===================================================================
--- gnuradio/trunk/grc/todo.txt 2008-11-28 04:50:23 UTC (rev 10080)
+++ gnuradio/trunk/grc/todo.txt 2008-11-28 06:51:21 UTC (rev 10081)
@@ -19,7 +19,6 @@
-zoom in/out (cairo vector graphics) (use scroll wheel as control)
-search for blocks
-click and drag on whitespace to scroll
--expand preferences, allow for custom prefs, prefs dialog should infer
structure
-gui grid editor for configuring grid params/placing wxgui plots and controls
-grid param chooser gui
-histogram plot
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10081 - in gnuradio/trunk/grc: . data/platforms/python data/platforms/python/blocks scripts src/gui src/platforms/gui src/platforms/python,
jblum <=