Meego Wiki
Views
From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(add aegis trick)
(add python tricks section)
Line 166: Line 166:
|
|
|}
|}
 +
 +
 +
=== Python tricks ===
 +
 +
==== QtMobility Accelerometer example ====
 +
 +
<pre class="code">
 +
import sys, os
 +
 +
from PySide import QtCore, QtGui, QtDeclarative, QtOpenGL
 +
from QtMobility import Sensors
 +
 +
class AccelListener(QtCore.QObject):
 +
    def __init__(self):
 +
        QtCore.QObject.__init__(self)
 +
        self.rotation = (0.0, 0.0, 0.0)
 +
 +
    @QtCore.Slot()
 +
    def on_reading_changed(self):
 +
        accel = self.sender()
 +
        reading = accel.reading()
 +
        self.rotation = (reading.x(),
 +
                        reading.y(),
 +
                        reading.z())
 +
        print "rotation = %s" % str(self.rotation)
 +
 +
 +
app = QtGui.QApplication(sys.argv)
 +
accel = Sensors.QAccelerometer()
 +
 +
accel_listener = AccelListener()
 +
accel.readingChanged.connect(accel_listener.on_reading_changed)
 +
accel.start()
 +
 +
sys.exit(app.exec_())
 +
</pre>

Revision as of 15:44, 17 October 2011

I'm a python developer in real life and enjoyed hacking on my N900 so much that I wanted to continue with the N9/N950. My application for the N950 was accepted and I'm starting the two projects:


Contents

scratchbox on Fedora

start / login

sudo /scratchbox/sbin/sbox_ctl start && sudo /scratchbox/sbin/sbox_sync && /scratchbox/login

quick and dirty package build

apt-get source python-minimal
cd python-defaults-2.6.6-3+squeeze4/
dpkg-buildpackage -sa -rfakeroot -kmartin@martindengler.com
fakeroot apt-get install debiandoc-sgml lsb-release
dpkg-buildpackage -sa -rfakeroot -kmartin@martindengler.com
aegis-manifest -d

things to do once

  • edit /etc/apt/sources.list in scratchbox (TODO: include what?)
  • copy / create you GPG private key in .gnupg
  • patch /scratchbox/users/*/targets/HARMATTAN_*/usr/lib/python2.6/urllib2.py if you're going to use the rpm/packaged osc, since you will have a problem with scratchbox's urllib2.py as in http://bugs.python.org/issue9639


my Harmattan debs

http://repo.pub.meego.com/home:/mdengler/MeeGo_1.2_Harmattan_Maemo.org_MeeGo_1.2_Harmattan_standard/

background

skype trick

http://wiki.meego.com/Migrating_from_N900_to_N950#GTalk_and_Skype_account_setup

dbus tricks

qdbus --system org.freedesktop.DBus / org.freedesktop.DBus.ListNames dbus-send --system --type=method_call --print-reply --dest=com.nokia.time /com/nokia/time org.freedesktop.DBus.Introspectable.Introspect

dbus-send --system --type=method_call --print-reply --dest=com.nokia.time /com/nokia/time com.nokia.time.enable_alarms boolean:"false"

dbus-send --system --type=method_call --print-reply --dest=com.nokia.time /com/nokia/time com.nokia.time.alarms_enabled

dbus-send --system --type=method_call --print-reply --dest=com.nokia.time /com/nokia/time com.nokia.time.get_cookies_by_attributes dict:string:string:"",""


Checking whether Aegis is securing a file / inode

~ # ls -i /bin/sh

144908 /bin/sh

~ # sha1sum /bin/sh 7fd44caa86b259e8724f5da10adfcc7fee4e0a16 /bin/sh ~ # grep 144908 /sys/kernel/security/validator/hashlist 9990003 144908 (0,0,33261)S no 7fd44caa86b259e8724f5da10adfcc7fee4e0a16

  1. note how both the inode number and sha1sum are present

~ # ls -i /etc/mce/mce.ini

143850 /etc/mce/mce.ini

~ # grep 143850 /sys/kernel/security/validator/hashlist

  1. nothing there - so aegis isn't monitoring it


command-line coding workflow

from http://www.developer.nokia.com/Community/Discussion/showthread.php?227292-Problem-deploying-project-on-N950-using-MADDE



N950 data storage and backup locations

Item Filesystem Backup
Contacts
Recent Calls
Web history
Messages
Email
Pictures (Gallery/Camera)
Music
Videos
Calendar
Documents
Feeds
Accounts
Clock (Alarms)
Settings
Notes
Autostart applications /usr/share/autostart/tracker-miner-fs.desktop
Extensions & Status menu applications /usr/share/meegotouch/applicationextensions
Application Launcher icons /usr/share/applications and /usr/share/applications/installer-extra
QuickLaunch Bar Application Launcher icons /etc/xdg/meegotouchhome-nokia/applications/


Python tricks

QtMobility Accelerometer example

import sys, os

from PySide import QtCore, QtGui, QtDeclarative, QtOpenGL
from QtMobility import Sensors

class AccelListener(QtCore.QObject):
    def __init__(self):
        QtCore.QObject.__init__(self)
        self.rotation = (0.0, 0.0, 0.0)

    @QtCore.Slot()
    def on_reading_changed(self):
        accel = self.sender()
        reading = accel.reading()
        self.rotation = (reading.x(),
                         reading.y(),
                         reading.z())
        print "rotation = %s" % str(self.rotation)


app = QtGui.QApplication(sys.argv)
accel = Sensors.QAccelerometer()

accel_listener = AccelListener()
accel.readingChanged.connect(accel_listener.on_reading_changed)
accel.start()

sys.exit(app.exec_())
Personal tools