1
2
3
4
5
6
7
8
9
10
11 """The publish subscribe mechanism used to maintain lists of stuff.
12
13 This helps different pieces of code maintain lists of things (eg
14 wallpapers, categories) and other to express and interest and be
15 notified when it changes (eg field editors). The wxPython pubsub
16 module is the base. The enhancements are a list of standard topics in
17 this file.
18
19 This code also used to be larger as the wxPython pubsub didn't use
20 weak references. It does now, so a whole bunch of code could be
21 deleted.
22 """
23
24 from wx.lib.pubsub import Publisher
25
26
27
28
29
30
31
32
33 REQUEST_GROUP_WALLPAPERS=( 'request', 'groupwps')
34 GROUP_WALLPAPERS=( 'response', 'groupwps' )
35 SET_GROUP_WALLPAPERS=( 'request', 'setgroupwps')
36 MERGE_GROUP_WALLPAPERS=( 'request', 'mergegroupwps')
37 REQUEST_CATEGORIES=( 'request', 'categories' )
38 ALL_CATEGORIES=( 'response', 'categories')
39 SET_CATEGORIES=( 'request', 'setcategories')
40 ADD_CATEGORY=( 'request', 'addcategory')
41 MERGE_CATEGORIES=( 'request', 'mergecategories')
42 ALL_WALLPAPERS=( 'response', 'wallpapers')
43 REQUEST_WALLPAPERS=( 'request', 'wallpapers')
44 ALL_RINGTONES=( 'response', 'ringtones' )
45 REQUEST_RINGTONES=( 'request', 'ringtones')
46 PHONE_MODEL_CHANGED=( 'notification', 'phonemodelchanged')
47 REQUEST_RINGTONE_INDEX=('request', 'ringtone-index')
48 ALL_RINGTONE_INDEX=('response', 'ringtone-index')
49 REQUEST_PB_LOOKUP=('request', 'phonebook')
50 RESPONSE_PB_LOOKUP=('response', 'phonebook')
51 MEDIA_NAME_CHANGED=('notificaion', 'medianamechanged')
52 REQUEST_TAB_CHANGED=('notification', 'tabchanges')
53 TODAY_ITEM_SELECTED=('notification', 'todayitemselected')
54 REQUEST_TODAY_DATA=('request', 'todaydata')
55 RESPONSE_TODAY_DATA=('response', 'todaydata')
56 NEW_DATA_AVAILABLE=('notification', 'dataavailable')
57 MIDNIGHT=('notification', 'midnight')
58 DR_RECORD=('notification', 'recorddata')
59 DR_PLAY=('notification', 'playdata')
60 DR_STOP=('notification', 'stop')
61 REQUEST_MEDIA_INFO=('request', 'mediainfo')
62 RESPONSE_MEDIA_INFO=('response', 'mediainfo')
63 REQUEST_MEDIA_OPEN=('request', 'mediaopen')
64
65
66 media_change_type='type'
67 wallpaper_type='wallpaper'
68 ringtone_type='ringtone'
69 media_old_name='old_name'
70 media_new_name='new_name'
71
74
77
79 Publisher.sendMessage(topic, data)
80