parameters: (self, ensure=True)
return_statement: return True
docstring: Close the current page.
          If the notebook becomes empty, and ensure is true,
          call new page upon exit to ensure that at least one page exists.
  
          Args:
              ensure: boolean
docstring_summary: Close the current page.
          If the notebook becomes empty, and ensure is true,
          call new page upon exit to ensure that at least one page exists.
docstring_tokens: Close the current page . If the notebook becomes empty and ensure is true call new page upon exit to ensure that at least one page exists .
function: def close_page(self, ensure=True):
          """
          Close the current page.
          If the notebook becomes empty, and ensure is true,
          call new page upon exit to ensure that at least one page exists.
  
          Args:
              ensure: boolean
          """
          if not self.page_to_be_closed:
              self.page_to_be_closed = self.current_page
          # show the page if it has an executing flow graph or is unsaved
          if self.page_to_be_closed.process or not self.page_to_be_closed.saved:
              self._set_page(self.page_to_be_closed)
          # unsaved? ask the user
          if not self.page_to_be_closed.saved:
              response = self._save_changes()  # return value is either OK, CLOSE, or CANCEL
              if response == Gtk.ResponseType.OK:
                  Actions.FLOW_GRAPH_SAVE()  # try to save
                  if not self.page_to_be_closed.saved:  # still unsaved?
                      self.page_to_be_closed = None  # set the page to be closed back to None
                      return False
              elif response == Gtk.ResponseType.CANCEL:
                  self.page_to_be_closed = None
                  return False
          # stop the flow graph if executing
          if self.page_to_be_closed.process:
              Actions.FLOW_GRAPH_KILL()
          # remove the page
          self.notebook.remove_page(
              self.notebook.page_num(self.page_to_be_closed))
          if ensure and self.notebook.get_n_pages() == 0:
              self.new_page()  # no pages, make a new one
          self.page_to_be_closed = None  # set the page to be closed back to None
          return True
function_tokens: def close_page ( self , ensure = True ) : if not self . page_to_be_closed : self . page_to_be_closed = self . current_page # show the page if it has an executing flow graph or is unsaved if self . page_to_be_closed . process or not self . page_to_be_closed . saved : self . _set_page ( self . page_to_be_closed ) # unsaved? ask the user if not self . page_to_be_closed . saved : response = self . _save_changes ( ) # return value is either OK, CLOSE, or CANCEL if response == Gtk . ResponseType . OK : Actions . FLOW_GRAPH_SAVE ( ) # try to save if not self . page_to_be_closed . saved : # still unsaved? self . page_to_be_closed = None # set the page to be closed back to None return False elif response == Gtk . ResponseType . CANCEL : self . page_to_be_closed = None return False # stop the flow graph if executing if self . page_to_be_closed . process : Actions . FLOW_GRAPH_KILL ( ) # remove the page self . notebook . remove_page ( self . notebook . page_num ( self . page_to_be_closed ) ) if ensure and self . notebook . get_n_pages ( ) == 0 : self . new_page ( ) # no pages, make a new one self . page_to_be_closed = None # set the page to be closed back to None return True