File: advanced_main.py

package info (click to toggle)
python-pypubsub 4.0.3-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 928 kB
  • sloc: python: 4,884; makefile: 156; xml: 16; php: 2
file content (44 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download | duplicates (2)
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
"""
Advanced example that shows other capabilities of pubsub such as pubsub notification, listener
exception handling, and topic definition providers.

:copyright: Copyright since 2006 by Oliver Schoenborn, all rights reserved.
:license: BSD, see LICENSE.txt for details.
"""

from pubsub import pub

import notifhandle
import exchandle

import kwargs_topics

# ***** actual application **********

print('Using "kwargs" messaging protocol of pubsub v3')

try:
    print('------- init ----------')

    pub.addTopicDefnProvider(kwargs_topics, pub.TOPIC_TREE_FROM_CLASS)
    pub.setTopicUnspecifiedFatal()

    import kwargs_listeners
    import kwargs_senders as senders

    print('-----------------------')
    senders.doSomething1()
    senders.doSomething2()

    print('------- done ----------')

    print('Exporting topic tree to', kwargs_topics.__name__)
    pub.exportTopicTreeSpec('kwargs_topics_out')

except Exception:
    import traceback

    traceback.print_exc()
    print(pub.exportTopicTreeSpec())

print('------ exiting --------')