-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.py
58 lines (50 loc) · 1.57 KB
/
GUI.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
from PyQt4 import QtGui, QtCore
def printIf(self, text):
if self.verb:
print text
def add2List(self, inLine, listDev):
try:
it = listDev.count()
item = QtGui.QListWidgetItem()
listDev.addItem(item)
item = listDev.item(it)
self.printIf("add2List: add2List successfully done...")
item.setText(QtGui.QApplication.translate("Form", inLine, None, QtGui.QApplication.UnicodeUTF8))
except:
self.printIf("add2List: add2List went wrong...")
return False
def dirSelect(self):
try:
fileName = QtGui.QFileDialog.getExistingDirectory( self, 'Select Local Data Path...')
self.printIf("dirSelect: dirSelect successfully done...")
return fileName
except:
self.printIf("dirSelect: takeFromList went wrong...")
return False
def takeFromList(self, listDev):
try:
for x in listDev.selectedItems():
listDev.takeItem(listDev.row(x))
self.printIf("takeFromList: takeFromList successfully done...")
except:
self.printIf("takeFromList: takeFromList went wrong...")
return False
def takeAllFromList(self, listDev):
try:
for x in xrange(listDev.count()):
listDev.takeItem(listDev.row(0))
self.printIf("takeFromList: takeFromList successfully done...")
except:
self.printIf("takeFromList: takeFromList went wrong...")
return False
def err(self, text):
QtGui.QMessageBox.critical( self, ("Camiryo Error"), (text))
def inf(self, text):
QtGui.QMessageBox.information( self, ("Camiryo Error"), (text))
def returnAllList(self, listDev):
items = []
for x in xrange(listDev.count()):
line = listDev.item(x)
ln = line.text()
items.append(ln)
return map(str, items)