forked from kieranjol/IFIscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pg.py
executable file
·103 lines (77 loc) · 3.71 KB
/
pg.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env python
from PyQt4 import QtGui, QtCore
import sys
import subprocess
import premisgui
import os
import filecmp
import hashlib
from glob import glob
class ExampleApp(QtGui.QMainWindow, premisgui.Ui_MainWindow):
def __init__(self):
global text
global counter
counter = 0
super(self.__class__, self).__init__()
self.setupUi(self) # This is defined in design.py file automatically
self.processButton.setEnabled(True)
self.processButton.clicked.connect(self.encode)
#self.oeTextBox.textChanged.connect(self.countup)
#print text
#items = []
self.filmPreparationListBox.itemSelectionChanged.connect(self.getPrepList)
self.filmCaptureInterventionsListBox.itemSelectionChanged.connect(self.getInterventionList)
self.rawAudioInterventions.itemSelectionChanged.connect(self.getRawAudioInterventionsList)
self.tapeWorkstationComboBox.activated[str].connect(self.getWorkstation)
self.processButton.clicked.connect(self.closeIt)
def closeIt(self):
self.close()
def getWorkstation(self):
global tapeWorkstation
tapeWorkstation = self.tapeWorkstationComboBox.currentText()
def getPrepList(self):
global items
items = []
itemObjects = self.filmPreparationListBox.selectedItems()
for i in itemObjects:
items.append(str(i.text()))
return items
def getInterventionList(self):
global interventions
interventions = []
interventionsObjects = self.filmCaptureInterventionsListBox.selectedItems()
for i in interventionsObjects:
interventions.append(str(i.text()))
return interventions
def getRawAudioInterventionsList(self):
global rawAudiointerventions
rawAudiointerventions = []
rawAudiointerventionsObjects = self.rawAudioInterventions.selectedItems()
for i in rawAudiointerventionsObjects:
rawAudiointerventions.append(str(i.text()))
return rawAudiointerventions
def encode(self):
global ifi_identifiersDict
ifi_identifiersDict = {}
user = self.userComboBox.currentText()
oe = self.oeTextBox.toPlainText()
filmographic = self.FilmographicTextBox.toPlainText()
sourceAccession = self.sourceAccessionTextBox.toPlainText()
#interventions = self.getInterventionList
#items = self.getPrepLists
if self.tabWidget.currentIndex() == 0:
ifi_identifiersDict = {"workflow":"scanning","oe":str(oe), "filmographic":str(filmographic), "sourceAccession":str(sourceAccession), "interventions":interventions, "prepList":items, "user":str(user)}
if self.tabWidget.currentIndex() == 1:
ifi_identifiersDict = {"workflow":"tape", "oe":str(oe), "filmographic":str(filmographic), "sourceAccession":str(sourceAccession), "tapeWorkstation":str(tapeWorkstation)}
elif self.tabWidget.currentIndex() == 2:
ifi_identifiersDict = {"workflow":"rawaudio","oe":str(oe), "filmographic":str(filmographic), "sourceAccession":str(sourceAccession), "rawAudiointerventions":str(rawAudiointerventions)}
return ifi_identifiersDict
#items = self.getPrepList
def main():
app = QtGui.QApplication(sys.argv) # A new instance of QApplication
form = ExampleApp() # We set the form to be our ExampleApp (design)
form.show() # Show the form
app.exec_() # and execute the app
return ifi_identifiersDict
if __name__ == '__main__':
main() # run the main function