-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEngeSpec.py
executable file
·57 lines (41 loc) · 1.28 KB
/
EngeSpec.py
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
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python3
from PySide6 import QtCore
from PySide6.QtWidgets import QApplication
import sys
import random
## All code is in the modules folder
sys.path.append('./modules')
from Views import Ui_MainWindow, WriteStream, MyReceiver
from SpectrumCanvas import *
from SpectrumCollection import *
#from SpectrumHandlers import *
from queue import Queue
## Define the spectrum
##spec =
app = QApplication([])
## Here is a new comment
## Load and initialize a collection of spectra
SpecColl = SpectrumCollection(0)
## Load the spectrum drawing routines
SpecCanvas = SpectrumCanvas(SpecColl=SpecColl)
## Draw everything!
ui = Ui_MainWindow(SpecCanvas) ## Pass the spectrum to the GUI
ui.show()
## make a queue and direct sys.stdout to it
commandqueue = Queue()
sys.stdout = WriteStream(commandqueue)
sys.stderr = WriteStream(commandqueue)
## Now create a receiver to listen to the queue
commandthread = QtCore.QThread()
commandreceiver = MyReceiver(commandqueue)
commandreceiver.mysignal.connect(ui.append_text)
commandreceiver.moveToThread(commandthread)
commandthread.started.connect(commandreceiver.run)
commandthread.start()
#app.exit(app.exec_())
app.exec_()
## A little trick to make the text printer exit nicely
print("Exiting")
commandthread.quit()
#commandthread.wait()
app.exit(0)