forked from vernwalrahul/OpenSoft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI.py
64 lines (53 loc) · 1.81 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
59
60
61
62
63
64
from PyQt4 import QtCore, QtGui
import submodules
import sys, os
import write_in_image
from Interface import Ui_MainWindow
img_path = "images/image20.jpg"
class MyPopup(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
def paintEvent(self, e):
pass
class MainWindow(QtGui.QMainWindow, Ui_MainWindow, QtGui.QWidget):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
QtGui.QDialog.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.filename = None
self.ui.uploadButton.clicked.connect(self.getfiles)
self.ui.submitButton.clicked.connect(self.execute)
self.setFixedSize(self.size())
def getfiles(self):
global img_path
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file',
'c:\\',"Image files (*.jpg *.gif)")
img_path = str(filename)
self.ui.lineEdit.setText(filename)
self.filename = filename
def execute(self):
if(self.filename==None):
print("Filename is None")
return
else:
message, co_ords, texts = submodules.execute_model(self.filename)
self.ui.DD.setText(message)
self.w = MyPopup()
# self.w.setGeometry(QtCore.QRect(100, 100, 400, 200))
self.w.setWindowTitle("Output Image")
write_in_image.main(img_path, co_ords, texts)
label = QtGui.QLabel(self.w)
pixmap = QtGui.QPixmap("/home/vernwalrahul/my_project/Open Soft/images/final.jpg")
label.setPixmap(pixmap)
label.show()
self.w.resize(pixmap.width(),pixmap.height())
self.w.show()
app=QtGui.QApplication(sys.argv)
w=MainWindow()
def main():
w.show()
app.exec_()
sys.exit(0)
if __name__=='__main__':
main()