Line | |
---|
1 | # The main program
|
---|
2 |
|
---|
3 | from .gui.gui import GUI
|
---|
4 |
|
---|
5 | from config import Config
|
---|
6 |
|
---|
7 | import os
|
---|
8 | import sys
|
---|
9 |
|
---|
10 | #--------------------------------------------------------------------------------------
|
---|
11 |
|
---|
12 | class StdIOHandler(object):
|
---|
13 | """Handler for the standard I/O messages."""
|
---|
14 | def __init__(self, gui):
|
---|
15 | """Construct the handler."""
|
---|
16 | self._gui = gui
|
---|
17 |
|
---|
18 | def write(self, text):
|
---|
19 | """Write the given text into the log."""
|
---|
20 | self._gui.writeStdIO(text)
|
---|
21 |
|
---|
22 | #--------------------------------------------------------------------------------------
|
---|
23 |
|
---|
24 | def main():
|
---|
25 | """The main operation of the program."""
|
---|
26 | programDirectory = os.path.dirname(sys.argv[0])
|
---|
27 |
|
---|
28 | config = Config()
|
---|
29 | gui = GUI(programDirectory, config)
|
---|
30 |
|
---|
31 | sys.stdout = StdIOHandler(gui)
|
---|
32 | sys.stderr = StdIOHandler(gui)
|
---|
33 |
|
---|
34 | gui.build(programDirectory)
|
---|
35 |
|
---|
36 | gui.run()
|
---|
37 |
|
---|
38 | #--------------------------------------------------------------------------------------
|
---|
39 |
|
---|
40 | if __name__ == "__main__":
|
---|
41 | main()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.