Example #1
0
 def launch(self):
     """
     launches the webbrowser
     """
     package = None
     if self.packagePath:
         package = self._loadPackage(self.packagePath)
     if not package:
         launchBrowser(self.config, "")
Example #2
0
    def launch(self):
        """
        launches the webbrowser
        """

        package = None
        if self.packagePath:
            package = self._loadPackage(self.packagePath)
        else:
            launchBrowser(self.config, "", "")
Example #3
0
    def launch(self):
        """
        launches the webbrowser
        """

        if self.packagePath:
            package = self.packageStore.loadPackage(self.packagePath)
            self.webServer.root.bindNewPackage(package)
            launchBrowser(self.config, package.name, "")
        else:
            launchBrowser(self.config, "", "")
Example #4
0
 def launch(self):
     """
     launches the webbrowser
     """
     if self.packagePath:
         package = self.packageStore.loadPackage(self.packagePath)
         log.debug("loading package "+package.name)
         self.webServer.root.bindNewPackage(package)
         launchBrowser(self.config, package.name)
     else:
         launchBrowser(self.config, "")
Example #5
0
 def _loadPackage(self, packagePath):
     """
     Convenience function for loading the first package that we'll browse to
     """
     try:
         package = self.packageStore.loadPackage(packagePath)
         log.debug("loading package "+package.name)
         self.webServer.root.bindNewPackage(package)
         launchBrowser(self.config, package.name)
         return package
     except Exception, e:
         log.error('Error loading first Package (%s): %s' % (packagePath, e))
         return None
Example #6
0
 def _loadPackage(self, packagePath):
     try:
         log.info("webDir: " + self.config.webDir)
         log.info("tempWebDir: " + self.tempWebDir)
         inSplashFile =  self.config.webDir + "/docs/splash.xulTemplate"
         outSplashFile = self.config.webDir + "/docs/splash.xul"
         outSplashData = self.config.webDir + "/docs/splash.dat"
         outSplashFile = self.tempWebDir + "/splash.xul"
         outSplashData = self.tempWebDir + "/splash.dat"
         log.info("inSplashFile: " + inSplashFile)
         log.info("outSplashFile: " + outSplashFile)
         log.info("outSplashData: " + outSplashData)
         outSplashFH = open(outSplashData, "w")
         outSplashFH.write("")
         outSplashFH.close()
         inSplashFH = open(inSplashFile, "r")
         outSplashFH = open(outSplashFile, "w")
         pleaseWaitLoad = _(u'Please wait until loading finishes')
         for line in inSplashFH:
             line = line.replace("LOADING_FILE_NAME", packagePath)
             line = line.replace("PLEASE_WAIT_LOAD", pleaseWaitLoad)
             outSplashFH.write(line)
         inSplashFH.close()
         outSplashFH.close()
         log.info("packagePath: " + packagePath)
         launchBrowser(self.config, outSplashFile, "splash")
         shutil.copyfile(self.config.webDir + '/images/exe_logo.png', 
                                   self.tempWebDir + '/exe_logo.png')
         package = self.packageStore.loadPackage(packagePath)
         port = self.config.port
         editorUrl = u'http://127.0.0.1:%d/%s' % (port, package.name)
         log.info("package.name: "+package.name)
         log.info("editorUrl: " + editorUrl)
         log.info("TempDirPath: " + editorUrl)
         outSplashFH = open(outSplashData, "w")
         outSplashFH.write("1000;" + editorUrl)
         outSplashFH.close()
         self.webServer.root.bindNewPackage(package)
         return package
     except Exception, e:
         log.error('Error loading first Package (%s): %s' % (packagePath, e))
         message = _(u'Sorry, wrong file format')
         outSplashFH=open(globals.application.tempWebDir + \
                            '/splash.dat',"w")
         message = re.sub(";",":",message)
         port = self.config.port
         outSplashFH.write("1000;http://127.0.0.1:" + `port` + "/;" + \
                            message)
         outSplashFH.close()
         return None
Example #7
0
 def launch(self):
     """
     launches the webbrowser
     """
     package = None
     if self.packagePath:
         package = self._loadPackage(self.packagePath)
     else:
         unsavedWork = self.config.configDir/'unsavedWork.elp'
         if unsavedWork.isfile():
             package = self._loadPackage(unsavedWork)
             if package:
                 package.isChanged = True # So it will be saved if user goes immediately file,quit
     if not package:
         launchBrowser(self.config, "")
Example #8
0
 def xulMessage(self, msg):
     """
     launches the web browser and displays a message 
     without the need of a running/responding webserver
     """
     inXulMsgFile = self.config.webDir + "/docs/xulMsg.xulTemplate"
     outXulMsgFile = self.tempWebDir + "/xulMsg.xul"
     log.info("outXulMsgFile: " + outXulMsgFile)
     log.info("xulMessage: " + msg)
     inXulMsgFH = open(inXulMsgFile, "r")
     outXulMsgFH = open(outXulMsgFile, "w")
     for line in inXulMsgFH:
         line = re.sub("XUL_MESSAGE", msg, line)
         outXulMsgFH.write(line)
     inXulMsgFH.close()
     outXulMsgFH.close()
     launchBrowser(self.config, outXulMsgFile, "xulMsg")
     shutil.copyfile(self.config.webDir + "/images/exe_logo.png", self.tempWebDir + "/exe_logo.png")
     time.sleep(3)
Example #9
0
    def xulMessage(self, msg):
        """
        launches the web browser and displays a message 
        without the need of a running/responding webserver
        """
        inXulMsgFile =  self.config.webDir + "/docs/xulMsg.xulTemplate"
        outXulMsgFile = self.tempWebDir + "/xulMsg.xul"
        log.info("outXulMsgFile: " + outXulMsgFile)
        log.info("xulMessage: " + msg)

        inXulMsgFH = open(inXulMsgFile, "r")
        outXulMsgFH = open(outXulMsgFile, "w")
        for line in inXulMsgFH:
            line = re.sub("XUL_MESSAGE", msg, line)
            outXulMsgFH.write(line)
        inXulMsgFH.close()
        outXulMsgFH.close()
        launchBrowser(self.config, outXulMsgFile, "xulMsg")
        shutil.copyfile(self.config.webDir + '/images/exe_logo.png', self.tempWebDir + '/exe_logo.png')
        #allow sufficient time for the file to be read before exiting 
        #which automatically deletes the tempWebDir and all files
        time.sleep(3)
Example #10
0
    def xulMessage(self, msg):
        """
        launches the web browser and displays a message 
        without the need of a running/responding webserver
        """
        inXulMsgFile =  self.config.webDir + "/docs/xulMsg.xulTemplate"
        outXulMsgFile = self.tempWebDir + "/xulMsg.xul"
        log.info("outXulMsgFile: " + outXulMsgFile)
        log.info("xulMessage: " + msg)

        inXulMsgFH = open(inXulMsgFile, "r")
        outXulMsgFH = open(outXulMsgFile, "w")
        for line in inXulMsgFH:
            line = re.sub("XUL_MESSAGE", msg, line)
            outXulMsgFH.write(line)
        inXulMsgFH.close()
        outXulMsgFH.close()
        launchBrowser(self.config, outXulMsgFile, "xulMsg")
        shutil.copyfile(self.config.webDir + '/images/exe_logo.png', self.tempWebDir + '/exe_logo.png')
        #allow sufficient time for the file to be read before exiting 
        #which automatically deletes the tempWebDir and all files
        time.sleep(3)
Example #11
0
    def launch(self):
        """
        launches the webbrowser
        """

        if self.packagePath:
            try:
                package = Package.load(self.packagePath)
                self.webServer.root.package = package
                launchBrowser(self.config, package.name)
            except:
                self.webServer.root.packagePath = None
                launchBrowser(self.config, "")
        else:
            launchBrowser(self.config, "")
Example #12
0
    def _loadPackage(self, packagePath):
        #"""
        #Convenience function for loading the first package that we'll browse to
        #"""
        try:
            #XXXX xxxx
            log.info("webDir: " + self.config.webDir)
            log.info("tempWebDir: " + self.tempWebDir)
            inSplashFile = self.config.webDir + "/docs/splash.xulTemplate"

            outSplashFile = self.config.webDir + "/docs/splash.xul"
            outSplashData = self.config.webDir + "/docs/splash.dat"

            outSplashFile = self.tempWebDir + "/splash.xul"
            outSplashData = self.tempWebDir + "/splash.dat"

            log.info("inSplashFile: " + inSplashFile)
            log.info("outSplashFile: " + outSplashFile)
            log.info("outSplashData: " + outSplashData)

            #resets any splash page data
            outSplashFH = open(outSplashData, "w")
            outSplashFH.write("")
            outSplashFH.close()

            inSplashFH = open(inSplashFile, "r")
            outSplashFH = open(outSplashFile, "w")
            pleaseWaitLoad = _(u'Please wait until loading finishes')
            for line in inSplashFH:
                line = line.replace("LOADING_FILE_NAME", packagePath)
                try:
                    # this can fail in non UTF-8 uris
                    line = line.replace("PLEASE_WAIT_LOAD", pleaseWaitLoad)
                except:
                    pass
                outSplashFH.write(line)
            inSplashFH.close()
            outSplashFH.close()

            log.info("packagePath: " + packagePath)

            launchBrowser(self.config, outSplashFile, "splash")
            shutil.copyfile(self.config.webDir + '/images/exe_logo.png',
                            self.tempWebDir + '/exe_logo.png')

            package = self.packageStore.loadPackage(packagePath)
            port = self.config.port
            editorUrl = u'http://127.0.0.1:%d/%s' % (port, package.name)
            log.info("package.name: " + package.name)
            log.info("editorUrl: " + editorUrl)
            log.info("TempDirPath: " + editorUrl)
            outSplashFH = open(outSplashData, "w")
            outSplashFH.write("1000;" + editorUrl)
            outSplashFH.close()

            self.webServer.root.bindNewPackage(package)
            return package

        except Exception, e:
            log.error('Error loading first Package (%s): %s' %
                      (packagePath, e))
            message = _(u'Sorry, wrong file format')

            outSplashFH=open(globals.application.tempWebDir + \
                               '/splash.dat',"w")
            message = re.sub(";", ":", message)
            port = self.config.port
            outSplashFH.write("1000;http://127.0.0.1:" + `port` + "/;" + \
                               message)
            outSplashFH.close()

            return None