Beispiel #1
0
    def LoadProject(self, filepath, skipHistory=False):
        for idx in range(1, self.notebook.GetPageCount()):
            page = self.notebook.GetPage(idx)
            if page.GetProject().GetFilename() == filepath:
                self.notebook.SetSelection(idx)
                return

        prjFile = WxProjectFile(self, filename=filepath)
        result = prjFile.Load()
        if not result:
            dlg = wx.MessageDialog(self,
                                   _(u"Invalid %(app)s-Project: %(file)s") % {"app": Constants.APP_NAME,
                                                                              "file": filepath},
                                   _(u"Error"),
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return

        photoFilmStrip = prjFile.GetProject()
        pics = photoFilmStrip.GetPictures()

        pnl = self.NewProject(photoFilmStrip)
        pnl.InsertPictures(pics)
        pnl.SetChanged(False)

        if not skipHistory:
            self.AddFileToHistory(filepath)

#             self.pnlWelcome.RefreshPage() # crashes on unix
            wx.CallAfter(self.pnlWelcome.RefreshPage)
Beispiel #2
0
    def OnProjectImport(self, event):
        dlg = wx.FileDialog(
            self, _("Import Slideshow"),
            Settings().GetProjectPath(), "",
            "%s %s" % (_("Portable slideshow"), "(*.ppfs)|*.ppfs"), wx.FD_OPEN)
        if dlg.ShowModal() == wx.ID_OK:
            filepath = dlg.GetPath()

            prjFile = WxProjectFile(self, filename=filepath)
            prjFile.Load()
Beispiel #3
0
    def OnProjectExport(self, event):
        prj = self.__project
        curFilePath = prj.GetFilename()
        dlg = wx.FileDialog(
            self, _("Export slideshow"),
            Settings().GetProjectPath(), curFilePath,
            "%s %s" % (_("Portable slideshow"), "(*.ppfs)|*.ppfs"), wx.FD_SAVE)
        if dlg.ShowModal() == wx.ID_OK:
            filepath = dlg.GetPath()
            if os.path.splitext(filepath)[1].lower() != ".ppfs":
                filepath += ".ppfs"

            prjFile = WxProjectFile(self, self.__project, filepath)
            prjFile.Save(True)
Beispiel #4
0
    def LoadProject(self, filepath, skipHistory=False):
        for idx in range(1, self.notebook.GetPageCount()):
            page = self.notebook.GetPage(idx)
            if page.GetProject().GetFilename() == filepath:
                self.notebook.SetSelection(idx)
                return

        if os.path.splitext(filepath)[1].lower() == ".pfstory":
            prjFile = StoryFile(filename=filepath)
        else:
            prjFile = WxProjectFile(self, filename=filepath)
        result = prjFile.Load()
        if not result:
            dlg = wx.MessageDialog(
                self,
                _("Invalid %(app)s-Project: %(file)s") % {
                    "app": Constants.APP_NAME,
                    "file": filepath
                }, _("Error"), wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return

        if isinstance(prjFile, StoryFile):
            pnl = self._NewStory(prjFile.GetStory())
            pnl.Init()
            pnl.SetChanged(False)
            return

        project = prjFile.GetProject()
        pics = project.GetPictures()

        if project.GetTimelapse():
            pnl = self._NewTimelapse(project)
        else:
            pnl = self._NewSlideshow(project)

        pnl.InsertPictures(pics)
        pnl.SetChanged(False)

        if not skipHistory:
            self.AddFileToHistory(filepath)

            #             self.pnlWelcome.RefreshPage() # crashes on unix
            wx.CallAfter(self.pnlWelcome.RefreshPage)
Beispiel #5
0
 def _Save(self, filepath):
     prjFile = WxProjectFile(self, self.__project, filepath)
     prjFile.Save(False)
     return True