├── .excludes ├── .gitignore ├── LICENSE ├── Main.qml ├── Makefile ├── lib ├── arm-linux-gnueabihf │ ├── io │ │ └── thp │ │ │ └── pyotherside │ │ │ ├── libpyothersideplugin.so │ │ │ └── qmldir │ ├── libpython3.4m.so.1 │ └── libpython3.4m.so.1.0 ├── i386-linux-gnu │ ├── io │ │ └── thp │ │ │ └── pyotherside │ │ │ ├── libpyothersideplugin.so │ │ │ └── qmldir │ ├── libpython3.4m.so.1 │ └── libpython3.4m.so.1.0 └── x86_64-linux-gnu │ ├── io │ └── thp │ │ └── pyotherside │ │ ├── libpyothersideplugin.so │ │ └── qmldir │ ├── libpython3.4m.so.1 │ └── libpython3.4m.so.1.0 ├── manifest.json ├── po └── ubuntu-touch-pyotherside-template.pot ├── pyotherside-template.apparmor ├── pyotherside-template.desktop ├── tests ├── autopilot │ ├── run │ └── ubuntu-touch-pyotherside-template │ │ ├── __init__.py │ │ └── tests │ │ ├── __init__.py │ │ └── test_main.py └── qml │ └── tst_main.qml ├── ubuntu-touch-pyotherside-template.png └── ubuntu-touch-pyotherside-template.qmlproject /.excludes: -------------------------------------------------------------------------------- 1 | Makefile 2 | *.tmp 3 | .bzr 4 | .git 5 | po 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.user* 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Sturmi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Main.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import io.thp.pyotherside 1.4 3 | 4 | Rectangle { 5 | width: 200 6 | height: 200 7 | color: 'blue' 8 | 9 | ListView { 10 | id: listView 11 | anchors.fill: parent 12 | delegate: Text { color: 'white'; text: modelData } 13 | } 14 | 15 | Python { 16 | id: python 17 | 18 | Component.onCompleted: { 19 | // Print version of plugin and Python interpreter 20 | console.log('PyOtherSide version: ' + pluginVersion()); 21 | console.log('Python version: ' + pythonVersion()); 22 | 23 | // Asynchronous module importing 24 | importModule('os', function() { 25 | console.log('Python module "os" is now imported'); 26 | 27 | // Asynchronous function calls 28 | call('os.listdir', [], function(result) { 29 | console.log('dir listing: ' + result); 30 | listView.model = result; 31 | }); 32 | 33 | // Synchronous calls - avoid these, they block the UI 34 | call_sync('os.chdir', ['/']); 35 | console.log('files in /: ' + call_sync('os.listdir', ['.'])); 36 | }); 37 | 38 | // sychronous imports and calls - again, avoid! 39 | importModule_sync('pyotherside'); 40 | call_sync('pyotherside.send', ['hello world!', 123]); 41 | 42 | // error handling 43 | importModule_sync('thismoduledoesnotexisthopefully'); 44 | evaluate('[ 123 [.syntax234-error!'); 45 | } 46 | 47 | onError: { 48 | // when an exception is raised, this error handler will be called 49 | console.log('python error: ' + traceback); 50 | } 51 | 52 | onReceived: { 53 | // asychronous messages from Python arrive here 54 | // in Python, this can be accomplished via pyotherside.send() 55 | console.log('got message from python: ' + data); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # More information: https://wiki.ubuntu.com/Touch/Testing 2 | # 3 | # Notes for autopilot tests: 4 | # --------------------------------------------------------------- 5 | # In order to run autopilot tests: 6 | # sudo apt-add-repository ppa:autopilot/ppa 7 | # sudo apt-get update 8 | # sudo apt-get install python-autopilot autopilot-qt 9 | # 10 | # Notes for translations: 11 | # --------------------------------------------------------------- 12 | # In order to create translation files manually: 13 | # 1) run make once to create and update the po/ubuntu-touch-pyotherside-template.pot 14 | # 2) copy the template file and set the name to the language you want to 15 | # translate to: cp po/ubuntu-touch-pyotherside-template.pot po/en.po 16 | # 3) edit the po file 17 | # 4) run make build-translations to build the translation files 18 | # 19 | # Steps 1) and 4) are automatically executed by QtCreator 20 | ################################################################# 21 | 22 | #APP_ID needs to match the "name" field of the click manifest 23 | APP_ID=ubuntu-touch-pyotherside-template.sturmflut 24 | 25 | #provides a way for the IDE to set a specific target folder for the translations 26 | TRANSLATION_ROOT=. 27 | 28 | MO_FILES=$(shell for infile in `find po -name "*.po"`; do basename -s .po $$infile | awk '{print "$(TRANSLATION_ROOT)/share/locale/" $$0 "/LC_MESSAGES/$(APP_ID).mo";}' ; done) 29 | QMLJS_FILES=$(shell find . -name "*.qml" -o -name "*.js" | grep -v ./tests) 30 | 31 | all: po/ubuntu-touch-pyotherside-template.pot 32 | 33 | autopilot: 34 | chmod +x tests/autopilot/run 35 | tests/autopilot/run 36 | 37 | check: 38 | qmltestrunner -input tests/qml 39 | 40 | #translation targets 41 | 42 | build-translations: $(MO_FILES) 43 | 44 | po/ubuntu-touch-pyotherside-template.pot: $(QMLJS_FILES) 45 | mkdir -p $(CURDIR)/po && xgettext -o po/ubuntu-touch-pyotherside-template.pot --qt --c++ --add-comments=TRANSLATORS --keyword=tr --keyword=tr:1,2 $(QMLJS_FILES) --from-code=UTF-8 46 | 47 | $(TRANSLATION_ROOT)/share/locale/%/LC_MESSAGES/$(APP_ID).mo: po/%.po 48 | mkdir -p $(TRANSLATION_ROOT)/share/locale/$*/LC_MESSAGES && msgfmt -o $(@) $(<) 49 | 50 | -------------------------------------------------------------------------------- /lib/arm-linux-gnueabihf/io/thp/pyotherside/libpyothersideplugin.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/arm-linux-gnueabihf/io/thp/pyotherside/libpyothersideplugin.so -------------------------------------------------------------------------------- /lib/arm-linux-gnueabihf/io/thp/pyotherside/qmldir: -------------------------------------------------------------------------------- 1 | module io.thp.pyotherside 2 | plugin pyothersideplugin 3 | -------------------------------------------------------------------------------- /lib/arm-linux-gnueabihf/libpython3.4m.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/arm-linux-gnueabihf/libpython3.4m.so.1 -------------------------------------------------------------------------------- /lib/arm-linux-gnueabihf/libpython3.4m.so.1.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/arm-linux-gnueabihf/libpython3.4m.so.1.0 -------------------------------------------------------------------------------- /lib/i386-linux-gnu/io/thp/pyotherside/libpyothersideplugin.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/i386-linux-gnu/io/thp/pyotherside/libpyothersideplugin.so -------------------------------------------------------------------------------- /lib/i386-linux-gnu/io/thp/pyotherside/qmldir: -------------------------------------------------------------------------------- 1 | module io.thp.pyotherside 2 | plugin pyothersideplugin 3 | -------------------------------------------------------------------------------- /lib/i386-linux-gnu/libpython3.4m.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/i386-linux-gnu/libpython3.4m.so.1 -------------------------------------------------------------------------------- /lib/i386-linux-gnu/libpython3.4m.so.1.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/i386-linux-gnu/libpython3.4m.so.1.0 -------------------------------------------------------------------------------- /lib/x86_64-linux-gnu/io/thp/pyotherside/libpyothersideplugin.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/x86_64-linux-gnu/io/thp/pyotherside/libpyothersideplugin.so -------------------------------------------------------------------------------- /lib/x86_64-linux-gnu/io/thp/pyotherside/qmldir: -------------------------------------------------------------------------------- 1 | module io.thp.pyotherside 2 | plugin pyothersideplugin 3 | -------------------------------------------------------------------------------- /lib/x86_64-linux-gnu/libpython3.4m.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/x86_64-linux-gnu/libpython3.4m.so.1 -------------------------------------------------------------------------------- /lib/x86_64-linux-gnu/libpython3.4m.so.1.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/lib/x86_64-linux-gnu/libpython3.4m.so.1.0 -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ubuntu-touch-pyotherside-template.sturmflut", 3 | "description": "description of ubuntu-touch-pyotherside-template", 4 | "architecture": "all", 5 | "title": "ubuntu-touch-pyotherside-template", 6 | "hooks": { 7 | "pyotherside-template": { 8 | "apparmor": "pyotherside-template.apparmor", 9 | "desktop": "pyotherside-template.desktop" 10 | } 11 | }, 12 | "version": "0.1", 13 | "maintainer": "Sturm Flut ", 14 | "framework" : "ubuntu-sdk-15.04" 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /po/ubuntu-touch-pyotherside-template.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: PACKAGE VERSION\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2015-07-12 18:19+0200\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: Main.qml:28 21 | msgid "pyotherside-template" 22 | msgstr "" 23 | 24 | #: Main.qml:41 25 | msgid "Hello.." 26 | msgstr "" 27 | 28 | #: Main.qml:48 29 | msgid "Tap me!" 30 | msgstr "" 31 | 32 | #: Main.qml:51 33 | msgid "..world!" 34 | msgstr "" 35 | -------------------------------------------------------------------------------- /pyotherside-template.apparmor: -------------------------------------------------------------------------------- 1 | { 2 | "policy_groups": [ 3 | "networking", 4 | "webview" 5 | ], 6 | "policy_version": 1.3 7 | } 8 | 9 | 10 | -------------------------------------------------------------------------------- /pyotherside-template.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=pyotherside-template 3 | Exec=qmlscene $@ Main.qml 4 | Icon=ubuntu-touch-pyotherside-template.png 5 | Terminal=false 6 | Type=Application 7 | X-Ubuntu-Touch=true 8 | 9 | -------------------------------------------------------------------------------- /tests/autopilot/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -z `which autopilot3` ]]; then 4 | echo "python3-autopilot is not installed. Skip" 5 | exit 6 | fi 7 | 8 | SCRIPTPATH=`dirname $0` 9 | pushd ${SCRIPTPATH} 10 | autopilot3 run ubuntu-touch-pyotherside-template 11 | popd 12 | -------------------------------------------------------------------------------- /tests/autopilot/ubuntu-touch-pyotherside-template/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 2 | """Application autopilot helpers.""" 3 | 4 | import logging 5 | import ubuntuuitoolkit 6 | 7 | logger = logging.getLogger(__name__) 8 | 9 | 10 | class AppException(ubuntuuitoolkit.ToolkitException): 11 | 12 | """Exception raised when there are problems with the Application.""" 13 | 14 | 15 | class TouchApp(object): 16 | 17 | """Autopilot helper object for the application.""" 18 | 19 | def __init__(self, app_proxy, test_type): 20 | self.app = app_proxy 21 | self.test_type = test_type 22 | self.main_view = self.app.select_single(MainView) 23 | 24 | @property 25 | def pointing_device(self): 26 | return self.app.pointing_device 27 | 28 | 29 | class MainView(ubuntuuitoolkit.MainView): 30 | 31 | """A helper that makes it easy to interact with the mainview""" 32 | 33 | def __init__(self, *args): 34 | super(MainView, self).__init__(*args) 35 | self.visible.wait_for(True, 30) 36 | 37 | def get_button(self): 38 | return self.select_single('Button', objectName="button") 39 | 40 | def get_label(self): 41 | return self.select_single('Label', objectName="label") 42 | -------------------------------------------------------------------------------- /tests/autopilot/ubuntu-touch-pyotherside-template/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 2 | """Ubuntu Touch App Autopilot tests.""" 3 | 4 | import os 5 | import logging 6 | 7 | import ubuntu-touch-pyotherside-template 8 | 9 | from autopilot.testcase import AutopilotTestCase 10 | from autopilot import logging as autopilot_logging 11 | 12 | import ubuntuuitoolkit 13 | from ubuntuuitoolkit import base 14 | 15 | logger = logging.getLogger(__name__) 16 | 17 | 18 | class BaseTestCase(AutopilotTestCase): 19 | 20 | """A common test case class 21 | 22 | """ 23 | 24 | local_location = os.path.dirname(os.path.dirname(os.getcwd())) 25 | local_location_qml = os.path.join(local_location, 'Main.qml') 26 | click_package = '{0}.{1}'.format('ubuntu-touch-pyotherside-template', 'sturmflut') 27 | 28 | def setUp(self): 29 | super(BaseTestCase, self).setUp() 30 | self.launcher, self.test_type = self.get_launcher_and_type() 31 | self.app = ubuntu-touch-pyotherside-template.TouchApp(self.launcher(), self.test_type) 32 | 33 | def get_launcher_and_type(self): 34 | if os.path.exists(self.local_location_qml): 35 | launcher = self.launch_test_local 36 | test_type = 'local' 37 | else: 38 | launcher = self.launch_test_click 39 | test_type = 'click' 40 | return launcher, test_type 41 | 42 | @autopilot_logging.log_action(logger.info) 43 | def launch_test_local(self): 44 | return self.launch_test_application( 45 | base.get_qmlscene_launch_command(), 46 | self.local_location_qml, 47 | app_type='qt', 48 | emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) 49 | 50 | @autopilot_logging.log_action(logger.info) 51 | def launch_test_click(self): 52 | return self.launch_click_package( 53 | self.click_package, 54 | emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) 55 | -------------------------------------------------------------------------------- /tests/autopilot/ubuntu-touch-pyotherside-template/tests/test_main.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 2 | 3 | from autopilot.matchers import Eventually 4 | from testtools.matchers import Equals 5 | from ubuntu-touch-pyotherside-template import tests 6 | 7 | 8 | class MainViewTestCase(tests.BaseTestCase): 9 | """Tests for the mainview""" 10 | 11 | def setUp(self): 12 | super(MainViewTestCase, self).setUp() 13 | 14 | def test_click_button(self): 15 | # Find and click the button 16 | button = self.app.main_view.get_button() 17 | self.app.pointing_device.click_object(button) 18 | 19 | # Make an assertion about what should happen 20 | label = self.app.main_view.get_label() 21 | self.assertThat(label.text, Eventually(Equals('..world!'))) 22 | -------------------------------------------------------------------------------- /tests/qml/tst_main.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import QtTest 1.0 3 | import Ubuntu.Test 1.0 4 | import "../../" 5 | // See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase 6 | 7 | // Execute these tests with: 8 | // qmltestrunner 9 | 10 | Item { 11 | 12 | width: units.gu(100) 13 | height: units.gu(75) 14 | 15 | // The objects 16 | Main { 17 | id: main 18 | } 19 | 20 | UbuntuTestCase { 21 | name: "MainTestCase" 22 | 23 | when: windowShown 24 | 25 | 26 | function init() { 27 | var label = findChild(main, "label"); 28 | // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method 29 | compare("Hello..", label.text); 30 | } 31 | 32 | function test_clickButtonMustChangeLabel() { 33 | var button = findChild(main, "button"); 34 | var buttonCenter = centerOf(button) 35 | mouseClick(button, buttonCenter.x, buttonCenter.y); 36 | var label = findChild(main, "label"); 37 | // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method 38 | tryCompare(label, "text", "..world!", 1); 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /ubuntu-touch-pyotherside-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sturmflut/ubuntu-touch-pyotherside-template/6487da6eb63dfe43926d6a889d469a5f2a38f024/ubuntu-touch-pyotherside-template.png -------------------------------------------------------------------------------- /ubuntu-touch-pyotherside-template.qmlproject: -------------------------------------------------------------------------------- 1 | import QmlProject 1.1 2 | 3 | Project { 4 | mainFile: "Main.qml" 5 | 6 | /* Include .qml, .js, and image files from current directory and subdirectories */ 7 | QmlFiles { 8 | directory: "." 9 | } 10 | JavaScriptFiles { 11 | directory: "." 12 | } 13 | ImageFiles { 14 | directory: "." 15 | } 16 | Files { 17 | filter: "*.desktop" 18 | } 19 | Files { 20 | filter: "www/*.html" 21 | } 22 | Files { 23 | filter: "Makefile" 24 | } 25 | Files { 26 | filter: "*.apparmor" 27 | } 28 | Files { 29 | directory: "." 30 | paths: ["manifest.json",".excludes"] 31 | } 32 | Files { 33 | directory: "www" 34 | filter: "*" 35 | } 36 | Files { 37 | directory: "lib" 38 | filter: "*" 39 | } 40 | Files { 41 | directory: "www/img/" 42 | filter: "*" 43 | } 44 | Files { 45 | directory: "www/css/" 46 | filter: "*" 47 | } 48 | Files { 49 | directory: "www/js/" 50 | filter: "*" 51 | } 52 | Files { 53 | directory: "tests/" 54 | filter: "*" 55 | } 56 | Files { 57 | directory: "debian" 58 | filter: "*" 59 | } 60 | /* List of plugin directories passed to QML runtime */ 61 | importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ] 62 | } 63 | 64 | --------------------------------------------------------------------------------