Docset Reader now on LiveCode Share

Are you developing tools to extend the LiveCode environment? This is the place to talk about the nuts and bolts of extending our nuts and bolts. If you want to use a LiveCode or third party Environment extension, visit the Using Evironment Extensions forum.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Docset Reader now on LiveCode Share

Post by jameshale » Thu Nov 01, 2018 2:50 pm

Now at V2

One of my other stacks "Make Docset" produces a Livecode package containing the complete dictionary API as well as all the guides that ship with each version of Livecode. This package can be read by DASH compatible readers that accept user contributed sources.

However not all platforms currently have such apps.

I have made "Docset Reader" to fill that void.

I am hoping it will be simple enough for users to make as a standalone for their platform of choice.

(Note: I am making this available for personal/non commercial use.)

It is available on LivecodeShare.

Also note: it was made with LC 9.01

V2 checks for platform and asks for and moves either a file or folder as appropriate. It also no longer tries to quit if you do not locate one.
Last edited by jameshale on Thu Nov 01, 2018 11:25 pm, edited 1 time in total.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Docset Reader now on LiveCode Share

Post by bogs » Thu Nov 01, 2018 5:21 pm

I feel like such a schmultz, I couldn't get it to work :oops:

Some of what I encountered is apparently the way any Lc past 8.x runs on non recommended distros, some is not.

Knowing that I can't compile from or get the current Lc IDE to work correctly on this distro beyond simple things, I knocked up a Win7 vm and loaded 9.0.1 onto it. I downloaded 'Make Docset' and ran it from the IDE, it appears to have worked correctly. in that it made a folder, copied the dictionary, etc. So far so good!

I then downloaded 'Docset Reader' and opened it after closing out 'Make Docset', with the intent of making it a standalone. It immediately started running and prompted an answer dialog looking for a docset. I closed that dialog, and attempted to make the standalone, which failed with the message that the dialog was already in memory.

Closing everything out, I restarted the IDE and killed messages, then re-opened the reader stack and proceeded to limit the os to 'nix64, then made the standalone. When that completed, I shifted back to the 'nix desktop, set the permissions for execution, and tried to launch it, with no result.

Having failed using that tack, I opened Lc 8.1.2 on the 'nix desktop and opened the reader stack there, since that IDE is *mostly* working on this distro (but still can't save to standalone) thinking I would make sure that it could run on 'nix, so I left the messages enabled. It opened the answer dialog, which I used to navigate to the previously created docset folder, where I chose Info.plist (which seemed like the only choice to make).
Please locate a LiveCode docset package._079.png
Docset folder...
At this point, the following error resulted :
revErrorDisplay_080.png
Rev Error...
revErrorDisplay_080.png (11.7 KiB) Viewed 11450 times
Unfortunately, I didn't have time to look into it further, but may do so later.
Image

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Docset Reader now on LiveCode Share

Post by jameshale » Thu Nov 01, 2018 10:20 pm

Hmm.
I did this on a Mac and perhaps that is the issue.
On a Mac “Livecode.docset” is seen as a file, not a folder (even though it is) and so it is the whole folder that is located and copied.
I will check. Perhaps I need to do a platform check and if not Mac, act on the folder.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Docset Reader now on LiveCode Share

Post by bogs » Thu Nov 01, 2018 10:29 pm

Yah, that sounds like the most likely culprit, certainly on Windows and 'nix it is a regular folder with files inside, not a monolithic file as seen on OSX.
Image

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Docset Reader now on LiveCode Share

Post by jameshale » Thu Nov 01, 2018 11:24 pm

I have updated the reader to check for platform.
If not a Mac it asks for and moves a folder (Livecode.docset).

It also no longer quits if you don't have one.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Docset Reader now on LiveCode Share

Post by bogs » Fri Nov 02, 2018 2:13 pm

Very nice James, that did the trick and it compiled {on / for} Windows 7 and read in the folder, works like a charm there.
Win7Tester [Running] - Oracle VM VirtualBox_079.png
Working on Windows!
Not your programs issue, but compiling from Win to run on 'nix still shows no love, will be looking into it on the 'nix side next.

Some things I did note that may be nice for later (nothing drastic! :wink: )

There is some resize-ability built in, which is great! The field holding the entries though seems a bit overly wide (not sure what it looks like on OSX or 'nix yet though). Is it possible to add a resize routine for that area, like a 'grab/drag' setup or, alternately, set the width of the field to the formatted width of the text, or possibly that + x pixels? If that were possible, I'm guessing you'd be able to shrink it by at least 1/3rd less its current minimum width, which would be helpful on smaller or lower resolution screens.

Aside from that, I didn't notice anything odd jump out at me, and I like how if you click on a major topic in the index, it shows the opening page in the reading pane again, very nice.
Image

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Docset Reader now on LiveCode Share

Post by jameshale » Fri Nov 02, 2018 2:40 pm

So glad it worked.
Funny, for some entries it is not wide enough! Try typing in "abs".
But yes, I did think later a drag target to change the relative widths might be good.
I had only really thought of tablet usage so figured anyone compiling it would adjust things to suit.
I am not sure what non Mac DASH readers are like and certainly don't want to step on any toes.
For MacOS and iOS users DASH is a much better option.
Let us know how it goes with the linux side.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Docset Reader now on LiveCode Share

Post by bogs » Fri Nov 02, 2018 3:44 pm

From the small amount of testing I was able to do so far, apparently there is something different in the way the 'nix side chooses which folder to read in. While your change definitely worked on the Win end of it, on 'nix the chooser just keeps opening folders. Maybe something like (psuedo) -

Code: Select all

if it is "Livecode.docset then
will do it.

Another thing did pop out though on following through on your suggestions, I found that the search doesn't work correctly!
Win7Tester [Running] - Oracle VM VirtualBox_080.png
Search blanked out the index...
That only happened once, on running it the second time, search worked as expected, so maybe a glitch, maybe not.

Searching 'abs' returned all short index entries (less than half the size of the index area), but I took the longer route and pulled it up through the tree to see what it looked like, and saw the 'android' entries can be quite long...
Win7Tester [Running] - Oracle VM VirtualBox_081.png
Android entries...
Despite that, I still think the drag/resize would still be a great resolution as it gives the user the most control, and a scrollbar on the bottom would resolve any width not being wide enough if you prefer to run that area smaller.

Testing it on my 'nix distros usually doesn't go well, since I don't use 'buntu based distros ever with the exception of LMDE, which is only partially 'buntu based. I can't get any of the IDEs past 8.1 to work correctly on them, another reason I tend to stick with the older IDEs which apparently run almost anywhere. Of course, those don't include the cef browser, heh, but then, the cef browser doesn't run on 32bit 'nix either, far as I know.

I'll throw up a supported 'buntu based 'nix vm so that I can (hopefully) give you better feedback on how it works there, but that may take a while.
Image

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Docset Reader now on LiveCode Share

Post by bogs » Fri Nov 02, 2018 6:22 pm

Well, I installed a 'buntu 16.04 vm, Lc 9.0.1 and proceeded to the sample stacks and downloaded the docset maker (which worked flawlessly) and docset reader.

Reader immediately hung the environment, never saw the dialog that popped to pick the docset, or anything else. I know it loaded, because it does show up in the project browser -
Image

So I saved it out locally, and tried re-opening it with the same results. I then force-quit Lc, re-opened it, turned off messages, and tried again but still no love. I'll try a few more tricks and see if I can get it to compile (which will hopefully sort it all out), and report back if any of that works and what steps I took.

*Edit - giving up on 9.0.1 which apparently has something goofy going on with it even on 'buntu, I dropped back to 8.1.5, which at least opened up the script editor at the error 9.x was failing at.
StepOsTesters [Running] - Oracle VM VirtualBox_084.png
ConnId error on 'buntu...
Image

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Docset Reader now on LiveCode Share

Post by bogs » Fri Nov 02, 2018 6:56 pm

Ok, so, having gotten as far as opening it up on 'buntu in 8.1.5, I saved it as a standalone (compiled smoothly, no major issues). Figured I might as well test to see if it would throw that same error running as a SA. It threw no error, and did seem to use the folder for the docset (i.e., it didn't just keep opening folders).

Obviously, though, it isn't going to get past that db connid error, it just fails silently in the standalone.
StepOsTesters [Running] - Oracle VM VirtualBox_085.png
No info...
Where we are at this point, I'm leaving you to test out on Mac :wink:

It works as expected on Win, but was unable to cross compile it to 'nix from there.

Not sure what is going on with the 'nix branch, but obviously there are quirks there that may or may not be related to your stack, which apparently works well enough on 2 out of 3 OSes :D
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Docset Reader now on LiveCode Share

Post by jacque » Fri Nov 02, 2018 7:11 pm

The reader hung the first time I ran it too until I figured out it was taking a long time to load the docset. If I waited long enough it was okay.

In deciding what to do about an Android app, I also noticed the width of the left-side terms field. Phones are usually in portrait orientation so widths are a consideration. I need to decide whether to restrict it to landscape, which will show only a small amount of the definition at a time, or resize everything to portrait.

That said, I do like this implementation. I've tried adapting more than one doc reader for Android and they all have similar issues. I suspect the thing to do here is to move the terms field to the top like the IDE dictionary.

I also got the connection error once and I'm not sure why, but I did notice that the existing db instances were never closed. I don't know if that's related.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Docset Reader now on LiveCode Share

Post by jameshale » Sat Nov 03, 2018 12:56 am

Ok, seems there are cross platform issues I need to look at.
I only ever tested in the IDE :oops: which might explain why I never had these issues.
For me on my machine it is almost instant in loading and drawing the tree.
The docs, once copied into the documents folder, are only ever loaded when an individual one is required. The database only loads once and consists of the entry name, its type and the names of the file with its detail.
Such a simple structure should not take and time.
I will look deeper.
Thanks bogs and Jacque.

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Docset Reader now on LiveCode Share

Post by jameshale » Sat Nov 03, 2018 3:35 am

I made a standalone on my Mac and didn't observe any of the issues reported.
The tree display only slowed a little (less than a second) when I had multiple headings expanded.
I am a bit perplexed.
I probably should have omitted the "Info" and "Font Size" buttons as they are really not required on a standalone given you make the standalone and can move around the stack without them. (I just got carried away with using the SVG icons :D )
To change the font size in the browser display would require a change to the css file within the docset.
Again, not sure if this is something that should be adjustable here or when the user makes a docset.
Food for thought though.
It seems only 3 of us are interested and only 1 has any use for it so I am open to suggestions as to future changes/features.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Docset Reader now on LiveCode Share

Post by jacque » Sat Nov 03, 2018 4:36 am

@bogs, try waiting two or three minutes before deciding LC has frozen. It takes about that long on my Mac. I have no explanation for why. James' scripts run very quickly, but the library that creates the tree view stalls out during a couple of recursive loops. It apparently doesn't do that for everyone, so more feedback would be useful.

I only saw your db error once right at first. I haven't seen it since. I did add a couple of lines that deleted old db IDs, since a new one is created every time the docs load and I was doing that a lot, but I'm not sure that has anything to do with the error.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 474
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: Docset Reader now on LiveCode Share

Post by jameshale » Sat Nov 03, 2018 8:40 am

I uploaded another version (V3) as I really discovered my idea of cross platform was sketchy to say the least.
In doing this I discovered that some of the libraries required probably weren't loaded when they were called.

from the docs...
Note: In a standalone application the Common library is implemented as a hidden group and made available when the group receives its first openBackground message. During the first part of the application's startup process, before this message is sent, the revCopyFile command is not yet available. This may affect attempts to use this command in startup, preOpenStack, openStack, or preOpenCard handlers in the main stack. Once the application has finished starting up, the library is available and the revCopyFile command can be used in any handler.

similarly for revCopyFolder

• I moved the "getDocs" call to an opencard handler (with checks to only run on launch.)
This allows for the common library module to load.
• The upload new docset handler now also differentiates between platforms and
deletes previous docset first. It will also announce any error.
• Current SQLlite connection now closed before new one is opened.

Post Reply

Return to “Making IDE Plugins”