Ejemplo n.º 1
0
 def load_tutorial_file(self, window, editor):
   if editor.is_modified():
     confirmation = ConfirmSaveLoad()
     state = confirmation.get_state()
     if state is 'save':
       # Save button was clicked
       self.save(window, editor)
     elif state is 'discard':
       # Don't Save button was clicked
       pass  # Do nothing
     else:
       # Cancel button or nothing was clicked
       pass  # Do nothing
   editor.editor.setPlainText(TutorialCode.CODE)
Ejemplo n.º 2
0
  def load(self, window, editor):
    if editor.is_modified():
      confirmation = ConfirmSaveLoad()
      state = confirmation.get_state()
      if state is 'save':
        # Save button was clicked
        self.save(window, editor)
        self.load(window, editor)
      elif state is 'discard':
        # Don't Save button was clicked
        editor.set_modified(False)
      else:
        # Cancel button or nothing was clicked
        return  # Do nothing

    load_fname = self.get_fname(window, 'load')
    if load_fname is not "":
      self.fname = load_fname
      editor.set_modified(False)
      FileManager.read_from_file(self.fname, editor)