#-*- coding: cp1254 -*-
import sys
# import PyQt4 QtCore and QtGui modules
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtSql import *
"""frmFirma inherits QDialog"""
def __init__(self, parent=None):
self.setWindowTitle("Firma Tanımları")
self.setGeometry(200, 200, 600, 510)
self.setAttribute(Qt.WA_DeleteOnClose);
self.firmaFormOlustur()
self.veritabaniBaglan()
self.firmaListele()
def firmaFormOlustur(self):
self.FontAyar.setFamily("MS Shell Dlg 2")
self.FontAyar.setPointSize(12)
self.
pnlFirmalar= QGroupBox(" Firmalar ", self
) self.pnlFirmalar.setGeometry(5, 5, 400, 500)
self.pnlFirmalar.setFont(self.FontAyar)
#self.grFirma.setFont(self.FontAyar)
self.lyTable.addWidget(self.grFirma)
self.
pnlButonlar = QGroupBox(" Ä°ÅŸlemler ", self
) self.pnlButonlar.setGeometry(410, 5, 185, 500)
self.pnlButonlar.setFont(self.FontAyar)
self.
btYeni.
setIconSize(QSize(48 ,
48))
self.
btDuzelt.
setIconSize(QSize(48 ,
48))
self.
btSil.
setIconSize(QSize(48 ,
48))
self.
btSatis.
setIconSize(QSize(48 ,
48))
self.
btKapat.
setIconSize(QSize(48 ,
48))
self.lyButonlar.addWidget(self.btYeni)
self.lyButonlar.addWidget(self.btDuzelt)
self.lyButonlar.addWidget(self.btSil)
self.lyButonlar.addWidget(self.btSatis)
self.lyButonlar.addWidget(self.btKapat)
self.btKapat.clicked.connect(self.close)
def veritabaniBaglan(self):
#connection.createConnection()
self.db.setDatabaseName("ButceTakip.db3")
self.db.open()
def firmaListele(self):
self.qFirma.exec('SELECT * FROM FIRMALAR')
if not self.firmaModel.setQuery(self.qFirma):
print("sorgu hatalı")
self.firmaModel.setHeaderData(0, Qt.Horizontal, "ID")
self.firmaModel.setHeaderData(1, Qt.Horizontal, "First Name")
self.firmaModel.setHeaderData(2, Qt.Horizontal, "Last Name")
self.grFirma.setModel(self.firmaModel)
#-*- coding: cp1254 -*-
import sys
# import PyQt4 QtCore and QtGui modules
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtSql import *
class frmFirma(QDialog):
"""frmFirma inherits QDialog"""
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle("Firma Tanımları")
self.setGeometry(200, 200, 600, 510)
self.setAttribute(Qt.WA_DeleteOnClose);
self.firmaFormOlustur()
self.veritabaniBaglan()
self.firmaListele()
def firmaFormOlustur(self):
self.FontAyar = QFont()
self.FontAyar.setFamily("MS Shell Dlg 2")
self.FontAyar.setPointSize(12)
self.pnlFirmalar= QGroupBox(" Firmalar ", self)
self.pnlFirmalar.setGeometry(5, 5, 400, 500)
self.pnlFirmalar.setFont(self.FontAyar)
self.lyTable = QVBoxLayout(self.pnlFirmalar)
self.grFirma = QTableView()
#self.grFirma.setFont(self.FontAyar)
self.lyTable.addWidget(self.grFirma)
self.pnlButonlar = QGroupBox(" Ä°ÅŸlemler ", self)
self.pnlButonlar.setGeometry(410, 5, 185, 500)
self.pnlButonlar.setFont(self.FontAyar)
self.btYeni = QPushButton(QIcon("icons/yeni.png"), "Yeni Firma")
self.btYeni.setIconSize(QSize(48 ,48))
self.btYeni.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
self.btDuzelt = QPushButton(QIcon("icons/duzenle.png"), "Düzelt")
self.btDuzelt.setIconSize(QSize(48 ,48))
self.btDuzelt.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
self.btSil = QPushButton(QIcon("icons/sil.png"), "Firma Sil")
self.btSil.setIconSize(QSize(48 ,48))
self.btSil.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
self.btSatis = QPushButton(QIcon("icons/satis.png"), "Satış Yap")
self.btSatis.setIconSize(QSize(48 ,48))
self.btSatis.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
self.btKapat = QPushButton(QIcon("icons/cikis.png"), "Çıkış")
self.btKapat.setIconSize(QSize(48 ,48))
self.btKapat.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
self.lyButonlar = QVBoxLayout(self.pnlButonlar)
self.lyButonlar.addWidget(self.btYeni)
self.lyButonlar.addWidget(self.btDuzelt)
self.lyButonlar.addWidget(self.btSil)
self.lyButonlar.addWidget(self.btSatis)
self.lyButonlar.addWidget(self.btKapat)
self.btKapat.clicked.connect(self.close)
def veritabaniBaglan(self):
#connection.createConnection()
self.db = QSqlDatabase.addDatabase("QSQLITE")
self.db.setDatabaseName("ButceTakip.db3")
self.db.open()
def firmaListele(self):
self.qFirma = QSqlQuery(self.db)
self.qFirma.exec('SELECT * FROM FIRMALAR')
self.firmaModel = QSqlQueryModel(self)
if not self.firmaModel.setQuery(self.qFirma):
print("sorgu hatalı")
self.firmaModel.setHeaderData(0, Qt.Horizontal, "ID")
self.firmaModel.setHeaderData(1, Qt.Horizontal, "First Name")
self.firmaModel.setHeaderData(2, Qt.Horizontal, "Last Name")
self.grFirma.setModel(self.firmaModel)
To copy to clipboard, switch view to plain text mode
Bookmarks