Exemplo n.º 1
0
def main():
  """Main for portable server."""
  application = tornado.web.Application([
      # Important to look for local requests first.
      (r"/local/(.*)", portable_server_base.LocalDocsHandler),
      (r"/ext/(.*)", portable_server_base.ExtHandler),
      (r".*/(\d+)/kh/flatfile/lf-(.*)", CompositeIconHandler),
      (r".*/(\d+)/kh/flatfile", CompositeFlatFileHandler),
      (r".*/(\d+)/kh/dbRoot.*", CompositeDbRootHandler),
      (r".*/(\d+)/kmllayer/(.*)", CompositeVectorLayerHandler),
      (r".*/flatfile/lf-(.*)", IconHandler),
      (r".*/flatfile", FlatFileHandler),
      (r".*/dbRoot.*", DbRootHandler),
      (r".*/MapsAdapter", JsonSearchHandler),
      (r".*/ECV4Adapter", KmlSearchHandler),
      (r".*/Portable2dPoiSearch", JsonSearchHandler),
      (r".*/Portable3dPoiSearch", KmlSearchHandler),
      (r".*/icons/(.*)", IconHandler),
      (r"/ping", PingHandler),
      (r"/info", InfoHandler),
      (r".*/(\d+)/query", CompositeQueryHandler),
      (r".*/query", QueryHandler),
      (r".*/(\d+)/(js/.*)", CompositeDocsHandler),
      (r".*/(\d+)/(kml/.*)", CompositeDocsHandler),
      (r".*/(\d+)/(license/.*)", CompositeDocsHandler),
      (r".*/(\d+)/(earth/.*)", CompositeDocsHandler),
      (r".*/(\d+)/(maps/.*)", CompositeDocsHandler),
      (r".*/(js/.*)", DocsHandler),
      (r".*/(kml/.*)", DocsHandler),
      (r".*/(license/.*)", DocsHandler),
      (r".*/(earth/.*)", DocsHandler),
      (r"/maps/gen_204", MapsGen204Handler),
      (r".*/(maps/.*)", DocsHandler),
      (r"/eb_balloon", BalloonHandler),
      (r"/(.*)", portable_web_interface.SetUpHandler),
      ])

  prepare_for_io_loop()

  tornado.web.globe_ = portable_globe.Globe()
  tornado.web.local_server_ = local_server.LocalServer()
  http_server = tornado.httpserver.HTTPServer(application)
  if tornado.web.globe_.config_.DisableBroadcasting():
    http_server.listen(tornado.web.globe_.Port(), address="127.0.0.1")
  else:
    http_server.listen(tornado.web.globe_.Port())
  tornado.ioloop.IOLoop.instance().start()
Exemplo n.º 2
0
def main():
    # Create MainApp
    app = QtGui.QApplication(sys.argv)

    # Check for Updates when run as frozen executable
    if getattr(sys, 'frozen', False):
        updater.update(app)

    # Start wizard to set database path
    if not cfg.config.has_option('Wizard', 'done'):
        wizard.run(app)
        cfg.add_entry('Wizard', 'done', 'True')

    # Splash screen
    splash_pix = QtGui.QPixmap(':/splashAssetJet.png')
    splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()

    # Load the heavy modules here
    import pandas
    import numpy
    import scipy
    import local_server
    time.sleep(1)

    # Initialise web server to server HTML to WebView
    srv = local_server.LocalServer()
    srv.daemon = True
    srv.start()
    log.Debug("Started web server")

    # Launch the app and pass control to the main controller
    mainForm = MainController()
    mainForm.show_()
    splash.finish(mainForm)
    sys.exit(app.exec_())
    sys.exit(0)