mwieder wrote: ↑Mon May 10, 2021 11:21 pm
m
Ah. I see. You're working with images on disk and not already imported into the stack.
Yah, kinda, they start out on the web, and for now come down to the folder the application is in, then get imageSourced directly from there.
And I'd be remiss not to ask "why?" because your stack will be limited to just working in that one location.
Not really, wherever the application is put, the pictures will follow.
But I'm sure you're aware of that and you're going to surprise us with some totally gnarly application.
LOL ! More like disappoint you with an application a 3 year old could write hahha. Here is the low down on why I am looking at this, and how it got to here.
(For the easily bored, I suggest moving on to the next thread you were going to look at
)
Andy P. resurrected something called "1001 things to do with Lc". Reading it, I came across a post by Jacque talking about how she had made a weather widget before there were such things. Linux has many fine weather widgets, but for whatever reason, many of them have problems. They either -
are based on weather sites in countries other than the U.S. (where I am) or...
like my favorite one, work for a time then don't work or...
act weirdly (crashing the panel for instance)...
something else, like look too garish for my tastes, etc.
Jacque's post on 1001 things just prompted me to attempt making one of my own, that is all.
Someone else (James) posted about
Free APIs, which are certainly the easier way to go about this, but I had some problems with that approach as well, the main one being that I didn't want to have to sign up for anything (like a key), and I know that api formats can be changed (out of my control).
Besides that, I often want to scrape a webpage and I figured building this from scratch would let me find ways to do just that. Unfortunately, while I can scrape the page just fine, the methods I'm using are far less universal at this point that you would need for a general scraper. They are, however, good enough to have produced these results for my home made weather thingie -
About the directions I've taken in doing this app -
I initially loaded the images directly from the website into an image object that had a matching field paired in size that I could set the scroll to independantly, and grouped the 7 pairs, set the background of the group to white, and that worked the best so far for display.
Any forecast larger than the picture popped up a scroller, if it was the same height (or less) it didn't. It also looked like a one page unified document. However, it was rare that I saw too many forecasts that exceeded the size of the picture, which started me looking at imageSource and the htmlText version <img src> tags.
After muddling around with those tags, and seeing how some tags could include subsections controlling size etc, I began to wonder whether other tags could be similarly expanded, not as actual html, but something like Lc's version of html.
I think I will likely roll it back to the individual image object + paired field in a group set though, as that seems to work best for alignment.
As for the images themselves, and whether things can be moved around, I could take them directly from NOAA's addresses, but that seemed to take longer to do than just downloading them locally to the app's folder and then displaying them. Not horrifically longer mind you, but enough longer to be an irritation.
I also decided to make my coding easier to save them as the final name instead of something incomprehensible like "sct.png".
I'll keep the downloading / renaming part of it, simply because it gives me an easy way to match the picture to the text it sits beside.
If your still awake, that is the whole story, pretty low level code (much of which is brute force stuff), put an entire webpage into a variable, use lineOffset to reduce the amount of code to wade through, replace unusable tags with Lc tags for formatting, then display it as the Lc version of html in a 2nd field.
The simple html utility above like I said was just so I didn't have to keep popping the dictionary up to look at certain things, and to find out what those things looked like by copying / modifying the source code in the top box.