ZeroBraneStudio icon indicating copy to clipboard operation
ZeroBraneStudio copied to clipboard

gideros live-coding not working on device player

Open keszegh opened this issue 8 years ago • 14 comments

see details here: http://giderosmobile.com/forum/discussion/comment/52568#Comment_52568

keszegh avatar Aug 19 '17 08:08 keszegh

@keszegh, I wouldn't expect there to be any difference between remote and local execution for the scratchpad (at least in the case of Gideros integration as currently implemented).

So, is the issue that the editor tab stays read-only, so it's not possible to do any updates? Does the scratchpad actually starts in this case (Scratchpad icon on the toolbar stays selected)?

I also wonder if you have the following two lines in your script before calling start() as suggested in http://notebook.kulchenko.com/zerobrane/gideros-live-coding-a-simple-example:

if initialized then return end
initialized = true

pkulchenko avatar Aug 20 '17 05:08 pkulchenko

yes, the editor tab stays read-only. no, the scratchpad does not start. no, I did not have those two lines in my script before start, now i added them but it did not have any effect.

keszegh avatar Aug 20 '17 06:08 keszegh

@keszegh, can you start the (remote) debugging as you do normally and then switch to scratchpad? Switching to scratchpad should still be enabled after remote debugging is started.

It's still puzzling that it works locally and doesn't work on the device as from the IDE perspective it's all the same and is taken care by the interpreter code with Gideros integration.

pkulchenko avatar Aug 20 '17 22:08 pkulchenko

while debugging is running the sratchpad button is inactive.

just in case, let me write here exactly the code i use for livecoding (mobdebug.lua and socket.lua from zbs folder are added to the project):

[set remote debugging](macro:shell(ide.config.gideros = {remote = "192.168.0.*"})) --ip of android tablet

if initialized then return end initialized = true if pcall(require, 'mobdebug') then require('mobdebug').start("192.168.0.*") --ip of pc end

keszegh avatar Aug 21 '17 08:08 keszegh

@keszegh, I can see why it doesn't allow to enable Scratchpad after a regular debugging is started remotely as there is a subtle difference in launching Gideros in "local" and "remote" configurations.

Changing this logic requires allowing scratchpad to be turned on after regular debugging is established, which should make it work in both configurations: when scratchpad is started from the IDE (and remote address is specified) and when the debugging is started remotely and then switched to scratchpad.

Can you try the following patch and let me know if this works for you:

diff --git a/src/editor/menu_project.lua b/src/editor/menu_project.lua
index cdb84be..bd0e22f 100644
--- a/src/editor/menu_project.lua
+++ b/src/editor/menu_project.lua
@@ -312,13 +312,13 @@ frame:Connect(ID_RUNNOW, wx.wxEVT_UPDATE_UI,
   function (event)
     local editor = GetEditor()
     local debugger = ide:GetDebugger()
-    -- allow scratchpad if there is no server or (there is a server and it is
-    -- allowed to turn it into a scratchpad) and we are not debugging anything
+    -- allow scratchpad if there is no server or the current debugger can be turned into
+    -- scratchpad or it's already running scratchpad (so that it can be turned off)
     event:Enable((ide.interpreter) and (ide.interpreter.hasdebugger) and
                  (ide.interpreter.frun ~= nil) and -- nil == no running from this interpreter
                  (ide.interpreter.scratchextloop ~= nil) and -- nil == no scratchpad support
-                 (editor ~= nil) and ((debugger:IsConnected() == nil or debugger.scratchable)
-                 and ide:GetLaunchedProcess() == nil or debugger.scratchpad ~= nil))
+                 (editor ~= nil) and
+                 (debugger:IsConnected() == nil or debugger.scratchable or debugger.scratchpad))
     local isscratchpad = debugger.scratchpad ~= nil
     menuBar:Check(ID_RUNNOW, isscratchpad)
     local tool = ide:GetToolBar():FindTool(ID_RUNNOW)

pkulchenko avatar Aug 22 '17 04:08 pkulchenko

it did not enable scratchpad button for me when debugging, not even on desktop debugging.

keszegh avatar Aug 22 '17 05:08 keszegh

Hm, interesting. Assuming Gideros is selected as the interpreter, can you run the following command in the console and show me the output after you start debugging locally and remotely:

> !local debugger = ide:GetDebugger(); return ide.interpreter.scratchextloop, debugger:IsConnected() == nil, debugger.scratchable, not not debugger.scratchpad

pkulchenko avatar Aug 22 '17 05:08 pkulchenko

Also, what if you start scratchpad in remote configuration; does it work?

pkulchenko avatar Aug 22 '17 05:08 pkulchenko

local debug paused and command run: true false false false remote debug paused and command run: true false false false

local scratchpad nonpaused: true false false false

when nothing is running then the results are: true true false false

if i run scratchpad in remote conf then it runs but i cannot edit the file while running.

On Tue, Aug 22, 2017 at 7:51 AM, Paul Kulchenko [email protected] wrote:

Also, what if you start scratchpad in remote configuration; does it work?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pkulchenko/ZeroBraneStudio/issues/795#issuecomment-323926039, or mute the thread https://github.com/notifications/unsubscribe-auth/ADrLHgUc9Kwdn3VQdCf6Qw9UwtVMEf3_ks5samxogaJpZM4O8RcD .

keszegh avatar Aug 22 '17 06:08 keszegh

any updates on this issue? thanks

keszegh avatar Sep 06 '17 19:09 keszegh

Still working on it. I've applied several fixes that I'd expect to eliminate the issue, but they all have some undesirable side-effects, so I'm still working through the options.

pkulchenko avatar Sep 06 '17 21:09 pkulchenko

any news about this issue?

keszegh avatar Oct 04 '17 21:10 keszegh

@keszegh, yes, I plan to have changes for you to test, but I'm getting close to the release and it is risky to apply them right now.

pkulchenko avatar Oct 04 '17 21:10 pkulchenko

understood

keszegh avatar Oct 06 '17 18:10 keszegh