I am attempting to execute a dialog I created. I get the error message
dlg = CCDialog
result = dlg.exec()
The dialog is imported using
from cust_code_dialog import CCDialog
Below is the code for cust_code_dialog
import os
from Windows.ui_cust_code import Ui_Dialog
# This imports (loads) the class Ui_Dialog out of the module cust_dialog.py
# which is the code saved out of QTdesigner
# for the module cust_code.ui which is a window dialog
from PySide6.QtWidgets import (
QDialog,
QDialogButtonBox,
)
basedir = os.path.dirname(__file__)
class CCDialog(Ui_Dialog, QDialog):
#sets up a class to execute in order to present dialog window imported previously
print("In CCDialogue")
def __init__(self, parent=None):
super().__init__(parent)
print("In def init")
self.setupUi(self)
self.cc_input.editingFinished.connect(self.check_disable)
self.buttonBox.accepted.connect(self.maybe_accept)
self.buttonBox.rejected.connect(self.reject)
def maybe_accept(self):
print("In maybe_accept")
if self.validate():
self.accept()
def check_disable(self):
print("In check_disable")
btn = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
is_valid = self.validate()
btn.setEnabled(is_valid)
def validate(self):
print("In validate")
customer_code = self.cc_input.text() # Updating the customer code
if len(customer_code) != 6:
self.cc_error.setText("Customer Code Must Be 6 Characters")
self.cc_error.setStyleSheet("background-color : red; color : white")
return False
self.cc_error.setStyleSheet("")
self.cc_error.setText("")
return True
def get_value(self):
print("In get_value")
return self.cc_input.text()
Thanks in advance for your help.