GUI to manage width of the IceWM toolbar

Forum Forums antiX-development Development GUI to manage width of the IceWM toolbar

  • This topic has 46 replies, 9 voices, and was last updated Jan 1-1:43 pm by Robin.
Viewing 15 posts - 31 through 45 (of 47 total)
  • Author
    Posts
  • #127279
    Member
    PPC

      Many thanks, Wallon- I can’t really test of comment right now- I trust that the .pot is ok… If possible, anyone with permissions, place it up for translation on Transifex, and I’ll try to help localize it to pt-pt when I can…

      P.

      #127309
      Member
      Wallon

        Thank you very much anticapistalista.

        #127542
        Forum Admin
        anticapitalista

          @PPC – There is one (big) problem with the new script.
          RAM use is almost 100MB!
          I remember now that I tried replacing our control centre (gtkdialog) for one using yad (like you have done) and scrapped the idea after seeing the huge increase in RAM usage.
          It seems that gtkdialog is a much better tool for this ‘style’ than yad is.

          Philosophers have interpreted the world in many ways; the point is to change it.

          antiX with runit - leaner and meaner.

          #127563
          Member
          PPC

            @anticapitalista – the memory footprint is because each yad tab is it’s own yad instance – I know no way around that.
            Tomorrow I may try to take a look at how antiX Control Centre script works and try to adapt IceWM Control Centre to run on gtkdialog – but I make no promisses- I know just bash scripts and yad… this means I’ll have to try to learn a new tool from scratch…

            P.

            #127565
            Moderator
            Brian Masinick

              100 MB *seems* like a lot of resources for a very simple task, though in comparison to Web browser usage, that’s nothing.
              Still it makes me wonder what the overhead is? Meanwhile, if gtkdialog is that much more efficient, perhaps it’s worth
              leveraging it as much as possible.

              I’ll see if I can spot any resources to speed start usage; if I find anything I’ll share the reference.

              --
              Brian Masinick

              #127567
              Moderator
              Brian Masinick

                I don’t know how much this will help, but here’s one quick reference I found:
                https://valadoc.org/gtk+-3.0/Gtk.Dialog.html

                Here’s another one with a different set of tables, descriptions and examples:
                https://blogs.czapski.id.au/tag/gtkdialog-bash-examples

                And this:

                https://blogs.czapski.id.au/tag/gtkdialog-bash-examples

                all of them appear to have multiple pages so you can figure out how to add
                buttons, headers, content, etc.

                At least it’s something to learn from. Does anyone beside anticapitalista
                also have experience with these; any simple examples to show @PPC and anyone
                else who may want to create easy gtkdialog interfaces to lean, efficient
                tools?

                --
                Brian Masinick

                #127568
                Moderator
                Brian Masinick

                  A guy in the PCLinuxOS forum wrote some stuff, maybe this could be helpful too:

                  https://pclosmag.com/html/Issues/201404/page12.html

                  --
                  Brian Masinick

                  #127585
                  Member
                  Robin

                    @PPC: Here’s my “secret” source of gtkdialog knowledge. Original site is no longer available.
                    https://web.archive.org/web/20160911043808/http://01micko.com/reference/button.html#note2
                    Follow the links in it’s footer line to see details about all the other “widgets” (not sure about this wording, widget translates for me to something like fiddle-faddle or hokum).

                    When writing in gtkdialog you need to think in xml and dash additionally to plain bash.
                    To check out how it works you could analyse the code of aCSTV script or antiXscreenshot2, which both make use of it to a large extent. In the end it’s nothing but putting some Lego bricks together, wrapped in xml tags. You can orient yourself by the nested indention I’ve applied (indention not mandatory as in python); mandatory is each opening tag must be complemented by a respective closing tag, and the tags can be nested. It’s just as in simple html.

                    To structure the GUI displayed use hbox and vbox tags along with frame tags in gtkdialog. See https://blogs.czapski.id.au/tag/gtkdialog-examples (this is another of my knowledge sources on this topic, and it is truly inexhaustible), mentioned already by Brian, and search in this page for section „Using eventboxes to add frames to objects” and scroll down a bit to all the poison-green and blue screenshots at the end of this very section to get an idea how all this nesting of frames and boxes works.

                    There is one (big) problem with the new script.
                    RAM use is almost 100MB!

                    and scrapped the idea after seeing the huge increase in RAM usage.

                    I’ve a similar issue in aCSTV, and it uses gtkdialog. Due to some shortcoming of gtkdialog (or maybe it’s my own lack of knowledge), for each button an individual full set of action events needs to be sent to each other button. The action line wouldn’t accept a variable instead to send a single action to a specific button, which would suffice, so the signals have to be sent to all buttons instead, again and again. The consequence is, the more stations you have in your list, the more RAM will be used, up to 25MB for very huge lists. (check cat /dev/shm/aCSTV-*01.tmp while it’s started; this endless repetition could be twenty lines merely if gtkdialog just would accept the variable, then it would use some kB merely instead)

                    this means I’ll have to try to learn a new tool from scratch…

                    And then please be aware: there are three levels of coding language to be observed while writing the action lines in gtkdialog.
                    – The first level is the bash syntax from your bash script you are writing. That’s trivial.
                    – The second level is the gtkdialog specific tag syntax.
                    – The third level is the sh/dash on which gtkdialog runs the commands internally.
                    You have to satisfy all three of them the same time. This makes it pretty tricky to get what you want in the end. Unfortunately these three contradict each other sometimes in their requirements, e.g. quoting or use of arrows. So if you get it right for bash and gtkdialog, the execution fails on the internal dash gtkdialog is handing over the code to for processing. Same if you get it right for bash and dash, it fails in gtkdialog. That’s a true language level hell (analogue to dependency hell). And you can’t rely to get back the result when stored in variables, since the dash process isn’t able to read variables from your bash script on runtime and vice versa while gtkdialog has it’s own set of variables again, not accessible from neither bash nor dash. That’s why you need to use temp files instead for each and everything, complicating things more and more.

                    Probably a true, well trained programmer will smile about this, knowing how to do it right.

                    Good luck, PPC, with mastering gtkdialog.

                    Robin.

                    Windows is like a submarine. Open a window and serious problems will start.

                    #127608
                    Forum Admin
                    anticapitalista

                      @PPC – I’m not expecting you to learn gtkdialog.
                      I’ll see if I can convert the yad stuff to gtkdialog (using antixcc.sh as a model).

                      Philosophers have interpreted the world in many ways; the point is to change it.

                      antiX with runit - leaner and meaner.

                      #127612
                      Member
                      PPC

                        @anticapitalista- I just read your post.
                        I tried to adapt the script from yad to gtkdialog. The result is far from perfect, but almost production ready.

                        TODO:
                        1- Change the main window icon to the one used by IceWM CC
                        2- Add the main text to all tabs, the warning that if an option fails to work it should be clicked again a second time
                        3- better configuration of where icons are placed
                        4- The “Show weather icon” is not working… I’m trying to debug it

                        P.

                        • This reply was modified 6 months, 3 weeks ago by PPC.
                        Attachments:
                        #127615
                        Member
                        PPC

                          Found the simple problem with the weather entry
                          I also cleaned up the code a bit

                          I also noticed that the “Manually edit conf files” button is missing…

                          The way I ported this script to gtkdialog was because I did not really learn how to program it, I “cheated” and adapted antiX’s Control Centre code… :-)

                          P.

                          #127620
                          Member
                          PPC

                            It seems that this is the last version of the script that I’ll write in 2023…

                            Change log:
                            -Added information to click option again if it initially fails to work (it’s a new string that has to be localized)
                            -added button to manually edit config files
                            -reordered a few icons

                            To do:
                            – Change window icon (I can’t figure out how to do it)
                            – Remove empty space that appears on the left of the icons (it was not there when I started creating the file, and I do not know what caused it)

                            As it, the script is production ready – no real bug that stops it from working. The yad script looked much better… but then again, was much, much heavier…

                            P.

                            #127627
                            Moderator
                            caprea

                              Many thanks, PPC!

                              #127664
                              Member
                              PPC

                                Thanks, Caprea!

                                I found out what causes the empty space to the left of the buttons (between the buttons and the tabs): gtkdialog seems to find it’s a good idea to insert that space any time it finds buttons that include “/” in their text. Most buttons include that character (ex: “on/off”).

                                I can say that I agree with what Robin implied – gtkdialog may be light on system resources, but it’s the most unintuitive piece of software I ever tried to work with! Inserting spaces because of a button’s contents? Having to create a file to store the functions we want the main script to use? It cleary was developed by someone that created a tool for their own use, not giving a crap about it’s usability by other people… sigh. at least it’s FOSS and light on system resorces.

                                I still have no idea why the gtk window sticks with the original Control Centre icon- I simply can’t convince gtkdialog to use a different icon, for some odd reason… man, I’m glad that when I started creating GUI’s for antix I found out about yad… if I was forced to used gktdialog, I can asure you I would haven given up on the very first days.

                                Does anyone know of any other way to create GUI’s that does not imply learning a programming language, like Python, etc? We have yad (that’s a fork from another program called Zenity), and spacefm/zzzfm that can create “simple” GUI’s…

                                Now that I know some of gtkdialog quirks I can try to use it on future scripts, but they will have to be very, very simple, or I’ll have a mental break down.

                                P.

                                • This reply was modified 6 months, 2 weeks ago by PPC.
                                #127668
                                Member
                                Robin

                                  @PPC: Just replace all slashes u002f by typographically identical signs u2215 in all buttons, then it should work. I ran into this very issue long ago while writing aCSTV, and now reused it somewhere in antiXradio code.

                                  Does anyone know of any other way to create GUI’s that does not imply learning a programming language, like Python, etc?

                                  Yes. You can just use it in bash, check out antiXscreenshot2 and aCSTV, as said before. That’s all pure bash.

                                  I simply can’t convince gtkdialog to use a different icon

                                  It expects named icons.

                                  You can register icons manually for testing.
                                  sudo xdg-icon-resource install --novendor --mode system --size 48x48 '/usr/local/lib/antiXradio/icons/48x48/antiXradio.png'

                                  And anticapitalista knows a way to mass register them, if I got it properly from his above posting.

                                  or I’ll have a mental break down.

                                  :) you can ask me before doing hara-kiri. By far I dont know all about it, but the one or other stumbling block I have already mastered with this thingy, so if I I can help you with some advice, I’ll do my very best.

                                  if I was forced to used gktdialog, I can assure you I would haven given up on the very first days.

                                  That was precisely my feeling when starting with it. But then I realized it isn’t that bad, you can do really nice things with it you can’t with yad. Make extensive use of the resource I called above my ‘secret’ source. There you’ll find many many answers how to control the workflow within the dialog itself once it runs, so not everything has to go in files. Instead use the functions, actions, events, signals and conditions provided by the “widgets”.

                                  Windows is like a submarine. Open a window and serious problems will start.

                                Viewing 15 posts - 31 through 45 (of 47 total)
                                • You must be logged in to reply to this topic.