Giter VIP home page Giter VIP logo

[Idea / Suggestion] "Glimmer components": the idea is to have different glimmer widgets, no matter the style, that could be integrated / included and re-used. For instance, rubio-radio to be embedded in a tabbed notebook with a weather-displaying widget about glimmer HOT 3 CLOSED

andyobtiva avatar andyobtiva commented on May 28, 2024
[Idea / Suggestion] "Glimmer components": the idea is to have different glimmer widgets, no matter the style, that could be integrated / included and re-used. For instance, rubio-radio to be embedded in a tabbed notebook with a weather-displaying widget

from glimmer.

Comments (3)

AndyObtiva avatar AndyObtiva commented on May 28, 2024

I didn't finish reading your very long message, but half-way through reading it, I know the answer already.

What you ask for is ALREADY supported!

It's part of the reason why I encourage people to now build Glimmer DSL for LibUI apps with include Glimmer::LibUI::CustomWindow or Glimmer::LibUI::Application. If you build your app that way, it AUTOMATICALLY becomes a REUSABLE custom control (custom widget) that you can EMBED in another app!

I am in the middle of watching a baseball game. When I have some free time, I'll finish reading your message and respond with some examples.

Cheers and keep the ideas coming! But, I also hope to see more contributions or complete works from you in the future in addition to ideas! Open-source is always a two-way street.

from glimmer.

AndyObtiva avatar AndyObtiva commented on May 28, 2024

Here is an example of reusing an app as a component (as I mentioned it is already supported).

First run this command under CRuby:

gem install rubio-radio

Next, add the following code to a file called launcher.rb:

require 'glimmer-dsl-libui'

# import reusable component defined with `include Glimmer::LibUI::CustomWindow` in Rubio-Radio
require 'rubio/view/radio' 

include Glimmer

# instantiate the custom window component called `radio` from Rubio-Radio, and pass `backend: 'vlc -I rc'` required option.
radio_window = radio(backend: 'vlc -I rc')

window('Launcher') {
  margined true
  
  vertical_box {
    label(' Click on one of these buttons to launch an app. ') {
      stretchy false
    }
    
    button('Rubio Radio') {
      stretchy false
      
      on_clicked do
        radio_window.show
      end
    }
  }
}.show

Now, run:

ruby launcher.rb

You should get this screen:

Screen Shot 2022-09-04 at 2 57 08 PM

Afterwards, you can click the button saying Rubio Radio, and you get this screen:

Screen Shot 2022-09-04 at 2 57 28 PM

By the way, components are called "Custom Keywords" in Glimmer DSL for LibUI. I know I've mentioned them to you before in other issues:

https://github.com/AndyObtiva/glimmer-dsl-libui#custom-keywords

From the link above: "Custom keywords can be defined to represent custom controls (components) that provide new features or act as composites of existing controls"

In Glimmer DSL for LibUI, components that are represented by Custom Keywords are either Custom Controls (including Area-Based Custom Controls) or Custom Windows. All of that is mentioned in the last link shared above.

Every application written with an entry point class that has include Glimmer::LibUI::Application or include Glimmer::LibUI::CustomWindow will become a reusable custom window component that you can launch from another app as a separate window.

Also, if the application author exposes the main body of their custom window as a separate custom control mixing include Glimmer::LibUI::CustomControl (representing what you call the core component or meat of the window), then you can embed their main GUI directly in your application's window instead of launching as a separate window, by doing the same thing as in the code above, but embedding the custom control directly under a vertical_box or tab_item for example.

(In Glimmer DSL for SWT, components are either Custom Widgets, Custom Shells (custom windows), or Custom Shapes)

Sometimes I wonder if you've paid any attention to what you read in Glimmer DSL for LibUI documentation or what you learned from its examples. The support for components was mentioned many months ago. I am surprised you asked for it in a new issue instead of simply knowing it exists and just using it successfully as demonstrated in examples.

I think you have a memory problem. Every once in a while, I mention to you all sorts of supported features, but you forget them a month later as if I never mentioned anything. Or, you ask me a question in an issue, I tell you no, and then a month later, you ask me the same question again. You might need to lighten up the load of your work on you. If you are working too hard, then work is hurting you. Or, maybe spend more time refreshing your soul with Christian worship. That helps people refresh their mind and body, and maintain strong memory and thinking faculties. I can attest to it as I go to Church and pray to God regularly.

Anyways, I'm closing this issue because it is already supported.

from glimmer.

AndyObtiva avatar AndyObtiva commented on May 28, 2024

About this part of your write-up:

The ideal thing would be where we could integrate all different
libui projects, no matter the "style" (DSL, or classic/original
verbose LibUI or monkey-patching fiddle).

I write this a lot about libui, but this could be extended to
the whole glimmer suite, where we can integrate glimmer with
other widgets, even if they don't use the glimmer DSL. I assume
you would prefer more applications in the glimmer DSL, but it
is not necessarily trivial to learn (well, not for everyone),
so this could be a baby step towards people becoming more
familiar with glimmer slowly, and gradually.

This is completely wrong!

Everyone must be using Glimmer DSL for LibUI because it is 100% simpler in ALL cases than writing C-style code in Ruby.

What you're proposing is like asking developers to write Assembly code in Ruby. That's what using the LibUI C binding directly feels like. That is a non-starter. Only an intentionally idiotic programmer would try to write Assembly code in Ruby instead of just writing Ruby style code via a friendly Ruby DSL. There is ZERO value in supporting idiotic actions like that.

The whole point of Glimmer is to enoucrage everyone to write 1/2 to 1/10 of the code that is automatically protected from memory garbage collection problems and pointer issues using Glimmer DSL for LibUI. We don't want to encourage stupidity. Otherwise, writing Ruby GUI applications will be just as bad as it always was without using Glimmer, which is the reason why not many people use Ruby for building GUI apps. We intentionally do NOT want to support such applications and want to discourage them completely. If people want to choose to be idiots, they are alone in their path. I do not support idiotic actions and do not want idiots using Glimmer. I only want smart people using Glimmer who either get Glimmer right away intuitively or are quick learners and will see why Glimmer DSLs provide the simplest way possible for building GUI.

This is exactly like how DHH didn't want Java and PHP idiots in the past polluting Rails with their awful ideas. Because they wanted to support idiotic things like dependency injection and embedded queries in the view. He just ignored them. And, the badness of their ideas shows up in their work. A website written in Java that is trying to do what Rails does will be least 4 times the amount of code if not more, and is much more complex. Thankfully, DHH was smart enough not to support idiots who want to build idiotic apps like that while claiming Rails was not good for everyone

from glimmer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.