code: def directory_button_status(self):
          
          if self.layer.currentLayer():
              self.directory_button.setEnabled(True)
          else:
              self.directory_button.setEnabled(False)
docs: Function to enable or disable directory button.