Esempio n. 1
0
 def export_singlepage(self, pkg, outputf, print_flag=0):
     images_dir = self.web_dir.joinpath('images')
     scripts_dir = self.web_dir.joinpath('scripts')
     templates_dir = self.web_dir.joinpath('templates')
     singlePageExport = SinglePageExport(self.styles_dir, outputf, \
                          images_dir, scripts_dir, templates_dir)
     singlePageExport.export(pkg, print_flag)
Esempio n. 2
0
 def exportSinglePage(self, client, filename, webDir, stylesDir, printFlag):
     """
     Export 'client' to a single web page,
     'webDir' is just read from config.webDir
     'stylesDir' is where to copy the style sheet information from
     'printFlag' indicates whether or not this is for print (and whatever else that might mean)
     """
     try:
         imagesDir    = webDir.joinpath('images')
         scriptsDir   = webDir.joinpath('scripts')
         templatesDir = webDir.joinpath('templates')
         filename = Path(filename)
         if filename.basename() != self.package.name:
             filename /= self.package.name
         if not filename.exists():
             filename.makedirs()
         elif not filename.isdir():
             client.alert(_(u'Filename %s is a file, cannot replace it') % 
                          filename)
             log.error("Couldn't export web page: "+
                       "Filename %s is a file, cannot replace it" % filename)
             return
         else:
             client.alert(_(u'Folder name %s already exists. '
                             'Please choose another one or delete existing one then try again.') % filename)           
             return 
         singlePageExport = SinglePageExport(stylesDir, filename, imagesDir, scriptsDir, templatesDir)
         singlePageExport.export(self.package, printFlag)
     except Exception, e:
         client.alert(_('SAVE FAILED!\n%s' % str(e)))
         raise
Esempio n. 3
0
 def exportSinglePage(self, client, filename, webDir, stylesDir):
     """
     Export 'client' to a single web page,
     'webDir' is just read from config.webDir
     'stylesDir' is where to copy the style sheet information from
     """
     imagesDir    = webDir.joinpath('images')
     scriptsDir   = webDir.joinpath('scripts')
     templatesDir = webDir.joinpath('templates')
     filename = Path(filename)
     if filename.basename() != self.package.name:
         filename /= self.package.name
     if not filename.exists():
         filename.makedirs()
     elif not filename.isdir():
         client.alert(_(u'Filename %s is a file, cannot replace it') % 
                      filename)
         log.error("Couldn't export web page: "+
                   "Filename %s is a file, cannot replace it" % filename)
         return
     else:
         filename.rmtree()
         filename.mkdir()
     singlePageExport = SinglePageExport(stylesDir, filename, 
                                         imagesDir, scriptsDir, templatesDir)
     singlePageExport.export(self.package)
     self._startFile(filename)
Esempio n. 4
0
 def export_singlepage(self, pkg, outputf, print_flag=0):
     images_dir = self.web_dir.joinpath('images')
     scripts_dir = self.web_dir.joinpath('scripts')
     css_dir = self.web_dir.joinpath('css')
     templates_dir = self.web_dir.joinpath('templates')
     singlePageExport = SinglePageExport(self.styles_dir, outputf, \
                          images_dir, scripts_dir, css_dir, templates_dir)
     singlePageExport.export(pkg, print_flag)
 def exportSinglePage(self, client, filename, webDir, stylesDir, \
                      printFlag):
     """
     Export 'client' to a single web page,
     'webDir' is just read from config.webDir
     'stylesDir' is where to copy the style sheet information from
     'printFlag' indicates whether or not this is for print 
                 (and whatever else that might mean)
     """
     try:
         imagesDir = webDir.joinpath('images')
         scriptsDir = webDir.joinpath('scripts')
         templatesDir = webDir.joinpath('templates')
         # filename is a directory where we will export the website to
         # We assume that the user knows what they are doing
         # and don't check if the directory is already full or not
         # and we just overwrite what's already there
         filename = Path(filename)
         # Append the package name to the folder path if necessary
         if filename.basename() != self.package.name:
             filename /= self.package.name
         if not filename.exists():
             filename.makedirs()
         elif not filename.isdir():
             client.alert(
                 _(u'Filename %s is a file, cannot replace it') % filename)
             log.error("Couldn't export web page: " +
                       "Filename %s is a file, cannot replace it" %
                       filename)
             return
         else:
             client.alert(
                 _(u'Folder name %s already exists. '
                   'Please choose another one or delete existing one then try again.'
                   ) % filename)
             return
         # Now do the export
         singlePageExport = SinglePageExport(stylesDir, filename, \
                                      imagesDir, scriptsDir, templatesDir)
         singlePageExport.export(self.package, printFlag)
     except Exception, e:
         client.alert(_('SAVE FAILED!\n%s' % str(e)))
         raise
Esempio n. 6
0
 def exportSinglePage(self, client, filename, webDir, stylesDir, \
                      printFlag):
     """
     Export 'client' to a single web page,
     'webDir' is just read from config.webDir
     'stylesDir' is where to copy the style sheet information from
     'printFlag' indicates whether or not this is for print 
                 (and whatever else that might mean)
     """
     try:
         imagesDir    = webDir.joinpath('images')
         scriptsDir   = webDir.joinpath('scripts')
         templatesDir = webDir.joinpath('templates')
         # filename is a directory where we will export the website to
         # We assume that the user knows what they are doing
         # and don't check if the directory is already full or not
         # and we just overwrite what's already there
         filename = Path(filename)
         # Append the package name to the folder path if necessary
         if filename.basename() != self.package.name:
             filename /= self.package.name
         if not filename.exists():
             filename.makedirs()
         elif not filename.isdir():
             client.alert(_(u'Filename %s is a file, cannot replace it') % 
                          filename)
             log.error("Couldn't export web page: "+
                       "Filename %s is a file, cannot replace it" % filename)
             return
         else:
             client.alert(_(u'Folder name %s already exists. '
                             'Please choose another one or delete existing one then try again.') % filename)           
             return 
         # Now do the export
         singlePageExport = SinglePageExport(stylesDir, filename, \
                                      imagesDir, scriptsDir, templatesDir)
         singlePageExport.export(self.package, printFlag)
     except Exception, e:
         client.alert(_('SAVE FAILED!\n%s' % str(e)))
         raise