[BlackBerry-Python] Looking for examples and howto for Python/QML with Tart on BB10
Peter Hansen
peter at engcorp.com
Sat Dec 8 09:46:02 EST 2012
On 2012-12-08 06:56, George Ruinelli wrote:
> To speed up development and testing, I am looking for a way to run my apps on
> the device without packing and deploying it.
> One way would be to copy them with secure copy (scp) to the devuser home
> directory and start it from there via SSH.
...
> One then simply could edit his Python/QML files on the PC, copy them over and
> start them over SSH.
I'm only 99% sure this isn't possible for any GUI app, because only apps
launched through the Navigator will be granted the required permissions
and/or given a screen context. Without that, they can run so long as
they just use non-GUI stuff (and probably don't interact with the user
through keyboard etc either).
It's not necessarily a problem though. I actually do all my development
"on the device" and probably achieve almost 100% of the benefits, and
perhaps with some extra advantages thrown in too.
First off, you start with a "stub" program that is packaged with just
the executable (tart-launch in this case), the icon, and the manifest
file. Pretty much a near-empty .bar file, which you deploy the usual
way. That gives you the app icon on the screen so you can tap it,
though if you wanted programmatic control you could use the
launch/terminate options of blackberry-deploy.
You grant the access_shared permission in the bar-descriptor file as
well, and configure the executable so that it looks to a folder like
shared/misc/ZombieSlayer for the rest of its code and assets. This can
be done through command line options, a configuration file, or other
mechanisms as appropriate. The tart-launch binary uses command line
options and a tart.cfg file, though what's there is just hacked together
and could stand some cleanup and rationalization.
To edit the other files, you can connect to the device's Samba network
share, and edit directly over wifi if you like. I used to do that, and
still do, but rarely. Several times I lost critical edits as a result,
such as when my Dev Alpha froze just before Jam Americas and the only
solution was a full wipe.
What I do now is use a utility that basically does an "rsync" from my PC
working folder tree to the shared/misc/AppName folder. It's actually a
Python utility (if you knew me well you'd say "of course" :-) and for
now uses the win32file.ReadDirectoryChangesW() routine which monitors
the directory for changes. It more or less instantly mirrors any
updates from my PC to the Dev Alpha, so by the time I've hit Save on the
PC and moved my finger over to the Dev Alpha to launch the app, the
changes have already been transferred.
On the plus side, I can't lose edits any more... :-)
With some cleanup, this tool (mirrordir) could be made available to
others... there are a few minor bugs which would make it a pain for
beginners.
An alternative that might work well enough would be to edit over wifi,
but have a background script running that did an rsync *back* to the PC,
thus ensuring that you've always got an up-to-date copy of the latest
changes preserved there. I sometimes find edit-over-wifi slightly
sluggish myself so I didn't go that route.
-Peter
More information about the BlackBerry-Python
mailing list