Changes between Version 23 and Version 24 of PySideForAndroid


Ignore:
Timestamp:
Feb 17, 2013, 7:54:01 PM (11 years ago)
Author:
Martin Kolman
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PySideForAndroid

    v23 v24  
    179179===== Bundling =====
    180180
    181 ====== Modified QtActivity ======
     181====== Modified !QtActivity.java ======
     182Another mportant file is the main Android ''activity'' located in {{{android/src/org/kde/necessitas/origo/QtActivity.java}}} This is actually the first thing that is started once you press the application icon on android. It basically works as a glue between Android, Qt and in our case, Python & PySide.
     183
     184The basic activity file that is part of every Necessitas Qt Creator project has been modified by the ''android_python27'' project, to look for two specific zip archives in the installation folder at startup ant to decompress them & then remover the archives.
     185
     186This way bundling of arbitrary files (libraries, executables, code, themes, etc.) inside the application APK has been achieved.
     187
     188'''NOTE:''' Necessitas Qt Creator might sometimes want to update the pre-generated *.java files with a new version. If this happens to you, check if the update didn't break or remove the bundling code in {{{QtActivity.java}}} .
     189
     190====== !GlobalConstants.java ======
     191The file {{{android/src/org/kde/necessitas/origo/GlobalConstants.java}}} contains variables for the main {{{QtActivity}}} file.
     192
     193It looks like this:
     194
     195{{{
     196package org.kde.necessitas.origo;
     197
     198public class GlobalConstants {
     199
     200        public static final String PYTHON_MAIN_SCRIPT_NAME = "main.py";
     201        public static final String PYTHON_PROJECT_ZIP_NAME = "my_python_project.zip";
     202        public static final String PYTHON_ZIP_NAME = "python_27.zip";
     203        public static final String PYTHON_EXTRAS_ZIP_NAME = "python_extras_27.zip";
     204
     205        public static final boolean IS_FOREGROUND_SERVICE = true;
     206
     207        public static final String PYTHON_BIN_RELATIVE_PATH = "/python/bin/python";
     208        public static final String PYTHON_NAME = "python";
     209        public static final String PYTHON_NICE_NAME = "Python 2.7.2";
     210
     211        public static String[] SCRIPT_ARGS = { "--foreground" };
     212
     213        public static final String LOG_TAG = "PythonAPK";
     214}
     215
     216}}}
     217As you can see, you can use it to set various variables, such as name of the bundling archives or logging prefix (does this actually work ?).
    182218
    183219====== my_python_project.zip ======
     220The first archive, located in {{{android/res/raw/my_python_project.zip}}} in the project contains the Python application code. On first application start, it's contents are unpacked into:
     221
     222{{{/data/data/org.modrana.PySide.Example/}}}
    184223
    185224====== python27.zip ======
    186 
     225This file is located {{{android/res/raw/python_27.zip}}} in the project and it's content is unpacked to:
     226
     227{{{/data/data/org.modrana.PySide.Example/python}}}
     228
     229The paths set in {{{main.h}}} expect this and point the corresponding environmental variables to the {{{bin}}}, {{{lib}}}, {{{imports}}} and {{{themes}}} folders in this directory.
    187230
    188231==== Modifying the project ====