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.
22 from Constants import VERSION
26 ## A list of functions that can receive a message.
27 MESSENGERS_LIST = list()
29 def register_messenger(messenger):
31 Append the given messenger to the list of messengers.
32 @param messenger a method thats takes a string
34 MESSENGERS_LIST.append(messenger)
38 Give the message to each of the messengers.
39 @param message a message string
41 for messenger in MESSENGERS_LIST: messenger(message)
43 #register stdout by default
44 register_messenger(sys.stdout.write)
46 ###########################################################################
47 # Special functions for specific program functionalities
48 ###########################################################################
50 send("""<<< Welcome to GRC %s >>>\n"""%VERSION)
52 def send_page_switch(file_path):
53 send('\nShowing: "%s"\n'%file_path)
55 ################# functions for loading flow graphs ########################################
56 def send_start_load(file_path):
57 send('\nLoading: "%s"'%file_path + '\n')
59 def send_error_load(error):
60 send('>>> Error: %s\n'%error)
66 def send_fail_load(error):
67 send('Parser Error: %s\n'%error)
71 ################# functions for generating flow graphs ########################################
72 def send_start_gen(file_path):
73 send('\nGenerating: "%s"'%file_path + '\n')
75 def send_fail_gen(error):
76 send('Generate Error: %s\n'%error)
80 ################# functions for executing flow graphs ########################################
81 def send_start_exec(file_path):
82 send('\nExecuting: "%s"'%file_path + '\n')
84 def send_verbose_exec(verbose):
90 ################# functions for saving flow graphs ########################################
91 def send_fail_save(file_path):
92 send('>>> Error: Cannot save: %s\n'%file_path)
94 ################# functions for connections ########################################
95 def send_fail_connection():
96 send('>>> Warning: A connection can only be created between a source and an unconnected sink.\n')
98 ################# functions for preferences ########################################
99 def send_fail_load_preferences(prefs_file_path):
100 send('>>> Error: Cannot load preferences file: "%s"\n'%prefs_file_path)
102 def send_fail_save_preferences(prefs_file_path):
103 send('>>> Error: Cannot save preferences file: "%s"\n'%prefs_file_path)