Creating LiveCode applications that play well with git

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Sun Jul 23, 2017 1:01 am

Try setting the behavior to the long id of the stack.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Sun Jul 23, 2017 2:22 pm

Try setting the behavior to the long id of the stack
As if by magic that worked - my guess is you knew it would :wink: Since it was already loaded into memory I thought the stack name was enough. Also, just putting "the long id" in front of the name isn't supplying any more information so a bit puzzling to me. The dictionary syntax wasn't clear when you need the long id.

Glad you were there with your knowledge - thanks!

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Mon Jul 24, 2017 5:57 am

jim1001 wrote:Since it was already loaded into memory I thought the stack name was enough. Also, just putting "the long id" in front of the name isn't supplying any more information so a bit puzzling to me. The dictionary syntax wasn't clear when you need the long id.

Glad you were there with your knowledge - thanks!
You're welcome. I'm still puzzled as to why you are having problems setting the stackFiles to the behavior, though.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Sun Aug 13, 2017 12:14 am

Trevor,

Tried to move my project from local drive to a network as I saw you had updated Levure to allow use of network drives (didn’t realise it was so long since I checked!).

I had the local drive project open in LiveCode which I exited. I then copied the file structure onto the network drive. When I opened the project on the network drive I got lots of messages of form “A stack with the same name as the one you are trying to load is already open. Before loading <network drive stack> what do you want to do with <local drive stack>?”
  1. If I’ve exited LiveCode when the local drive stacks were open why are they still open when I close then start a fresh instance of LiveCode? They do have destroyStack set to false but shouldn’t they be removed from memory when LiveCode exits?
  2. To stop it happening in the future I’ve read on the forums that you can a) set destroyStack property to “true” for new stacks in Preferences and b) set destroyStack “true” for existing stacks. Would that create any problems with a Levure project?
  3. Even if I choose to purge the local stacks they are still reported as open the next time I open the network drive project. Is the answer to open the local project, set all stacks with destroyStack as true, close LiveCode then open it again on the network project?
I tried to replicate the problem with a simple one stack non-Levure project but couldn’t.

Thanks for help.

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Sun Aug 13, 2017 12:19 am

One more for the road Trevor:

I’m not copying my media onto the Android device every time I install my application. I have the media already on the device and refer to the absolute path of a media file from code within my app. If I want to set an Assets / Media directory base location for use when running on Android (that will be a different location to the corresponding IDE directory) is the best / natural Levure way to put it in a preferences : shared : android file? I’m not sure if that’s a recommended use for preference files.

ps: I don’t quite understand how you’ve used preferences in the Bell Conductor app. In app.yml you set different values for preferences filename > user > default & windows. But you also have a prefs.yml set in the build profiles section. Please can you explain?

Many thanks,
Jim

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Sun Aug 13, 2017 2:15 am

jim1001 wrote:I’m not copying my media onto the Android device every time I install my application. I have the media already on the device and refer to the absolute path of a media file from code within my app. If I want to set an Assets / Media directory base location for use when running on Android (that will be a different location to the corresponding IDE directory) is the best / natural Levure way to put it in a preferences : shared : android file? I’m not sure if that’s a recommended use for preference files.
`shared` preferences won't work on mobile devices. AFAIK there isn't a shared location for mobile devices. If there is then we would need to add the logic to the preferences helper.

While you could use preferences to store a path, I don't think I would Unless the path is going to be different on every Android device I would probably just write a function that returns a different value based on the environment.

Code: Select all

function MediaAssetFolder
  if the environment is "development" then
    # return IDE path
  else
    # return Android path
  end if
end MediaAssetFolder
jim1001 wrote:ps: I don’t quite understand how you’ve used preferences in the Bell Conductor app. In app.yml you set different values for preferences filename > user > default & windows. But you also have a prefs.yml set in the build profiles section. Please can you explain?
prefs.yml stores default values to use for preferences. See these docs:

https://github.com/trevordevore/levure/ ... ces-values
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Mon Aug 14, 2017 12:17 pm

I would probably just write a function that returns a different value based on the environment.
Thanks for the advice. That was an option I’d considered & good to know your thoughts.

I had looked at the preferences docs on the wiki before my first posting & have just looked at them again. As I understand it now:
  1. the developer sets default app preferences in prefs.yml. The user cannot read or write to these.
  2. if an app uses preferences then the developer can ask the user whether they want to share preferences for all users of the device (maybe on install?) This would determine whether in the app code preferences are stored to the shared or user preferences file
  3. the user can override the default prefs.yml preferences by setting values in the app. These user-set preferences are then stored in the file specified by the developer in app.yml > preferences filename > user / shared prefs file
Is that right?

Thanks.

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Mon Aug 14, 2017 12:44 pm

When I opened the project on the network drive I got lots of messages of form “A stack with the same name as the one you are trying to load is already open.
Re: the above messages from one of my previous posts

I think (hope) I may have found the problem. I set a lot of behavior script files as stack files of the UI in the app.livecodescript file & use levureAppFolder() for the first part of the path to the behavior script files. However LiveCode hardcodes these paths in the UI .livecode file on saving. So even though I moved the project to a network drive Z: these files were trying to be loaded from the local C: drive on project startup.

When I saved the UI .livecode file after clicking through all the warning messages & clicking the “Open application” button for the Levure app the stack files were then hardcoded as Z:/… in the saved UI .livecode file on disk. The next time I opened the network drive project I didn’t get the “stack with the same name…” messages.

Hope that makes sense!

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Fri Aug 18, 2017 4:56 am

Yes it does. I think if you try setting the stackFiles property by hand (rather than using the PI) then you can use relative paths to the behavior files without the IDE adding the full paths. In LC 9 the PI works properly. In LC 8 there are still some issues with relative paths. I just set the stackFiles by hand and it works for me and I don't have to worry about setting the stackFiles in my code.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Sat Sep 09, 2017 8:29 pm

Trevor,

Testing on an Android device using the uninstall - build apk - install apk works reliably. I'm doing it all the time using the method described in the wiki. We talked a while back in this thread (Jun 15) about the Test button. It would really speed things up if that could work for an Levure Android app the same way it works for a non-Levure one. Could I put in a request for it? I know you'll have another million things on your to-do list but hope you don't mind me asking. I've no idea how complex it would be to get it working.

ps: using Levure all the time and slowly trying more & more features. Wouldn't go back.

Thanks,
Jim

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Sat Sep 09, 2017 11:04 pm

Have you tried `levurePackageApplication "android simulator"`?

https://github.com/trevordevore/levure/ ... -simulator
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Sun Sep 10, 2017 3:55 pm

Hi Trevor,

Thanks for the suggestion.

I spent a lot of time a few months back (pre-Levure) trying to get a simulator for my target Android device working satisfactorily. Gave up in the end when I saw how quick & easy it was to test on the real thing using the Test button. The app I'm working on will be used on a specific tablet model (at least for first phase) so using the real thing lets me see exactly how it will look for users.

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Tue Oct 17, 2017 12:28 am

I’m trying to create an Android app similar to the stack here, only in Levure:
http://forums.livecode.com/viewtopic.ph ... 15#p158077

This uses some javascript to display a PDF file in the same folder. I’ve tested it works on Android.

With Levure I can get a test file I put in <levureAppFolder()>/assets/pdfjs/web/ to display in the browser.

I can also get an empty PDF reader to show by setting the browser URL to <levureAppFolder()>/assets/pdfjs/web/viewer.html

However, in the last case, the default test PDF file that should be loaded from viewer.js in the same folder doesn’t appear in the PDF reader.

Any idea why?

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Tue Oct 17, 2017 1:27 pm

@jim1001 Sorry, I don't. I would suggest making a more detailed description of the setup that works (full folder names of all files being loaded, etc.) and the setup that doesn't work. Then we could compare to see where the differences are and determine where things are going wrong.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Tue Oct 17, 2017 3:09 pm

I wonder if this could be related? Spaces in the filename affect PDF loading in browser widget:

http://quality.livecode.com/show_bug.cgi?id=19226
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply

Return to “Talking LiveCode”