2 # -*- coding: utf-8 -*-
5 from PyQt4
.QtGui
import QApplication
, QDialog
6 from PyQt4
.QtCore
import QTimer
, SIGNAL
, SLOT
7 from PyQt4
.uic
import loadUi
9 jack
.attach("qtransport")
12 def __init__(self
, *args
):
13 QDialog
.__init
__(self
, *args
)
14 loadUi(sys
.path
[0]+"/qtransport_gui.ui", self
)
19 self
.connect(self
.b_back
, SIGNAL("clicked()"), self
.goBack
)
20 self
.connect(self
.b_play
, SIGNAL("clicked()"), self
.play
)
21 self
.connect(self
.b_stop
, SIGNAL("clicked()"), self
.stop
)
22 self
.connect(self
.b_forward
, SIGNAL("clicked()"), self
.goForward
)
23 self
.connect(self
.timer
, SIGNAL("timeout()"), self
.refreshUi
)
26 pos
= int(jack
.get_current_transport_frame()) - 100000
28 jack
.transport_locate(0)
30 jack
.transport_locate(pos
)
33 jack
.transport_locate(jack
.get_current_transport_frame()+100000)
36 if (self
.b_play
.isChecked()):
37 jack
.transport_start()
43 jack
.transport_locate(0)
44 self
.b_play
.setChecked(False)
47 state
= jack
.get_transport_state()
48 frame
= jack
.get_current_transport_frame()
49 rate
= jack
.get_sample_rate()
53 self
.l_state
.setText("Stopped")
54 self
.b_play
.setChecked(False)
56 self
.l_state
.setText("Rolling")
57 self
.b_play
.setChecked(True)
58 elif (state
== 3): self
.l_state
.setText("Starting")
59 else: self
.l_state
.setText("Unknown (%i)" % state
)
64 mins
= (time
/ 60) % 60
65 hrs
= (time
/ 3600) % 60
66 secH
= minH
= hrsH
= ""
67 if secs
< 10: secH
= "0"
68 if mins
< 10: minH
= "0"
69 if hrs
< 10: hrsH
= "0"
70 self
.l_time
.setText(hrsH
+str(hrs
)+":"+minH
+str(mins
)+":"+secH
+str(secs
))
73 self
.l_frame
.setText(str(frame
))
75 #--------------- main ------------------
76 if __name__
== '__main__':
78 app
= QApplication(sys
.argv
)