1 """
2 Observers for running interactive programs in the terminal.
3 """
4
5
6
7
8
9
10
11 from __future__ import print_function
12
13 from gavo import base
17 """An Observer swallowing infos, warnings, and the like.
18
19 This is to configure the UI. Enable it by calling
20 ``api.StingyPlainUI(api.ui)``.
21 """
25
27 print(self.curIndent+msg)
28
30 self.curIndent = self.curIndent+" "
31
33 self.curIndent = self.curIndent[:-2]
34
35 @base.listensTo("SourceError")
37 self.showMsg("Failed source %s"%srcString)
38
39 @base.listensTo("Error")
42
45 """A StingyPlainUI that at least displays warnings.
46
47 This is to configure the UI. Enable it by calling
48 ``api.SemiStingyPlainUI(api.ui)``.
49 """
50 @base.listensTo("Warning")
53
54
55 -class PlainUI(SemiStingyPlainUI):
56 """An Observer spitting out most info to the screen.
57
58 This is to configure the UI. Enable it by calling ``api.PlainUI(api.ui)``.
59 """
60 @base.listensTo("NewSource")
64
65 @base.listensTo("SourceFinished")
67 self.popIndent()
68 self.showMsg("Done %s, read %d"%(srcString, self.dispatcher.totalRead))
69
70 @base.listensTo("SourceError")
74
75 @base.listensTo("Shipout")
77 self.showMsg("Shipped %d/%d"%(
78 noShipped, self.dispatcher.totalShippedOut))
79
80 @base.listensTo("IndexCreation")
82 self.showMsg("Create index %s"%indexName)
83
84 @base.listensTo("ScriptRunning")
88
89 @base.listensTo("Info")
92