# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
class AddWindow(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.setWindowTitle("Добавить новый ")
self.setFixedSize(400, 550)
self.label1 = QtGui.QLabel("Дата покупки", self)
self.label1.setGeometry(10, 40, 81, 20)
self.line1 = QtGui.QLineEdit(self)
self.line1.setGeometry(100, 40, 113, 20)
self.label2 = QtGui.QLabel("Модель", self)
self.label2.setGeometry(225, 40, 61, 20)
self.comboBox1 = QtGui.QComboBox(self)
self.comboBox1.setGeometry(283, 40, 101, 22)
self.comboBox1.addItem("0 GPRS")
self.comboBox1.addItem("i220")
self.comboBox1.addItem("i20 GPRS")
self.comboBox1.addItem("50 GPRS")
self.label3 = QtGui.QLabel("Серийный номер", self)
self.label3.setGeometry(10, 80, 101, 16)
self.line2 = QtGui.QLineEdit(self)
self.line2.setGeometry(100, 80, 281, 20)
self.label4 = QtGui.QLabel("Версия ОС", self)
self.label4.setGeometry(10, 120, 61, 20)
self.comboBox2 = QtGui.QComboBox(self)
self.comboBox2.setGeometry(100, 120, 91, 22)
self.comboBox2.addItem("8.2n")
self.comboBox2.addItem("9.8")
self.label5 = QtGui.QLabel("Версия ПО", self)
self.label5.setGeometry(210, 120, 61, 16)
self.comboBox3 = QtGui.QComboBox(self)
self.comboBox3.setGeometry(280, 120, 101, 22)
self.comboBox3.addItem("ow 4.0.2.66bc")
self.comboBox3.addItem("ow 4.0.2.143bc")
self.comboBox3.addItem("ow 4.0.2.309bc")
self.label6 = QtGui.QLabel("Организация", self)
self.label6.setGeometry(10, 160, 71, 16)
self.line3 = QtGui.QLineEdit(self)
self.line3.setGeometry(100, 160, 281, 20)
self.label7 = QtGui.QLabel("Место установки", self)
self.label7.setGeometry(10, 200, 91, 16)
self.textEdit1 = QtGui.QTextEdit(self)
self.textEdit1.setGeometry(110, 200, 271, 64)
self.label8 = QtGui.QLabel("Примечание", self)
self.label8.setGeometry(10, 280, 81, 16)
self.textEdit2 = QtGui.QTextEdit(self)
self.textEdit2.setGeometry(110, 280, 271, 91)
self.label9 = QtGui.QLabel("Стоимость фактическая", self)
self.label9.setGeometry(10, 390, 131, 16)
self.line4 = QtGui.QLineEdit(self)
self.line4.setGeometry(140, 390, 101, 20)
self.label10 = QtGui.QLabel("Стоимость балансовая", self)
self.label10.setGeometry(10, 420, 121, 16)
self.line5 = QtGui.QLineEdit(self)
self.line5.setGeometry(140, 420, 101, 20)
self.label11 = QtGui.QLabel("Номер телефона SIM-карты", self)
self.label11.setGeometry(10, 450, 151, 16)
self.line6 = QtGui.QLineEdit(self)
self.line6.setGeometry(160, 450, 201, 20)
self.label12 = QtGui.QLabel("Сертификат", self)
self.label12.setGeometry(10, 480, 91, 16)
self.line7 = QtGui.QLineEdit(self)
self.line7.setGeometry(100, 480, 61, 20)
self.label13 = QtGui.QLabel("Статус ", self)
self.label13.setGeometry(170, 480, 101, 16)
self.comboBox4 = QtGui.QComboBox(self)
self.comboBox4.setGeometry(270, 480, 111, 22)
self.comboBox4.addItem("Установлен ")
self.comboBox4.addItem("Склад ")
self.Button1 = QtGui.QPushButton("Сохранить", self)
self.Button1.setGeometry(80, 520, 75, 23)
self.Button2 = QtGui.QPushButton("Отмена", self)
self.Button2.setGeometry(260, 520, 75, 23)
#Отклик на кнопки
self.connect(self.Button1, QtCore.SIGNAL("clicked()"),
self.save_info)
self.connect(self.Button2, QtCore.SIGNAL("clicked()"),
self, QtCore.SLOT("close()"))
def save_info(self):
c = AddWindow()
sql_per =dict.fromkeys(["line1", "comboBox1", "line2", "comboBox2", "comboBox3",
"line3", "textEdit1", "textEdit2", "line4", "line5",
"line6", "line7", "comboBox4"])
for i in range(49, 55):
tmp_per = getattr(c, ("line%c" % i))
print(tmp_per.text())
sql_per["line%c" % i] = tmp_per.text()