コード例 #1
0
def main():
    setproctitle(PROCESS_NAME)

    init_logging("{}.txt".format(PROCESS_NAME))
    init_gettext()

    pew.set_app_name("Kolibri")

    logger = logging.getLogger(__name__)

    # Since the log files can contain multiple runs, make the first printout very visible to quickly show
    # when a new run starts in the log files.
    logger.info("")
    logger.info("************************************")
    logger.info("*  Kolibri GNOME App Initializing  *")
    logger.info("************************************")
    logger.info("")
    logger.info("Started at: {}".format(datetime.datetime.today()))

    application = Application()
    signal.signal(signal.SIGTERM,
                  partial(application_signal_handler, application))
    application.run()

    logger.info("Stopped at: {}".format(datetime.datetime.today()))
コード例 #2
0
def main():
    init_logging("kolibri-gnome.txt")
    init_gettext()

    pew.set_app_name("Kolibri")

    # Since the log files can contain multiple runs, make the first printout very visible to quickly show
    # when a new run starts in the log files.
    logger.info("")
    logger.info("************************************")
    logger.info("*  Kolibri GNOME App Initializing  *")
    logger.info("************************************")
    logger.info("")
    logger.info("Started at: {}".format(datetime.datetime.today()))

    app = Application()
    app.run()
    app.join()

    logger.info("Stopped at: {}".format(datetime.datetime.today()))
コード例 #3
0
import logging
import os
import time
import urllib.error
import urllib.request

# initialize logging before loading any third-party modules, as they may cause logging to get configured.
logging.basicConfig(level=logging.DEBUG)

import pew
import pew.ui

from config import KOLIBRI_PORT

pew.set_app_name("Kolibri")
logging.info("Entering main.py...")

if pew.ui.platform == "android":

    from android_utils import get_home_folder, get_version_name

    os.environ["KOLIBRI_HOME"] = get_home_folder()
    os.environ["KOLIBRI_APK_VERSION_NAME"] = get_version_name()
    # We can't use symlinks as at least some Android devices have the user storage
    # and app data directories on different mount points.
    os.environ['KOLIBRI_STATIC_USE_SYMLINKS'] = "False"


def get_init_url(next_url='/'):
    # we need to initialize Kolibri to allow us to access the app key