python - PySide Dialog return values on accept -
I am creating a dialog that returns a dictionary to a function, though the need to validate the input before being processed is.
I am using the following code to run the dialog and return the dictionary:
if transadd.exec_ (): known = trans.widig.get_views () A dialog that communicates with a dialog and a widget with a transition.
. Unknown: self Unknown [key] = self.unknown_trans [key] [1]. Current text () returns self I have an authentication method that is activated when the user clicks on 'OK':
def is valid (auto, Dialog): count = 1 incorrect = wrong for the key in itself. Unknown: if self Unknown_tr key [1]. Current text () == "Please select ..." and \ self.gridLayout.itemAtPosition (counting, 3)! = 0: self.gridLayout.addWidget (QtGui.QLabel ("missing answer", dialog), count, 3, 1, 1) incorrect = true self.sizePolicy = Q TGui.QSizePolicy (QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy .Expanding) Count = = 1 If not Errored: Dialog.accept () Currently all the above mentioned tasks are exactly how I want it to serve me. The problem occurs when the user clicks on the canceled dialog (disapproved ()). This case is not recognized because we are canceling it which is fine. But due to the first part of the code, get_values is still running - that will turn the remaining function and create an incorrect output.
So my question is: How do I return a dialog box only when accepting acceptable clicks as opposed to rejecting the user?
In general, if you do not go into a standard way (a top-level modal widget) , You can still use whether the result was accepted or rejected:
transadd.widg.result ()
Comments
Post a Comment