Rev | Line | |
---|
[18] | 1 | # The main program
|
---|
| 2 |
|
---|
[28] | 3 | from .gui.gui import GUI
|
---|
[36] | 4 |
|
---|
| 5 | from config import Config
|
---|
[27] | 6 |
|
---|
[29] | 7 | import os
|
---|
[36] | 8 | import sys
|
---|
[27] | 9 |
|
---|
[36] | 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():
|
---|
[29] | 25 | """The main operation of the program."""
|
---|
[36] | 26 | programDirectory = os.path.dirname(sys.argv[0])
|
---|
| 27 |
|
---|
| 28 | config = Config()
|
---|
| 29 | gui = GUI(programDirectory, config)
|
---|
[27] | 30 |
|
---|
[36] | 31 | sys.stdout = StdIOHandler(gui)
|
---|
| 32 | sys.stderr = StdIOHandler(gui)
|
---|
| 33 |
|
---|
| 34 | gui.build(programDirectory)
|
---|
[27] | 35 |
|
---|
[18] | 36 | gui.run()
|
---|
[27] | 37 |
|
---|
[36] | 38 | #--------------------------------------------------------------------------------------
|
---|
| 39 |
|
---|
[20] | 40 | if __name__ == "__main__":
|
---|
[36] | 41 | main()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.