Mouse events duplicated with Tk menu commands, not accelerator keys - menu

This question pertains to Tcl/Tk 8.5.9 (via a starkit runtime) and 8.6 (via TkCon 2.7) on 64-bit Win7, and brings me back to the first Tk scripts I ever wrote. With the following:
menu .menubar
. config -menu .menubar
menu .menubar.file -tearoff 0
.menubar add cascade -label "File" -menu .menubar.file -underline 0
.menubar.file add command -label "Test" -command {puts "Test"}
When invoking the "Test" menu command graphically, I get "Test" on stdout twice, as if the button-release event is duplicated. With a keyboard accelerator assigned to this menu command, the key command works as expected (i.e. executing the command only once).
The widget configure options look as follows:
% .menubar.file configure
{-activebackground activeBackground Foreground SystemHighlight SystemHighlight} {-activeborderwidth activeBorderWidth BorderWidth 0 1} {-activeforeground activeForeground Background SystemHighlightText SystemHighlightText} {-background background Background SystemMenu SystemMenu} {-bd -borderwidth} {-bg -background} {-borderwidth borderWidth BorderWidth 0 1} {-cursor cursor Cursor arrow arrow} {-disabledforeground disabledForeground DisabledForeground SystemDisabledText SystemDisabledText} {-fg -foreground} {-font font Font TkMenuFont {{Segoe UI} 9}} {-foreground foreground Foreground SystemMenuText SystemMenuText} {-postcommand postCommand Command {} {}} {-relief relief Relief flat flat} {-selectcolor selectColor Background SystemMenuText SystemMenuText} {-takefocus takeFocus TakeFocus 0 0} {-tearoff tearOff TearOff 1 0} {-tearoffcommand tearOffCommand TearOffCommand {} {}} {-title title Title {} {}} {-type type Type normal normal}
% .menubar.file entryconfigure 0
{-activebackground {} {} {} {}} {-activeforeground {} {} {} {}} {-accelerator {} {} {} {}} {-background {} {} {} {}} {-bitmap {} {} {} {}} {-columnbreak {} {} 0 0} {-command {} {} {} {puts "Test"}} {-compound compound Compound none none} {-font {} {} {} {}} {-foreground {} {} {} {}} {-hidemargin {} {} 0 0} {-image {} {} {} {}} {-label {} {} {} Test} {-state {} {} normal normal} {-underline {} {} -1 -1}
This problem does not occur with 8.5 on a Mac.
I see a lot of material alluding to something like this with Python and Tkinter, though I'm not using Python. I also wondered if this could relate to the mouse on my Win box, though swapping the same mouse between this machine and the Mac does not alter the behavior above.
Has anyone seen this before?
Update: By chance, I happened to notice that when I allow the menu to be torn off, and then when I invoke the tearoff, there are actually two File menu windows that are created. When I separate these (i.e. drag them so they are not overlapping each other), clicking each Test menu entry individually causes the command to be invoked only once. So somehow I've created duplicate menus. (This is 8.6.4/8.6.4 from TkCon 2.7.)

Related

how to write the correct pipline jenkins docker grovy node

I am rewriting my pipline in node, I need to understand how to perform a step with a gait in node now an error is coming from stage('Deploy')
node {
checkout scm
def customImage = docker.build("python-web-tests:${env.BUILD_ID}")
customImage.inside {
sh "python ${env.CMD_PARAMS}"
}
stage('Deploy') {
post {
always {
allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'report']]
])
cleanWs()
}
}
}
and this is the old pipeline
pipeline {
agent {label "slave_first"}
stages {
stage("Создание контейнера image") {
steps {
catchError {
script {
docker.build("python-web-tests:${env.BUILD_ID}", "-f Dockerfile .")
}
}
}
}
stage("Running and debugging the test") {
steps {
sh 'ls'
sh 'docker run --rm -e REGION=${REGION} -e DATA=${DATA} -e BUILD_DESCRIPTION=${BUILD_URL} -v ${WORKSPACE}:/tmp python-web-tests:${BUILD_ID} /bin/bash -c "python ${CMD_PARAMS} || exit_code=$?; chmod -R 777 /tmp; exit $exit_code"'
}
}
}
post {
always {
allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'report']]
])
cleanWs()
}
}
}
I tried to transfer the method of creating an allure report, but nothing worked, I use the version above, almost everything turned out, you can still add environment variables to the build, for example, those that are specified -e DATA=${DATA} how do I add it
I don't recommend to switch from declarative to scriptive pipeline.
You are losing possibility to use multiple tooling connected with declarative approach like syntax checkers.
If you still want to use scriptive approach try this:
node('slave_first') {
stage('Build') {
checkout scm
def customImage = docker.build("python-web-tests:${env.BUILD_ID}")
customImage.inside {
sh "python ${env.CMD_PARAMS}"
}
}
stage('Deploy') {
allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'report']]])
cleanWs()
}
}
There is no post and always directive in scriptive pipelines. It's on your head to catch all exceptions and set status of the job. I guess you were using this page: https://www.jenkins.io/doc/book/pipeline/syntax/, but it's a mistake.
This page only refers to declarative approach and in few cases you have hidden scriptive code as examples.
Also i don't know if you have default agent label set in your Jenkins config, but by looking at your declarative one I think you missed 'slave_first' arg in node object.
those that are specified -e DATA=${DATA} how do I add it
That's a docker question not a Jenkins. If you want to launch docker image and then also have access to some reports located in this container you should mount workspace/file where those output files landed. You should also pass location of those files to allure.
I suggest you to try this:
mount some subfolder in workspace to docker container
cat test report file if it's visible
add allure report with passing this file location to allure step

Can not use keyboard 3rd level on Manjaro

I feel all my settings right:
~/: setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: pc105
layout: us,ru
variant: ,
options: grp:shift_caps_switch,lv3:switch,nbsp:level2
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+us+ru:2+inet(evdev)+group(shift_caps_switch)+level3(switch)+nbsp(level2)
geometry: pc(pc105)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+ru:2+inet(evdev)+group(shift_caps_switch)+level3(switch)+nbsp(level2)" };
xkb_geometry { include "pc(pc105)" };
};
~/: localectl status
System Locale: LANG=ru_RU.UTF-8
VC Keymap: us
X11 Layout: us,ru
X11 Model: pc105
X11 Variant: ,
X11 Options: grp:shift_caps_switch,lv3:ralt_switch_multikey,numpad:mac,nbsp:level2
But the 3rd level or compose layer (ralt+shift) just does nothing. And it seems to me like there is no of these layouts in my Manjaro (XFCE) distribution.
Finally, I've found the reason: need to add typo layout to every layout in xkb:
$ setxkbmap -layout us+typo,ru:2+typo
Also, 3rd level should be enabled, for example like:
lv3:ralt_switch_multikey

VS code VIM extension copy and paste

Is there a normal way to copy and paste in vs code using vim extension?
I've tried mapping VIM register commands to the shortcut commands I'm used to (ctrl + c for copying and ctrl + v for pasting), but the results are pretty weird and I'm not sure how to do this correctly.
While using vim the key bindings were quite simple,
vimrc file:
map <C-c> "+y
map <C-v> "+p
Now I try to migrate those to vs-code by editting json.settings file:
{
"vim.visualModeKeyBindings": [
{
"before": ["<C-c>"],
"after": ["\"", "+", "y"]
},
{
"before": ["<C-v>"],
"after": ["\"", "+", "p"]
},
], }
I want this to operate both in visual mode and in normal mode (for pasting), and be able to copy and paste from clipboard using these shortcuts.
How to do this correctly?
Is there another way to do this?
Vim - extension config flag
Tick the checkbox in settings by searching for "vim clip".
or
Paste the following inside your VS Code's settings.json file:
"vim.useSystemClipboard": true
Access VSCode settings.json file:
Press Ctrl + , (or go to File > Preferences > Settings)
Click the icon: "file with arrow" in the top right corner
Settings found in VSCodeVim/Vim repository quick-example
Rather than rebinding, you can simply stop the vscodevim extension from handling Ctrl-C and Ctrl-V entirely, which then allows VSCode to handle them natively. This can be done by placing the below code in the extension's settings.json file:
"vim.handleKeys": {
"<C-c>": false,
"<C-v>": false
}
This will work regardless of which mode you're in, and will perfectly accommodate the system clipboard. I'm not sure if the <C-c> is necessary, but the <C-v> definitely is, as <C-v> is the standard Vim chord to enter visual block mode.
As an aside, your rebind method is perfectly valid; it just requires a bit more code:
// For visual mode
"vim.visualModeKeyBindings": [
{
"before": ["<C-c>"],
"after": ["\"", "+", "y"]
},
{
"before": ["<C-v>"],
"after": ["\"", "+", "p"]
}
],
// For normal mode
"vim.normalModeKeyBindings": [
{
"before": ["<C-c>"],
"after": ["\"", "+", "y"]
},
{
"before": ["<C-v>"],
"after": ["\"", "+", "p"]
}
]
In the latest version of VS code (on Linux, flatpak version, 1.68.1) and vim addon (at the time of writing), this can be easily enabled by ticking the "Vim: Use System Clipboard".
Note: You can open settings by Ctrl+, then search for 'vim clipboard'
I have found that one can use CTRL+INSERT / SHIFT+INSERT successfully with VS Code VIM to copy to/from the system clipboard without stumbling over the VIM buffers.
For context, I'm running VS Code on WSL2 on Windows.
Use vs code default copy, paste, delete line.
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["d","d"],
"commands":["editor.action.deleteLines"],
"when":"textInputFocus && !editorReadonly"
},
{
"before":["y"],
"commands":["editor.action.clipboardCopyAction"],
"when":"textInputFocus"
},
{
"before":["y","y"],
"commands":["editor.action.clipboardCopyAction"],
"when":"textInputFocus"
},
{
"before":["p"],
"commands":["editor.action.clipboardPasteAction"],
"when":"textInputFocus && !editorReadonly"
}
],
"vim.visualModeKeyBindingsNonRecursive":[
{
"before":["y"],
"commands":["editor.action.clipboardCopyAction"],
"when":"textInputFocus"
},
{
"before":["y","y"],
"commands":["editor.action.clipboardCopyAction"],
"when":"textInputFocus"
},
{
"before":["x"],
"commands":["deleteRight"],
"when":"textInputFocus"
},
]
https://github.com/VSCodeVim/Vim/#key-remapping
https://code.visualstudio.com/docs/getstarted/keybindings
You can also access system clipboard with vim
In INSERT mode hit CTRL+R then * or +
If you use Linux (or a terminal itself) you must know that for copy and paste you add the shift key in the middle, that is:
ctrl + shift + c to copy
ctrl + shift + v to paste
Thus, for me is more simple to remember this, and add it to the configuration, because it helps me to see VS Code as a "terminal".
Steps:
F1
Preferences: Open Keyboard shortcuts (JSON)
Add this
{
"key": "ctrl+shift+c",
"command": "editor.action.clipboardCopyAction"
},
{
"key": "ctrl+shift+v",
"command": "editor.action.clipboardPasteAction"
}
For mac users,
add this into the settings.json
"vim.handleKeys":{
"<D-c>": false
}
Access VSCode settings.json file:
Press Cmd + , (or go to File > Preferences > Settings)
Click the icon: "file with arrow" in the top right corner

tpool use to speed up computation

I try to use tpool to speed up the shasum computation of any files with size between 30 and 300 MiB in some folders.
I use tcl-tk version 8.6.6 from homebrew on macOS Sierra 10.12.5 (the tcl-tk OS X version is 8.5.9 and the result is same but terminate with an error).
As I can understand the result of command “brew info tcl-tk”, tcl is compiled with option :
—with-threads
"Build with multithreading support"
Without thread usage, it’s clear the CPU load (Activity Monitor) isn’t very busy.
With threading of tpool, not more, and time spend to compute a set of shasum files is globally the same.
Depending of -maxworkers number, the global % CPU of perl5.18 processes (shasum is a Perl script) is the same. Everything happens as if all the threads that work at the same time do it on the same processor core.
See below the main script based on an example from Donald Fellows answer:
#!/bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec /usr/local/Cellar/tcl-tk/bin/tclsh "$0" ${1+"$#"}
package require Thread
set pool [tpool::create -maxworkers 16 -initcmd {
source myProcedures.tcl
}]
proc TREE_parse_big_files {path} {
foreach f [ glob -nocomplain ${path}/* ] {
puts "Parsing ${f}"
if { [ file type ${f} ] == "link" } { return }
if { [ file isdirectory ${f} ] } {
TREE_parse_big_files ${f}
} else {
tpool::post $::pool [list computeSHA ${f}]
}
}
}
TREE_parse_big_files “/tmp/BigFiles” $pool
# Dispose of the pool
tpool::release $pool
The file myProcedures.tcl contains:
proc computeSHA {bigFile} {
puts [eval exec shasum -a 256 -b {$bigFile}]
}
Is there something I didn't understood?

How to disable "do not use ids in selectors" in sublime text

In sublime text 3 with the sublimelinter plugin (linter / css) how to disable these warnings IDs and padding specifically
warnings
.csslintrc
CSSLint allows you to disable its rules using the .csslintrc in your project root.
Example:
{
"ids": false
}
.sublimelinterrc
The same thing can be achieved using Sublime Linter's own configuration file, which is basically making use of CSSLint's --ignore command-line parameter.
Example:
{
"linters": {
"csslint": {
"ignore": ["ids]
}
}
}

Resources