AndyObtiva/glimmer

Glimmer Video Request +1 - a dedicated video for "styling glimmer" applications

rubyFeedback opened this issue · 3 comments

Hello there Andy,

You are now at video number #35. So I had this mostly ad-hoc request.

Do you think you could add a specific video (does not have to happen
soon, perhaps some day in the future) about "styling glimmer"? That
is specifically to style glimmer-apps in different ways.

This means colours of course, different fonts (when possible) but
also certain effects, e. g. fade-in or fade-out (if these are
possible; in ruby-gtk3 + CSS this is doable for some elements
for instance). You could also show transition effects in drawable
widgets - I also classify this as "styling". Padding and margin
too.

So the idea would be that if someone wants to learn glimmer, and
wants to make it "look prettier", one could point at that video.

(If you already showed this then please ignore this here - I
watched some of the videos partially, but not all so I may not
know all of them.)

This can be shorter in length than normally, so perhaps around
10 minutes or so, however you feel to fit "naturally" content into
a video that relates to the theme/topic styling. (Would be cool
if this could be applied to both desktop and web-use, but this
is an aside.)

Either way please feel free to disregard/close/proceed as you
wish, like always. Time is a finite resource after all. :)

PS: A bit off-topic, but I wanted if there is a glimmer support
for a RESTful API, e. g. to use a REST-API like in rails or
sinatra but have this be mapped 1:1 onto a widget automagically
if possible. Not sure how this could look, but it would be nice to
have this available in a standalone widget too, without needing
to start sinatra and then use a browser, for instance. Kind of like
making this all doable within a widget.

You're not supposed to do too much styling in desktop apps or even transitions. That's the whole point of desktop app development being very quick and productive. You would be missing the point or defeating the point completely if you try to break away from operating system desktop style guides and do too much styling for a desktop app.

That said, I did cover how to handle layouts, which relate to margins and paddings, in video tutorial 4:
Glimmer DSL for SWT Video Tutorial 4 - Hello, Layout!

Also, you can check out Glimmer DSL for SWT samples (like Hello, Table!) for examples of how to change font, foreground color, and background color for Glimmer DSL for SWT widgets, but ideally, you would learn about all of that by checking each widget's API in the SWT Javadoc:
https://www.eclipse.org/swt/javadoc.php

Especially the general Control API (which includes setFont, setBackground, and setForeground that translate into simply font, background, and foreground in Glimmer GUI DSL):
https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Control.html

In any case, SWT does support CSS too, but I did not expose that support through Glimmer DSL for SWT directly yet. Still, I'm sure a diligent software engineer could figure out how to use that support from Glimmer DSL for SWT. If you do figure it out, you can contribute back to the community by writing a blog post about it and informing me of it to include it on the project page.

Also, the Nebula custom widget library for SWT does include support for Transitions. You would have to check the Nebula master docs for examples of how to use it.

transitions

PS: A bit off-topic, but I wanted if there is a glimmer support
for a RESTful API, e. g. to use a REST-API like in rails or
sinatra but have this be mapped 1:1 onto a widget automagically
if possible. Not sure how this could look, but it would be nice to
have this available in a standalone widget too, without needing
to start sinatra and then use a browser, for instance. Kind of like
making this all doable within a widget.

So, I'm a bit surprised you are asking for this because I did demo at the very end of the last tutorial (35) how to turn any web application (website) into a desktop app AUTOMATICALLY. If you had followed the same instructions and checked the scaffolded code, you would learn that it is done by wrapping a website with the browser widget

Check out Hello, Browser! for an example:
https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_SAMPLES.md#hello-browser

Here is a web app URL that is converted into a desktop app:
web app

Also, if you mean using RESTful API to pull data into a Glimmer DSL for SWT app, then there is NOTHING special here. You just write pure Ruby code to call out the RESTful API using net/http, httparty, faraday, rest-client or any of the other Ruby gems that Ruby offers.

I do provide an example of a RESTful app in the Weather sample (which includes styling examples too):

weather

It pulls weather using a REST API. You can read the code here:
https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/weather.rb

I am closing this ticket because I believe I addressed it fully for now.

By the way, here is a quick example of a styled label in Glimmer DSL for SWT (most widgets are styled the same way):

      label {
        layout_data :center, :center, true, false
        
        text 'BASEBALL PLAYOFF SCHEDULE'
        background :transparent if OS.windows?
        foreground rgb(94, 107, 103)
        font name: 'Optima', height: 38, style: :bold
      }

Here is how it looks in Hello, Table!:

hello table

PS: A bit off-topic, but I wanted if there is a glimmer support
for a RESTful API, e. g. to use a REST-API like in rails or
sinatra but have this be mapped 1:1 onto a widget automagically
if possible. Not sure how this could look, but it would be nice to
have this available in a standalone widget too, without needing
to start sinatra and then use a browser, for instance. Kind of like
making this all doable within a widget.

Upon further thought, I am not sure if I fully addressed or even understood your request about the RESTful API mapping to widgets here.

If possible, please explain to me in more details and give me examples of what you want.

One guess is if I pull data with a REST API that gives me a collection of Person models, which have first_name, last_name, email, address, date of birth, and salary for example, then you want the GUI to automatically display this data, selecting the right widget per Person model attribute depending on attribute type.

This can be offloaded into a separate ticket for Glimmer DSL for SWT:
AndyObtiva/glimmer-dsl-swt#27

Eventually, once implemented, it could be ported to Glimmer DSL for LibUI (and other Glimmer toolkits too)