Changeset 9512

Show
Ignore:
Timestamp:
09/06/08 21:41:43
Author:
jblum
Message:

back to working order

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gnuradio/branches/developers/jblum/grc_reorganize/grc/data/platforms/python/flow_graph.tmpl

    r9450 r9512  
    4242#set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(), param.get_make()) for param in $parameters]) 
    4343#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 
    4546class $(class_name)(grc_wxgui.top_block_gui): 
    4647 
  • gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/ActionHandler.py

    r9497 r9512  
    2020import os 
    2121import signal 
    22 from Constants import * 
    23 from Actions import * 
     22from .. platforms.base.Constants import PY_GTK_ICON, IMAGE_FILE_EXTENSION 
     23from Constants import DIR_LEFT, DIR_RIGHT 
     24import Actions 
    2425import pygtk 
    2526pygtk.require('2.0') 
     
    3132import random 
    3233from .. platforms.gui.Platform import Platform 
    33  
    3434from MainWindow import MainWindow 
    3535from Dialogs import PreferencesDialog, AboutDialog, HotKeysDialog 
     
    5353                platform = Platform(platform) 
    5454                if PY_GTK_ICON: gtk.window_set_default_icon_from_file(PY_GTK_ICON) 
    55                 for action in ACTIONS_LIST: action.connect('activate', self._handle_actions) 
     55                for action in Actions.ACTIONS_LIST: action.connect('activate', self._handle_actions) 
    5656                #setup the main window 
    5757                self.main_window = MainWindow(self.handle_states, platform) 
     
    6666                #initialize 
    6767                self.init_file_paths = file_paths 
    68                 self.handle_states(APPLICATION_INITIALIZE) 
     68                self.handle_states(Actions.APPLICATION_INITIALIZE) 
    6969                #enter the mainloop 
    7070                gtk.gdk.threads_init() 
     
    8585                #################### save/open/new/close ############################### 
    8686                if ctrl and keyname == 's': 
    87                         self.handle_states(FLOW_GRAPH_SAVE) 
     87                        self.handle_states(Actions.FLOW_GRAPH_SAVE) 
    8888                elif ctrl and keyname == 'o': 
    89                         self.handle_states(FLOW_GRAPH_OPEN) 
     89                        self.handle_states(Actions.FLOW_GRAPH_OPEN) 
    9090                elif ctrl and keyname == 'n': 
    91                         self.handle_states(FLOW_GRAPH_NEW) 
     91                        self.handle_states(Actions.FLOW_GRAPH_NEW) 
    9292                elif ctrl and keyname == 'q': 
    93                         self.handle_states(FLOW_GRAPH_CLOSE) 
     93                        self.handle_states(Actions.FLOW_GRAPH_CLOSE) 
    9494                #################### Cut/Copy/Paste ############################### 
    9595                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) 
    9797                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) 
    9999                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) 
    101101                #################### Undo/Redo ############################### 
    102102                elif ctrl and keyname == 'z': 
    103                         self.handle_states(FLOW_GRAPH_UNDO) 
     103                        self.handle_states(Actions.FLOW_GRAPH_UNDO) 
    104104                elif ctrl and keyname == 'y': 
    105                         self.handle_states(FLOW_GRAPH_REDO) 
     105                        self.handle_states(Actions.FLOW_GRAPH_REDO) 
    106106                #################### Delete ############################### 
    107107                elif self.get_focus_flag() and keyname == 'Delete':     #mouse focus 
    108                         self.handle_states(ELEMENT_DELETE) 
     108                        self.handle_states(Actions.ELEMENT_DELETE) 
    109109                #################### Params     ############################### 
    110110                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) 
    112112                #################### Rotate ############################### 
    113113                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) 
    115115                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) 
    117117                #################### Enable/Disable ############################### 
    118118                elif self.get_focus_flag() and keyname == 'e': #mouse focus 
    119                         self.handle_states(BLOCK_ENABLE) 
     119                        self.handle_states(Actions.BLOCK_ENABLE) 
    120120                elif self.get_focus_flag() and keyname == 'd': #mouse focus 
    121                         self.handle_states(BLOCK_DISABLE) 
     121                        self.handle_states(Actions.BLOCK_DISABLE) 
    122122                #################### Data Type ############################### 
    123123                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) 
    125125                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) 
    127127                #################### Port Controllers ############################### 
    128128                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) 
    130130                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) 
    132132                #################### Gen/Exec/Stop/Print ############################### 
    133133                elif keyname == 'F5': 
    134                         self.handle_states(FLOW_GRAPH_GEN) 
     134                        self.handle_states(Actions.FLOW_GRAPH_GEN) 
    135135                elif keyname == 'F6': 
    136                         self.handle_states(FLOW_GRAPH_EXEC) 
     136                        self.handle_states(Actions.FLOW_GRAPH_EXEC) 
    137137                elif keyname == 'F7': 
    138                         self.handle_states(FLOW_GRAPH_KILL) 
     138                        self.handle_states(Actions.FLOW_GRAPH_KILL) 
    139139                elif keyname == 'Print': 
    140                         self.handle_states(FLOW_GRAPH_SCREEN_CAPTURE) 
     140                        self.handle_states(Actions.FLOW_GRAPH_SCREEN_CAPTURE) 
    141141                #propagate this if the fg is not in focus or nothing is selected 
    142142                return self.get_focus_flag() and self.get_flow_graph().is_selected() 
     
    149149                @return true 
    150150                """ 
    151                 self.handle_states(APPLICATION_QUIT) 
     151                self.handle_states(Actions.APPLICATION_QUIT) 
    152152                return True 
    153153 
     
    174174                # Initalize/Quit 
    175175                ############################################################################################## 
    176                 if state == APPLICATION_INITIALIZE: 
    177                         for action in ACTIONS_LIST: action.set_sensitive(False) #set all actions disabled 
     176                if state == Actions.APPLICATION_INITIALIZE: 
     177                        for action in Actions.ACTIONS_LIST: action.set_sensitive(False) #set all actions disabled 
    178178                        # enable a select few actions 
    179179                        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() 
    185188                        if not self.init_file_paths: self.init_file_paths = [''] 
    186189                        for file_path in self.init_file_paths: 
    187190                                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) 
    189193                        if not self.get_page(): self.main_window.new_page() #ensure that at least a blank page exists 
    190                 elif state == APPLICATION_QUIT: 
     194                elif state == Actions.APPLICATION_QUIT: 
    191195                        if self.main_window.close_pages(): 
    192196                                gtk.main_quit() 
     
    195199                # Selections 
    196200                ############################################################################################## 
    197                 elif state == ELEMENT_SELECT: 
     201                elif state == Actions.ELEMENT_SELECT: 
    198202                        self.get_flow_graph().update() 
    199                 elif state == NOTHING_SELECT: 
     203                elif state == Actions.NOTHING_SELECT: 
    200204                        self.get_flow_graph().unselect() 
    201205                        self.get_flow_graph().update() 
     
    203207                # Enable/Disable 
    204208                ############################################################################################## 
    205                 elif state == BLOCK_ENABLE: 
     209                elif state == Actions.BLOCK_ENABLE: 
    206210                        if self.get_flow_graph().enable_selected(True): 
    207211                                self.get_flow_graph().update() 
    208212                                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 
    209213                                self.get_page().set_saved(False) 
    210                 elif state == BLOCK_DISABLE: 
     214                elif state == Actions.BLOCK_DISABLE: 
    211215                        if self.get_flow_graph().enable_selected(False): 
    212216                                self.get_flow_graph().update() 
     
    216220                # Cut/Copy/Paste 
    217221                ############################################################################################## 
    218                 elif state == BLOCK_CUT: 
     222                elif state == Actions.BLOCK_CUT: 
    219223                        self.handle_states(BLOCK_COPY) 
    220224                        self.handle_states(ELEMENT_DELETE) 
    221                 elif state == BLOCK_COPY: 
     225                elif state == Actions.BLOCK_COPY: 
    222226                        self.clipboard = self.get_flow_graph().copy_to_clipboard() 
    223                 elif state == BLOCK_PASTE: 
     227                elif state == Actions.BLOCK_PASTE: 
    224228                        if self.clipboard: 
    225229                                self.get_flow_graph().paste_from_clipboard(self.clipboard) 
     
    230234                # Move/Rotate/Delete/Create 
    231235                ############################################################################################## 
    232                 elif state == BLOCK_MOVE: 
     236                elif state == Actions.BLOCK_MOVE: 
    233237                        self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 
    234238                        self.get_page().set_saved(False) 
    235                 elif state == BLOCK_ROTATE_LEFT: 
     239                elif state == Actions.BLOCK_ROTATE_LEFT: 
    236240                        if self.get_flow_graph().rotate_selected(DIR_LEFT): 
    237241                                self.get_flow_graph().update() 
    238242                                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 
    239243                                self.get_page().set_saved(False) 
    240                 elif state == BLOCK_ROTATE_RIGHT: 
     244                elif state == Actions.BLOCK_ROTATE_RIGHT: 
    241245                        if self.get_flow_graph().rotate_selected(DIR_RIGHT): 
    242246                                self.get_flow_graph().update() 
    243247                                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 
    244248                                self.get_page().set_saved(False) 
    245                 elif state == ELEMENT_DELETE: 
     249                elif state == Actions.ELEMENT_DELETE: 
    246250                        if self.get_flow_graph().remove_selected(): 
    247251                                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: 
    251255                        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) 
    253257                        self.get_page().set_saved(False) 
    254                 elif state == BLOCK_INC_TYPE: 
     258                elif state == Actions.BLOCK_INC_TYPE: 
    255259                        if self.get_flow_graph().type_controller_modify_selected(1): 
    256260                                self.get_flow_graph().update() 
    257261                                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 
    258262                                self.get_page().set_saved(False) 
    259                 elif state == BLOCK_DEC_TYPE: 
     263                elif state == Actions.BLOCK_DEC_TYPE: 
    260264                        if self.get_flow_graph().type_controller_modify_selected(-1): 
    261265                                self.get_flow_graph().update() 
    262266                                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 
    263267                                self.get_page().set_saved(False) 
    264                 elif state == PORT_CONTROLLER_INC: 
     268                elif state == Actions.PORT_CONTROLLER_INC: 
    265269                        if self.get_flow_graph().port_controller_modify_selected(1): 
    266270                                self.get_flow_graph().update() 
     
    268272                                self.get_page().get_state_cache().save_new_state(self.get_flow_graph().export_data()) 
    269273                                self.get_page().set_saved(False) 
    270                 elif state == PORT_CONTROLLER_DEC: 
     274                elif state == Actions.PORT_CONTROLLER_DEC: 
    271275                        if self.get_flow_graph().port_controller_modify_selected(-1): 
    272276                                self.get_flow_graph().update() 
     
    277281                # Window stuff 
    278282                ############################################################################################## 
    279                 elif state == PREFS_WINDOW_DISPLAY: 
     283                elif state == Actions.PREFS_WINDOW_DISPLAY: 
    280284                        PreferencesDialog() 
    281285                        self.get_flow_graph().update() 
    282                 elif state == ABOUT_WINDOW_DISPLAY: 
     286                elif state == Actions.ABOUT_WINDOW_DISPLAY: 
    283287                        AboutDialog() 
    284                 elif state == HOTKEYS_WINDOW_DISPLAY: 
     288                elif state == Actions.HOTKEYS_WINDOW_DISPLAY: 
    285289                        HotKeysDialog() 
    286290                ############################################################################################## 
    287291                # Param Modifications 
    288292                ############################################################################################## 
    289                 elif state == BLOCK_PARAM_MODIFY: 
     293                elif state == Actions.BLOCK_PARAM_MODIFY: 
    290294                        if self.get_flow_graph().param_modify_selected(): 
    291295                                self.get_flow_graph().update() 
     
    295299                # Undo/Redo 
    296300                ############################################################################################## 
    297                 elif state == FLOW_GRAPH_UNDO: 
     301                elif state == Actions.FLOW_GRAPH_UNDO: 
    298302                        n = self.get_page().get_state_cache().get_prev_state() 
    299303                        if n: 
     
    302306                                self.get_flow_graph().update() 
    303307                                self.get_page().set_saved(False) 
    304                 elif state == FLOW_GRAPH_REDO: 
     308                elif state == Actions.FLOW_GRAPH_REDO: 
    305309                        n = self.get_page().get_state_cache().get_next_state() 
    306310                        if n: 
     
    312316                # New/Open/Save/Close 
    313317                ############################################################################################## 
    314                 elif state == FLOW_GRAPH_NEW: 
     318                elif state == Actions.FLOW_GRAPH_NEW: 
    315319                        self.main_window.new_page() 
    316                 elif state == FLOW_GRAPH_OPEN: 
     320                elif state == Actions.FLOW_GRAPH_OPEN: 
    317321                        file_paths = OpenFlowGraphFileDialog(self.get_page().get_file_path()).run() 
    318322                        if file_paths: #open a new page for each file, show only the first 
    319323                                for i,file_path in enumerate(file_paths): 
    320324                                        self.main_window.new_page(file_path, show=(i==0)) 
    321                 elif state == FLOW_GRAPH_CLOSE: 
     325                elif state == Actions.FLOW_GRAPH_CLOSE: 
    322326                        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) 
    325329                        else: 
    326330                                try: 
     
    330334                                        Messages.send_fail_save(self.get_page().get_file_path()) 
    331335                                        self.get_page().set_saved(False) 
    332                 elif state == FLOW_GRAPH_SAVE_AS: 
     336                elif state == Actions.FLOW_GRAPH_SAVE_AS: 
    333337                        file_path = SaveFlowGraphFileDialog(self.get_page().get_file_path()).run() 
    334338                        if file_path != None: 
    335339                                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: 
    338342                        file_path = SaveImageFileDialog(self.get_page().get_file_path()).run() 
    339343                        if file_path != None: 
     
    346350                # Gen/Exec/Stop 
    347351                ############################################################################################## 
    348                 elif state == FLOW_GRAPH_GEN: 
     352                elif state == Actions.FLOW_GRAPH_GEN: 
    349353                        if not self.get_page().get_pid(): 
    350354                                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 saved 
     355                                        self.handle_states(Actions.FLOW_GRAPH_SAVE) #only save if file path missing or not saved 
    352356                                if self.get_page().get_saved() and self.get_page().get_file_path(): 
    353357                                        generator = self.get_page().get_generator() 
     
    357361                                        except Exception,e: Messages.send_fail_gen(e) 
    358362                                else: self.generator = None 
    359                 elif state == FLOW_GRAPH_EXEC: 
     363                elif state == Actions.FLOW_GRAPH_EXEC: 
    360364                        if not self.get_page().get_pid(): 
    361                                 self.handle_states(FLOW_GRAPH_GEN) 
     365                                self.handle_states(Actions.FLOW_GRAPH_GEN) 
    362366                                if self.get_page().get_saved() and self.get_page().get_file_path(): 
    363367                                        ExecFlowGraphThread(self) 
    364                 elif state == FLOW_GRAPH_KILL: 
     368                elif state == Actions.FLOW_GRAPH_KILL: 
    365369                        if self.get_page().get_pid(): 
    366370                                try: os.kill(self.get_page().get_pid(), signal.SIGKILL) 
     
    373377                ############################################################################################## 
    374378                #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())) 
    379383                #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)) 
    383387                #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())) 
    386390                #set the exec and stop buttons 
    387391                self.update_exec_stop() 
    388392                #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()) 
    390394                self.main_window.update() 
    391395                #draw the flow graph 
     
    398402                """ 
    399403                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) 
    403407 
    404408class ExecFlowGraphThread(Thread): 
  • gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Actions.py

    r9487 r9512  
    1717Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
    1818""" 
    19 ##@package Actions 
    20 #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) 
    2219 
    2320import pygtk 
  • gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Bars.py

    r9379 r9512  
    1717Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
    1818""" 
    19 ##@package grc.gui.Bars 
    20 #Create the GUI's toolbar and menubar 
    2119 
    22 from grc.Actions import * 
     20import Actions 
    2321import pygtk 
    2422pygtk.require('2.0') 
     
    2725##The list of actions for the toolbar. 
    2826TOOLBAR_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, 
    3331        None, 
    34         FLOW_GRAPH_SCREEN_CAPTURE, 
     32        Actions.FLOW_GRAPH_SCREEN_CAPTURE, 
    3533        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, 
    4038        None, 
    41         FLOW_GRAPH_UNDO, 
    42         FLOW_GRAPH_REDO, 
     39        Actions.FLOW_GRAPH_UNDO, 
     40        Actions.FLOW_GRAPH_REDO, 
    4341        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, 
    4745        None, 
    48         BLOCK_ROTATE_LEFT, 
    49         BLOCK_ROTATE_RIGHT, 
     46        Actions.BLOCK_ROTATE_LEFT, 
     47        Actions.BLOCK_ROTATE_RIGHT, 
    5048        None, 
    51         BLOCK_ENABLE, 
    52         BLOCK_DISABLE, 
     49        Actions.BLOCK_ENABLE, 
     50        Actions.BLOCK_DISABLE, 
    5351) 
    5452 
     
    5654MENU_BAR_LIST = ( 
    5755        (gtk.Action('File', '_File', None, None), [ 
    58                 FLOW_GRAPH_NEW, 
    59                 FLOW_GRAPH_OPEN, 
     56                Actions.FLOW_GRAPH_NEW, 
     57                Actions.FLOW_GRAPH_OPEN, 
    6058                None, 
    61                 FLOW_GRAPH_SAVE, 
    62                 FLOW_GRAPH_SAVE_AS, 
     59                Actions.FLOW_GRAPH_SAVE, 
     60                Actions.FLOW_GRAPH_SAVE_AS, 
    6361                None, 
    64                 FLOW_GRAPH_SCREEN_CAPTURE, 
     62                Actions.FLOW_GRAPH_SCREEN_CAPTURE, 
    6563                None, 
    66                 FLOW_GRAPH_CLOSE, 
    67                 APPLICATION_QUIT, 
     64                Actions.FLOW_GRAPH_CLOSE, 
     65                Actions.APPLICATION_QUIT, 
    6866        ]), 
    6967        (gtk.Action('Edit', '_Edit', None, None), [ 
    70                 FLOW_GRAPH_UNDO, 
    71                 FLOW_GRAPH_REDO, 
     68                Actions.FLOW_GRAPH_UNDO, 
     69                Actions.FLOW_GRAPH_REDO, 
    7270                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, 
    7775                None, 
    78                 BLOCK_ROTATE_LEFT, 
    79                 BLOCK_ROTATE_RIGHT, 
     76                Actions.BLOCK_ROTATE_LEFT, 
     77                Actions.BLOCK_ROTATE_RIGHT, 
    8078                None, 
    81                 BLOCK_ENABLE, 
    82                 BLOCK_DISABLE, 
     79                Actions.BLOCK_ENABLE, 
     80                Actions.BLOCK_DISABLE, 
    8381                None, 
    84                 BLOCK_PARAM_MODIFY, 
     82                Actions.BLOCK_PARAM_MODIFY, 
    8583        ]), 
    8684        (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, 
    9088        ]), 
    9189        (gtk.Action('Options', '_Options', None, None), [ 
    92                 PREFS_WINDOW_DISPLAY, 
     90                Actions.PREFS_WINDOW_DISPLAY, 
    9391        ]), 
    9492        (gtk.Action('Help', '_Help', None, None), [ 
    95                 ABOUT_WINDOW_DISPLAY, 
    96                 HOTKEYS_WINDOW_DISPLAY, 
     93                Actions.ABOUT_WINDOW_DISPLAY, 
     94                Actions.HOTKEYS_WINDOW_DISPLAY, 
    9795        ]), 
    9896) 
     
    110108                for action_name in TOOLBAR_LIST: 
    111109                        if action_name: #add a tool item 
    112                                 action = get_action_from_name(action_name) 
     110                                action = Actions.get_action_from_name(action_name) 
    113111                                self.add(action.create_tool_item()) 
    114112                                #this reset of the tooltip property is required (after creating the tool item) for the tooltip to show 
     
    136134                        for action_name in action_names: 
    137135                                if action_name: #append a menu item 
    138                                         action = get_action_from_name(action_name) 
     136                                        action = Actions.get_action_from_name(action_name) 
    139137                                        main_menu.append(action.create_menu_item()) 
    140138                                else: main_menu.append(gtk.SeparatorMenuItem()) 
  • gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/BlockTreeWindow.py

    r9379 r9512  
    1717Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
    1818""" 
    19 ##@package grc.gui.BlockTreeWindow 
    20 #The block selection panel gives the user a tree selection to choose a block. 
    2119 
    22 from grc.Constants import * 
     20from Constants import BLOCK_SELECTION_WINDOW_WIDTH 
    2321import pygtk 
    2422pygtk.require('2.0') 
  • gnuradio/branches/developers/jblum/grc_reorganize/grc/src/gui/Constants.py

    r9495 r9512  
    1717Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
    1818""" 
    19 ##@package grc.Constants 
    20 #Global constants 
    21 #@author Josh Blum 
    2219 
    23 ###################################################################################################### 
     20################################################## 
    2421## Global Titles 
    25 ###################################################################################################### 
     22################################################## 
    2623 
    2724##The name to appear in the main window for a flow graph that has not been saved to file. 
     
    3128MAIN_WINDOW_PREFIX = "GRC" 
    3229 
    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################################################## 
    5031## 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################################################## 
    5533 
    5634##direction of rotation left. 
     
    6038DIR_RIGHT = 'right' 
    6139 
    62 ###################################################################################################### 
     40################################################## 
    6341## Dimension constraints for the various windows (in pixels) 
    64 ###################################################################################################### 
     42################################################## 
    6543 
    6644##main window constraints 
     
    7856BLOCK_SELECTION_WINDOW_WIDTH = 200 
    7957 
    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################################################## 
    10059## Dragging, scrolling, and redrawing constants for the flow graph window in pixels 
    101 ###################################################################################################### 
     60################################################## 
    10261 
    10362##How close can the mouse get to the window border before mouse events are ignored. 
     
    11675CONNECTION_SELECT_SENSITIVITY = 5 
    11776 
    118 ###################################################################################################### 
     77################################################## 
    11978# A state is recorded for each change to the flow graph, the size dictates how many states we can record 
    120 ###################################################################################################### 
     79