Show More
@@ -32,15 +32,13 b' class ui(object):' | |||||
32 | # this is the parent of all ui children |
|
32 | # this is the parent of all ui children | |
33 | self.parentui = None |
|
33 | self.parentui = None | |
34 | self.readhooks = [] |
|
34 | self.readhooks = [] | |
|
35 | self.quiet = quiet | |||
|
36 | self.verbose = verbose | |||
|
37 | self.debugflag = debug | |||
|
38 | self.interactive = interactive | |||
|
39 | self.traceback = traceback | |||
35 | self.cdata = ConfigParser.SafeConfigParser() |
|
40 | self.cdata = ConfigParser.SafeConfigParser() | |
36 | self.readconfig(util.rcpath()) |
|
41 | self.readconfig(util.rcpath()) | |
37 |
|
||||
38 | self.quiet = self.configbool("ui", "quiet") |
|
|||
39 | self.verbose = self.configbool("ui", "verbose") |
|
|||
40 | self.debugflag = self.configbool("ui", "debug") |
|
|||
41 | self.interactive = self.configbool("ui", "interactive", True) |
|
|||
42 | self.traceback = traceback |
|
|||
43 |
|
||||
44 | self.updateopts(verbose, debug, quiet, interactive) |
|
42 | self.updateopts(verbose, debug, quiet, interactive) | |
45 | else: |
|
43 | else: | |
46 | # parentui may point to an ui object which is already a child |
|
44 | # parentui may point to an ui object which is already a child | |
@@ -55,28 +53,32 b' class ui(object):' | |||||
55 |
|
53 | |||
56 | def updateopts(self, verbose=False, debug=False, quiet=False, |
|
54 | def updateopts(self, verbose=False, debug=False, quiet=False, | |
57 | interactive=True, traceback=False, config=[]): |
|
55 | interactive=True, traceback=False, config=[]): | |
58 | self.quiet = self.quiet or quiet |
|
|||
59 | self.verbose = self.verbose or verbose |
|
|||
60 | self.debugflag = self.debugflag or debug |
|
|||
61 |
|
||||
62 | self.verbosity_constraints(quiet, verbose, debug) |
|
|||
63 |
|
||||
64 | self.interactive = (self.interactive and interactive) |
|
|||
65 | self.traceback = self.traceback or traceback |
|
|||
66 | for section, name, value in config: |
|
56 | for section, name, value in config: | |
67 | self.setconfig(section, name, value) |
|
57 | self.setconfig(section, name, value) | |
68 |
|
58 | |||
69 | def verbosity_constraints(self, quiet, verbose, debug): |
|
59 | if quiet or verbose or debug: | |
|
60 | self.setconfig('ui', 'quiet', str(bool(quiet))) | |||
|
61 | self.setconfig('ui', 'verbose', str(bool(verbose))) | |||
|
62 | self.setconfig('ui', 'debug', str(bool(debug))) | |||
|
63 | ||||
|
64 | self.verbosity_constraints() | |||
|
65 | ||||
|
66 | if not interactive: | |||
|
67 | self.setconfig('ui', 'interactive', 'False') | |||
|
68 | self.interactive = False | |||
|
69 | ||||
|
70 | self.traceback = self.traceback or traceback | |||
|
71 | ||||
|
72 | def verbosity_constraints(self): | |||
|
73 | self.quiet = self.configbool('ui', 'quiet') | |||
|
74 | self.verbose = self.configbool('ui', 'verbose') | |||
|
75 | self.debugflag = self.configbool('ui', 'debug') | |||
|
76 | ||||
70 | if self.debugflag: |
|
77 | if self.debugflag: | |
71 | self.verbose = True |
|
78 | self.verbose = True | |
72 | self.quiet = False |
|
79 | self.quiet = False | |
73 | elif self.verbose and self.quiet: |
|
80 | elif self.verbose and self.quiet: | |
74 |
|
|
81 | self.quiet = self.verbose = False | |
75 | self.verbose = False |
|
|||
76 | elif not quiet and verbose: |
|
|||
77 | self.quiet = False |
|
|||
78 | else: |
|
|||
79 | self.quiet = self.verbose = False |
|
|||
80 |
|
82 | |||
81 | def readconfig(self, fn, root=None): |
|
83 | def readconfig(self, fn, root=None): | |
82 | if isinstance(fn, basestring): |
|
84 | if isinstance(fn, basestring): | |
@@ -114,6 +116,14 b' class ui(object):' | |||||
114 | if path and "://" not in path and not os.path.isabs(path): |
|
116 | if path and "://" not in path and not os.path.isabs(path): | |
115 | cdata.set("paths", n, os.path.join(root, path)) |
|
117 | cdata.set("paths", n, os.path.join(root, path)) | |
116 |
|
118 | |||
|
119 | # update quiet/verbose/debug and interactive status | |||
|
120 | if section is None or section == 'ui': | |||
|
121 | if name is None or name in ('quiet', 'verbose', 'debug'): | |||
|
122 | self.verbosity_constraints() | |||
|
123 | ||||
|
124 | if name is None or name == 'interactive': | |||
|
125 | self.interactive = self.configbool("ui", "interactive", True) | |||
|
126 | ||||
117 | def setconfig(self, section, name, value): |
|
127 | def setconfig(self, section, name, value): | |
118 | if not self.overlay: |
|
128 | if not self.overlay: | |
119 | self.overlay = ConfigParser.SafeConfigParser() |
|
129 | self.overlay = ConfigParser.SafeConfigParser() |
@@ -12,26 +12,26 b'' | |||||
12 | 9 True False False True False False -> True False False |
|
12 | 9 True False False True False False -> True False False | |
13 | 10 False True False True False False -> True False False |
|
13 | 10 False True False True False False -> True False False | |
14 | 11 True True False True False False -> True False False |
|
14 | 11 True True False True False False -> True False False | |
15 |
12 False False True True False False -> |
|
15 | 12 False False True True False False -> True False False | |
16 |
13 True False True True False False -> |
|
16 | 13 True False True True False False -> True False False | |
17 |
14 False True True True False False -> |
|
17 | 14 False True True True False False -> True False False | |
18 |
15 True True True True False False -> |
|
18 | 15 True True True True False False -> True False False | |
19 | 16 False False False False True False -> False True False |
|
19 | 16 False False False False True False -> False True False | |
20 | 17 True False False False True False -> False True False |
|
20 | 17 True False False False True False -> False True False | |
21 | 18 False True False False True False -> False True False |
|
21 | 18 False True False False True False -> False True False | |
22 | 19 True True False False True False -> False True False |
|
22 | 19 True True False False True False -> False True False | |
23 |
20 False False True False True False -> False True |
|
23 | 20 False False True False True False -> False True False | |
24 |
21 True False True False True False -> False True |
|
24 | 21 True False True False True False -> False True False | |
25 |
22 False True True False True False -> False True |
|
25 | 22 False True True False True False -> False True False | |
26 |
23 True True True False True False -> False True |
|
26 | 23 True True True False True False -> False True False | |
27 | 24 False False False True True False -> False False False |
|
27 | 24 False False False True True False -> False False False | |
28 | 25 True False False True True False -> False False False |
|
28 | 25 True False False True True False -> False False False | |
29 | 26 False True False True True False -> False False False |
|
29 | 26 False True False True True False -> False False False | |
30 | 27 True True False True True False -> False False False |
|
30 | 27 True True False True True False -> False False False | |
31 |
28 False False True True True False -> False |
|
31 | 28 False False True True True False -> False False False | |
32 |
29 True False True True True False -> False |
|
32 | 29 True False True True True False -> False False False | |
33 |
30 False True True True True False -> False |
|
33 | 30 False True True True True False -> False False False | |
34 |
31 True True True True True False -> False |
|
34 | 31 True True True True True False -> False False False | |
35 | 32 False False False False False True -> False True True |
|
35 | 32 False False False False False True -> False True True | |
36 | 33 True False False False False True -> False True True |
|
36 | 33 True False False False False True -> False True True | |
37 | 34 False True False False False True -> False True True |
|
37 | 34 False True False False False True -> False True True |
General Comments 0
You need to be logged in to leave comments.
Login now