Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:using_with_tcl_tk [2018/04/15 06:38] – simplified separator aplsimple | howtos:using_with_tcl_tk [2019/09/15 14:30] (current) – links updated aplsimple | ||
---|---|---|---|
Line 26: | Line 26: | ||
* passing a selected text to the menu commands to process | * passing a selected text to the menu commands to process | ||
- | * the selection can be passed as underlined (" | + | * the selection can be passed as underlined (" |
* commands can be run by itself and by shell in console box | * commands can be run by itself and by shell in console box | ||
Line 32: | Line 32: | ||
* commands can be run with or without waiting their completion | * commands can be run with or without waiting their completion | ||
- | * internal command //%e %s// means " | + | * internal command //%E %s// means " |
- | * internal command //%b " | + | * internal command //%B " |
- | * internal command //%q " | + | * internal command //%Q " |
- | * a batch of commands can be under one menu item | + | * a batch of commands can be united |
* any command can be confirmed, with message box of title and text including Geany selection | * any command can be confirmed, with message box of title and text including Geany selection | ||
Line 45: | Line 45: | ||
* 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 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 ' | * menus can be called (or made afterwards) as ' | ||
Line 64: | Line 66: | ||
* any menu item can be assigned to ' | * any menu item can be assigned to ' | ||
- | * to ' | + | * commands that are invisible in menu may be assigned to ' |
- | * any Tcl command(s) can be assigned to ' | + | * Tcl command(s) can be assigned to ' |
* menus can be edited in Geany 'on fly' and then re-read | * menus can be edited in Geany 'on fly' and then re-read | ||
Line 78: | Line 80: | ||
* items can be run repeatedly at intervals set in seconds | * items can be run repeatedly at intervals set in seconds | ||
- | * [[using_with_tcl_tk|e_menu]] neighboring applications can be killed with two keystrokes (well fit to clear) | + | * [[using_with_tcl_tk|e_menu]] neighboring applications can be killed with two keystrokes (sort of clearance) |
- | * there are a lot of 'look and feel' options (inc. highlighting ' | + | * there are a lot of 'look and feel' options (incl. highlighting ' |
* the options may be set at calling of [[using_with_tcl_tk|e_menu]] and/or in [OPTIONS] section of a menu | * the options may be set at calling of [[using_with_tcl_tk|e_menu]] and/or in [OPTIONS] section of a menu | ||
Line 86: | Line 88: | ||
* parent menu options are inherited by child menu and can be overridden by its [OPTIONS] | * parent menu options are inherited by child menu and can be overridden by its [OPTIONS] | ||
- | * as an example, [[https:// | + | * for an easy exercise, [[https:// |
* encoding of menus is utf-8 | * encoding of menus is utf-8 | ||
Line 94: | Line 96: | ||
===== Context action of Geany IDE ===== | ===== Context action of Geany IDE ===== | ||
- | I try and show how the Geany context command can be used with all its beauty. | + | I try and show how the Geany context command can be used in all its beauty. |
Imagine we have a Python module under testing in Geany. And it is called with parameters. And the parameters are changed from time to time. | Imagine we have a Python module under testing in Geany. And it is called with parameters. And the parameters are changed from time to time. | ||
Line 130: | Line 132: | ||
1. If you do not have [[http:// | 1. If you do not have [[http:// | ||
- | 2. Unpack the below attached zip to save files: | + | 2. Unpack the below attached zip to save: |
+ | |||
+ | e_menu | ||
+ | menus directory | ||
+ | src directory | ||
- | emenu | ||
- | ehelp | ||
- | rarrow.png | ||
- | run_pause.bat | ||
- | run_pause.sh | ||
- | ...etc... | ||
into some directory, e.g. / | into some directory, e.g. / | ||
3. Go to Geany' | 3. Go to Geany' | ||
- | wish / | + | wish / |
Uff. Now you should be able to call the context help. While editing your [[http:// | Uff. Now you should be able to call the context help. While editing your [[http:// | ||
Line 170: | Line 170: | ||
**// | **// | ||
- | wish emenu [s=%s] [m=menufile] [options] | + | wish e_menu |
//** | //** | ||
Line 209: | Line 209: | ||
|// fs=number //|size of fonts used in menu| fs=9| | |// fs=number //|size of fonts used in menu| fs=9| | ||
|// " | |// " | ||
- | |// " | + | |// " |
|// w=number //|width of menu items (in characters)| w=30 | | |// w=number //|width of menu items (in characters)| w=30 | | ||
- | |// c=number //|index of color scheme (0 through | + | |// c=number //|index of color scheme (0 through |
|// o=number // | |// o=number // | ||
|// | |// | ||
Line 221: | Line 221: | ||
|// g=+x+y //|sets (x,y) screen coordinates of menu| g=+700+200| | |// g=+x+y //|sets (x,y) screen coordinates of menu| g=+700+200| | ||
|// wc=1 // |centers a menu on screen|wc=1| | |// wc=1 // |centers a menu on screen|wc=1| | ||
- | |// " | + | |// " |
- | |// " | + | |// " |
|// " | |// " | ||
|// " | |// " | ||
Line 236: | Line 236: | ||
|// ah=list //|sets a list of hotkeys of autorun menu items of [HIDDEN] section to be run at start of [[using_with_tcl_tk|e_menu]]|ah=1, | |// ah=list //|sets a list of hotkeys of autorun menu items of [HIDDEN] section to be run at start of [[using_with_tcl_tk|e_menu]]|ah=1, | ||
|// " | |// " | ||
- | |// P=syms // |sets a symbol(s) used instead of " | + | |// P=syms // |sets a symbol(s) used instead of " |
|// pa=number //|sets a pause (in milliseconds) to suspend [[using_with_tcl_tk|e_menu]] before starting it; sometimes it may be desirable|pa=500| | |// pa=number //|sets a pause (in milliseconds) to suspend [[using_with_tcl_tk|e_menu]] before starting it; sometimes it may be desirable|pa=500| | ||
|// " | |// " | ||
Line 262: | Line 262: | ||
R: R: 6 | R: R: 6 | ||
R: Firefox search for " | R: Firefox search for " | ||
- | R: Wikipedia for " | + | R: Wikipedia for " |
- | R: Open/create file(s) " | + | R: Open/create file(s) " |
R: geany: edit all R: geany readme.md wiki.txt e_help.tcl e_menu.tcl | R: geany: edit all R: geany readme.md wiki.txt e_help.tcl e_menu.tcl | ||
| | ||
Line 302: | Line 302: | ||
** 1. ** | ** 1. ** | ||
- | wish / | + | wish / |
" | " | ||
" | " | ||
Line 336: | Line 336: | ||
cd $DIR | cd $DIR | ||
| | ||
- | wish ./emenu " | + | wish ./e_menu |
m=menus/ | m=menus/ | ||
| | ||
- | wish ./emenu " | + | wish ./e_menu |
m=menus/ | m=menus/ | ||
| | ||
- | wish ./emenu " | + | wish ./e_menu |
m=menus/ | m=menus/ | ||
| | ||
Line 349: | Line 349: | ||
cd $curdir | cd $curdir | ||
- | Notice that all three menus are called as topmost independent applications (t=1, &) without ' | + | Notice that all three menus are called as topmost independent applications (t=1, &) without ' |
\\ | \\ | ||
Line 443: | Line 443: | ||
A //menu item name// can begin with //F1// through //F12// which means a hotkey F1...F12 for this name. By default, items have hotkeys //1// through //9// and //a// through //z//. For example: | A //menu item name// can begin with //F1// through //F12// which means a hotkey F1...F12 for this name. By default, items have hotkeys //1// through //9// and //a// through //z//. For example: | ||
- | RE: F1 Geany' | + | RE: F1 Geany' |
- this would display [[using_with_tcl_tk|e_menu]] that would display (after second F1) the help of Geany IDE and close. | - this would display [[using_with_tcl_tk|e_menu]] that would display (after second F1) the help of Geany IDE and close. | ||
Line 481: | Line 481: | ||
|// %u0 \\ %u1 \\ -" | |// %u0 \\ %u1 \\ -" | ||
|// %i0 \\ %i1 \\ -" | |// %i0 \\ %i1 \\ -" | ||
- | |// %b " | + | |// %B " |
- | |// %q " | + | |// %Q " |
- | |// %e file1 [file2 ...] //| calls Geany editor to edit/create //file(s)// e.g.: \\ ... to edit file(s) of Geany' | + | |// %E file1 [file2 ...] //| calls Geany editor to edit/create //file(s)// e.g.: \\ ... to edit file(s) of Geany' |
|// ''< | |// ''< | ||
|// %d //| Geany' | |// %d //| Geany' | ||
Line 558: | Line 558: | ||
| | ||
R: Firefox search for " | R: Firefox search for " | ||
- | R: Wikipedia for " | + | R: Wikipedia for " |
| | ||
MW/ Git menu MW/ " | MW/ Git menu MW/ " | ||
Line 578: | Line 578: | ||
The wildcard //%s// refers to Geany' | The wildcard //%s// refers to Geany' | ||
- | The wildcard //%q// is a query with ' | + | The wildcard //%Q// is a query with ' |
- | In // %q // command you should use edging double quotes and internal single quotes in a title and a message. Symbol \//n// stands for an empty line. | + | In // %Q // command you should use edging double quotes and internal single quotes in a title and a message. Symbol \//n// stands for an empty line. |
# git menu for e_menu | # git menu for e_menu | ||
Line 593: | Line 593: | ||
S:git add * S: git add * | S:git add * S: git add * | ||
| | ||
- | R:git commit -m " | + | R:git commit -m " |
R:git commit -m " | R:git commit -m " | ||
S:git commit -m " | S:git commit -m " | ||
| | ||
- | R:git commit -am " | + | R:git commit -am " |
R:git commit -am " | R:git commit -am " | ||
S:git commit -am " | S:git commit -am " | ||
| | ||
- | R:git log --since="1 day ago" R: cd %PD | + | R:git log "--since=1 day ago" R: cd %PD |
- | S:git log --since="1 day ago" S: git log --since="1 day ago" | + | S:git log "--since=1 day ago" S: git log "--since=1 day ago" |
| | ||
- | R:git log -p --since="1 day ago" R: cd %PD | + | R:git log -p "--since=1 day ago" R: cd %PD |
- | S:git log -p --since="1 day ago" S: git log -p --since="1 day ago" | + | S:git log -p "--since=1 day ago" S: git log -p "--since=1 day ago" |
| | ||
MW: Others MW: m=menus/ | MW: Others MW: m=menus/ | ||
Line 659: | Line 659: | ||
It's also assumed in the next sections that [[using_with_tcl_tk|e_menu]] has been unpacked into // | It's also assumed in the next sections that [[using_with_tcl_tk|e_menu]] has been unpacked into // | ||
- | Try [[using_with_tcl_tk|e_menu]] now. Set the caret on a word of your text edited in Geany IDE. You may also select a piece of text. Call //' | + | Try [[using_with_tcl_tk|e_menu]] now. Set the caret on a word of your text edited in Geany IDE. You may also select a piece of text. Call //' |
You should see the following: | You should see the following: | ||
Line 676: | Line 676: | ||
* include the h= parameter into Geany context action: | * include the h= parameter into Geany context action: | ||
- | wish C: | + | wish C: |
* download the [[http:// | * download the [[http:// | ||
Line 686: | Line 686: | ||
wget -r -k -l 2 -p --accept-regex=.+/ | wget -r -k -l 2 -p --accept-regex=.+/ | ||
- | Now the offline help should be ready to call. If not, check the version of your //wget// utility. You may also check // | + | Now the offline help should be ready to call. If not, check the version of your //wget// utility. |
Retry [[http:// | Retry [[http:// | ||
Line 699: | Line 699: | ||
Let's try and create a simple menu of 2 commands that would be available from Geany' | Let's try and create a simple menu of 2 commands that would be available from Geany' | ||
- | The menu file will be // | + | The menu file will be // |
* seek the selected internet pages | * seek the selected internet pages | ||
* view the selected words in a dictionary | * view the selected words in a dictionary | ||
- | Fill the // | + | Fill the // |
R/ Firefox search for " | R/ Firefox search for " | ||
Line 715: | Line 715: | ||
After that include the menu file into the call string of Geany' | After that include the menu file into the call string of Geany' | ||
- | wish C: | + | wish C: |
NOTE: if you dislike to have the HELP/ | NOTE: if you dislike to have the HELP/ | ||
Line 724: | Line 724: | ||
For example, you can write Geany' | For example, you can write Geany' | ||
- | wish C: | + | wish C: |
... and // | ... and // | ||
Line 786: | Line 786: | ||
SW: echo %%PD is %PD SW: echo %%PD is %PD | SW: echo %%PD is %PD SW: echo %%PD is %PD | ||
| | ||
- | R: git init R: %q "Init GIT" "Are you sure to init git in\n\n%PD ?" | + | R: git init R: %Q "Init GIT" "Are you sure to init git in\n\n%PD ?" |
R: git init R: cd %PD | R: git init R: cd %PD | ||
S: git init S: git init | S: git init S: git init | ||
Line 799: | Line 799: | ||
S: git add * S: git add * | S: git add * S: git add * | ||
| | ||
- | R: git commit -am ' | + | R: git commit -am ' |
R: git commit -am ' | R: git commit -am ' | ||
S: git commit -am ' | S: git commit -am ' | ||
Line 850: | Line 850: | ||
Let me remind you how [[using_with_tcl_tk|e_menu]] is called: | Let me remind you how [[using_with_tcl_tk|e_menu]] is called: | ||
- | wish / | + | wish / |
The following call options of [[using_with_tcl_tk|e_menu]] can influence on menus' look and feel: | The following call options of [[using_with_tcl_tk|e_menu]] can influence on menus' look and feel: | ||
Line 872: | Line 872: | ||
* c=0 - sets an index of color scheme; 0 is default. | * c=0 - sets an index of color scheme; 0 is default. | ||
- | The following colors are available from c=0 to c=11: | + | The following colors are available from c=0 to c=12: |
- | {{: | + | {{: |
and their shadowed counterparts (3rd scheme is of special highlight as you see): | and their shadowed counterparts (3rd scheme is of special highlight as you see): | ||
- | {{: | + | {{: |
5th color scheme can be used to open a potentially dangerous menu, e.g. containing some irrevocable commands. | 5th color scheme can be used to open a potentially dangerous menu, e.g. containing some irrevocable commands. | ||
Line 910: | Line 910: | ||
Here the Tcl commands are used to exit and close the dangerous menu possibly open by mistake. Q is a query with " | Here the Tcl commands are used to exit and close the dangerous menu possibly open by mistake. Q is a query with " | ||
- | When calling a menu item, you can use //%q " | + | When calling a menu item, you can use //%Q " |
- | R:git reset --hard HEAD R: %q " | + | R:git reset --hard HEAD R: %Q " |
R:git reset --hard HEAD R: cd %PD | R:git reset --hard HEAD R: cd %PD | ||
S:git reset --hard HEAD S: git reset --hard HEAD | S:git reset --hard HEAD S: git reset --hard HEAD | ||
Line 933: | Line 933: | ||
* // %i9 // - are counters of item runs | * // %i9 // - are counters of item runs | ||
- | It's useful feature for commands that are logging or marking their data (files, directories etc.) with a current time, date and/or counter. There are 10 run counters per a menu and 4 time/date formats that can be set at call. | + | It's useful feature for commands that are logging or marking their data (files, directories etc.) with a current time, date and/or counter. There are 10 run counters per a menu and 10 time/date formats that can be set at call. |
Here is a typical example: | Here is a typical example: | ||
Line 965: | Line 965: | ||
cd %DIR% | cd %DIR% | ||
- | start wish %EMDIR%/emenu " | + | start wish %EMDIR%/e_menu |
- | start wish %EMDIR%/emenu " | + | start wish %EMDIR%/e_menu |
start cmd.exe /c " | start cmd.exe /c " | ||
Line 991: | Line 991: | ||
Insert into " | Insert into " | ||
- | R: Open all R: %e readme.md wiki.txt e_help.tcl e_menu.tcl | + | R: Open all R: %E readme.md wiki.txt e_help.tcl e_menu.tcl |
... and assuming that "Open all" entry is number 8 in menu.mnu, change its call so: | ... and assuming that "Open all" entry is number 8 in menu.mnu, change its call so: | ||
- | start wish %EMDIR%/emenu " | + | start wish %EMDIR%/e_menu |
That's all. Minus a special start of Geany in batch file. Plus a useful menu command that allows __to restore your project file list__ in Geany IDE. | That's all. Minus a special start of Geany in batch file. Plus a useful menu command that allows __to restore your project file list__ in Geany IDE. | ||
Line 1022: | Line 1022: | ||
| | ||
R: Run periodic reminding of rest at 45 min interval R: ? | R: Run periodic reminding of rest at 45 min interval R: ? | ||
- | R: Run batches of commands periodically R: ? | ||
- | The last two tasks should be explained in details. The common format of periodic command is following: | + | The last task should be explained in details. The common format of periodic command is following: |
? | ? | ||
Line 1099: | Line 1098: | ||
cd / | cd / | ||
- | wish / | + | wish / |
geany ... (run Geany IDE) | geany ... (run Geany IDE) | ||
Line 1110: | Line 1109: | ||
So, you can have a lot of menus in " | So, you can have a lot of menus in " | ||
- | wish / | + | wish / |
It would open the main menu of your current project as Geany' | It would open the main menu of your current project as Geany' | ||
Also you can set in the calling string of [[using_with_tcl_tk|e_menu]] " | Also you can set in the calling string of [[using_with_tcl_tk|e_menu]] " | ||
+ | |||
+ | The environment variable E_MENU_PN has the highest priority in setting the project name. E.g., in Linux you can call [[using_with_tcl_tk|e_menu]] this way: | ||
+ | |||
+ | export E_MENU_PN=myproject | ||
+ | wish / | ||
It would be convenient to have a batch of common menus that are not related to Geany' | It would be convenient to have a batch of common menus that are not related to Geany' | ||
Line 1176: | Line 1180: | ||
[[using_with_tcl_tk|e_menu]]' | [[using_with_tcl_tk|e_menu]]' | ||
- | {{ :howtos:e_menu:tcl_geany.zip |}} | + | [[https:// |
or here: | or here: | ||
- | [[http://aplsimple.ucoz.ru/misc/tcl_geany.zip|aplsimple.ucoz.ru]] | + | [[https://chiselapp.com/user/aplsimple/ |
- | Notice that [[using_with_tcl_tk|e_menu]] is still disposed to update. | + | Home page: |
+ | |||
+ | [[https:// | ||
+ | |||
+ | Notice that [[using_with_tcl_tk|e_menu]] is still disposed to update. I would try and support its [[https:// | ||
\\ | \\ | ||
Line 1195: | Line 1203: | ||
Also, the applied tool, namely the great and awful Tcl/Tk would never stop to amaze as well. Though the first impression of Tcl is 'What a s...!' Second, third, fourth and ..th impressions are the same till one day this thing begins to tease your brains and make to wonder. | Also, the applied tool, namely the great and awful Tcl/Tk would never stop to amaze as well. Though the first impression of Tcl is 'What a s...!' Second, third, fourth and ..th impressions are the same till one day this thing begins to tease your brains and make to wonder. | ||
+ | |||
+ | An unexpected and pleasant discovery had occurred while me coding [[using_with_tcl_tk|e_menu]], | ||
And these wonders tend to become //a movable feast//. | And these wonders tend to become //a movable feast//. | ||
Line 1204: | Line 1214: | ||
===== See also ===== | ===== See also ===== | ||
+ | |||
+ | Home page: [[https:// | ||
More screenshots of [[using_with_tcl_tk|e_menu]]: | More screenshots of [[using_with_tcl_tk|e_menu]]: | ||
* https:// | * https:// | ||
+ | |||
+ | A sort of proposal: | ||
+ | * https:// | ||
A sort of conversation: | A sort of conversation: |