kivy-remote-shell
kivy-remote-shell copied to clipboard
Service-based remote shell
This version starts a service-based remote shell.
It does not drop the connection nor freeze on Home button pressed, but have no access to the mActivity:
$ ssh -p8000 [email protected]
[email protected]'s password:
>>> from jnius import autoclass, cast
>>> activity = autoclass('org.renpy.android.PythonActivity').mActivity
>>> activity is None
True
Do you think it is worth the benefit?
I'm hesitating about that one. Why the mActivity is not accessible? Lot of tests and usage need the application Context instance (and so, the mActivity). Plyer would be broken as well.
I really love the separation, but this will broke many things :/
No ok, It's PythonService.mContext instead of PythonActivity.mActivity. Both are interesting to have. Replacing one by the other sucks.
Could you improve your PR in order to add an UI choice: run as a service or as a standalone application ? And then, listen on SSH and choice either the previous way to work, or yours: it will allows to test android API either within the app, or within a service. That's would be awesome!
So I can replace PythonActivity.mActivity with PythonService.mContext and it works? Nice.
Will do the UI change. I dont know when :) or if it will be as visually nice as now, but will do.
Thanks for the feedback and the tests.
I made some progress on this, using a ToggleButton for service-based. Problem is that I found no way to stop the running listenTCP on the Activity version. I am considering to have a splash question to the user. This or start as the Service-version, and have a single-use button to switch to the Activity version.
What would be better? Start with service-based, or ask on every start?
@tito, I finally managed to work around Twisted Reactor integration, but now this needs a patched Kivy (https://github.com/kivy/kivy/pull/1805), otherwise I have troubles with both reactors (Activity and Service) trying to bind the same port, without waiting the other one to stop listening.
Can you please take a look at https://github.com/kivy/kivy/pull/1805 ?
The merge of kivy/kivy#1805 closed this one by accident. Is there a way to reopen?
@alanjds sry, this got ignored, could you rebase to master, would be a welcome addition.
Got it. I do not know when, but will rebase the thing. Thanks.
@alanjds Waiting keenly 😺
Oops. Forgot completely. Thanks for the nudge.
Bump!
I updated the branch with a rebased version to keep the PR. Please "force" the pull if needed. The old branch was renamed to service-old.
But it had not worked here on MacOSX. Seems to be about the upstream changes to the UI. Attached is the the console output.
[INFO ] [Logger ] Record log in /Users/alanjds/.kivy/logs/kivy_16-12-24_10.txt
[INFO ] [Kivy ] v1.9.1
[INFO ] [Python ] v2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]
[INFO ] [Factory ] 179 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_gif, img_pygame (img_pil, img_ffpyplayer ignored)
[INFO ] [Window ] Provider: pygame
[INFO ] [GL ] OpenGL version <2.1 INTEL-8.28.34>
[INFO ] [GL ] OpenGL vendor <Intel Inc.>
[INFO ] [GL ] OpenGL renderer <Intel HD Graphics 4000 OpenGL Engine>
[INFO ] [GL ] OpenGL parsed version: 2, 1
[INFO ] [GL ] Shading version <1.20>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <16>
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[WARNING] Call to deprecated function __call__ in /Users/alanjds/.virtualenvs/sandbox/lib/python2.7/site-packages/kivy/utils.py line 402.Called from /Users/alanjds/src/git/kivy-remote-shell/service/__init__.py line 5 by <module>().
[INFO ] [GL ] NPOT texture support is available
[INFO ] [Text ] Provider: pygame
[INFO ] [Video ] Provider: null(['video_pygst', 'video_ffmpeg', 'video_ffpyplayer', 'video_pyglet'] ignored)
[INFO ] [OSC ] using <multiprocessing> for socket
[INFO ] [Base ] Start application main loop
[ERROR ] [Rst ] error while loading text
Traceback (most recent call last):
File "/Users/alanjds/.virtualenvs/sandbox/lib/python2.7/site-packages/kivy/uix/rst.py", line 593, in _load_from_text
document.walkabout(visitor)
File "/Users/alanjds/.virtualenvs/sandbox/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/Users/alanjds/.virtualenvs/sandbox/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/Users/alanjds/.virtualenvs/sandbox/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/Users/alanjds/.virtualenvs/sandbox/lib/python2.7/site-packages/docutils/nodes.py", line 166, in walkabout
visitor.dispatch_visit(self)
File "/Users/alanjds/.virtualenvs/sandbox/lib/python2.7/site-packages/kivy/uix/rst.py", line 943, in dispatch_visit
assert(self.text == '')
AssertionError
(then I close the window)
[INFO ] [Base ] Leaving application in progress...