[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7716 - in grc/branches/grc_reloaded: data notes src/g
From: |
jblum |
Subject: |
[Commit-gnuradio] r7716 - in grc/branches/grc_reloaded: data notes src/grc src/grc/elements src/grc/gui src/grc/gui/elements src/grc/platforms/gnuradio_python src/grc/platforms/gnuradio_python/blocks |
Date: |
Fri, 15 Feb 2008 21:06:37 -0700 (MST) |
Author: jblum
Date: 2008-02-15 21:06:36 -0700 (Fri, 15 Feb 2008)
New Revision: 7716
Removed:
grc/branches/grc_reloaded/data/initial_flow_graph.grc.xml
Modified:
grc/branches/grc_reloaded/notes/todo.txt
grc/branches/grc_reloaded/src/grc/ActionHandler.py
grc/branches/grc_reloaded/src/grc/Actions.py
grc/branches/grc_reloaded/src/grc/Constants.py
grc/branches/grc_reloaded/src/grc/Preferences.py
grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py
grc/branches/grc_reloaded/src/grc/gui/Bars.py
grc/branches/grc_reloaded/src/grc/gui/Dialogs.py
grc/branches/grc_reloaded/src/grc/gui/DrawingArea.py
grc/branches/grc_reloaded/src/grc/gui/__init__.py
grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
grc/branches/grc_reloaded/src/grc/gui/elements/Param.py
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/options.xml
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/default_flow_graph.grc.xml
Log:
work
Deleted: grc/branches/grc_reloaded/data/initial_flow_graph.grc.xml
Modified: grc/branches/grc_reloaded/notes/todo.txt
===================================================================
--- grc/branches/grc_reloaded/notes/todo.txt 2008-02-16 01:25:37 UTC (rev
7715)
+++ grc/branches/grc_reloaded/notes/todo.txt 2008-02-16 04:06:36 UTC (rev
7716)
@@ -1,11 +1,8 @@
############ GRC Reloaded: #############
-Implement variables block:
- $means substitution, no $ means use as a variable
-Integrate existing graphics code with new backend
-Import/Export in blocks and flowgraph
-Data type parsing in params
- remove datatype.py
+restore preferences
+fix connections
reload(usrp) in usrp diagnostics
+generate code
setup.py for grc
############ Blocks to Add: ####################
Modified: grc/branches/grc_reloaded/src/grc/ActionHandler.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/ActionHandler.py 2008-02-16 01:25:37 UTC
(rev 7715)
+++ grc/branches/grc_reloaded/src/grc/ActionHandler.py 2008-02-16 04:06:36 UTC
(rev 7716)
@@ -46,7 +46,7 @@
and connect all of the action handlers. Finally, enter the gtk
main loop and block.
@param file_paths a list of flow graph file passed from command
line
"""
- #TODO if PY_GTK_ICON:
gtk.window_set_default_icon_from_file(PY_GTK_ICON)
+ if PY_GTK_ICON:
gtk.window_set_default_icon_from_file(PY_GTK_ICON)
for action in ACTIONS_LIST: action.connect('activate',
self._handle_actions)
#setup the main window
self.main_window = gui.MainWindow(self.handle_states, platform)
@@ -163,7 +163,7 @@
for action in (
APPLICATION_QUIT, FLOW_GRAPH_NEW,
FLOW_GRAPH_OPEN, FLOW_GRAPH_SAVE_AS, FLOW_GRAPH_CLOSE,
ABOUT_WINDOW_DISPLAY,
DATA_TYPES_WINDOW_DISPLAY, HOTKEYS_WINDOW_DISPLAY, MATH_EXPR_WINDOW_DISPLAY,
- FLOW_GRAPH_WINDOW_RESIZE, PREFS_WINDOW_DISPLAY,
FLOW_GRAPH_SCREEN_CAPTURE,
+ PREFS_WINDOW_DISPLAY, FLOW_GRAPH_SCREEN_CAPTURE,
): get_action_from_name(action).set_sensitive(True)
#TODO if not self.init_file_paths and
Preferences.restore_files(): self.init_file_paths = Preferences.files_open()
if not self.init_file_paths: self.init_file_paths = ['']
@@ -243,12 +243,6 @@
gui.HotKeysDialog()
elif state == MATH_EXPR_WINDOW_DISPLAY:
gui.MathExprDialog()
- elif state == FLOW_GRAPH_WINDOW_RESIZE: #TODO remove
- dimensions =
gui.FlowGraphWindowSizeDialog(self.get_flow_graph().get_size_request()).run()
- if dimensions:
-
self.get_flow_graph().set_size_request(*dimensions)
-
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
- self.get_page().set_saved(False)
##############################################################################################
# Param Modifications
##############################################################################################
Modified: grc/branches/grc_reloaded/src/grc/Actions.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Actions.py 2008-02-16 01:25:37 UTC
(rev 7715)
+++ grc/branches/grc_reloaded/src/grc/Actions.py 2008-02-16 04:06:36 UTC
(rev 7716)
@@ -60,7 +60,6 @@
FLOW_GRAPH_SAVE_AS = 'flow graph save as'
FLOW_GRAPH_CLOSE = 'flow graph close'
FLOW_GRAPH_NEW = 'flow graph new'
-FLOW_GRAPH_WINDOW_RESIZE = 'flow graph window resize'
FLOW_GRAPH_EXEC = 'flow graph exec'
FLOW_GRAPH_STOP = 'flow graph stop'
FLOW_GRAPH_SCREEN_CAPTURE = 'flow graph screen capture'
@@ -89,7 +88,6 @@
gtk.Action(BLOCK_ROTATE_LEFT, 'Rotate _Left', 'Rotate the block 90
degrees', 'gtk-go-back'),
gtk.Action(BLOCK_ROTATE_RIGHT, 'Rotate _Right', 'Rotate the block -90
degrees', 'gtk-go-forward'),
gtk.Action(BLOCK_PARAM_MODIFY, '_Properties', 'Modify params for the
selected block', 'gtk-properties'),
- gtk.Action(FLOW_GRAPH_WINDOW_RESIZE, '_Window Size', 'Set the window
size', 'gtk-edit'),
gtk.Action(USRP_DIAGNOSTICS_DISPLAY, '_USRP Diagnostics', 'Analyze the
USRP', 'gtk-dialog-info'),
gtk.Action(PREFS_WINDOW_DISPLAY, '_Preferences', 'Configure
Preferences', 'gtk-preferences'),
gtk.Action(ABOUT_WINDOW_DISPLAY, '_About', 'About this program',
'gtk-about'),
Modified: grc/branches/grc_reloaded/src/grc/Constants.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Constants.py 2008-02-16 01:25:37 UTC
(rev 7715)
+++ grc/branches/grc_reloaded/src/grc/Constants.py 2008-02-16 04:06:36 UTC
(rev 7716)
@@ -132,6 +132,7 @@
PORT_HEIGHT = 17
PORT_WIDTH = 27
PORT_BORDER_SEPARATION = 10
+MAX_NUM_PORTS = 7
PARAM_FONT = 'Sans 8'
BLOCK_FONT = 'Sans 9 Bold'
@@ -173,11 +174,8 @@
SRC_DIR = os.path.abspath(os.path.dirname(__file__))
##Location of external data files.
-DATA_DIR = os.path.abspath(SRC_DIR+'/../data/')
+DATA_DIR = os.path.abspath(SRC_DIR + '/../../data/')
-##The setting for a blank flow graph.
-INITIAL_FLOW_GRAPH_FILE =
os.path.abspath(DATA_DIR+'/initial_flow_graph.grc.xml')
-
##The default file extension for flow graphs.
FLOW_GRAPH_FILE_EXTENSION = '.grc.xml'
@@ -185,13 +183,13 @@
IMAGE_FILE_EXTENSION = '.png'
##The default path for the open/save dialogs.
-DEFAULT_FILE_PATH = os.path.expanduser('~')+'/'
+DEFAULT_FILE_PATH = os.path.expanduser('~') + '/'
##The default icon for the gtk windows.
-PY_GTK_ICON = os.path.abspath(DATA_DIR+'/grc-icon-256.png')
+PY_GTK_ICON = os.path.abspath(DATA_DIR + '/grc-icon-256.png')
##The default icon for the wx windows.
-WX_APP_ICON = os.path.abspath(DATA_DIR+'/grc-icon-32.png')
+WX_APP_ICON = os.path.abspath(DATA_DIR + '/grc-icon-32.png')
#>>> platform dependency! wx under cygwin has issues with icon paths #
if sys.platform == 'cygwin': WX_APP_ICON = None
@@ -200,9 +198,6 @@
#>>> platform dependency! MacOS requires pythonw to run wx apps #
if sys.platform == 'darwin': PYEXEC = 'pythonw'
-##The default command to run a flow graph file.
-DEFAULT_FLOW_GRAPH_EXEC = '%s %s/ExecFlowGraphGUI.py'%(PYEXEC, SRC_DIR)
-
##The default user preferences file.
PREFERENCES_FILE_PATH = os.path.abspath(DEFAULT_FILE_PATH + '/.grc.xml')
address@hidden
Modified: grc/branches/grc_reloaded/src/grc/Preferences.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/Preferences.py 2008-02-16 01:25:37 UTC
(rev 7715)
+++ grc/branches/grc_reloaded/src/grc/Preferences.py 2008-02-16 04:06:36 UTC
(rev 7716)
@@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden Preferences
-#Holds global preferences stored as GraphicalParams.
+#Holds global preferences
address@hidden Josh Blum
import time,socket #for tagging saved files
Modified: grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py 2008-02-16
01:25:37 UTC (rev 7715)
+++ grc/branches/grc_reloaded/src/grc/elements/FlowGraph.py 2008-02-16
04:06:36 UTC (rev 7716)
@@ -37,10 +37,7 @@
#hold connections and blocks
self._elements = list()
#initialize
- Element.__init__(self, platform)
- #create option block
- self._options_block = self.get_parent().get_new_block(self,
'options')
- self._options_block.get_param('id').set_value('options')
+ Element.__init__(self, platform)
def __str__(self): return 'FlowGraph: "%s"'%self.get_option('name')
@@ -164,6 +161,9 @@
fg_n = n['flow_graph']
blocks_n = Utils.listify(fg_n, 'block')
connections_n = Utils.listify(fg_n, 'connection')
+ #create option block
+ self._options_block = self.get_parent().get_new_block(self,
'options')
+ self._options_block.get_param('id').set_value('options')
#build the blocks
for block_n in blocks_n:
key = block_n['key']
Modified: grc/branches/grc_reloaded/src/grc/gui/Bars.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/Bars.py 2008-02-16 01:25:37 UTC
(rev 7715)
+++ grc/branches/grc_reloaded/src/grc/gui/Bars.py 2008-02-16 04:06:36 UTC
(rev 7716)
@@ -72,7 +72,6 @@
FLOW_GRAPH_STOP,
]),
(gtk.Action('Options', '_Options', None, None), [
- FLOW_GRAPH_WINDOW_RESIZE,
PREFS_WINDOW_DISPLAY,
]),
(gtk.Action('Help', '_Help', None, None), [
Modified: grc/branches/grc_reloaded/src/grc/gui/Dialogs.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/Dialogs.py 2008-02-16 01:25:37 UTC
(rev 7715)
+++ grc/branches/grc_reloaded/src/grc/gui/Dialogs.py 2008-02-16 04:06:36 UTC
(rev 7716)
@@ -68,44 +68,6 @@
self.destroy()
######################################################################################################
-class FlowGraphWindowSizeDialog(gtk.Dialog):
- """A dialog box to set the window size, width and heigh in pixels."""
-
- def __init__(self, dimensions):
- """!
- FlowGraphWindowSizeDialog constructor.
- @param dimensions the (width,height) tuple from the flow graph
- """
- gtk.Dialog.__init__(self, buttons=('gtk-close',
gtk.RESPONSE_CLOSE))
- self.set_title("Set the Window Size")
- # the helpful dimension constraints label #
- window_size_label = gtk.Label()
- window_size_label.set_markup("""<i>
-Minimum window (width/height) in pixels is (%d/%d).
-Maximum window (width/height) in pixels is (%d/%d).
-</i>"""%(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT, MAX_WINDOW_WIDTH,
MAX_WINDOW_HEIGHT))
- self.vbox.pack_end(window_size_label, False)
- self.original_dimensions = width,height = dimensions
- self.width = Int(width, min=MIN_WINDOW_WIDTH,
max=MAX_WINDOW_WIDTH)
- self.height = Int(height, min=MIN_WINDOW_HEIGHT,
max=MAX_WINDOW_HEIGHT)
- self.vbox.pack_start(GraphicalParam('width (pixels)',
self.width).get_input_object(), False)
- self.vbox.pack_start(GraphicalParam('height (pixels)',
self.height).get_input_object(), False)
- self.show_all()
-
- def run(self):
- """!
- Get the new dimensions.
- @return the new dimensions (width,height) or None if invalid.
- """
- self.dimensions = None
- gtk.Dialog.run(self)
- if self.width.is_valid() and self.height.is_valid():
- self.dimensions = (self.width.parse(),
self.height.parse())
- self.destroy()
- if self.original_dimensions == self.dimensions: return None
# do not return dimensions if no change
- return self.dimensions
-
-######################################################################################################
def MessageDialogHelper(type, buttons, title=None, markup=None):
"""!
Create a modal message dialog and run it.
Modified: grc/branches/grc_reloaded/src/grc/gui/DrawingArea.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/DrawingArea.py 2008-02-16
01:25:37 UTC (rev 7715)
+++ grc/branches/grc_reloaded/src/grc/gui/DrawingArea.py 2008-02-16
04:06:36 UTC (rev 7716)
@@ -40,6 +40,7 @@
#inject drawing area into main_window
self._main_window.drawing_area = self
gtk.DrawingArea.__init__(self)
+ self.set_size_request(800, 600)
self.connect('expose-event', self._handle_window_expose)
self.connect('motion-notify-event', self._handle_mouse_motion)
self.connect('button-press-event',
self._handle_mouse_button_press)
@@ -106,9 +107,9 @@
return True
def _handle_window_expose(self, widget, event):
- """Called when the window initially appears or is resized:
create a new pixmap, draw the flow graph."""
- #TODO remove set size
- self.set_size_request(800, 600)
+ """!
+ Called when the window initially appears or is resized: create
a new pixmap, draw the flow graph.
+ """
self.gc = self.window.new_gc()
width, height = self.get_size_request()
if not self.pixmap or (width, height) !=
self.pixmap.get_size():
Modified: grc/branches/grc_reloaded/src/grc/gui/__init__.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/__init__.py 2008-02-16 01:25:37 UTC
(rev 7715)
+++ grc/branches/grc_reloaded/src/grc/gui/__init__.py 2008-02-16 04:06:36 UTC
(rev 7716)
@@ -23,5 +23,5 @@
#only import the modules that need external access
from MainWindow import MainWindow
from FileDialogs import
OpenFlowGraphFileDialog,SaveFlowGraphFileDialog,SaveImageFileDialog
-from Dialogs import
PreferencesDialog,FlowGraphWindowSizeDialog,MessageDialogHelper,AboutDialog,DataTypesDialog,HotKeysDialog,MathExprDialog
+from Dialogs import
PreferencesDialog,MessageDialogHelper,AboutDialog,DataTypesDialog,HotKeysDialog,MathExprDialog
from USRPDiagnostics import USRPDiagnosticsDialog,enable_usrp_diagnostics
Modified: grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-16
01:25:37 UTC (rev 7715)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/FlowGraph.py 2008-02-16
04:06:36 UTC (rev 7716)
@@ -139,7 +139,7 @@
try:
value =
param.evaluate()
value = value +
direction
- assert(0 <
value < 11)
+ assert(0 <
value <= MAX_NUM_PORTS)
param.set_value(value)
self.update()
return True
@@ -247,14 +247,13 @@
self.drawing_area.draw()
def update(self):
- print 'fg update'
"""Call update on all elements."""
map(lambda e: e.update(), self.get_elements())
#set the size of the flow graph area
- #old_x, old_y = self.get_size()
- #try: new_x, new_y = self.get_option('window_size')
- #except: new_x, new_y = old_x, old_y
- #if new_x != old_x or new_y != old_y:
self.drawing_area.set_size_request(new_x, new_y)
+ old_x, old_y = self.get_size()
+ try: new_x, new_y = self.get_option('window_size')
+ except: new_x, new_y = old_x, old_y
+ if new_x != old_x or new_y != old_y:
self.drawing_area.set_size_request(new_x, new_y)
#draw the flow graph
self.draw()
Modified: grc/branches/grc_reloaded/src/grc/gui/elements/Param.py
===================================================================
--- grc/branches/grc_reloaded/src/grc/gui/elements/Param.py 2008-02-16
01:25:37 UTC (rev 7715)
+++ grc/branches/grc_reloaded/src/grc/gui/elements/Param.py 2008-02-16
04:06:36 UTC (rev 7716)
@@ -41,8 +41,8 @@
gtk.HBox.__init__(self)
self.param = param
self._handle_changed = _handle_changed
- self.label = gtk.Label() #no label, markup is added by
set_markup
- self.label.set_size_request(140,-1)
+ self.label = gtk.Label('') #no label, markup is added by
set_markup
+ self.label.set_size_request(140, -1)
self.pack_start(self.label, False)
self.set_markup = lambda m: self.label.set_markup(m)
self.tp = None
@@ -50,30 +50,32 @@
class EntryParam(InputParam):
"""Provide an entry box for strings and numbers."""
- def __init__(self, *args):
- InputParam.__init__(self, *args)
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
self.entry = input = gtk.Entry()
input.set_text(self.param.get_value())
input.connect("changed", self._handle_changed)
self.pack_start(input, True)
self.get_text = input.get_text
- #tool tip fun
+ #tool tip
self.tp = gtk.Tooltips()
- self.tp.set_tip(self.entry, "")
+ self.tp.set_tip(self.entry, '')
self.tp.enable()
class FileParam(EntryParam):
"""Provide an entry box for filename and a button to browse for a
file."""
- def __init__(self, *args):
- EntryParam.__init__(self, *args)
+ def __init__(self, *args, **kwargs):
+ EntryParam.__init__(self, *args, **kwargs)
input = gtk.Button('...')
- input.connect('clicked', self.handle_clicked)
+ input.connect('clicked', self._handle_clicked)
self.pack_start(input, False)
- def handle_clicked(self, widget=None):
- """ If the button was clicked, open a file dialog in open/save
format.
- Replace the text in the entry with the new filename from the
file dialog. """
+ def _handle_clicked(self, widget=None):
+ """
+ If the button was clicked, open a file dialog in open/save
format.
+ Replace the text in the entry with the new filename from the
file dialog.
+ """
file_path = self.param.evaluate()
#bad file paths will be redirected to default
if not path.exists(path.dirname(file_path)): file_path =
DEFAULT_FILE_PATH
@@ -97,8 +99,8 @@
class EnumParam(InputParam):
"""Provide an entry box for Enum types with a drop down menu."""
- def __init__(self, *args):
- InputParam.__init__(self, *args)
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
input = gtk.ComboBox(gtk.ListStore(gobject.TYPE_STRING))
cell = gtk.CellRendererText()
input.pack_start(cell, True)
@@ -110,7 +112,7 @@
self.get_text = lambda: str(input.get_active()) #the get text
parses the selected index to a string
######################################################################################################
-# A Parameter, hold a data type and a cname
+# A Flow Graph Parameter
######################################################################################################
class Param(Element):
@@ -194,7 +196,7 @@
if t in ('file_open', 'file_save'): #file types
suggested_length = 30
if len(data) <= suggested_length: dt_str = data
- else: #truncate the tail if there is not
enough space
+ else: #truncate the tail if there is not enough
space
tail,head = path.split(data)
if len(head) >= suggested_length:
dt_str = head
else: dt_str =
tail[0:suggested_length-len(head)] + '...' + head
Modified:
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/options.xml
===================================================================
---
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/options.xml
2008-02-16 01:25:37 UTC (rev 7715)
+++
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/blocks/options.xml
2008-02-16 04:06:36 UTC (rev 7716)
@@ -26,7 +26,7 @@
<param>
<name>Window Size</name>
<key>window_size</key>
- <value>800, 600</value>
+ <value>1024, 768</value>
<type>int_vector</type>
</param>
<param>
@@ -44,6 +44,9 @@
</option>
</param>
<check>len(($window_size)) == 2</check>
- <check>400 <= $window_size[0] <= 1600</check>
- <check>300 <= $window_size[1] <= 1200</check>
+ <check>400 <= $window_size[0] <= 2048</check>
+ <check>300 <= $window_size[1] <= 1536</check>
+ <doc>
+The window size in (width, height) must be between (400, 300) and (2048, 1536).
+ </doc>
</block>
Modified:
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/default_flow_graph.grc.xml
===================================================================
---
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/default_flow_graph.grc.xml
2008-02-16 01:25:37 UTC (rev 7715)
+++
grc/branches/grc_reloaded/src/grc/platforms/gnuradio_python/default_flow_graph.grc.xml
2008-02-16 04:06:36 UTC (rev 7716)
@@ -13,10 +13,6 @@
<value>options</value>
</param>
<param>
- <key>window_size</key>
- <value>1000, 1000</value>
- </param>
- <param>
<key>position</key>
<value>{'x': 20, 'y': 20, 'rot': 0}</value>
</param>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7716 - in grc/branches/grc_reloaded: data notes src/grc src/grc/elements src/grc/gui src/grc/gui/elements src/grc/platforms/gnuradio_python src/grc/platforms/gnuradio_python/blocks,
jblum <=