Changeset 9512
- Timestamp:
- 09/06/08 21:41:43
- Files:
-
- gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/flow_graph.tmpl (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ActionHandler.py (modified) (21 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Actions.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Bars.py (modified) (5 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/BlockTreeWindow.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py (modified) (5 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Dialogs.py (modified) (5 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/DrawingArea.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/FileDialogs.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/MainWindow.py (modified) (3 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/NotebookPage.py (modified) (3 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/StateCache.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base (modified) (1 prop)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Block.py (modified) (2 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Param.py (modified) (2 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/base/Platform.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Block.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Connection.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Constants.py (added)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Element.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/FlowGraph.py (modified) (3 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Makefile.am (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Param.py (modified) (4 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Port.py (modified) (2 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/gui/Utils.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Makefile.am (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Platform.py (modified) (1 diff)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/platforms/python/Port.py (modified) (2 diffs)
- gnuradio/branches/developers/jblum/grc_reorganize/grc/src/utils/converter.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/flow_graph.tmpl
r9450 r9512 42 42 #set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(), param.get_make()) for param in $parameters]) 43 43 #if $generate_options == 'wx_gui' 44 #from grc.Constants import MAIN_WINDOW_PREFIX, DATA_DIR 44 #from gnuradio.grc.platforms.base.Constants import DATA_DIR 45 #from gnuradio.grc.gui.Constants import MAIN_WINDOW_PREFIX 45 46 class $(class_name)(grc_wxgui.top_block_gui): 46 47 gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ActionHandler.py
r9497 r9512 20 20 import os 21 21 import signal 22 from Constants import * 23 from Actions import * 22 from .. platforms.base.Constants import PY_GTK_ICON, IMAGE_FILE_EXTENSION 23 from Constants import DIR_LEFT, DIR_RIGHT 24 import Actions 24 25 import pygtk 25 26 pygtk.require('2.0') … … 31 32 import random 32 33 from .. platforms.gui.Platform import Platform 33 34 34 from MainWindow import MainWindow 35 35 from Dialogs import PreferencesDialog, AboutDialog, HotKeysDialog … … 53 53 platform = Platform(platform) 54 54 if PY_GTK_ICON: gtk.window_set_default_icon_from_file(PY_GTK_ICON) 55 for action in A CTIONS_LIST: action.connect('activate', self._handle_actions)55 for action in Actions.ACTIONS_LIST: action.connect('activate', self._handle_actions) 56 56 #setup the main window 57 57 self.main_window = MainWindow(self.handle_states, platform) … … 66 66 #initialize 67 67 self.init_file_paths = file_paths 68 self.handle_states(A PPLICATION_INITIALIZE)68 self.handle_states(Actions.APPLICATION_INITIALIZE) 69 69 #enter the mainloop 70 70 gtk.gdk.threads_init() … … 85 85 #################### save/open/new/close ############################### 86 86 if ctrl and keyname == 's': 87 self.handle_states( FLOW_GRAPH_SAVE)87 self.handle_states(Actions.FLOW_GRAPH_SAVE) 88 88 elif ctrl and keyname == 'o': 89 self.handle_states( FLOW_GRAPH_OPEN)89 self.handle_states(Actions.FLOW_GRAPH_OPEN) 90 90 elif ctrl and keyname == 'n': 91 self.handle_states( FLOW_GRAPH_NEW)91 self.handle_states(Actions.FLOW_GRAPH_NEW) 92 92 elif ctrl and keyname == 'q': 93 self.handle_states( FLOW_GRAPH_CLOSE)93 self.handle_states(Actions.FLOW_GRAPH_CLOSE) 94 94 #################### Cut/Copy/Paste ############################### 95 95 elif self.get_focus_flag() and ctrl and keyname == 'x': #mouse focus 96 self.handle_states( BLOCK_CUT)96 self.handle_states(Actions.BLOCK_CUT) 97 97 elif self.get_focus_flag() and ctrl and keyname == 'c': #mouse focus 98 self.handle_states( BLOCK_COPY)98 self.handle_states(Actions.BLOCK_COPY) 99 99 elif self.get_focus_flag() and ctrl and keyname == 'v': #mouse focus 100 self.handle_states( BLOCK_PASTE)100 self.handle_states(Actions.BLOCK_PASTE) 101 101 #################### Undo/Redo ############################### 102 102 elif ctrl and keyname == 'z': 103 self.handle_states( FLOW_GRAPH_UNDO)103 self.handle_states(Actions.FLOW_GRAPH_UNDO) 104 104 elif ctrl and keyname == 'y': 105 self.handle_states( FLOW_GRAPH_REDO)105 self.handle_states(Actions.FLOW_GRAPH_REDO) 106 106 #################### Delete ############################### 107 107 elif self.get_focus_flag() and keyname == 'Delete': #mouse focus 108 self.handle_states( ELEMENT_DELETE)108 self.handle_states(Actions.ELEMENT_DELETE) 109 109 #################### Params ############################### 110 110 elif self.get_focus_flag() and keyname == 'Return': #mouse focus 111 self.handle_states( BLOCK_PARAM_MODIFY)111 self.handle_states(Actions.BLOCK_PARAM_MODIFY) 112 112 #################### Rotate ############################### 113 113 elif self.get_focus_flag() and keyname == 'Right': #mouse focus 114 self.handle_states( BLOCK_ROTATE_RIGHT)114 self.handle_states(Actions.BLOCK_ROTATE_RIGHT) 115 115 elif self.get_focus_flag() and keyname == 'Left': #mouse focus 116 self.handle_states( BLOCK_ROTATE_LEFT)116 self.handle_states(Actions.BLOCK_ROTATE_LEFT) 117 117 #################### Enable/Disable ############################### 118 118 elif self.get_focus_flag() and keyname == 'e': #mouse focus 119 self.handle_states( BLOCK_ENABLE)119 self.handle_states(Actions.BLOCK_ENABLE) 120 120 elif self.get_focus_flag() and keyname == 'd': #mouse focus 121 self.handle_states( BLOCK_DISABLE)121 self.handle_states(Actions.BLOCK_DISABLE) 122 122 #################### Data Type ############################### 123 123 elif self.get_focus_flag() and keyname == 'Down': #mouse focus 124 self.handle_states( BLOCK_INC_TYPE)124 self.handle_states(Actions.BLOCK_INC_TYPE) 125 125 elif self.get_focus_flag() and keyname == 'Up': #mouse focus 126 self.handle_states( BLOCK_DEC_TYPE)126 self.handle_states(Actions.BLOCK_DEC_TYPE) 127 127 #################### Port Controllers ############################### 128 128 elif self.get_focus_flag() and keyname in ('equal','plus', 'KP_Add'): #mouse focus 129 self.handle_states( PORT_CONTROLLER_INC)129 self.handle_states(Actions.PORT_CONTROLLER_INC) 130 130 elif self.get_focus_flag() and keyname in ('minus', 'KP_Subtract'): #mouse focus 131 self.handle_states( PORT_CONTROLLER_DEC)131 self.handle_states(Actions.PORT_CONTROLLER_DEC) 132 132 #################### Gen/Exec/Stop/Print ############################### 133 133 elif keyname == 'F5': 134 self.handle_states( FLOW_GRAPH_GEN)134 self.handle_states(Actions.FLOW_GRAPH_GEN) 135 135 elif keyname == 'F6': 136 self.handle_states( FLOW_GRAPH_EXEC)136 self.handle_states(Actions.FLOW_GRAPH_EXEC) 137 137 elif keyname == 'F7': 138 self.handle_states( FLOW_GRAPH_KILL)138 self.handle_states(Actions.FLOW_GRAPH_KILL) 139 139 elif keyname == 'Print': 140 self.handle_states( FLOW_GRAPH_SCREEN_CAPTURE)140 self.handle_states(Actions.FLOW_GRAPH_SCREEN_CAPTURE) 141 141 #propagate this if the fg is not in focus or nothing is selected 142 142 return self.get_focus_flag() and self.get_flow_graph().is_selected() … … 149 149 @return true 150 150 """ 151 self.handle_states(A PPLICATION_QUIT)151 self.handle_states(Actions.APPLICATION_QUIT) 152 152 return True 153 153 … … 174 174 # Initalize/Quit 175 175 ############################################################################################## 176 if state == A PPLICATION_INITIALIZE:177 for action in A CTIONS_LIST: action.set_sensitive(False) #set all actions disabled176 if state == Actions.APPLICATION_INITIALIZE: 177 for action in Actions.ACTIONS_LIST: action.set_sensitive(False) #set all actions disabled 178 178 # enable a select few actions 179 179 for action in ( 180 APPLICATION_QUIT, FLOW_GRAPH_NEW, FLOW_GRAPH_OPEN, FLOW_GRAPH_SAVE_AS, FLOW_GRAPH_CLOSE, 181 ABOUT_WINDOW_DISPLAY, HOTKEYS_WINDOW_DISPLAY, 182 PREFS_WINDOW_DISPLAY, FLOW_GRAPH_SCREEN_CAPTURE, 183 ): get_action_from_name(action).set_sensitive(True) 184 if not self.init_file_paths and Preferences.restore_files(): self.init_file_paths = Preferences.files_open() 180 Actions.APPLICATION_QUIT, Actions.FLOW_GRAPH_NEW, 181 Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS, 182 Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY, 183 Actions.HOTKEYS_WINDOW_DISPLAY, Actions.PREFS_WINDOW_DISPLAY, 184 Actions.FLOW_GRAPH_SCREEN_CAPTURE, 185 ): Actions.get_action_from_name(action).set_sensitive(True) 186 if not self.init_file_paths and Preferences.restore_files(): 187 self.init_file_paths = Preferences.files_open() 185 188 if not self.init_file_paths: self.init_file_paths = [''] 186 189 for file_path in self.init_file_paths: 187 190 if file_path: self.main_window.new_page(file_path) #load pages from file paths 188 if Preferences.file_open() in self.init_file_paths: self.main_window.new_page(Preferences.file_open(), show=True) 191 if Preferences.file_open() in self.init_file_paths: 192 self.main_window.new_page(Preferences.file_open(), show=True) 189 193 if not self.get_page(): self.main_window.new_page() #ensure that at least a blank page exists 190 elif state == A PPLICATION_QUIT:194 elif state == Actions.APPLICATION_QUIT: 191 195 if self.main_window.close_pages(): 192 196 gtk.main_quit() … … 195 199 # Selections 196 200 ############################################################################################## 197 elif state == ELEMENT_SELECT:201 elif state == Actions.ELEMENT_SELECT: 198 202 self.get_flow_graph().update() 199 elif state == NOTHING_SELECT:203 elif state == Actions.NOTHING_SELECT: 200 204 self.get_flow_graph().unselect() 201 205 self.get_flow_graph().update() … … 203 207 # Enable/Disable 204 208 ############################################################################################## 205 elif state == BLOCK_ENABLE:209 elif state == Actions.BLOCK_ENABLE: 206 210 if self.get_flow_graph().enable_selected(True): 207 211 self.get_flow_graph().update() 208 212 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 209 213 self.get_page().set_saved(False) 210 elif state == BLOCK_DISABLE:214 elif state == Actions.BLOCK_DISABLE: 211 215 if self.get_flow_graph().enable_selected(False): 212 216 self.get_flow_graph().update() … … 216 220 # Cut/Copy/Paste 217 221 ############################################################################################## 218 elif state == BLOCK_CUT:222 elif state == Actions.BLOCK_CUT: 219 223 self.handle_states(BLOCK_COPY) 220 224 self.handle_states(ELEMENT_DELETE) 221 elif state == BLOCK_COPY:225 elif state == Actions.BLOCK_COPY: 222 226 self.clipboard = self.get_flow_graph().copy_to_clipboard() 223 elif state == BLOCK_PASTE:227 elif state == Actions.BLOCK_PASTE: 224 228 if self.clipboard: 225 229 self.get_flow_graph().paste_from_clipboard(self.clipboard) … … 230 234 # Move/Rotate/Delete/Create 231 235 ############################################################################################## 232 elif state == BLOCK_MOVE:236 elif state == Actions.BLOCK_MOVE: 233 237 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 234 238 self.get_page().set_saved(False) 235 elif state == BLOCK_ROTATE_LEFT:239 elif state == Actions.BLOCK_ROTATE_LEFT: 236 240 if self.get_flow_graph().rotate_selected(DIR_LEFT): 237 241 self.get_flow_graph().update() 238 242 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 239 243 self.get_page().set_saved(False) 240 elif state == BLOCK_ROTATE_RIGHT:244 elif state == Actions.BLOCK_ROTATE_RIGHT: 241 245 if self.get_flow_graph().rotate_selected(DIR_RIGHT): 242 246 self.get_flow_graph().update() 243 247 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 244 248 self.get_page().set_saved(False) 245 elif state == ELEMENT_DELETE:249 elif state == Actions.ELEMENT_DELETE: 246 250 if self.get_flow_graph().remove_selected(): 247 251 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 248 self.handle_states( NOTHING_SELECT)249 self.get_page().set_saved(False) 250 elif state == ELEMENT_CREATE:252 self.handle_states(Actions.NOTHING_SELECT) 253 self.get_page().set_saved(False) 254 elif state == Actions.ELEMENT_CREATE: 251 255 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 252 self.handle_states( NOTHING_SELECT)256 self.handle_states(Actions.NOTHING_SELECT) 253 257 self.get_page().set_saved(False) 254 elif state == BLOCK_INC_TYPE:258 elif state == Actions.BLOCK_INC_TYPE: 255 259 if self.get_flow_graph().type_controller_modify_selected(1): 256 260 self.get_flow_graph().update() 257 261 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 258 262 self.get_page().set_saved(False) 259 elif state == BLOCK_DEC_TYPE:263 elif state == Actions.BLOCK_DEC_TYPE: 260 264 if self.get_flow_graph().type_controller_modify_selected(-1): 261 265 self.get_flow_graph().update() 262 266 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 263 267 self.get_page().set_saved(False) 264 elif state == PORT_CONTROLLER_INC:268 elif state == Actions.PORT_CONTROLLER_INC: 265 269 if self.get_flow_graph().port_controller_modify_selected(1): 266 270 self.get_flow_graph().update() … … 268 272 self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 269 273 self.get_page().set_saved(False) 270 elif state == PORT_CONTROLLER_DEC:274 elif state == Actions.PORT_CONTROLLER_DEC: 271 275 if self.get_flow_graph().port_controller_modify_selected(-1): 272 276 self.get_flow_graph().update() … … 277 281 # Window stuff 278 282 ############################################################################################## 279 elif state == PREFS_WINDOW_DISPLAY:283 elif state == Actions.PREFS_WINDOW_DISPLAY: 280 284 PreferencesDialog() 281 285 self.get_flow_graph().update() 282 elif state == A BOUT_WINDOW_DISPLAY:286 elif state == Actions.ABOUT_WINDOW_DISPLAY: 283 287 AboutDialog() 284 elif state == HOTKEYS_WINDOW_DISPLAY:288 elif state == Actions.HOTKEYS_WINDOW_DISPLAY: 285 289 HotKeysDialog() 286 290 ############################################################################################## 287 291 # Param Modifications 288 292 ############################################################################################## 289 elif state == BLOCK_PARAM_MODIFY:293 elif state == Actions.BLOCK_PARAM_MODIFY: 290 294 if self.get_flow_graph().param_modify_selected(): 291 295 self.get_flow_graph().update() … … 295 299 # Undo/Redo 296 300 ############################################################################################## 297 elif state == FLOW_GRAPH_UNDO:301 elif state == Actions.FLOW_GRAPH_UNDO: 298 302 n = self.get_page().get_state_cache().get_prev_state() 299 303 if n: … … 302 306 self.get_flow_graph().update() 303 307 self.get_page().set_saved(False) 304 elif state == FLOW_GRAPH_REDO:308 elif state == Actions.FLOW_GRAPH_REDO: 305 309 n = self.get_page().get_state_cache().get_next_state() 306 310 if n: … … 312 316 # New/Open/Save/Close 313 317 ############################################################################################## 314 elif state == FLOW_GRAPH_NEW:318 elif state == Actions.FLOW_GRAPH_NEW: 315 319 self.main_window.new_page() 316 elif state == FLOW_GRAPH_OPEN:320 elif state == Actions.FLOW_GRAPH_OPEN: 317 321 file_paths = OpenFlowGraphFileDialog(self.get_page().get_file_path()).run() 318 322 if file_paths: #open a new page for each file, show only the first 319 323 for i,file_path in enumerate(file_paths): 320 324 self.main_window.new_page(file_path, show=(i==0)) 321 elif state == FLOW_GRAPH_CLOSE:325 elif state == Actions.FLOW_GRAPH_CLOSE: 322 326 self.main_window.close_page() 323 elif state == FLOW_GRAPH_SAVE:324 if not self.get_page().get_file_path(): self.handle_states( FLOW_GRAPH_SAVE_AS)327 elif state == Actions.FLOW_GRAPH_SAVE: 328 if not self.get_page().get_file_path(): self.handle_states(Actions.FLOW_GRAPH_SAVE_AS) 325 329 else: 326 330 try: … … 330 334 Messages.send_fail_save(self.get_page().get_file_path()) 331 335 self.get_page().set_saved(False) 332 elif state == FLOW_GRAPH_SAVE_AS:336 elif state == Actions.FLOW_GRAPH_SAVE_AS: 333 337 file_path = SaveFlowGraphFileDialog(self.get_page().get_file_path()).run() 334 338 if file_path != None: 335 339 self.get_page().set_file_path(file_path) 336 self.handle_states( FLOW_GRAPH_SAVE)337 elif state == FLOW_GRAPH_SCREEN_CAPTURE:340 self.handle_states(Actions.FLOW_GRAPH_SAVE) 341 elif state == Actions.FLOW_GRAPH_SCREEN_CAPTURE: 338 342 file_path = SaveImageFileDialog(self.get_page().get_file_path()).run() 339 343 if file_path != None: … … 346 350 # Gen/Exec/Stop 347 351 ############################################################################################## 348 elif state == FLOW_GRAPH_GEN:352 elif state == Actions.FLOW_GRAPH_GEN: 349 353 if not self.get_page().get_pid(): 350 354 if not self.get_page().get_saved() or not self.get_page().get_file_path(): 351 self.handle_states( FLOW_GRAPH_SAVE) #only save if file path missing or not saved355 self.handle_states(Actions.FLOW_GRAPH_SAVE) #only save if file path missing or not saved 352 356 if self.get_page().get_saved() and self.get_page().get_file_path(): 353 357 generator = self.get_page().get_generator() … … 357 361 except Exception,e: Messages.send_fail_gen(e) 358 362 else: self.generator = None 359 elif state == FLOW_GRAPH_EXEC:363 elif state == Actions.FLOW_GRAPH_EXEC: 360 364 if not self.get_page().get_pid(): 361 self.handle_states( FLOW_GRAPH_GEN)365 self.handle_states(Actions.FLOW_GRAPH_GEN) 362 366 if self.get_page().get_saved() and self.get_page().get_file_path(): 363 367 ExecFlowGraphThread(self) 364 elif state == FLOW_GRAPH_KILL:368 elif state == Actions.FLOW_GRAPH_KILL: 365 369 if self.get_page().get_pid(): 366 370 try: os.kill(self.get_page().get_pid(), signal.SIGKILL) … … 373 377 ############################################################################################## 374 378 #update general buttons 375 get_action_from_name(ELEMENT_DELETE).set_sensitive(bool(self.get_flow_graph().get_selected_elements()))376 get_action_from_name(BLOCK_PARAM_MODIFY).set_sensitive(bool(self.get_flow_graph().get_selected_block()))377 get_action_from_name(BLOCK_ROTATE_RIGHT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))378 get_action_from_name(BLOCK_ROTATE_LEFT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))379 Actions.get_action_from_name(Actions.ELEMENT_DELETE).set_sensitive(bool(self.get_flow_graph().get_selected_elements())) 380 Actions.get_action_from_name(Actions.BLOCK_PARAM_MODIFY).set_sensitive(bool(self.get_flow_graph().get_selected_block())) 381 Actions.get_action_from_name(Actions.BLOCK_ROTATE_RIGHT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks())) 382 Actions.get_action_from_name(Actions.BLOCK_ROTATE_LEFT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks())) 379 383 #update cut/copy/paste 380 get_action_from_name(BLOCK_CUT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))381 get_action_from_name(BLOCK_COPY).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))382 get_action_from_name(BLOCK_PASTE).set_sensitive(bool(self.clipboard))384 Actions.get_action_from_name(Actions.BLOCK_CUT).set_sensitive(bool(self.get_flow_graph().get_selected_blocks())) 385 Actions.get_action_from_name(Actions.BLOCK_COPY).set_sensitive(bool(self.get_flow_graph().get_selected_blocks())) 386 Actions.get_action_from_name(Actions.BLOCK_PASTE).set_sensitive(bool(self.clipboard)) 383 387 #update enable/disable 384 get_action_from_name(BLOCK_ENABLE).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))385 get_action_from_name(BLOCK_DISABLE).set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))388 Actions.get_action_from_name(Actions.BLOCK_ENABLE).set_sensitive(bool(self.get_flow_graph().get_selected_blocks())) 389 Actions.get_action_from_name(Actions.BLOCK_DISABLE).set_sensitive(bool(self.get_flow_graph().get_selected_blocks())) 386 390 #set the exec and stop buttons 387 391 self.update_exec_stop() 388 392 #saved status 389 get_action_from_name(FLOW_GRAPH_SAVE).set_sensitive(not self.get_page().get_saved())393 Actions.get_action_from_name(Actions.FLOW_GRAPH_SAVE).set_sensitive(not self.get_page().get_saved()) 390 394 self.main_window.update() 391 395 #draw the flow graph … … 398 402 """ 399 403 sensitive = self.get_flow_graph().is_valid() and not self.get_page().get_pid() 400 get_action_from_name(FLOW_GRAPH_GEN).set_sensitive(sensitive)401 get_action_from_name(FLOW_GRAPH_EXEC).set_sensitive(sensitive)402 get_action_from_name(FLOW_GRAPH_KILL).set_sensitive(self.get_page().get_pid() != None)404 Actions.get_action_from_name(Actions.FLOW_GRAPH_GEN).set_sensitive(sensitive) 405 Actions.get_action_from_name(Actions.FLOW_GRAPH_EXEC).set_sensitive(sensitive) 406 Actions.get_action_from_name(Actions.FLOW_GRAPH_KILL).set_sensitive(self.get_page().get_pid() != None) 403 407 404 408 class ExecFlowGraphThread(Thread): gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Actions.py
r9487 r9512 17 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 18 18 """ 19 ##@package Actions20 #Global actions for gui elements to communicate state changes to the action handler.21 #Use gtk.stock_list_ids() to get a list of possible stock ids (for toolbar/menu icons)22 19 23 20 import pygtk gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Bars.py
r9379 r9512 17 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 18 18 """ 19 ##@package grc.gui.Bars20 #Create the GUI's toolbar and menubar21 19 22 from grc.Actions import * 20 import Actions 23 21 import pygtk 24 22 pygtk.require('2.0') … … 27 25 ##The list of actions for the toolbar. 28 26 TOOLBAR_LIST = ( 29 FLOW_GRAPH_NEW,30 FLOW_GRAPH_OPEN,31 FLOW_GRAPH_SAVE,32 FLOW_GRAPH_CLOSE,27 Actions.FLOW_GRAPH_NEW, 28 Actions.FLOW_GRAPH_OPEN, 29 Actions.FLOW_GRAPH_SAVE, 30 Actions.FLOW_GRAPH_CLOSE, 33 31 None, 34 FLOW_GRAPH_SCREEN_CAPTURE,32 Actions.FLOW_GRAPH_SCREEN_CAPTURE, 35 33 None, 36 BLOCK_CUT,37 BLOCK_COPY,38 BLOCK_PASTE,39 ELEMENT_DELETE,34 Actions.BLOCK_CUT, 35 Actions.BLOCK_COPY, 36 Actions.BLOCK_PASTE, 37 Actions.ELEMENT_DELETE, 40 38 None, 41 FLOW_GRAPH_UNDO,42 FLOW_GRAPH_REDO,39 Actions.FLOW_GRAPH_UNDO, 40 Actions.FLOW_GRAPH_REDO, 43 41 None, 44 FLOW_GRAPH_GEN,45 FLOW_GRAPH_EXEC,46 FLOW_GRAPH_KILL,42 Actions.FLOW_GRAPH_GEN, 43 Actions.FLOW_GRAPH_EXEC, 44 Actions.FLOW_GRAPH_KILL, 47 45 None, 48 BLOCK_ROTATE_LEFT,49 BLOCK_ROTATE_RIGHT,46 Actions.BLOCK_ROTATE_LEFT, 47 Actions.BLOCK_ROTATE_RIGHT, 50 48 None, 51 BLOCK_ENABLE,52 BLOCK_DISABLE,49 Actions.BLOCK_ENABLE, 50 Actions.BLOCK_DISABLE, 53 51 ) 54 52 … … 56 54 MENU_BAR_LIST = ( 57 55 (gtk.Action('File', '_File', None, None), [ 58 FLOW_GRAPH_NEW,59 FLOW_GRAPH_OPEN,56 Actions.FLOW_GRAPH_NEW, 57 Actions.FLOW_GRAPH_OPEN, 60 58 None, 61 FLOW_GRAPH_SAVE,62 FLOW_GRAPH_SAVE_AS,59 Actions.FLOW_GRAPH_SAVE, 60 Actions.FLOW_GRAPH_SAVE_AS, 63 61 None, 64 FLOW_GRAPH_SCREEN_CAPTURE,62 Actions.FLOW_GRAPH_SCREEN_CAPTURE, 65 63 None, 66 FLOW_GRAPH_CLOSE,67 A PPLICATION_QUIT,64 Actions.FLOW_GRAPH_CLOSE, 65 Actions.APPLICATION_QUIT, 68 66 ]), 69 67 (gtk.Action('Edit', '_Edit', None, None), [ 70 FLOW_GRAPH_UNDO,71 FLOW_GRAPH_REDO,68 Actions.FLOW_GRAPH_UNDO, 69 Actions.FLOW_GRAPH_REDO, 72 70 None, 73 BLOCK_CUT,74 BLOCK_COPY,75 BLOCK_PASTE,76 ELEMENT_DELETE,71 Actions.BLOCK_CUT, 72 Actions.BLOCK_COPY, 73 Actions.BLOCK_PASTE, 74 Actions.ELEMENT_DELETE, 77 75 None, 78 BLOCK_ROTATE_LEFT,79 BLOCK_ROTATE_RIGHT,76 Actions.BLOCK_ROTATE_LEFT, 77 Actions.BLOCK_ROTATE_RIGHT, 80 78 None, 81 BLOCK_ENABLE,82 BLOCK_DISABLE,79 Actions.BLOCK_ENABLE, 80 Actions.BLOCK_DISABLE, 83 81 None, 84 BLOCK_PARAM_MODIFY,82 Actions.BLOCK_PARAM_MODIFY, 85 83 ]), 86 84 (gtk.Action('Build', '_Build', None, None), [ 87 FLOW_GRAPH_GEN,88 FLOW_GRAPH_EXEC,89 FLOW_GRAPH_KILL,85 Actions.FLOW_GRAPH_GEN, 86 Actions.FLOW_GRAPH_EXEC, 87 Actions.FLOW_GRAPH_KILL, 90 88 ]), 91 89 (gtk.Action('Options', '_Options', None, None), [ 92 PREFS_WINDOW_DISPLAY,90 Actions.PREFS_WINDOW_DISPLAY, 93 91 ]), 94 92 (gtk.Action('Help', '_Help', None, None), [ 95 A BOUT_WINDOW_DISPLAY,96 HOTKEYS_WINDOW_DISPLAY,93 Actions.ABOUT_WINDOW_DISPLAY, 94 Actions.HOTKEYS_WINDOW_DISPLAY, 97 95 ]), 98 96 ) … … 110 108 for action_name in TOOLBAR_LIST: 111 109 if action_name: #add a tool item 112 action = get_action_from_name(action_name)110 action = Actions.get_action_from_name(action_name) 113 111 self.add(action.create_tool_item()) 114 112 #this reset of the tooltip property is required (after creating the tool item) for the tooltip to show … … 136 134 for action_name in action_names: 137 135 if action_name: #append a menu item 138 action = get_action_from_name(action_name)136 action = Actions.get_action_from_name(action_name) 139 137 main_menu.append(action.create_menu_item()) 140 138 else: main_menu.append(gtk.SeparatorMenuItem()) gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/BlockTreeWindow.py
r9379 r9512 17 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 18 18 """ 19 ##@package grc.gui.BlockTreeWindow20 #The block selection panel gives the user a tree selection to choose a block.21 19 22 from grc.Constants import *20 from Constants import BLOCK_SELECTION_WINDOW_WIDTH 23 21 import pygtk 24 22 pygtk.require('2.0') gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py
r9495 r9512 17 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 18 18 """ 19 ##@package grc.Constants20 #Global constants21 #@author Josh Blum22 19 23 ################################################## ####################################################20 ################################################## 24 21 ## Global Titles 25 ################################################## ####################################################22 ################################################## 26 23 27 24 ##The name to appear in the main window for a flow graph that has not been saved to file. … … 31 28 MAIN_WINDOW_PREFIX = "GRC" 32 29 33 ###################################################################################################### 34 ## Signal block connector lengths 35 ###################################################################################################### 36 37 ##The length that a connection must extend from the port until the length depends on the index of the port. 38 CONNECTOR_EXTENSION_INITIAL_LENGTH = 11 39 40 ##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. 41 CONNECTOR_EXTENSION_LENGTH = 11 42 43 ##The length of the connector arrow base in pixels 44 CONNECTOR_ARROW_BASE = 13 45 46 ##The length of the connector arrow height in pixels 47 CONNECTOR_ARROW_HEIGHT = 17 48 49 ###################################################################################################### 30 ################################################## 50 31 ## Signal block rotations 51 ###################################################################################################### 52 53 ##List of possible angles (in degrees) that a block can be rotated to. 54 POSSIBLE_ROTATIONS = (0, 90, 180, 270) 32 ################################################## 55 33 56 34 ##direction of rotation left. … … 60 38 DIR_RIGHT = 'right' 61 39 62 ################################################## ####################################################40 ################################################## 63 41 ## Dimension constraints for the various windows (in pixels) 64 ################################################## ####################################################42 ################################################## 65 43 66 44 ##main window constraints … … 78 56 BLOCK_SELECTION_WINDOW_WIDTH = 200 79 57 80 ###################################################################################################### 81 ## Constraints on displayable labels and ports 82 ###################################################################################################### 83 84 LABEL_SEPARATION = 3 85 LABEL_PADDING_WIDTH = 9 86 LABEL_PADDING_HEIGHT = 9 87 88 PORT_SEPARATION = 17 89 PORT_HEIGHT = 15 90 PORT_WIDTH = 25 91 PORT_BORDER_SEPARATION = 9 92 MAX_NUM_PORTS = 7 93 94 PARAM_LABEL_FONT = 'Sans 9.5' 95 PARAM_FONT = 'Sans 7.5' 96 BLOCK_FONT = 'Sans 8' 97 PORT_FONT = 'Sans 7.5' 98 99 ###################################################################################################### 58 ################################################## 100 59 ## Dragging, scrolling, and redrawing constants for the flow graph window in pixels 101 ################################################## ####################################################60 ################################################## 102 61 103 62 ##How close can the mouse get to the window border before mouse events are ignored. … … 116 75 CONNECTION_SELECT_SENSITIVITY = 5 117 76 118 ################################################## ####################################################77 ################################################## 119 78 # A state is recorded for each change to the flow graph, the size dictates how many states we can record 120 ################################################## ####################################################79
