prepare for working
[Laueye.git] / src / gui.py
blob004affcc0827b7a681968f1c54f99df03e829059
1 #coding: utf-8
2 #file name : gui.py
3 #Laueye - A program to analyze Laue diffraction diagrams.
4 #Copyright (C) <2008> <Grissiom>
6 #This program is free software: you can redistribute it and/or modify
7 #it under the terms of the GNU General Public License as published by
8 #the Free Software Foundation, either version 3 of the License, or
9 #(at your option) any later version.
11 #This program is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #GNU General Public License for more details.
16 #You should have received a copy of the GNU General Public License
17 #along with this program. If not, see <http://www.gnu.org/licenses/>.
19 from PyQt4.QtGui import *
20 from PyQt4.QtCore import *
21 import sys
23 class SimpleExampleWidget(QWidget):
24 def __init__(self, im_ori, parant = None):
25 QWidget.__init__(self, parant)
26 self.im_ori = im_ori
27 self.update()
29 def paintEvent(self, event):
30 painter = QPainter(self)
31 painter.drawImage(QPointF(0, 0), self.im_ori)
33 app = QApplication(sys.argv)
34 window = QWidget()
35 window.setWindowTitle(u"试验")
37 #value = store_value()
39 #close_button = QPushButton("Quit")
40 #QObject.connect(close_button, SIGNAL("clicked()"), app, SLOT("quit()"))
42 #spin_box = QSpinBox()
43 #slider = QSlider(Qt.Horizontal)
44 #spin_box.setRange(0, 130)
45 #slider.setRange(0, 130)
46 ##QObject.connect(spin_box, SIGNAL("valueChanged(int)"),slider, SLOT("setValue(int)"))
47 ##QObject.connect(slider, SIGNAL("valueChanged(int)"),spin_box, SLOT("setValue(int)"))
49 #QObject.connect(spin_box, SIGNAL("valueChanged(int)"),value.set(int))
50 #QObject.connect(slider, SIGNAL("valueChanged(int)"),spin_box, SLOT("setValue(int)"))
52 #slider.setValue(35)
54 #layout = QHBoxLayout()
55 #layout.addWidget(slider)
56 #layout.addWidget(spin_box)
57 #layout.addWidget(close_button)
58 #window.setLayout(layout)
60 #window.show()
61 #im_ori = QImage()
62 #im_ori.load('/usr/local/src/project_Laueye/svn/trunk/test.png')
63 #painter = QPainter()
64 #painter.drawImage(0, 0, im_ori, 15, 15)
66 layout = QHBoxLayout()
67 layout.setSpacing(0)
69 im_ori = QImage()
70 im_ori.load('../test/test.png')
71 window.setGeometry(0, 0, im_ori.width(), im_ori.height())
72 pain = SimpleExampleWidget(im_ori)
73 layout.addWidget(pain)
74 window.setLayout(layout)
75 window.show()
77 sys.exit(app.exec_())