aplsimple's home page

Tcl/Tk


Tcl/Tk color picker

The native Tcl/Tk color picker (tk_chooseColor) is used in Unix platforms as they have no default color picker, while Windows and Mac OS have.

The proposed changes to tk_chooseColor are the following:

  • The resizing of window is locked (supposedly the resizing makes no sense, at least in the current version of tk_chooseColor).
  • The default sizes of Tcl/Tk color picker are changed a little for more usability.
  • The 'Move all' checkbox is added allowing to move all (R, G, B) selectors simultaneously.
  • The 'Tone moves' checkbox is added allowing to implement the toning feature for a current color.
  • The RGBCMY and their tones are added, in separate color boxes.
  • The -moveall (0 by defauls) and -tonemoves (1 by default) options are added.
  • The chooser is themed now. The themed choosers of font and color are shown beside on the above screenshot.
  • A stand-alone Tk color chooser is available (see its screenshot above). Invoked with: tclsh tkclr.tcl.

Further details:
    Description of tk_chooseColor


Mulster

This little thing provides multi-line replacements in text files. Also, it provides in-memory replacements, on a list of strings.

Although there are tons of similar utilities, maybe the mulster has its own goods.

It would be useful when you need:

  1. replace periodically some bunches of strings in some texts;
  2. modify periodically a snapshot of some software without its forking;
  3. share your little modifications with your colleagues, without resorting to those great GIT, MERCURIAL, FOSSIL etc.;
  4. use multi-line replacement functions in your software.

Further details:
    Description of mulster


Doctest

The doctest software allows you to doctest Tcl scripts.

To say shortly, the doctests are special comments inserted directly into a Tcl code. The doctest blocks are closely related to the code of module and used for testing and documenting it. You run this doctest on them and get the results of testing (OK or FAILED). Just so simple.

This allows you to keep your code in a working state each time you modify it.

The features of this doctest:

  • a full body of Tcl module can be used for doctesting
  • selected named blocks can be used for doctesting
  • several commands can produce one result to be checked
  • the results and commands can be multi-lined (continued with \)
  • the doctest blocks can contain several results to be checked
  • the block result is estimated OK if all its results are OK
  • the doctesting can be performed in safe/unsafe interpreter
  • the outputs modes are verbose, short or silent
  • only 'silent' output mode means 'hide OK, show FAILED if any'

Further details:
    Description of doctest


Pave

The pave software provides a sort of geometry management for Tcl/Tk.

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

The Tk geometry managers have the following drawbacks:

  • The place is very good when you need e.g. the overlapping popup messages. Still it is rarely used because of its complexity esp. when you need a resizable window of multiple widgets.
  • The pack is very good for simple layouts. But if your layout is growing in contents and complexity, its packs start being more and more tricky, sometimes even mystic.
  • The grid is best of all. However it is tiresome and tricky at the modifications of existing layouts. The inserting/removing a cell can become a real torment with those recalculations of cells/rows and sticky/weight attributes. The usage of relative (- x ^) grid is restricted with simple layouts of table type.

All of the Tk GMs have the common drawback consisting in that the widgets' creation, configuration and layout are separated in space and time. In practice it means that to modify the layout you need look at the 2-3-4.. places of your code, namely the widgets creation / configuration / geometry management. You are happy if those separated places are spanned by your editor's screen.

The proposed pave allows you to get rid of these drawbacks by means of:

  • uniting the creation of widgets (and often their configuration) with their layout
  • minimizing a coder's efforts at inserting/removing widgets
  • using a batch of 'mega-widgets'
  • joining the power of grid and pack

Further details:
    Description of Pave


Menu system for editor

The e_menu software provides a menu system bound to an edit session.

A text editor with plugin or context facilities allows to use e_menu as "a plugin of plugins" that raises a whole environment of commands & menus around the editor.

Also, e_menu provides a context help on Tcl/Tk commands / keywords while editing a Tcl script. It means that you can set the caret on desirable Tcl/Tk command / keyword and press F1 key (if you map F1 to call e_menu) and then get a help page for the selected Tcl/Tk command / keyword.

By now e_menu is implemented for Geany and TKE editors. Though the usage of e_menu is mostly independent on an editor, a few demonstrative details for Geany and TKE are described.

e_menu has the following features:

  • calling a context help for Tcl/Tk while editing a Tcl script (nay, any text containing Tcl)
  • for faster response Tcl/Tk help pages can be made and called offline
  • opening any number of menus containing any commands (programs) to run
  • passing a selected text as %s wildcard to the menu commands to process
  • using a lot of other wildcards in the menu commands, including %f (edited file name), %x (its extention), %d (its directory), %PD (its project's directory derived from %d)
  • commands can be run by itself and by shell in console box
  • commands can be run with or without waiting their completion
  • internal command %E means “edit a file”
  • internal command %B means “browse an internet link”
  • internal command %M means “do a message”
  • internal command %Q means “do a query“
  • internal command %I means “enter a data that can be required by next commands“
  • internal command %C means “execute a Tcl code“
  • internal command %S means “execute OS command“
  • internal command %IF means “conditional execution“
    • all internal commands can include a selected text
  • a batch of multiple commands can be united under a single menu item which in turn can be multi-lined
  • a menu item can include the whole shell script (even in two ways), so no need of disk files to perform it
  • any command can be confirmed, with message box of title and text including the selection
  • input dialogs (with entries, checkboxes, radiobuttons etc.) may provide data for commands
    • the data may be saved/restored between sessions
  • a hierarchy of menus is provided
  • a child menu can be called with or without waiting it, with or without closing its parent menu
  • a child menu can be called with closing its parent and calling back the parent after closing the child
  • menus can be called (or made afterwards) as 'stayed on the top of screen'
  • menus can be called to stay at any desirable position with reasonable width
  • inactive menus are lowlighted as opposed to highlighted active ones
  • menu items can be bound to hotkeys F1-F12 (by default they are bound to 1-9a-zA-Z which makes maximum 61+3=64 items)
  • menu items and their underlying commands can include counters of their calls (up to 10 counters per a menu)
  • menu items and their underlying commands can be supplied with current date/time
  • e_menu menus are independent applications and as such can be run independently on the editor
  • any menu item can be assigned to 'autorun' at start of e_menu (submenus including)
  • commands that are invisible in menu may be assigned to 'autorun' (submenus including)
  • Tcl command(s) can be assigned to 'autorun' at start of e_menu
  • menus can be edited 'on fly' and then re-read
  • when calling non-existent menu you are prompted to create it from a template; so you can create all menu system 'on fly'
  • 'autorun' items and commands are also re-run when the menu is re-read
  • menu items can be run repeatedly at intervals set in seconds
  • e_menu can be started with a pause to delay its initialization
  • e_menu neighboring applications can be killed with two keystrokes (sort of clearance)
  • there are a lot of 'look and feel' options
  • the options may be set at calling of e_menu and/or in [OPTIONS] section of a menu
  • parent menu options are inherited by child menu and can be overridden by its [OPTIONS]
  • encoding of menus is utf-8

Further details:
    Description of e_menu
    e_menu.mp4, sort of demo.






Booksum

The booksum allows to make summaries of Tcl code snippets cut from books.

You might want to save such snippets in a summary file, in order to review them afterwards for refreshing your memory ... or to test ... or to play ... or even to publish your own code samples.

Most certainly, you'd like to save the code snippets along with their output.

Further details:
    Description of booksum


Plugins for TKE

I've made a batch of plugins for TKE editor. The editor and its plugins are all written in Tcl/Tk.

Further details:
    add_shortcut
    doctest
    edit_utils
    e_menu
    highlight_matches
    open_glob



Miscellaneous


Minimum Mercurial history of binary files

All of VCS including Mercurial SCM have a common problem with binary files of repository, namely:
If the files were being changed, their versions (even mistaken or stale) are all present in VCS history - nearly 'as is', with minimal packing if any.

In the course of time, this accumulation of binaries would involve the terrific size of remote repository and its local clones.

A method proposed below allows to minimize the binary overheads for a bitbucket site managed by Mercurial SCM.

We'll consider the following case only:

  • there is a bitbucket site managed by Mercurial SCM
  • the site contains binary files not wanted in hg history
  • the site is developed by one person or a very small team

Further details:
    How to minimize the Mercurial SCM history of binary files


FVords program

FVords is a language learning program. It's free of charge and designed mostly for Russians who learn English and, partially, vice versa.

An Englishman (believe it or not) found it very good for learning Russian.

Other languages are also present in FVords, but not so good in their contents and learning modes. The program interface can be chosen between English, Russian and Ukrainian.

The program runs with MS Windows and, with some restrictions, can be used under Linux's Wine. It is 32-bit and need Windows-1251 charset coding.

FVords installer is available through this link:
     FVords+English-base-1.13.25.exe
You might get an antivirus warning - be not afraid, it's rather standard warning for downloaded '.exe' files.

For details, see a demo sort of documentation available in "Help" menu of FVords.


APLinkee program

APLinkee is an archivist and a launcher of links to various resources. It can be also used as a small organizer that keeps scheduled affairs. The program is freeware.

APLinkee provides a standard set of actions to do with a tree of records, i.e. adding records and groups, changing, deleting, mouse moving etc.

Other features:

  • calling not only Internet pages, but nearly all you can run in MS Windows or Linux;
  • calling a group of links;
  • calling links at MS Windows or APLinkee startup;
  • viewing a list of last runs and re-running them;
  • searching links in the tree, including word-by-word searching of key words;
  • executing a batch commands that are stored in APLinkee database;
  • calling links for assigned time with subsequent break ('curriculum' for weekdays);
  • reminding of events in date intervals;
  • minimizing to the tray;
  • saving and restoring the program options, window sizes, last link's selection etc.;
  • three languages of interface (English, Русский, Українська);
  • using many files of links independent on re-installations of OS (presuming you backup the files more often than installing OS);
  • fine work under Linux's Wine
  • it is 32-bit and need Windows-1251 charset coding.

The APLinkee installer is available through this link:
    arlsetup138.exe
You might get an antivirus warning - be not afraid, it's rather standard warning for downloaded '.exe' files.

For details, click  ?  in APLinkee's menubar.


Eng-Rus dictionary

It's an English-Russian and Russian-English dictionary.

Features:

  • ~87000 words in English-Russian part
  • ~45000 words in Russian-English part
  • runs under MS Windows and Linux's Wine
  • is 32-bit and need Windows-1251 charset coding

Its installer is available through this link:
    fvdictsetup.exe
You might get an antivirus warning - be not afraid, it's rather standard warning for downloaded '.exe' files.

For details, see fvdict.txt in the installation directory.