Esempio n. 1
0
    def open(self, path):
        """Opens a specific story file."""
        openedFile = None
        try:
            with open(path, 'rb') as openedFile:
                openedFile.seek(0)
                st = pickle.load(openedFile)
                newStory = StoryFrame(None, app=self, state=st)
                newStory.saveDestination = path
                self.stories.append(newStory)
                newStory.Show(True)
                # self.addRecentFile(path)
                self.config.Write('LastFile', path)

            # weird special case:
            # if we only had one story opened before
            # and it's pristine (e.g. no changes ever made to it),
            # then we close it after opening the file successfully

            if (len(self.stories) == 2) and (self.stories[0].pristine):
                self.stories[0].Destroy()

        except:
            # self.displayError('opening your story')
            # weird error...
            pass
Esempio n. 2
0
 def newHiddenWindow(self, display=False):
     frame = StoryFrame(parent=None, app=self)
     self.hiddenwindows.append(frame)
     frame.SetPosition((-1000, -1000))
     frame.SetSize(1, 1)
     frame.Bind(wx.EVT_CLOSE, lambda e: None)  # empty event handlers
     frame.Bind(wx.EVT_MENU, lambda e: None, id=wx.ID_CLOSE)
     frame.Bind(wx.EVT_MENU,
                frame.app.newStory,
                id=StoryFrame.STORY_NEW_PASSAGE)  # override ctrl-N behavior
     # frame.Bind(wx.EVT_MENU, lambda e: frame.app.exit(), id=wx.ID_EXIT)
     frame.Show(display)  # but off screen and small
Esempio n. 3
0
 def newStory(self, event = None):
     """Opens a new, blank story."""
     s = StoryFrame(parent = None, app = self)
     self.stories.append(s)
     s.Show(True)