2 Copyright 2007 Free Software Foundation, Inc.
3 This file is part of GNU Radio
5 GNU Radio Companion is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 GNU Radio Companion is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 #Handle all of the system messages and error reports.
23 from Constants import VERSION
27 ## A list of functions that can receive a message.
28 MESSENGERS_LIST = list()
30 def register_messenger(messenger):
32 Append the given messenger to the list of messengers.
33 @param messenger a method thats takes a string
35 MESSENGERS_LIST.append(messenger)
39 Give the message to each of the messengers.
40 @param message a message string
42 for messenger in MESSENGERS_LIST: messenger(message)
44 #register stdout by default
45 register_messenger(sys.stdout.write)
47 ###########################################################################
48 # Special functions for specific program functionalities
49 ###########################################################################
51 send("""<<< Welcome to GRC %s >>>\n"""%VERSION)
53 def send_page_switch(file_path):
54 send('\nShowing: "%s"\n'%file_path)
56 ################# functions for loading flow graphs ########################################
57 def send_start_load(file_path):
58 send('\nLoading: "%s"'%file_path + '\n')
60 def send_error_load(error):
61 send('>>> Error: %s\n'%error)
67 def send_fail_load(error):
68 send('Parser Error: %s\n'%error)
72 ################# functions for generating flow graphs ########################################
73 def send_start_gen(file_path):
74 send('\nGenerating: "%s"'%file_path + '\n')
76 def send_fail_gen(error):
77 send('Generate Error: %s\n'%error)
81 ################# functions for executing flow graphs ########################################
82 def send_start_exec(file_path):
83 send('\nExecuting: "%s"'%file_path + '\n')
85 def send_verbose_exec(verbose):
91 ################# functions for saving flow graphs ########################################
92 def send_fail_save(file_path):
93 send('>>> Error: Cannot save: %s\n'%file_path)
95 ################# functions for connections ########################################
96 def send_fail_connection():
97 send('>>> Warning: A connection can only be created between a source and an unconnected sink.\n')
99 ################# functions for preferences ########################################
100 def send_fail_load_preferences(prefs_file_path):
101 send('>>> Error: Cannot load preferences file: "%s"\n'%prefs_file_path)
103 def send_fail_save_preferences(prefs_file_path):
104 send('>>> Error: Cannot save preferences file: "%s"\n'%prefs_file_path)