title: Python QGIS Do not open dialog box unless Map layer is currently open
body: <pre><code>    iface.messageBar().pushMessage("Error", "I'm sorry but you must open a map layer in order to fill in the Dialog Box", level=QgsMessageBar.CRITICAL)
      #Dialog Box
      qid = QInputDialog()
      canvas = iface.mapCanvas()
      #Features inside the dialog box 
      input, ok = QInputDialog.getText( qid, "Enter Coordinates", "Enter Coordinates (X,Y)", QLineEdit.Normal, "X" + "," + "Y")
      #If that works, goes through code and splits x,y 
      if ok:
          x = input.split( "," )[ 0 ]
          print x
          y = input.split( "," )[ 1 ]
          print y
          #If X and Y are right coordinates:
          if x.isnumeric() and y.isnumeric(): 
              scale=225
              rect = QgsRectangle(float(x)-scale,float(y)-scale, float(x)+scale,float(y)+scale)
              canvas.setExtent(rect)
              pt = QgsPoint(float(x),float(y))
              canvas.refresh()
              print x + "," + y
  
      else: 
          #MessageBox after cancel clicked 
          QMessageBox.information(None, "debug", "User Cancelled!") 
  </code></pre>
  
  <p>I want to add some sort of IF statement so an error message appears IF a map layer has not been open</p>