📜 ⬆️ ⬇️

Visual Tcl. GUI Development for Command Line Utilities (Continued)

In the previous article, the tkBuilder constructor was considered as a tool for creating a graphical interface for Tcl / Tk command line utilities. The constructor is good, but as noted in the article it also has a number of drawbacks, the main one being the lack of support for UTF-8, and, consequently, the Russian alphabet. Another flaw was noted by merlin-vrn . This is currently support only Tcl / Tk version 8.4.

But in the comments from the user svk28 , the Tck / Tk-based Visual Tcl constructor was mentioned:

image

After preliminary acquaintance, it was decided to use it in business, especially since the previous material actually remained unfinished, if you look at it from the point of view of the declared goal - to give a graphical shell to command line utilities, with which you can access the PKCS # 11 cloud cryptographic token . Therefore, it is time to develop a graphical interface for the second utility, namely ls11cloud_config:
')
bash-4.3$ /usr/local/bin64/ls11cloud_config LS11CLOUD User Utility usage: /usr/local/bin64/ls11cloud_config <command> [-p <password>] [-n <new password>] Commands: register <host> <port> <id> - register new user on the server duplicate <host> <port> <id> - duplicate user account on other computer change_pswd - change SESPAKE authentication password status - display current configuration data log - display server log file recreate - re-create token to initial empty state unregister - remove all user files from the server NB: Don't use non-latin letters to avoid encoding problems! Copyright(C) Ltd (http://soft.lissi.ru) 2017 bash-4.3$ 

First of all, it was checked which version of Tcl / Tk supported Visual Tcl. It turned out that version 8.6, which is installed on my computer, is supported by the Visual Tcl designer:

 bash-4.3$ cd ../vtcl.vtcl-8.6-master bash-4.3$ ./configure Using /bin/wish8.6 bash-4.3$ 

The first launch of the designer did not inspire, it was too many windows appeared on the desktop:

image

But looking around it turned out that a couple of windows (news feed - Visual Tcl News and you know it - Did you know) can be closed without any damage to the work. And it turns out that there are already not so many windows and, if necessary, they can be periodically hidden.

A pleasant surprise was the presence of his easel for each widget of the toplevel class:

image

Our project required three toplevel widgets and, accordingly, we had three easels at our disposal:

1. GUICloudConfig widget, the main window with utility functions ls11cloudconfig (see above);
2. Password widget, which is somehow involved in all functions:

image

3. Widget CloudToken, which is used in the functions of registering and duplicating a cloud-based cryptographic token:

image

And there are no problems with “a great, powerful, truthful and free Russian language!” (I.S. Turgenev).

Note one feature of the Visual Tcl designer. It is associated with editing functions. Changes made to the functions will not be included in the project until the window in which the function is edited is closed:

image

Note also that the project in the understanding of Visual Tcl is saved as a Tcl / Tk file (* .tcl) and can be executed at any time by itself without additional conversions. The reverse is not true, not every Tcl / Tk file will be considered by the designer as its own project.

Another very useful thing brought the Visual Tcl project - the ability to save the project in binary code. For this purpose, the freewrap utility is involved , which turns the Tcl / Tk scripts into single-file executable programs. So both of us, the scripts implementing the graphical interface for the utilities p11conf and ls11cloudconfig, have been converted into executable programs:

 bash-4.3$ ls GUITKP11Conf.tcl LS11CLOUD_CONFIG.tcl bash-4.3$ bash-4.3$ freewrap GUITKP11Conf.tcl bash-4.3$ freewrap LS11CLOUD_CONFIG.tcl bash-4.3$ ls GUITKP11Conf LS11CLOUD_CONFIG GUITKP11Conf.tcl LS11CLOUD_CONFIG.tcl bash-4.3$ 

Now we only have everything (projects, tcl-scripts and executable programs) to pack and lay out for free use. Download distributions for Linux / Windows platforms here :


Many thanks to the user svk28 for his tip!

Source: https://habr.com/ru/post/333742/


All Articles