Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service-based remote shell #3

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Service-based remote shell #3

wants to merge 17 commits into from

Conversation

alanjds
Copy link
Contributor

@alanjds alanjds commented Jan 11, 2014

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 admin@192.168.0.14
admin@192.168.0.14'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?

@tito
Copy link
Member

tito commented Jan 18, 2014

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
Copy link
Member

tito commented Jan 18, 2014

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!

@alanjds
Copy link
Contributor Author

alanjds commented Jan 18, 2014

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
Copy link
Contributor Author

alanjds commented Jan 21, 2014

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
Copy link
Contributor Author

alanjds commented Jan 22, 2014

@tito, I finally managed to work around Twisted Reactor integration, but now this needs a patched Kivy (kivy/kivy#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 kivy/kivy#1805 ?

@alanjds
Copy link
Contributor Author

alanjds commented Mar 12, 2014

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

@akshayaurora akshayaurora reopened this Mar 12, 2014
@akshayaurora
Copy link
Member

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

@alanjds
Copy link
Contributor Author

alanjds commented Aug 16, 2016

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

@kamathln
Copy link

kamathln commented Nov 29, 2016

@alanjds Waiting keenly 😺

@alanjds
Copy link
Contributor Author

alanjds commented Nov 29, 2016

Oops. Forgot completely. Thanks for the nudge.

@akshayaurora
Copy link
Member

Bump!

@alanjds
Copy link
Contributor Author

alanjds commented Dec 24, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants