kivy-remote-shell icon indicating copy to clipboard operation
kivy-remote-shell copied to clipboard

Service-based remote shell

Open alanjds opened this issue 11 years ago • 12 comments
trafficstars

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?

alanjds avatar Jan 11 '14 18:01 alanjds

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 :/

tito avatar Jan 18 '14 01:01 tito

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!

tito avatar Jan 18 '14 01:01 tito

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.

alanjds avatar Jan 18 '14 01:01 alanjds

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?

alanjds avatar Jan 21 '14 22:01 alanjds

@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 ?

alanjds avatar Jan 22 '14 02:01 alanjds

The merge of kivy/kivy#1805 closed this one by accident. Is there a way to reopen?

alanjds avatar Mar 12 '14 03:03 alanjds

@alanjds sry, this got ignored, could you rebase to master, would be a welcome addition.

akshayaurora avatar Aug 14 '16 16:08 akshayaurora

Got it. I do not know when, but will rebase the thing. Thanks.

alanjds avatar Aug 16 '16 12:08 alanjds

@alanjds Waiting keenly 😺

kamathln avatar Nov 29 '16 15:11 kamathln

Oops. Forgot completely. Thanks for the nudge.

alanjds avatar Nov 29 '16 15:11 alanjds

Bump!

akshayaurora avatar Dec 24 '16 07:12 akshayaurora

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.

logs.txt

[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...

alanjds avatar Dec 24 '16 17:12 alanjds