forked from paoletto/PythonPhotoSphere
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPhotoSphere.py
More file actions
executable file
·70 lines (49 loc) · 1.68 KB
/
PhotoSphere.py
File metadata and controls
executable file
·70 lines (49 loc) · 1.68 KB
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
import os
import sys
from renderer import Window
fileUrl = ""
def main():
Window(640, 480).open(fileUrl)
def qtmain():
from PyQt4 import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.setWindowFlags(QtCore.Qt.Dialog)
self.initUI()
def initUI(self):
self.btn = QtGui.QPushButton('OK', self)
self.btn.move(20, 20)
self.btn.clicked.connect(self.showDialog)
self.le = QtGui.QLineEdit(self)
self.le.move(130, 22)
self.fdBtn = QtGui.QPushButton('Choose', self)
self.fdBtn.move(280, 20)
self.fdBtn.clicked.connect(self.chooseFile)
self.setGeometry(100, 100, 390, 60)
self.setWindowTitle('Input dialog')
self.show()
def chooseFile(self):
sFileName = QtGui.QFileDialog.getOpenFileName(self, "Open File", "","Files (*.*)" )
if not sFileName: return
self.le.setText("file:///"+sFileName)
self.showDialog()
def showDialog(self):
global fileUrl
text = (str(self.le.text()))
fileUrl = text
QtCore.QCoreApplication.instance().quit()
app = QtGui.QApplication(sys.argv)
ex = Example()
ret = app.exec_()
return ret
if __name__ == '__main__':
if len(sys.argv) > 1 and os.path.isfile(sys.argv[1]):
fileUrl = "file://{0}".format(os.path.abspath(sys.argv[1]))
main()
ret = 0
else:
ret = qtmain()
# Your code that must run when the application closes goes here
main()
sys.exit(ret)