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
23 ## A list of functions that can receive a message.
24 MESSENGERS_LIST = list()
26 def register_messenger(messenger):
28 Append the given messenger to the list of messengers.
29 @param messenger a method thats takes a string
31 MESSENGERS_LIST.append(messenger)
35 Give the message to each of the messengers.
36 @param message a message string
38 for messenger in MESSENGERS_LIST: messenger(message)
40 #register stdout by default
41 register_messenger(sys.stdout.write)
43 ###########################################################################
44 # Special functions for specific program functionalities
45 ###########################################################################
46 def send_init(platform):
47 send("""<<< Welcome to %s %s >>>\n"""%(platform.get_name(), platform.get_version()))
49 def send_page_switch(file_path):
50 send('\nShowing: "%s"\n'%file_path)
52 ################# functions for loading flow graphs ########################################
53 def send_start_load(file_path):
54 send('\nLoading: "%s"'%file_path + '\n')
56 def send_error_load(error):
57 send('>>> Error: %s\n'%error)
63 def send_fail_load(error):
64 send('Error: %s\n'%error)
68 ################# functions for generating flow graphs ########################################
69 def send_start_gen(file_path):
70 send('\nGenerating: "%s"'%file_path + '\n')
72 def send_fail_gen(error):
73 send('Generate Error: %s\n'%error)
77 ################# functions for executing flow graphs ########################################
78 def send_start_exec(file_path):
79 send('\nExecuting: "%s"'%file_path + '\n')
81 def send_verbose_exec(verbose):
87 ################# functions for saving flow graphs ########################################
88 def send_fail_save(file_path):
89 send('>>> Error: Cannot save: %s\n'%file_path)
91 ################# functions for connections ########################################
92 def send_fail_connection():
93 send('>>> Error: Cannot create connection.\n')
95 ################# functions for preferences ########################################
96 def send_fail_load_preferences(prefs_file_path):
97 send('>>> Error: Cannot load preferences file: "%s"\n'%prefs_file_path)
99 def send_fail_save_preferences(prefs_file_path):
100 send('>>> Error: Cannot save preferences file: "%s"\n'%prefs_file_path)
102 ################# functions for warning ########################################
103 def send_warning(warning):
104 send('>>> Warning: %s\n'%warning)