~sir-rainbow/+junk/scribes-on-win

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
# -*- coding: utf-8 -*-
# Copyright © 2007 Lateef Alabi-Oki
#
# This file is part of Scribes.
#
# Scribes is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Scribes is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Scribes; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

"""
This module documents a class that sends messages to the text editor's
statusbar.

@author: Lateef Alabi-Oki
@organization: The Scribes Project
@copyright: Copyright © 2007 Lateef Alabi-Oki
@license: GNU GPLv2 or Later
@contact: mystilleef@gmail.com
"""

class FeedbackManager(object):
	"""
	This class creates an instance that manages messages sent to the
	text editor's statusbar.
	"""

	def __init__(self, editor):
		"""
		Initialize object.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.
		"""
		self.__init_attributes(editor)
		self.__signal_id_1 = editor.connect("close-document", self.__close_document_cb)
		self.__signal_id_2 = editor.connect("close-document-no-save", self.__close_document_cb)
		self.__signal_id_3 = editor.connect("checking-document", self.__checking_document_cb)
		self.__signal_id_4 = editor.connect("loaded-document", self.__loaded_document_cb)
		self.__signal_id_5 = editor.connect("load-error", self.__load_error_cb)
		self.__signal_id_6 = editor.connect("renamed-document", self.__renamed_document_cb)
		self.__signal_id_7 = editor.connect_after("saved-document", self.__saved_document_cb)
		self.__signal_id_8 = editor.connect("enable-readonly", self.__enable_readonly_cb)
		self.__signal_id_9 = editor.connect("disable-readonly", self.__disable_readonly_cb)
		self.__signal_id_10 = editor.connect("not-yet-implemented", self.__not_yet_implemented_cb)
		self.__signal_id_11 = editor.connect_after("modified-document", self.__changed_cb)
		self.__signal_id_12 = editor.connect("gui-created", self.__gui_created_cb)
		self.__signal_id_13 = editor.connect("reload-document", self.__reload_document_cb)
		from gobject import idle_add, PRIORITY_LOW
		idle_add(self.__precompile_methods, priority=PRIORITY_LOW)

	def __init_attributes(self, editor):
		"""
		Initialize data attributes.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.
		"""
		self.__editor = editor
		self.__registration_id = editor.register_object()
		self.__icon_dictionary = self.__create_feedback_icons()
		self.__spinner = editor.store.get_object("Spinner")
		self.__message_stack = []
		self.__error_strings = ("fail", "no", "error", "warning")
		self.__message_id = None
		self.__filename = None
		self.__reset_timer = None
		self.__is_busy = False
		self.__default_message_is_set = False
		return

########################################################################
#
#						Public APIs
#
########################################################################

	def update_status_message(self, message=None, icon=None, time=3):
		"""
		Update the statusbar with feedback message and image.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param message: Message to send to the statusbar.
		@type message: A String object.

		@param icon: Image to place in the statusbar.
		@type icon: A gtk.STOCK object.

		@param time: How long to display feedback message in seconds.
		@type time: An Integer object.

		@return: False to call this function once.
		@rtype: A Boolean object.
		"""
		self.__is_busy = True
		from gobject import idle_add, PRIORITY_LOW
		idle_add(self.__set_message, message, priority=PRIORITY_LOW)
		idle_add(self.__set_icon, icon, priority=PRIORITY_LOW)
		idle_add(self.__reset, time, priority=PRIORITY_LOW)
		idle_add(self.__beep, icon, priority=PRIORITY_LOW)
		self.__default_message_is_set = False
		return False

	def set_modal_message(self, message=None, icon=None):
		"""
		Add feedback data to message stack.

		@param message: Feedback data representing a message.
		@type message: A String object.

		@param icon: Feedback data representing an image.
		@type icon: A String object.

		@return: A unique number associated with a set of feedback data.
		@rtype: An Integer object.
		"""
		message_id = self.__editor.generate_random_number(self.__message_stack)
		self.__message_stack.append((message, icon, message_id))
		from gobject import idle_add, PRIORITY_LOW
		idle_add(self.__set_message, message, priority=PRIORITY_LOW)
		idle_add(self.__set_icon, icon, priority=PRIORITY_LOW)
		self.__default_message_is_set = False
		return message_id

	def unset_modal_message(self, message_id, reset=True):
		"""
		Remove feedback data from message stack.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param message_id: A unique number associated with feedback data.
		@type message_id: A Integer object.

		@param reset: If True reset the statusbar.
		@type reset: A Boolean object.

		@return: False to call this function once.
		@rtype: A Boolean object.
		"""
		try:
			for feedback in self.__message_stack:
				found = self.__remove_message_from_stack(message_id, feedback)
				if found: break
			if reset:
				from gobject import idle_add, PRIORITY_LOW
				idle_add(self.__reset_message, priority=PRIORITY_LOW)
		except RuntimeError:
			pass
		return False

	def start_spinner(self):
		"""
		Start spinning the feedback throbber.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		self.__spinner.start()
		return False

	def stop_spinner(self):
		"""
		Stop spinning the feedback throbber.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		self.__spinner.stop()
		return False

	def start_busy_cursor(self):
		"""
		Show the busy cursor.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		from cursor import show_busy_textview_cursor
		show_busy_textview_cursor(self.__editor.textview)
		return False

	def stop_busy_cursor(self):
		"""
		Stop showing busy cursor.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		from cursor import show_textview_cursor
		show_textview_cursor(self.__editor.textview)
		return False

########################################################################
#
#						Helper Methods
#
########################################################################

	def __set_message(self, message):
		"""
		Update the statusbar with message.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param message: A message to push to the statusbar.
		@type message: A String object.
		"""
		try:
			if not message: return False
			statusbar = self.__editor.statusone
			statusbar.pop(statusbar.context_id)
			context_id = statusbar.get_context_id(message)
			statusbar.push(context_id, message)
		except AttributeError:
			self.__destroy()
		except RuntimeError:
			pass
		return False

	def __set_icon(self, icon):
		"""
		Update the statusbar with icon.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param message: An icon to place in the statusbar.
		@type message: A gtk.STOCK object.
		"""
		try:
			if not icon: return False
			image = self.__editor.status_image
			frame = self.__editor.status_image_frame
			image.clear()
			from gtk import ICON_SIZE_MENU
			image.set_from_stock(self.__icon_dictionary[icon], ICON_SIZE_MENU)
			image.show_all()
			frame.show()
		except KeyError:
			pass
		except AttributeError:
			self.__destroy()
		except RuntimeError:
			pass
		return False

	def __remove_message(self):
		"""
		Remove message from statusbar.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		try:
			statusbar = self.__editor.statusone
			statusbar.pop(statusbar.context_id)
			statusbar.push(0, "")
		except AttributeError:
			self.__destroy()
		return False

	def __remove_icon(self):
		"""
		Remove image from statusbar.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		try:
			self.__editor.status_image.clear()
			self.__editor.status_image_frame.hide_all()
		except AttributeError:
			self.__destroy()
		return False

	def __reset_message(self):
		"""
		Reset the message in the statusbar.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		if self.__message_stack and not self.__editor.is_readonly:
			self.__set_message_from_stack()
		elif self.__filename is None:
			self.__remove_message()
			self.__remove_icon()
		else:
			self.__set_default_message()
			self.__set_default_icon()
		self.__is_busy = False
		self.__default_message_is_set = True
		return False

	def __set_default_message(self):
		"""
		Determine default message to display in the statusbar.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		from internationalization import msg0044, msg0045
		if self.__editor.is_readonly:
			message = msg0044 % self.__filename
			self.__set_message(message)
		else:
			message = msg0045 % self.__filename
			self.__set_message(message)
		return False

	def __set_default_icon(self):
		"""
		Determine default image to show in the statusbar.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		if self.__editor.is_readonly:
			self.__set_icon("readonly")
		elif self.__editor.file_is_saved:
			self.__set_icon("new")
		else:
			self.__set_icon("edit")
		return False

	def __set_message_from_stack(self):
		"""
		Determine feedback to show in the statusbar from the message stack.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		message = self.__message_stack[-1][0]
		icon = self.__message_stack[-1][1]
		self.__set_message(message)
		self.__set_icon(icon)
		return False

	def __remove_message_from_stack(self, message_id, feedback):
		"""
		Remove feedback data from message stack.

		@param message_id: A unique number associated with feedback data.
		@type message_id: An Integer object.

		@param feedback: Data representing feedback information.
		@type feedback: A Tuple object.

		@return: True if feedback data is found in message stack.
		@rtype: A Boolean object.
		"""
		if message_id in feedback:
			self.__message_stack.remove(feedback)
			return True
		return False

	def __reset(self, time):
		"""
		Reset the statusbar with default message.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param time: How long to reset the statusbar.
		@type time: An Integer object.
		"""
		if time is None: time = 3
		time *= 1000
		from gobject import timeout_add
		self.__remove_timer()
		self.__reset_timer = timeout_add(time, self.__reset_message)
		return False

	def __remove_timer(self):
		"""
		Remove timer of timeout_add functions to prevent multiple calls.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.
		"""
		from gobject import source_remove
		try:
			source_remove(self.__reset_timer)
		except:
			pass
		return False

	def __beep(self, icon):
		"""
		Beep on failed, error or warning messages.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param icon: A string representing an image.
		@type icon: A String object.
		"""
		if icon in self.__error_strings:
			from gtk.gdk import beep
			beep()
		return False

	def __set_filename_from_uri(self, uri):
		"""
		Set filename to show in the statusbar.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param uri: A string representing a file.
		@type uri: A String object.
		"""
		if uri.startswith("file:///"):
			from gnomevfs import get_local_path_from_uri
			local_path = get_local_path_from_uri(uri)
			if local_path.startswith(self.__editor.home_folder):
				self.__filename = local_path.replace(self.__editor.home_folder, "~")
			else:
				self.__filename = local_path
		else:
			self.__filename = uri
		return False

	def __create_feedback_icons(self):
		"""
		Generate feedback images for the statusbar.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@return: A dictionary of stock icons.
		@rtype: A Dictionary object.
		"""
		from gtk import STOCK_YES, STOCK_NO, STOCK_OPEN, STOCK_EDIT, STOCK_SAVE
		from gtk import STOCK_SAVE_AS, STOCK_NEW, STOCK_PRINT, STOCK_UNDO
		from gtk import STOCK_REDO, STOCK_JUMP_TO, STOCK_FIND
		from gtk import STOCK_FIND_AND_REPLACE, STOCK_PREFERENCES
		from gtk import STOCK_DIALOG_WARNING, STOCK_DIALOG_AUTHENTICATION
		from gtk import STOCK_DIALOG_ERROR, STOCK_COPY, STOCK_CUT, STOCK_PASTE
		from gtk import STOCK_SPELL_CHECK, STOCK_HELP, STOCK_EXECUTE
		from gtk import STOCK_DIALOG_INFO, STOCK_ABOUT, STOCK_SELECT_COLOR
		from gtk import STOCK_STOP
		icon_dictionary = {
			"succeed": STOCK_YES,
			"suceed": STOCK_YES,
			"fail": STOCK_NO,
			"no": STOCK_NO,
			"yes": STOCK_YES,
			"open": STOCK_OPEN,
			"edit": STOCK_EDIT,
			"save": STOCK_SAVE,
			"saveas": STOCK_SAVE_AS,
			"new": STOCK_NEW,
			"print": STOCK_PRINT,
			"undo": STOCK_UNDO,
			"redo": STOCK_REDO,
			"goto": STOCK_JUMP_TO,
			"find": STOCK_FIND,
			"replace": STOCK_FIND_AND_REPLACE,
			"preferences": STOCK_PREFERENCES,
			"warning": STOCK_DIALOG_WARNING,
			"readonly": STOCK_DIALOG_AUTHENTICATION,
			"error": STOCK_DIALOG_ERROR,
			"copy" : STOCK_COPY,
			"cut": STOCK_CUT,
			"paste": STOCK_PASTE,
			"spell": STOCK_SPELL_CHECK,
			"help": STOCK_HELP,
			"run": STOCK_EXECUTE,
			"info": STOCK_DIALOG_INFO,
			"about": STOCK_ABOUT,
			"color": STOCK_SELECT_COLOR,
			"stop": STOCK_STOP,
		}
		return icon_dictionary

	def __destroy(self):
		"""
		Destroy instance of this class.

		@param self: Reference to the Store instance.
		@type self: A Store object.
		"""
		self.__remove_timer()
		# Disconnect signals.
		self.__editor.disconnect_signal(self.__signal_id_1, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_2, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_3, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_4, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_5, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_6, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_7, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_8, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_9, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_10, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_11, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_12, self.__editor)
		self.__editor.disconnect_signal(self.__signal_id_13, self.__editor)
		self.__icon_dictionary.clear()
		# Unregister object so that editor can quit.
		self.__spinner.destroy_object()
		self.__editor.unregister_object(self.__registration_id)
		# Delete data attributes.
		del self
		self = None
		return

########################################################################
#
#					Event and Signal Handlers
#
########################################################################

	def __close_document_cb(self, editor):
		"""
		Handles callback when the "close-document" signal is emitted.

		This function destroys instance of this class.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.
		"""
		self.__destroy()
		return False

	def __checking_document_cb(self, editor, uri):
		"""
		Handles callback when the "checking-document" signal is emitted.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.

		@param uri: A string representing a file.
		@type uri: A String object.
		"""
		self.__set_filename_from_uri(uri)
		self.start_spinner()
		self.start_busy_cursor()
		from internationalization import msg0032
		self.__message_id = self.set_modal_message(msg0032, "run")
		return False

	def __loaded_document_cb(self, *args):
		"""
		Handles callback when the "loaded-document" signal is emitted.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.

		@param uri: A string representing a file.
		@type uri: A String object.
		"""
		from internationalization import msg0030
		message = msg0030 % self.__filename
		self.unset_modal_message(self.__message_id, False)
		self.update_status_message(message, "open")
		self.stop_spinner()
		self.stop_busy_cursor()
		return False

	def __load_error_cb(self, editor, uri):
		"""
		Handles callback when the "load-error" signal is emitted.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.

		@param uri: A string representing a file.
		@type uri: A String object.
		"""
		self.__filename = None
		self.stop_spinner()
		self.stop_busy_cursor()
		self.unset_modal_message(self.__message_id)
		return False

	def __renamed_document_cb(self, editor, uri, *args):
		"""
		Handles callback when the "renamed-document" signal is emitted.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.

		@param uri: A string representing a file.
		@type uri: A String object.
		"""
		self.__set_filename_from_uri(uri)
		from internationalization import msg0085
		message = msg0085 % self.__filename
		self.update_status_message(message, "save", 5)
		return False

	def __reload_document_cb(self, *args):
		from internationalization import msg0489
		message = msg0489 % self.__filename
		self.update_status_message(message, "run", 15)
		return False

	def __saved_document_cb(self, *args):
		"""
		Handles callback when the "saved-document" signal is emitted.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.

		@param uri: A string representing a file.
		@type uri: A String object.
		"""
		if self.__is_busy: return False
		if not self.__default_message_is_set: return False
		from internationalization import msg0085
		message = msg0085 % self.__filename
		self.update_status_message(message, "save", 5)
		return False

	def __enable_readonly_cb(self, editor):
		"""
		Handles callback when the "enable-readonly" signal is emitted.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.
		"""
		from internationalization import msg0322
		self.update_status_message(msg0322, "suceed")
		return False

	def __disable_readonly_cb(self, editor):
		"""
		Handles callback when the "disable-readonly" signal is emitted.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.
		"""
		from internationalization import msg0324
		self.update_status_message(msg0324, "suceed")
		return False

	def __not_yet_implemented_cb(self, editor):
		"""
		Handles callback when the "not-yet-implemented" signal is emitted.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.
		"""
		message = "Not yet implemented"
		self.update_status_message(message, "warning")
		return False

	def __changed_cb(self, *args):
		"""
		Handles callback when the "changed" signal is emitted.

		@param self: Reference to the FeedbackManager instance.
		@type self: A FeedbackManager object.

		@param args: Unimportant arguments.
		@type args: A Tuple object.
		"""
		if self.__filename is None: return False
		if not self.__default_message_is_set: return False
		from gtk import STOCK_EDIT
		if self.__editor.status_image.get_stock()[0] != STOCK_EDIT: self.__set_icon("edit")
		return False

	def __gui_created_cb(self, *args):
		self.__remove_message()
		self.__remove_icon()
		return False

	def __precompile_methods(self):
		try:
			from psyco import bind
			bind(self.__set_icon)
			bind(self.__set_message)
			bind(self.__set_default_icon)
			bind(self.__set_message_from_stack)
			bind(self.update_status_message)
			bind(self.set_modal_message)
			bind(self.unset_modal_message)
		except ImportError:
			pass
		return False