Pave, sort of geometry manager

Difference between version 20 and 21 - Previous - Next
The [https://aplsimple.github.io/en/tcl/pave/index.html%|%apave v3.2.7%|%] package provides a sort of geometry manager for Tcl/Tk.

The ''apave'' isn't designed to replace the existing Tk geometry managers (''place, pack, grid''). Rather the ''pave'' tries to simplify the window layout by using their best, by means of:

   * joining the power of ''grid'' and ''pack''
   * uniting the creation of widgets with their layout (and mostly their configuration)
   * minimizing a coder's efforts at creating / modifying / removing widgets
   * setting a natural tab order of widgets
   * theming both ttk and non-ttk widgets
   * centralizing things like icons or popup menus
   * providing ''mega-attributes'', right up to the user-defined ones
   * providing ''mega-widgets''

The ''apave'' is implemented as ''APave'' oo::class, so that you can enhance it with your own inherited / mixin-ed class.

While ''APave'' oo::class allows to layout highly sophisticated windows, you can also employ its more 'earthy' descendants:

''APaveDialog'' and ''APaveInput'' allow you:

   * to call a variety of dialogs, optionally using a "Don't show again" checkbox and a tagged text
   * to use a variety of widgets in dialogs, with entry, text, combobox, file content combobox, spinbox, listbox, file listbox, tablelist, option cascade, checkbutton, radiobutton, label, title label
   * to resize windows neatly (however strange, not done in Tk standard dialogs)

The theming facility of ''apave'' is enabled by ''ObjectTheming'' oo::class which embraces both ttk and non-ttk widgets.

Along with standard widgets, the mentioned ''apave'' classes provide a batch of following ''mega-widgets'':

   * file picker
   * saved file picker
   * directory picker
   * font picker
   * color picker
   * date picker
   * menubar
   * toolbar
   * statusbar
   * file combobox
   * file listbox
   * file viewer/editor
   * option cascade
   * e_menu
   * bartabs
   * link
   * baltip
   * gutter

At last, a stand-alone dialog allows not only to ask "OK/Cancel" or "Yes/No" returning 1/0 but also to set environment variables to use in shell scripts.

The ''apave'' originates from the old ''pave'' package, to comply with [https://wiki.tcl-lang.org/page/How+to+build+good+packages%|%How to build good packages%|%] ("avoid simple, obvious names for your namespace"). Let it be a sort of ''a-pave''.

** **

'''Further details:'''

[https://aplsimple.github.io/en/tcl/pave/index.html%|%Description%|%]

[https://aplsimple.github.io/en/tcl/pave/apave.html%|%Reference%|%]

** **

'''Download link:'''

[https://chiselapp.com/user/aplsimple/repository/pave/download%|%pave.zip%|%]


** **

'''Gallery of demos:'''

[https://github.com/aplsimple/pave/releases/download/apave-3.2.7/apave.3.2.7.mp4%|%Overview of apave%|%]

[https://github.com/aplsimple/pave/releases/download/apave-theming.3.2.5/apave-theming.3.2.5.mp4%|%Theming in apave%|%]

[https://github.com/aplsimple/pave/releases/download/apave-links.3.2.7/apave-links.3.2.7.mp4%|%Links in apave%|%]

[https://github.com/aplsimple/pave/releases/download/apave-dialogs.3.2.7/apave-dialogs.3.2.7.mp4%|%Dialogues in apave%|%]

** **

Below are some screenshots, just to give a glance at this stuff.

** **

[https://aplsimple.github.io/en/tcl/pave/files/findreplace.jpg%|%PaveMe example%|%]

''Figure 1. PaveMe example described line by line in https://aplsimple.github.io/en/tcl/pave/index.html#example_Pave ''

** **

[https://aplsimple.github.io/en/tcl/pave/files/test2.png%|%test2_pave.tcl demo%|%]

''Figure 2. Screenshot of test (test2_pave.tcl)''.

** **

[https://aplsimple.github.io/en/tcl/pave/files/test2t.png%|%test2_pave.tcl demo themed%|%]

''Figure 3. The same as above, just themed''.

** **

[https://aplsimple.github.io/en/tcl/pave/files/test2nt.png%|%test2_pave.tcl demo themed%|%]

''Figure 4. Themed non-ttk widgets''.

** **
----[Jeff Smith] 2021-01-21 : Below is an online demo using [CloudTk]. This demo runs "Pave, sort of geometry manager" in an Alpine Linux Docker Container. It is a 29.8MB image which is made up of Alpine Linux + tclkit + Pave-sort-of-geometry-manager-3.2.78.kit + libx11 + libxft + fontconfig + ttf-linux-libertine + tzdata. It is run under a user account in the Container. The Container is restrictive with permissions for "Other" removed for "execute" and "read" for certain directories.

[Jeff Smith] Without looking at the code this demo appears to disconnect at times. I think it maybe because  when changes occur the Tk app gets "Restarted" and [CloudTk] disconnects the session if the Tk app disappears.

<<inlinehtml>>

<iframe height="700" width="800" src="https://cloudtk.tcl-lang.org/cloudtk/VNC?session=new&Tk=Pave-sort-of-geometry-manager" allowfullscreen></iframe>

<<inlinehtml>>

----
'''[aplsimple] - 2021-01-21 09:37:22'''

Hi Jeff,

Thanks for your attention, I'm kinda touched.

As for restarting, you could imitate it with this start of ''test2_pave.tcl'':

     test2_pave.tcl 0 14 12 "middle icons"

where:

   * 0 means "Mild dark" color scheme
   * 14 is a font size
   * 12 is an answer to "Restart test?" warning (i.e. "No" + "Don't show again")
   * "middle icons" means an icon set

By the way, this start resolves a problem with color schemes: when CS is set at start, no blinking occurs at switching tabs, resizing etc.

Also, I have to note that ''test2_pave.tcl'' is a test & demo, i.e. something preparatory. Hopefully, it would be followed by something real.

Regards,
Alex
----
[Jeff Smith] 2021-01-22 : Hi Alex, I made the changes as suggested. With the increased font and icon sizes, it may be better to click on the noVNC control bar tab at the side of the iFrame and select "Fullscreen" for viewing this demo.
----
'''[aplsimple] - 2021-01-22 18:08:07'''

Hi Jeff,

Perhaps, it makes sense to insert ''tklib0.6/widget/calendar.tcl'' (or ''tklib0.6/widget'' or entire ''tklib0.6'') into the image and maybe into other ones. Otherwise, at least in this specific demo, the date picker isn't called.

I've updated [https://chiselapp.com/user/aplsimple/repository/pave/download%|%pave.zip%|%] to disable all of "Restart" options when started from [CloudTk]. Hopefully it will work.

The "Mild dark" color scheme (0 in the above example) may seem too dark/gloomy for Australian, nay, for anyone. If so, you might try a light CS, e.g. Sandy (12), Florid (19), LightGreen (20), TKE-YellowStone (28)... After all, it's your kingdom of [CloudTk] and you are the king, not?

The ''Fullscreen'' mode runs like a dream :)
----[Jeff Smith] 2021-01-27 : Calendar is now working but may not appear as expected due to the "matchbox window manager". Also the clocks are displaying correctly with the inclusion of the "tzdata" package in the Alpine Linux Docker Container. Now running apave v3.2.78.

<<categories>> GUI | Dialog | Widget