code: def ok_button_status(self):
          
          if not self.layer.currentLayer():
              self.button_box.button(
                  QtWidgets.QDialogButtonBox.Ok).setEnabled(False)
          elif (self.hazard_class_form.count() > 0
                and self.layer.currentLayer().name()
                and len(self.output_form.text()) >= 0):
              self.button_box.button(
                  QtWidgets.QDialogButtonBox.Ok).setEnabled(True)
          else:
              self.button_box.button(
                  QtWidgets.QDialogButtonBox.Ok).setEnabled(False)
docs: Function to enable or disable OK button.