I have a problem with opening a small dialog window when I press a button from my MainWindow. I know how to make a window that I need to open (let's call it EDIT WINDOW), but calling (opening) it from Main form, and another module is a different story.
Main window is showing, and working. All the imports are fine, with sqlite connection working. Basically, program is finished, only this dialog remains... It should have QMainWindow as it parent.
#!/usr/bin/python
#encoding=utf8
import sys
from PyQt4 import QtCore, QtGui
from gui import Ui_glavni
from dialog import Ui_Dialog
import snimanje #imported modules
import clear
import pretraga
import izmena #this should represent module with custom made dialog.
class Prozor(snimanje.Snimi, clear.Brisanje, pretraga.Pretraga,QtGui.QMainWindow):
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.ui=Ui_glavni()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.dugmeSnimi, QtCore.SIGNAL("clicked()"), self.snimi)
QtCore.QObject.connect(self.ui.dugmeOtkazi, QtCore.SIGNAL("clicked()"), self.brisanjeUnos)
QtCore.QObject.connect(self.ui.dugmeOtkazi2, QtCore.SIGNAL("clicked()"), self.brisanjeListanje)
QtCore.QObject.connect(self.ui.dugmeTrazi, QtCore.SIGNAL("clicked()"), self.pretraga)
QtCore.QObject.connect(self.ui.checkJedinica, QtCore.SIGNAL("stateChanged(int)"), self.aktivJedinica)
QtCore.QObject.connect(self.ui.checkVrednost, QtCore.SIGNAL("stateChanged(int)"), self.aktivVrednost)
QtCore.QObject.connect(self.ui.menjaIme, QtCore.SIGNAL("clicked()"), izmena.dijalog)
QtCore.QObject.connect(self.ui.dugmeBrisi, QtCore.SIGNAL("clicked()"), self.brisanjeIzBaze)
#SREDI IZMENU. SREDI PROVERU UNETIH U BAZU PO BROJU PREDMETA
def startup():
self.brisanjeUnos()
self.brisanjeListanje()
self.provera()
startup()
def aktivJedinica(self):
self.ui.lineJedinica.setEnabled(False)
self.ui.lineJedinica.setText("")
self.ui.checkJedinica.checkStateSet()
if self.ui.checkJedinica.isChecked():
self.ui.lineJedinica.setEnabled(True)
#self.ui.checkJedinica.setEnabled(False)
def aktivVrednost(self):
self.ui.vrednost.setEnabled(False)
self.ui.vrednost.setText("")
if self.ui.checkVrednost.isChecked():
self.ui.vrednost.setEnabled(True)
def pretraga(self):
if self.ui.radioIme.isChecked():
self.pretragaIme()
elif self.ui.radioBrPr.isChecked():
self.pretragaBrPr()
else:
self.pretragaSudski()
if __name__=="__main__":
program = QtGui.QApplication(sys.argv)
mojprogram = Prozor()
mojprogram.show()
sys.exit(program.exec_())