[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9512 - in gnuradio/branches/developers/jblum/grc_reor
From: |
jblum |
Subject: |
[Commit-gnuradio] r9512 - in gnuradio/branches/developers/jblum/grc_reorganize/grc: data/platforms/python src/gui src/platforms/base src/platforms/gui src/platforms/python src/utils |
Date: |
Sat, 6 Sep 2008 21:41:44 -0600 (MDT) |
Author: jblum
Date: 2008-09-06 21:41:43 -0600 (Sat, 06 Sep 2008)
New Revision: 9512
Added:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Constants.py
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/flow_graph.tmpl
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ActionHandler.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Actions.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Bars.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/BlockTreeWindow.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Dialogs.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/DrawingArea.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/FileDialogs.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/MainWindow.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/NotebookPage.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/StateCache.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Block.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Param.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Platform.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Block.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Connection.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Element.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/FlowGraph.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Makefile.am
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Param.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Port.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Utils.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Platform.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Port.py
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py
Log:
back to working order
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/flow_graph.tmpl
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/flow_graph.tmpl
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/flow_graph.tmpl
2008-09-07 03:41:43 UTC (rev 9512)
@@ -41,7 +41,8 @@
#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 grc.Constants import MAIN_WINDOW_PREFIX, DATA_DIR
+ #from gnuradio.grc.platforms.base.Constants import DATA_DIR
+ #from gnuradio.grc.gui.Constants import MAIN_WINDOW_PREFIX
class $(class_name)(grc_wxgui.top_block_gui):
def __init__($param_str):
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ActionHandler.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ActionHandler.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ActionHandler.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -19,8 +19,9 @@
import os
import signal
-from Constants import *
-from Actions import *
+from .. platforms.base.Constants import PY_GTK_ICON, IMAGE_FILE_EXTENSION
+from Constants import DIR_LEFT, DIR_RIGHT
+import Actions
import pygtk
pygtk.require('2.0')
import gtk
@@ -30,7 +31,6 @@
from .. utils import ParseXML
import random
from .. platforms.gui.Platform import Platform
-
from MainWindow import MainWindow
from Dialogs import PreferencesDialog, AboutDialog, HotKeysDialog
from FileDialogs import OpenFlowGraphFileDialog, SaveFlowGraphFileDialog,
SaveImageFileDialog
@@ -52,7 +52,7 @@
self.clipboard = None
platform = Platform(platform)
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)
+ for action in Actions.ACTIONS_LIST: action.connect('activate',
self._handle_actions)
#setup the main window
self.main_window = MainWindow(self.handle_states, platform)
self.main_window.connect('delete_event', self._quit)
@@ -65,7 +65,7 @@
Messages.send_init()
#initialize
self.init_file_paths = file_paths
- self.handle_states(APPLICATION_INITIALIZE)
+ self.handle_states(Actions.APPLICATION_INITIALIZE)
#enter the mainloop
gtk.gdk.threads_init()
gtk.main()
@@ -84,60 +84,60 @@
shift = event.state & gtk.gdk.SHIFT_MASK
#################### save/open/new/close
###############################
if ctrl and keyname == 's':
- self.handle_states(FLOW_GRAPH_SAVE)
+ self.handle_states(Actions.FLOW_GRAPH_SAVE)
elif ctrl and keyname == 'o':
- self.handle_states(FLOW_GRAPH_OPEN)
+ self.handle_states(Actions.FLOW_GRAPH_OPEN)
elif ctrl and keyname == 'n':
- self.handle_states(FLOW_GRAPH_NEW)
+ self.handle_states(Actions.FLOW_GRAPH_NEW)
elif ctrl and keyname == 'q':
- self.handle_states(FLOW_GRAPH_CLOSE)
+ self.handle_states(Actions.FLOW_GRAPH_CLOSE)
#################### Cut/Copy/Paste
###############################
elif self.get_focus_flag() and ctrl and keyname == 'x': #mouse
focus
- self.handle_states(BLOCK_CUT)
+ self.handle_states(Actions.BLOCK_CUT)
elif self.get_focus_flag() and ctrl and keyname == 'c': #mouse
focus
- self.handle_states(BLOCK_COPY)
+ self.handle_states(Actions.BLOCK_COPY)
elif self.get_focus_flag() and ctrl and keyname == 'v': #mouse
focus
- self.handle_states(BLOCK_PASTE)
+ self.handle_states(Actions.BLOCK_PASTE)
#################### Undo/Redo ###############################
elif ctrl and keyname == 'z':
- self.handle_states(FLOW_GRAPH_UNDO)
+ self.handle_states(Actions.FLOW_GRAPH_UNDO)
elif ctrl and keyname == 'y':
- self.handle_states(FLOW_GRAPH_REDO)
+ self.handle_states(Actions.FLOW_GRAPH_REDO)
#################### Delete ###############################
elif self.get_focus_flag() and keyname == 'Delete': #mouse
focus
- self.handle_states(ELEMENT_DELETE)
+ self.handle_states(Actions.ELEMENT_DELETE)
#################### Params ###############################
elif self.get_focus_flag() and keyname == 'Return': #mouse
focus
- self.handle_states(BLOCK_PARAM_MODIFY)
+ self.handle_states(Actions.BLOCK_PARAM_MODIFY)
#################### Rotate ###############################
elif self.get_focus_flag() and keyname == 'Right': #mouse focus
- self.handle_states(BLOCK_ROTATE_RIGHT)
+ self.handle_states(Actions.BLOCK_ROTATE_RIGHT)
elif self.get_focus_flag() and keyname == 'Left': #mouse focus
- self.handle_states(BLOCK_ROTATE_LEFT)
+ self.handle_states(Actions.BLOCK_ROTATE_LEFT)
#################### Enable/Disable
###############################
elif self.get_focus_flag() and keyname == 'e': #mouse focus
- self.handle_states(BLOCK_ENABLE)
+ self.handle_states(Actions.BLOCK_ENABLE)
elif self.get_focus_flag() and keyname == 'd': #mouse focus
- self.handle_states(BLOCK_DISABLE)
+ self.handle_states(Actions.BLOCK_DISABLE)
#################### Data Type ###############################
elif self.get_focus_flag() and keyname == 'Down': #mouse focus
- self.handle_states(BLOCK_INC_TYPE)
+ self.handle_states(Actions.BLOCK_INC_TYPE)
elif self.get_focus_flag() and keyname == 'Up': #mouse focus
- self.handle_states(BLOCK_DEC_TYPE)
+ self.handle_states(Actions.BLOCK_DEC_TYPE)
#################### Port Controllers
###############################
elif self.get_focus_flag() and keyname in ('equal','plus',
'KP_Add'): #mouse focus
- self.handle_states(PORT_CONTROLLER_INC)
+ self.handle_states(Actions.PORT_CONTROLLER_INC)
elif self.get_focus_flag() and keyname in ('minus',
'KP_Subtract'): #mouse focus
- self.handle_states(PORT_CONTROLLER_DEC)
+ self.handle_states(Actions.PORT_CONTROLLER_DEC)
#################### Gen/Exec/Stop/Print
###############################
elif keyname == 'F5':
- self.handle_states(FLOW_GRAPH_GEN)
+ self.handle_states(Actions.FLOW_GRAPH_GEN)
elif keyname == 'F6':
- self.handle_states(FLOW_GRAPH_EXEC)
+ self.handle_states(Actions.FLOW_GRAPH_EXEC)
elif keyname == 'F7':
- self.handle_states(FLOW_GRAPH_KILL)
+ self.handle_states(Actions.FLOW_GRAPH_KILL)
elif keyname == 'Print':
- self.handle_states(FLOW_GRAPH_SCREEN_CAPTURE)
+ self.handle_states(Actions.FLOW_GRAPH_SCREEN_CAPTURE)
#propagate this if the fg is not in focus or nothing is selected
return self.get_focus_flag() and
self.get_flow_graph().is_selected()
@@ -148,7 +148,7 @@
This method in turns calls the state handler to quit.
@return true
"""
- self.handle_states(APPLICATION_QUIT)
+ self.handle_states(Actions.APPLICATION_QUIT)
return True
def _handle_actions(self, event):
@@ -173,41 +173,45 @@
##############################################################################################
# Initalize/Quit
##############################################################################################
- if state == APPLICATION_INITIALIZE:
- for action in ACTIONS_LIST: action.set_sensitive(False)
#set all actions disabled
+ if state == Actions.APPLICATION_INITIALIZE:
+ for action in Actions.ACTIONS_LIST:
action.set_sensitive(False) #set all actions disabled
# enable a select few actions
for action in (
- APPLICATION_QUIT, FLOW_GRAPH_NEW,
FLOW_GRAPH_OPEN, FLOW_GRAPH_SAVE_AS, FLOW_GRAPH_CLOSE,
- ABOUT_WINDOW_DISPLAY, HOTKEYS_WINDOW_DISPLAY,
- PREFS_WINDOW_DISPLAY, FLOW_GRAPH_SCREEN_CAPTURE,
- ): get_action_from_name(action).set_sensitive(True)
- if not self.init_file_paths and
Preferences.restore_files(): self.init_file_paths = Preferences.files_open()
+ 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.HOTKEYS_WINDOW_DISPLAY,
Actions.PREFS_WINDOW_DISPLAY,
+ Actions.FLOW_GRAPH_SCREEN_CAPTURE,
+ ):
Actions.get_action_from_name(action).set_sensitive(True)
+ 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 = ['']
for file_path in self.init_file_paths:
if file_path:
self.main_window.new_page(file_path) #load pages from file paths
- if Preferences.file_open() in self.init_file_paths:
self.main_window.new_page(Preferences.file_open(), show=True)
+ if Preferences.file_open() in self.init_file_paths:
+
self.main_window.new_page(Preferences.file_open(), show=True)
if not self.get_page(): self.main_window.new_page()
#ensure that at least a blank page exists
- elif state == APPLICATION_QUIT:
+ elif state == Actions.APPLICATION_QUIT:
if self.main_window.close_pages():
gtk.main_quit()
exit(0)
##############################################################################################
# Selections
##############################################################################################
- elif state == ELEMENT_SELECT:
+ elif state == Actions.ELEMENT_SELECT:
self.get_flow_graph().update()
- elif state == NOTHING_SELECT:
+ elif state == Actions.NOTHING_SELECT:
self.get_flow_graph().unselect()
self.get_flow_graph().update()
##############################################################################################
# Enable/Disable
##############################################################################################
- elif state == BLOCK_ENABLE:
+ elif state == Actions.BLOCK_ENABLE:
if self.get_flow_graph().enable_selected(True):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == BLOCK_DISABLE:
+ elif state == Actions.BLOCK_DISABLE:
if self.get_flow_graph().enable_selected(False):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
@@ -215,12 +219,12 @@
##############################################################################################
# Cut/Copy/Paste
##############################################################################################
- elif state == BLOCK_CUT:
+ elif state == Actions.BLOCK_CUT:
self.handle_states(BLOCK_COPY)
self.handle_states(ELEMENT_DELETE)
- elif state == BLOCK_COPY:
+ elif state == Actions.BLOCK_COPY:
self.clipboard =
self.get_flow_graph().copy_to_clipboard()
- elif state == BLOCK_PASTE:
+ elif state == Actions.BLOCK_PASTE:
if self.clipboard:
self.get_flow_graph().paste_from_clipboard(self.clipboard)
self.get_flow_graph().update()
@@ -229,45 +233,45 @@
##############################################################################################
# Move/Rotate/Delete/Create
##############################################################################################
- elif state == BLOCK_MOVE:
+ elif state == Actions.BLOCK_MOVE:
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == BLOCK_ROTATE_LEFT:
+ elif state == Actions.BLOCK_ROTATE_LEFT:
if self.get_flow_graph().rotate_selected(DIR_LEFT):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == BLOCK_ROTATE_RIGHT:
+ elif state == Actions.BLOCK_ROTATE_RIGHT:
if self.get_flow_graph().rotate_selected(DIR_RIGHT):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == ELEMENT_DELETE:
+ elif state == Actions.ELEMENT_DELETE:
if self.get_flow_graph().remove_selected():
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
- self.handle_states(NOTHING_SELECT)
+ self.handle_states(Actions.NOTHING_SELECT)
self.get_page().set_saved(False)
- elif state == ELEMENT_CREATE:
+ elif state == Actions.ELEMENT_CREATE:
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
- self.handle_states(NOTHING_SELECT)
+ self.handle_states(Actions.NOTHING_SELECT)
self.get_page().set_saved(False)
- elif state == BLOCK_INC_TYPE:
+ elif state == Actions.BLOCK_INC_TYPE:
if
self.get_flow_graph().type_controller_modify_selected(1):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == BLOCK_DEC_TYPE:
+ elif state == Actions.BLOCK_DEC_TYPE:
if
self.get_flow_graph().type_controller_modify_selected(-1):
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == PORT_CONTROLLER_INC:
+ elif state == Actions.PORT_CONTROLLER_INC:
if
self.get_flow_graph().port_controller_modify_selected(1):
self.get_flow_graph().update()
self.get_flow_graph().update() #2 times
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
self.get_page().set_saved(False)
- elif state == PORT_CONTROLLER_DEC:
+ elif state == Actions.PORT_CONTROLLER_DEC:
if
self.get_flow_graph().port_controller_modify_selected(-1):
self.get_flow_graph().update()
self.get_flow_graph().update() #2 times
@@ -276,17 +280,17 @@
##############################################################################################
# Window stuff
##############################################################################################
- elif state == PREFS_WINDOW_DISPLAY:
+ elif state == Actions.PREFS_WINDOW_DISPLAY:
PreferencesDialog()
self.get_flow_graph().update()
- elif state == ABOUT_WINDOW_DISPLAY:
+ elif state == Actions.ABOUT_WINDOW_DISPLAY:
AboutDialog()
- elif state == HOTKEYS_WINDOW_DISPLAY:
+ elif state == Actions.HOTKEYS_WINDOW_DISPLAY:
HotKeysDialog()
##############################################################################################
# Param Modifications
##############################################################################################
- elif state == BLOCK_PARAM_MODIFY:
+ elif state == Actions.BLOCK_PARAM_MODIFY:
if self.get_flow_graph().param_modify_selected():
self.get_flow_graph().update()
self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data())
@@ -294,14 +298,14 @@
##############################################################################################
# Undo/Redo
##############################################################################################
- elif state == FLOW_GRAPH_UNDO:
+ elif state == Actions.FLOW_GRAPH_UNDO:
n = self.get_page().get_state_cache().get_prev_state()
if n:
self.get_flow_graph().unselect()
self.get_flow_graph().import_data(n)
self.get_flow_graph().update()
self.get_page().set_saved(False)
- elif state == FLOW_GRAPH_REDO:
+ elif state == Actions.FLOW_GRAPH_REDO:
n = self.get_page().get_state_cache().get_next_state()
if n:
self.get_flow_graph().unselect()
@@ -311,17 +315,17 @@
##############################################################################################
# New/Open/Save/Close
##############################################################################################
- elif state == FLOW_GRAPH_NEW:
+ elif state == Actions.FLOW_GRAPH_NEW:
self.main_window.new_page()
- elif state == FLOW_GRAPH_OPEN:
+ elif state == Actions.FLOW_GRAPH_OPEN:
file_paths =
OpenFlowGraphFileDialog(self.get_page().get_file_path()).run()
if file_paths: #open a new page for each file, show
only the first
for i,file_path in enumerate(file_paths):
self.main_window.new_page(file_path,
show=(i==0))
- elif state == FLOW_GRAPH_CLOSE:
+ elif state == Actions.FLOW_GRAPH_CLOSE:
self.main_window.close_page()
- elif state == FLOW_GRAPH_SAVE:
- if not self.get_page().get_file_path():
self.handle_states(FLOW_GRAPH_SAVE_AS)
+ elif state == Actions.FLOW_GRAPH_SAVE:
+ if not self.get_page().get_file_path():
self.handle_states(Actions.FLOW_GRAPH_SAVE_AS)
else:
try:
ParseXML.to_file(self.get_flow_graph().export_data(),
self.get_page().get_file_path())
@@ -329,12 +333,12 @@
except IOError:
Messages.send_fail_save(self.get_page().get_file_path())
self.get_page().set_saved(False)
- elif state == FLOW_GRAPH_SAVE_AS:
+ elif state == Actions.FLOW_GRAPH_SAVE_AS:
file_path =
SaveFlowGraphFileDialog(self.get_page().get_file_path()).run()
if file_path != None:
self.get_page().set_file_path(file_path)
- self.handle_states(FLOW_GRAPH_SAVE)
- elif state == FLOW_GRAPH_SCREEN_CAPTURE:
+ self.handle_states(Actions.FLOW_GRAPH_SAVE)
+ elif state == Actions.FLOW_GRAPH_SCREEN_CAPTURE:
file_path =
SaveImageFileDialog(self.get_page().get_file_path()).run()
if file_path != None:
pixmap =
self.get_flow_graph().get_drawing_area().pixmap
@@ -345,10 +349,10 @@
##############################################################################################
# Gen/Exec/Stop
##############################################################################################
- elif state == FLOW_GRAPH_GEN:
+ elif state == Actions.FLOW_GRAPH_GEN:
if not self.get_page().get_pid():
if not self.get_page().get_saved() or not
self.get_page().get_file_path():
- self.handle_states(FLOW_GRAPH_SAVE)
#only save if file path missing or not saved
+
self.handle_states(Actions.FLOW_GRAPH_SAVE) #only save if file path missing or
not saved
if self.get_page().get_saved() and
self.get_page().get_file_path():
generator =
self.get_page().get_generator()
try:
@@ -356,12 +360,12 @@
generator.write()
except Exception,e:
Messages.send_fail_gen(e)
else: self.generator = None
- elif state == FLOW_GRAPH_EXEC:
+ elif state == Actions.FLOW_GRAPH_EXEC:
if not self.get_page().get_pid():
- self.handle_states(FLOW_GRAPH_GEN)
+ self.handle_states(Actions.FLOW_GRAPH_GEN)
if self.get_page().get_saved() and
self.get_page().get_file_path():
ExecFlowGraphThread(self)
- elif state == FLOW_GRAPH_KILL:
+ elif state == Actions.FLOW_GRAPH_KILL:
if self.get_page().get_pid():
try: os.kill(self.get_page().get_pid(),
signal.SIGKILL)
except: print "could not kill pid:
%s"%self.get_page().get_pid()
@@ -372,21 +376,21 @@
# Global Actions for all States
##############################################################################################
#update general buttons
-
get_action_from_name(ELEMENT_DELETE).set_sensitive(bool(self.get_flow_graph().get_selected_elements()))
-
get_action_from_name(BLOCK_PARAM_MODIFY).set_sensitive(bool(self.get_flow_graph().get_selected_block()))
-
get_action_from_name(BLOCK_ROTATE_RIGHT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
-
get_action_from_name(BLOCK_ROTATE_LEFT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+
Actions.get_action_from_name(Actions.ELEMENT_DELETE).set_sensitive(bool(self.get_flow_graph().get_selected_elements()))
+
Actions.get_action_from_name(Actions.BLOCK_PARAM_MODIFY).set_sensitive(bool(self.get_flow_graph().get_selected_block()))
+
Actions.get_action_from_name(Actions.BLOCK_ROTATE_RIGHT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+
Actions.get_action_from_name(Actions.BLOCK_ROTATE_LEFT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
#update cut/copy/paste
-
get_action_from_name(BLOCK_CUT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
-
get_action_from_name(BLOCK_COPY).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
-
get_action_from_name(BLOCK_PASTE).set_sensitive(bool(self.clipboard))
+
Actions.get_action_from_name(Actions.BLOCK_CUT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+
Actions.get_action_from_name(Actions.BLOCK_COPY).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+
Actions.get_action_from_name(Actions.BLOCK_PASTE).set_sensitive(bool(self.clipboard))
#update enable/disable
-
get_action_from_name(BLOCK_ENABLE).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
-
get_action_from_name(BLOCK_DISABLE).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+
Actions.get_action_from_name(Actions.BLOCK_ENABLE).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+
Actions.get_action_from_name(Actions.BLOCK_DISABLE).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
#set the exec and stop buttons
self.update_exec_stop()
#saved status
- get_action_from_name(FLOW_GRAPH_SAVE).set_sensitive(not
self.get_page().get_saved())
+
Actions.get_action_from_name(Actions.FLOW_GRAPH_SAVE).set_sensitive(not
self.get_page().get_saved())
self.main_window.update()
#draw the flow graph
self.get_flow_graph().draw()
@@ -397,9 +401,9 @@
Lock and unlock the mutex for race conditions with exec flow
graph threads.
"""
sensitive = self.get_flow_graph().is_valid() and not
self.get_page().get_pid()
- get_action_from_name(FLOW_GRAPH_GEN).set_sensitive(sensitive)
- get_action_from_name(FLOW_GRAPH_EXEC).set_sensitive(sensitive)
-
get_action_from_name(FLOW_GRAPH_KILL).set_sensitive(self.get_page().get_pid()
!= None)
+
Actions.get_action_from_name(Actions.FLOW_GRAPH_GEN).set_sensitive(sensitive)
+
Actions.get_action_from_name(Actions.FLOW_GRAPH_EXEC).set_sensitive(sensitive)
+
Actions.get_action_from_name(Actions.FLOW_GRAPH_KILL).set_sensitive(self.get_page().get_pid()
!= None)
class ExecFlowGraphThread(Thread):
"""Execute the flow graph as a new process and wait on it to finish."""
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Actions.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Actions.py
2008-09-06 23:20:32 UTC (rev 9511)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Actions.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -16,9 +16,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden Actions
-#Global actions for gui elements to communicate state changes to the action
handler.
-#Use gtk.stock_list_ids() to get a list of possible stock ids (for
toolbar/menu icons)
import pygtk
pygtk.require('2.0')
Modified: gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Bars.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Bars.py
2008-09-06 23:20:32 UTC (rev 9511)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Bars.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -16,84 +16,82 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden grc.gui.Bars
-#Create the GUI's toolbar and menubar
-from grc.Actions import *
+import Actions
import pygtk
pygtk.require('2.0')
import gtk
##The list of actions for the toolbar.
TOOLBAR_LIST = (
- FLOW_GRAPH_NEW,
- FLOW_GRAPH_OPEN,
- FLOW_GRAPH_SAVE,
- FLOW_GRAPH_CLOSE,
+ Actions.FLOW_GRAPH_NEW,
+ Actions.FLOW_GRAPH_OPEN,
+ Actions.FLOW_GRAPH_SAVE,
+ Actions.FLOW_GRAPH_CLOSE,
None,
- FLOW_GRAPH_SCREEN_CAPTURE,
+ Actions.FLOW_GRAPH_SCREEN_CAPTURE,
None,
- BLOCK_CUT,
- BLOCK_COPY,
- BLOCK_PASTE,
- ELEMENT_DELETE,
+ Actions.BLOCK_CUT,
+ Actions.BLOCK_COPY,
+ Actions.BLOCK_PASTE,
+ Actions.ELEMENT_DELETE,
None,
- FLOW_GRAPH_UNDO,
- FLOW_GRAPH_REDO,
+ Actions.FLOW_GRAPH_UNDO,
+ Actions.FLOW_GRAPH_REDO,
None,
- FLOW_GRAPH_GEN,
- FLOW_GRAPH_EXEC,
- FLOW_GRAPH_KILL,
+ Actions.FLOW_GRAPH_GEN,
+ Actions.FLOW_GRAPH_EXEC,
+ Actions.FLOW_GRAPH_KILL,
None,
- BLOCK_ROTATE_LEFT,
- BLOCK_ROTATE_RIGHT,
+ Actions.BLOCK_ROTATE_LEFT,
+ Actions.BLOCK_ROTATE_RIGHT,
None,
- BLOCK_ENABLE,
- BLOCK_DISABLE,
+ Actions.BLOCK_ENABLE,
+ Actions.BLOCK_DISABLE,
)
##The list of actions and categories for the menu bar.
MENU_BAR_LIST = (
(gtk.Action('File', '_File', None, None), [
- FLOW_GRAPH_NEW,
- FLOW_GRAPH_OPEN,
+ Actions.FLOW_GRAPH_NEW,
+ Actions.FLOW_GRAPH_OPEN,
None,
- FLOW_GRAPH_SAVE,
- FLOW_GRAPH_SAVE_AS,
+ Actions.FLOW_GRAPH_SAVE,
+ Actions.FLOW_GRAPH_SAVE_AS,
None,
- FLOW_GRAPH_SCREEN_CAPTURE,
+ Actions.FLOW_GRAPH_SCREEN_CAPTURE,
None,
- FLOW_GRAPH_CLOSE,
- APPLICATION_QUIT,
+ Actions.FLOW_GRAPH_CLOSE,
+ Actions.APPLICATION_QUIT,
]),
(gtk.Action('Edit', '_Edit', None, None), [
- FLOW_GRAPH_UNDO,
- FLOW_GRAPH_REDO,
+ Actions.FLOW_GRAPH_UNDO,
+ Actions.FLOW_GRAPH_REDO,
None,
- BLOCK_CUT,
- BLOCK_COPY,
- BLOCK_PASTE,
- ELEMENT_DELETE,
+ Actions.BLOCK_CUT,
+ Actions.BLOCK_COPY,
+ Actions.BLOCK_PASTE,
+ Actions.ELEMENT_DELETE,
None,
- BLOCK_ROTATE_LEFT,
- BLOCK_ROTATE_RIGHT,
+ Actions.BLOCK_ROTATE_LEFT,
+ Actions.BLOCK_ROTATE_RIGHT,
None,
- BLOCK_ENABLE,
- BLOCK_DISABLE,
+ Actions.BLOCK_ENABLE,
+ Actions.BLOCK_DISABLE,
None,
- BLOCK_PARAM_MODIFY,
+ Actions.BLOCK_PARAM_MODIFY,
]),
(gtk.Action('Build', '_Build', None, None), [
- FLOW_GRAPH_GEN,
- FLOW_GRAPH_EXEC,
- FLOW_GRAPH_KILL,
+ Actions.FLOW_GRAPH_GEN,
+ Actions.FLOW_GRAPH_EXEC,
+ Actions.FLOW_GRAPH_KILL,
]),
(gtk.Action('Options', '_Options', None, None), [
- PREFS_WINDOW_DISPLAY,
+ Actions.PREFS_WINDOW_DISPLAY,
]),
(gtk.Action('Help', '_Help', None, None), [
- ABOUT_WINDOW_DISPLAY,
- HOTKEYS_WINDOW_DISPLAY,
+ Actions.ABOUT_WINDOW_DISPLAY,
+ Actions.HOTKEYS_WINDOW_DISPLAY,
]),
)
@@ -109,7 +107,7 @@
self.set_style(gtk.TOOLBAR_ICONS)
for action_name in TOOLBAR_LIST:
if action_name: #add a tool item
- action = get_action_from_name(action_name)
+ action =
Actions.get_action_from_name(action_name)
self.add(action.create_tool_item())
#this reset of the tooltip property is required
(after creating the tool item) for the tooltip to show
action.set_property('tooltip',
action.get_property('tooltip'))
@@ -135,7 +133,7 @@
main_menu_item.set_submenu(main_menu)
for action_name in action_names:
if action_name: #append a menu item
- action =
get_action_from_name(action_name)
+ action =
Actions.get_action_from_name(action_name)
main_menu.append(action.create_menu_item())
else: main_menu.append(gtk.SeparatorMenuItem())
main_menu.show_all() #this show all is required for the
separators to show
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/BlockTreeWindow.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/BlockTreeWindow.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/BlockTreeWindow.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -16,10 +16,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden grc.gui.BlockTreeWindow
-#The block selection panel gives the user a tree selection to choose a block.
-from grc.Constants import *
+from Constants import BLOCK_SELECTION_WINDOW_WIDTH
import pygtk
pygtk.require('2.0')
import gtk
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py
2008-09-06 23:20:32 UTC (rev 9511)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -16,13 +16,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden grc.Constants
-#Global constants
address@hidden Josh Blum
-######################################################################################################
+##################################################
## Global Titles
-######################################################################################################
+##################################################
##The name to appear in the main window for a flow graph that has not been
saved to file.
NEW_FLOGRAPH_TITLE = 'untitled'
@@ -30,38 +27,19 @@
##The prefix title on the main window.
MAIN_WINDOW_PREFIX = "GRC"
-######################################################################################################
-## Signal block connector lengths
-######################################################################################################
-
-##The length that a connection must extend from the port until the length
depends on the index of the port.
-CONNECTOR_EXTENSION_INITIAL_LENGTH = 11
-
-##The length that a connection must extend from the initial length times the
index of the port, after this length, the connection may have a bend.
-CONNECTOR_EXTENSION_LENGTH = 11
-
-##The length of the connector arrow base in pixels
-CONNECTOR_ARROW_BASE = 13
-
-##The length of the connector arrow height in pixels
-CONNECTOR_ARROW_HEIGHT = 17
-
-######################################################################################################
+##################################################
## Signal block rotations
-######################################################################################################
+##################################################
-##List of possible angles (in degrees) that a block can be rotated to.
-POSSIBLE_ROTATIONS = (0, 90, 180, 270)
-
##direction of rotation left.
DIR_LEFT = 'left'
##direction of rotation right.
DIR_RIGHT = 'right'
-######################################################################################################
+##################################################
## Dimension constraints for the various windows (in pixels)
-######################################################################################################
+##################################################
##main window constraints
MIN_WINDOW_WIDTH = 600
@@ -77,28 +55,9 @@
##static width of block selection window
BLOCK_SELECTION_WINDOW_WIDTH = 200
-######################################################################################################
-## Constraints on displayable labels and ports
-######################################################################################################
-
-LABEL_SEPARATION = 3
-LABEL_PADDING_WIDTH = 9
-LABEL_PADDING_HEIGHT = 9
-
-PORT_SEPARATION = 17
-PORT_HEIGHT = 15
-PORT_WIDTH = 25
-PORT_BORDER_SEPARATION = 9
-MAX_NUM_PORTS = 7
-
-PARAM_LABEL_FONT = 'Sans 9.5'
-PARAM_FONT = 'Sans 7.5'
-BLOCK_FONT = 'Sans 8'
-PORT_FONT = 'Sans 7.5'
-
-######################################################################################################
+##################################################
## Dragging, scrolling, and redrawing constants for the flow graph window in
pixels
-######################################################################################################
+##################################################
##How close can the mouse get to the window border before mouse events are
ignored.
BORDER_PROXIMITY_SENSITIVITY = 50
@@ -115,9 +74,9 @@
##How close the mouse click can be to a connection and register a connection
select.
CONNECTION_SELECT_SENSITIVITY = 5
-######################################################################################################
+##################################################
# A state is recorded for each change to the flow graph, the size dictates how
many states we can record
-######################################################################################################
+##################################################
##The size of the state saving cache in the flow graph (for undo/redo
functionality)
STATE_CACHE_SIZE = 42
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Dialogs.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Dialogs.py
2008-09-06 23:20:32 UTC (rev 9511)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Dialogs.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -20,7 +20,10 @@
import pygtk
pygtk.require('2.0')
import gtk
-from Constants import *
+from Constants import \
+ MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT, \
+ MAIN_WINDOW_PREFIX
+from .. platforms.base.Constants import VERSION
import Preferences
class TextDisplay(gtk.TextView):
@@ -40,7 +43,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."""
@@ -62,12 +64,12 @@
self.run()
self.destroy()
-######################################################################################################
def MessageDialogHelper(type, buttons, title=None, markup=None):
"""!
Create a modal message dialog and run it.
@param type the type of message: gtk.MESSAGE_INFO, gtk.MESSAGE_WARNING,
gtk.MESSAGE_QUESTION or gtk.MESSAGE_ERROR
- @param buttons the predefined set of buttons to use: gtk.BUTTONS_NONE,
gtk.BUTTONS_OK, gtk.BUTTONS_CLOSE, gtk.BUTTONS_CANCEL, gtk.BUTTONS_YES_NO,
gtk.BUTTONS_OK_CANCEL
+ @param buttons the predefined set of buttons to use:
+ gtk.BUTTONS_NONE, gtk.BUTTONS_OK, gtk.BUTTONS_CLOSE,
gtk.BUTTONS_CANCEL, gtk.BUTTONS_YES_NO, gtk.BUTTONS_OK_CANCEL
@param tittle the title of the window (string)
@param markup the message text with pango markup
@return the gtk response from run()
@@ -79,7 +81,6 @@
message_dialog.destroy()
return response
-######################################################################################################
class AboutDialog(gtk.AboutDialog):
"""A cute little about dialog."""
@@ -104,7 +105,6 @@
self.run()
self.destroy()
-######################################################################################################
class HotKeysDialog(gtk.Dialog):
"""Display each action with the associated hotkey."""
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/DrawingArea.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/DrawingArea.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/DrawingArea.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -16,13 +16,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden grc.gui.DrawingArea
-#Drawing area for graphical elements.
import pygtk
pygtk.require('2.0')
import gtk
-from grc.Constants import *
+from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT
class DrawingArea(gtk.DrawingArea):
"""
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/FileDialogs.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/FileDialogs.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/FileDialogs.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -21,7 +21,10 @@
pygtk.require('2.0')
import gtk
from Dialogs import MessageDialogHelper
-from grc.Constants import
DEFAULT_FILE_PATH,FLOW_GRAPH_FILE_EXTENSION,IMAGE_FILE_EXTENSION,NEW_FLOGRAPH_TITLE
+from Constants import NEW_FLOGRAPH_TITLE
+from .. platforms.base.Constants import \
+ DEFAULT_FILE_PATH, FLOW_GRAPH_FILE_EXTENSION, \
+ IMAGE_FILE_EXTENSION
from os import path
OPEN_FLOW_GRAPH = 'open flow graph'
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/MainWindow.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/MainWindow.py
2008-09-06 23:20:32 UTC (rev 9511)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/MainWindow.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -19,18 +19,22 @@
address@hidden grc.gui.MainWindow
#The main window, containing all windows, tool bars, and menu bars.
-from grc.Constants import *
-from grc.Actions import *
+from Constants import \
+ MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT, \
+ NEW_FLOGRAPH_TITLE, MAIN_WINDOW_PREFIX, \
+ REPORTS_WINDOW_HEIGHT
+from .. platforms.base.Constants import FLOW_GRAPH_FILE_EXTENSION
+from Actions import APPLICATION_QUIT, FLOW_GRAPH_KILL
import pygtk
pygtk.require('2.0')
import gtk
import Bars
from BlockTreeWindow import BlockTreeWindow
-from Dialogs import TextDisplay,MessageDialogHelper
+from Dialogs import TextDisplay, MessageDialogHelper
from DrawingArea import DrawingArea
-from grc import Preferences
-from grc import Messages
-from NotebookPage import Page
+from NotebookPage import NotebookPage
+import Preferences
+import Messages
import os
############################################################
@@ -166,7 +170,7 @@
#inject drawing area and handle states into flow graph
flow_graph.drawing_area = self.drawing_area
flow_graph.handle_states = self.handle_states
- page = Page(
+ page = NotebookPage(
self,
flow_graph=flow_graph,
file_path=file_path,
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/NotebookPage.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/NotebookPage.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/NotebookPage.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -16,23 +16,21 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden grc.gui.NotebookPage
-#A page in the notebook, represents an individual flow graph.
-from grc.Actions import *
+from Actions import FLOW_GRAPH_CLOSE
import pygtk
pygtk.require('2.0')
import gtk
-from grc import ParseXML
-from grc.StateCache import StateCache
-from grc.Constants import FLOW_GRAPH_DTD
+from .. utils import ParseXML
+from StateCache import StateCache
+from .. platforms.base.Constants import FLOW_GRAPH_DTD
import os
############################################################
## Notebook Page
############################################################
-class Page(gtk.HBox):
+class NotebookPage(gtk.HBox):
"""A page in the notebook."""
def __init__(self, main_window, flow_graph, file_path=''):
@@ -48,7 +46,7 @@
self.set_file_path(file_path)
file_path = file_path or
flow_graph.get_parent().get_default_flow_graph()
############################################################
- from grc import converter
+ from .. utils import converter
converter.convert(file_path, flow_graph.get_parent())
############################################################
ParseXML.validate_dtd(file_path, FLOW_GRAPH_DTD)
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/StateCache.py
===================================================================
--- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/StateCache.py
2008-09-06 23:20:32 UTC (rev 9511)
+++ gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/StateCache.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -16,11 +16,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden StateCache
-#Stores the flow graph states to drive the undo/redo and save interface.
from Actions import FLOW_GRAPH_UNDO, FLOW_GRAPH_REDO, get_action_from_name
-
from Constants import STATE_CACHE_SIZE
class StateCache(object):
Property changes on:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
+ Makefile
Makefile.in
Constants.py
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Block.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Block.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Block.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -59,10 +59,10 @@
#grab the data
name = n['name']
key = n['key']
- category = Utils.exists_or_else(n, 'category', '')
- params = Utils.listify(n, 'param')
- sources = Utils.listify(n, 'source')
- sinks = Utils.listify(n, 'sink')
+ category = utils.exists_or_else(n, 'category', '')
+ params = utils.listify(n, 'param')
+ sources = utils.listify(n, 'source')
+ sinks = utils.listify(n, 'sink')
#build the block
Element.__init__(self, flow_graph)
#store the data
@@ -225,7 +225,7 @@
Any param keys that do not exist will be ignored.
@param n the nested data odict
"""
- params_n = Utils.listify(n, 'param')
+ params_n = utils.listify(n, 'param')
for param_n in params_n:
#key and value must exist in the n data
if 'key' in param_n.keys() and 'value' in
param_n.keys():
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Param.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Param.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Param.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -64,7 +64,7 @@
#grab the data
name = n['name']
key = n['key']
- opts = Utils.listify(n, 'opt')
+ opts = utils.listify(n, 'opt')
#build the option
return Option(
param=param,
@@ -89,10 +89,10 @@
#grab the data
name = n['name']
key = n['key']
- value = Utils.exists_or_else(n, 'value', '')
+ value = utils.exists_or_else(n, 'value', '')
type = n['type']
- hide = Utils.exists_or_else(n, 'hide', '')
- options = Utils.listify(n, 'option')
+ hide = utils.exists_or_else(n, 'hide', '')
+ options = utils.listify(n, 'option')
#build the param
Element.__init__(self, block)
self._name = name
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Platform.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Platform.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Platform.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -58,7 +58,7 @@
for block_path in self._block_paths:
if os.path.isfile(block_path):
self._load_block(block_path)
elif os.path.isdir(block_path):
- for dirpath,dirnames,filenames in
os.walk(block_path):
+ for dirpath, dirnames, filenames in
os.walk(block_path):
for filename in filter(lambda f:
f.endswith('.xml'), filenames):
self._load_block(os.path.join(dirpath, filename))
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Block.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Block.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Block.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -21,7 +21,12 @@
from Element import Element
import Utils
import Colors
-from ... gui.Constants import BLOCK_FONT, BORDER_PROXIMITY_SENSITIVITY,
LABEL_PADDING_HEIGHT, PORT_HEIGHT, PORT_SEPARATION, LABEL_SEPARATION
+from ... gui.Constants import BORDER_PROXIMITY_SENSITIVITY
+from Constants import \
+ BLOCK_FONT, LABEL_PADDING_WIDTH, \
+ LABEL_PADDING_HEIGHT, PORT_HEIGHT, \
+ PORT_SEPARATION, LABEL_SEPARATION, \
+ PORT_BORDER_SEPARATION, POSSIBLE_ROTATIONS
import pygtk
pygtk.require('2.0')
import gtk
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Connection.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Connection.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Connection.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -20,7 +20,7 @@
import Utils
from Element import Element
import Colors
-from ... gui.Constants import CONNECTOR_ARROW_BASE, CONNECTOR_ARROW_HEIGHT
+from Constants import CONNECTOR_ARROW_BASE, CONNECTOR_ARROW_HEIGHT
class Connection(Element):
"""A graphical connection for ports."""
Added:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Constants.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Constants.py
(rev 0)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Constants.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -0,0 +1,44 @@
+#
+# Copyright 2008 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+#label constraint dimensions
+LABEL_SEPARATION = 3
+LABEL_PADDING_WIDTH = 9
+LABEL_PADDING_HEIGHT = 9
+#port constraint dimensions
+PORT_SEPARATION = 17
+PORT_HEIGHT = 15
+PORT_WIDTH = 25
+PORT_BORDER_SEPARATION = 9
+#fonts
+PARAM_LABEL_FONT = 'Sans 9.5'
+PARAM_FONT = 'Sans 7.5'
+BLOCK_FONT = 'Sans 8'
+PORT_FONT = 'Sans 7.5'
+#minimal length of connector
+CONNECTOR_EXTENSION_MINIMAL = 11
+#increment length for connector
+CONNECTOR_EXTENSION_INCREMENT = 11
+#connection arrow dimensions
+CONNECTOR_ARROW_BASE = 13
+CONNECTOR_ARROW_HEIGHT = 17
+#possible rotations in degrees
+POSSIBLE_ROTATIONS = (0, 90, 180, 270)
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Element.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Element.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Element.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -22,7 +22,8 @@
pygtk.require('2.0')
import gtk
import pango
-from ... gui.Constants import POSSIBLE_ROTATIONS, CONNECTION_SELECT_SENSITIVITY
+from ... gui.Constants import CONNECTION_SELECT_SENSITIVITY
+from Constants import POSSIBLE_ROTATIONS
class Element(object):
"""
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/FlowGraph.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/FlowGraph.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/FlowGraph.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -18,18 +18,21 @@
"""
from ... gui import Preferences
-#from .. base.Constants import *
-#from ... gui.Actions import *
+from ... gui.Constants import \
+ DIR_LEFT, DIR_RIGHT, \
+ SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE, \
+ MOTION_DETECT_REDRAWING_SENSITIVITY
+from ... gui.Actions import \
+ ELEMENT_CREATE, ELEMENT_SELECT, \
+ BLOCK_PARAM_MODIFY, BLOCK_MOVE
import Colors
import Utils
from ... gui.ParamsDialog import ParamsDialog
from Element import Element
from .. base import FlowGraph as _FlowGraph
-
import pygtk
pygtk.require('2.0')
import gtk
-
import random
import time
from ... gui import Messages
@@ -218,7 +221,7 @@
try:
value =
param.evaluate()
value = value +
direction
- assert(0 <
value <= MAX_NUM_PORTS)
+ assert 0 < value
param.set_value(value)
changed = True
except: pass
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Makefile.am
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Makefile.am
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Makefile.am
2008-09-07 03:41:43 UTC (rev 9512)
@@ -26,6 +26,7 @@
ourpython_PYTHON = \
Block.py \
Colors.py \
+ Constants.py \
Connection.py \
Element.py \
FlowGraph.py \
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Param.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Param.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Param.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -17,14 +17,14 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from ... import utils
+import Utils
from Element import Element
import pygtk
pygtk.require('2.0')
import gtk
import pango
import gobject
-from ... gui.Constants import PARAM_LABEL_FONT
+from Constants import PARAM_LABEL_FONT, PARAM_FONT
from os import path
######################################################################################################
@@ -145,7 +145,7 @@
if self.is_enum(): value = self.get_option_keys()[int(value)]
self.set_value(value)
#set the markup on the label, red for errors in corresponding
data type.
- name = '<span font_desc="%s">%s</span>'%(PARAM_LABEL_FONT,
utils.xml_encode(self.get_name()))
+ name = '<span font_desc="%s">%s</span>'%(PARAM_LABEL_FONT,
Utils.xml_encode(self.get_name()))
#special markups if param is involved in a callback
if hasattr(self.get_parent(), 'get_callbacks') and \
filter(lambda c: self.get_key() in c,
self.get_parent()._callbacks):
@@ -205,8 +205,8 @@
max_len = max(42 - len(self.get_name()), 3)
if len(dt_str) > max_len:
dt_str = dt_str[:max_len-3] + '...'
- 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())
+ 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())
def get_layout(self):
"""!
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Port.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Port.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Port.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -18,7 +18,10 @@
"""
from Element import Element
-from ... gui.Constants import PORT_HEIGHT, PORT_SEPARATION, PORT_WIDTH,
CONNECTOR_EXTENSION_INITIAL_LENGTH, CONNECTOR_EXTENSION_LENGTH
+from Constants import \
+ PORT_HEIGHT, PORT_SEPARATION, \
+ PORT_WIDTH, CONNECTOR_EXTENSION_MINIMAL, \
+ CONNECTOR_EXTENSION_INCREMENT, PORT_FONT
import Colors
import pygtk
pygtk.require('2.0')
@@ -74,7 +77,7 @@
self.add_area((x, y), (PORT_HEIGHT, PORT_WIDTH))
self._connector_coordinate = (x+PORT_HEIGHT/2,
y+1+PORT_WIDTH)
#the connector length
- self._connector_length = CONNECTOR_EXTENSION_INITIAL_LENGTH +
CONNECTOR_EXTENSION_LENGTH*index
+ self._connector_length = CONNECTOR_EXTENSION_MINIMAL +
CONNECTOR_EXTENSION_INCREMENT*index
def _create_labels(self):
"""Create the labels for the socket."""
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Utils.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Utils.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Utils.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -16,10 +16,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
address@hidden grc.gui.elements.Utils
-#Shared functions for flow graph elements.
-from ... gui.Constants import POSSIBLE_ROTATIONS
+from Constants import POSSIBLE_ROTATIONS
def get_rotated_coordinate(coor, rotation):
"""!
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am
2008-09-07 03:41:43 UTC (rev 9512)
@@ -44,7 +44,7 @@
sed \
-e 's|@address@hidden|$(PYTHONW)|g' \
-e 's|@address@hidden|$(grc_python_data_dir)|g' \
- -e 's|@address@hidden|$(grc_gnuradio_blocks_dir)|g' \
+ -e 's|@address@hidden|$(grc_python_blocks_dir)|g' \
-e 's|@address@hidden|$(docdir)|g' \
$(srcdir)/Constants.py.in > $@
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Platform.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Platform.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Platform.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -26,7 +26,10 @@
from Port import Source,Sink
from Param import Param as _Param
from Generator import Generator
-from Constants import *
+from Constants import \
+ HIER_BLOCKS_LIB_DIR, BLOCK_DTD, \
+ BLOCK_TREE, DEFAULT_FLOW_GRAPH, \
+ BLOCKS_DIR
class Platform(_Platform):
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Port.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Port.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Port.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -19,7 +19,6 @@
from .. base.Port import Port as _Port
from ... import utils
-from ... gui.Constants import MAX_NUM_PORTS
class Port(_Port):
@@ -68,7 +67,7 @@
if not nports: return ''
try:
nports =
int(self.get_parent().get_parent().evaluate(nports))
- assert(0 < nports <= MAX_NUM_PORTS)
+ assert 0 < nports
return nports
except: return 1
Modified:
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py
===================================================================
---
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py
2008-09-06 23:20:32 UTC (rev 9511)
+++
gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py
2008-09-07 03:41:43 UTC (rev 9512)
@@ -19,9 +19,9 @@
address@hidden grc.converter
#convert old flow graph file format to new format
-from grc.Constants import FLOW_GRAPH_DTD
-from grc import ParseXML, Utils
-from grc.Utils import odict
+from .. platforms.base.Constants import FLOW_GRAPH_DTD
+import ParseXML
+from .. utils import odict
from lxml import etree
import difflib
import os
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9512 - in gnuradio/branches/developers/jblum/grc_reorganize/grc: data/platforms/python src/gui src/platforms/base src/platforms/gui src/platforms/python src/utils,
jblum <=