When I call self.ui.action1.triggered.connect(self.Insert) the program doesn't react anything.
(1 is PyQt ui object)
Here's the code:
from PyQt5.QtWidgets import QWidget, QApplication, QMainWindow, QMessageBox
from PyQt5.uic import loadUi
import mainwindow
import sys
import subprocess as sub
import LayoutUI
import SetDirUi
import aboutdia
**import edui #edui.py**
import Selectoruiu
class MyApp(QMainWindow):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.ui = mainwindow.Ui_MainWindow()
self.ui.setupUi(self)
super(MyApp, self).__init__()
loadUi(r"D:\folder visead\RAIN FORREST\Data Base\Citizen record\Citizen_database.ui", self)
self.ui.actionDocumentation_2.triggered.connect(self.docOpen)
self.ui.actionLayout.triggered.connect(self.CallLayout)
self.ui.actionDatabase_directory.triggered.connect(self.CallNdirSetting)
self.ui.actionAbout.triggered.connect(self.CallAbout)
self.ui.actionEdit.triggered.connect(self.Edit)
** self.ui.action1.triggered.connect(self.Insert) #Problem here**
def docOpen(self):
try:
sub.call("cscript Normal.vbs")
except Exception as e:
print(f"Error opening documentation: {e}")
def CallLayout(self):
self.LayUi = LayoutUI.MyApp()
self.LayUi.show()
def CallNdirSetting(self):
self.DirUi = SetDirUi.MyApp()
self.DirUi.show()
def CallAbout(self):
self.AboutUi = aboutdia.MyApp()
self.AboutUi.show()
def Edit(self):
try:
self.SelectUi = Selectoruiu.MyApp()
self.SelectUi.show()
with open("GateawayOntime.txt", "wt") as f:
writer = "edit"
f.write(writer)
print(writer)
except Exception as e:
print(f"Error in Edit: {e}")
** def Insert(self): #Function that was calling
try:
self.uie = edui.MyApp()
self.uie.show()
with open("GateawayOntime.txt", "wt") as f:
writer = "insert"
f.write(writer)
print(writer)
except Exception as e:
print(f"Error in Insert: {e}")
**
if __name__ == '__main__':
app = QApplication(sys.argv)
mapp = MyApp()
mapp.show()
sys.exit(app.exec_())
It should pop the Editor ui (import edui) as the content of the Insert() function defined.