Compare commits

...

9 Commits

10 changed files with 148 additions and 16 deletions

3
TODO
View File

@ -5,8 +5,6 @@
# Home page: https://nuk-svk.ru
######################################################
2. Подстветку текущей вкладки и элемента в дереве
--- Ansible ---
1. Определение всех переменных в отдельный список
- внутри файла, конструкции вида:
@ -22,4 +20,3 @@
3. Если используется роль и переменная не найдена в плэйбуке то искать в роли (не факт что требуется)

View File

@ -233,10 +233,13 @@ namespace eval FileOper {
$tree delete $treeItem
}
}
unset modified($nbItem)
if [info exists modified($nbItem)] {
unset modified($nbItem)
}
.frmStatus.lblPosition configure -text ""
.frmStatus.lblEncoding configure -text ""
.frmStatus.lblSize configure -text ""
NB::NextTab $nbEditor 0
}
proc Save {} {
@ -398,6 +401,10 @@ namespace eval FileOper {
regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName
set itemName "$nbEditor.$itemName"
set treeItemName [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
# переместим указатель на нужный файл в дереве
Tree::SelectItem $treeItemName
if {[winfo exists $itemName] == 0} {
NB::InsertItem $nbEditor $fileFullPath "file"
Editor::Editor $fileFullPath $nbEditor $itemName
@ -435,9 +442,10 @@ namespace eval FileOper {
set res [SearchStringInFolder $str]
}
}
FindInFilesDialog $txt $res
.find.entryFind delete 0 end
.find.entryFind insert end $str
if [FindInFilesDialog $txt $res] {
.find.entryFind delete 0 end
.find.entryFind insert end $str
}
}
proc ReplaceInFiles {} {

View File

@ -367,6 +367,22 @@ namespace eval Git {
puts $cmd
$w.body.t delete 1.0 end
}
proc Clone {repo dir} {
global activeProject cfgVariables
# puts $values
set cmd exec
lappend cmd $cfgVariables(gitCommand)
lappend cmd "clone"
lappend cmd $repo
lappend cmd $dir
puts $cmd
catch $cmd pipe
puts $pipe
return
}
proc Key {k fr} {
# puts [Editor::Key $k]
switch $k {
@ -552,14 +568,76 @@ namespace eval Git {
wm geom $win +$x+$y
}
proc CloneDialog {} {
set win .clone
set x [winfo rootx .frmWork]
set y [winfo rooty .frmWork]
if { [winfo exists $win] } {
destroy $win
return
}
toplevel $win
wm transient $win .
wm overrideredirect $win 1
ttk::entry $win.entUrl
ttk::entry $win.entFolder
ttk::button $win.btnFolder -image folder -command {
set folderPath [tk_chooseDirectory -initialdir $env(HOME) -parent .]
.clone.entFolder insert end $folderPath
}
ttk::button $win.btnClone -compound left -image done_20x20 \
-text [::msgcat::mc "Clone repository"] \
-command {
set folderPath [.clone.entFolder get]
set repo [.clone.entUrl get]
if {$repo eq ""} {return}
if {$folderPath eq ""} {
set folderPath [tk_chooseDirectory -initialdir $env(HOME) -parent .]
if {$folderPath eq ""} {return}
}
set repoDir [file join $folderPath [string trimright [file rootname [file tail $repo]] "."]]
Git::Clone $repo $repoDir
FileOper::ReadFolder $repoDir
ReadFilesFromDirectory $repoDir $repoDir
destroy .clone
}
grid $win.entUrl -row 0 -column 0 -columnspan 2 -sticky new
grid $win.entFolder -row 1 -column 0 -sticky new
grid $win.btnFolder -row 1 -column 1 -sticky e
grid $win.btnClone -row 2 -column 0 -columnspan 2 -sticky new
bind $win <Escape> "destroy $win"
# Определям расстояние до края экрана (основного окна) и если
# оно меньше размера окна со списком то сдвигаем его вверх
set winGeom [winfo reqheight $win]
set topHeight [winfo height .]
# puts "$x, $y, $winGeom, $topHeight"
if [expr [expr $topHeight - $y] < $winGeom] {
set y [expr $topHeight - $winGeom]
}
wm geom $win +$x+$y
focus $win.entUrl
}
proc Dialog {} {
global cfgVariables activeProject nbEditor
variable fr
if [winfo exists $nbEditor.git_browse] {
$nbEditor select $nbEditor.git_browse
if {[$nbEditor select] eq "$nbEditor.git_browse"} {
destroy $nbEditor.git_browse
} else {
$nbEditor select $nbEditor.git_browse
}
return
}
if {[info exists activeProject] == 0} {
Git::CloneDialog
return
}
set fr [NB::InsertItem $nbEditor git_browse "git"]

View File

@ -188,6 +188,7 @@ ttk::style layout TNotebook.Tab {
bind TNotebook <Button-1> "catch {NB::PressTab %W %x %y}\;[bind TNotebook <Button-1>];break"
# bind <<NotebookTabChanged>> "NB::PressTab %W %x %y"
bind TNotebook <ButtonRelease-1> "NB::PressTab %W %x %y"
# bind TNotebook <Control-w> FileOper::Close
# bind . <Control-Tab> "NB::NextTab $nbEditor"
bind . <Control-Next> "NB::NextTab $nbEditor 1"
bind . <Control-Prior> "NB::NextTab $nbEditor -1"

View File

@ -1262,4 +1262,20 @@ image create photo refresh_11x11 -data {
pbzGVYiIebvdftnv9/9sAqWUDoYR8a3CIQ5wkJk7+/v783/aIl7gWWZeb100MvN0PB53MCuldDLz
eWYer/e+iVJK4gvu4wqWOMMNXMKv1Wr1eDAYnFR4OplMHlZVdQ9l/dwufmTmh7qu7w4GgxP4C5QM
b3lPIiauAAAAAElFTkSuQmCC
}
}
image create photo folder_24x24 -data {
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9
kT1Iw0AcxV9TRakVEQuKOGSoThbELxy1CkWoEGqFVh1MLv2CJg1Jiouj4Fpw8GOx6uDirKuDqyAI
foA4OjkpukiJ/0sKLWI9OO7Hu3uPu3eAUC0yzWobAzTdNhOxqJhKr4odr+hCPwKYQq/MLGNOkuJo
Ob7u4ePrXYRntT735+hWMxYDfCLxLDNMm3iDeHrTNjjvE4dYXlaJz4lHTbog8SPXFY/fOOdcFnhm
yEwm5olDxGKuiZUmZnlTI54kDquaTvlCymOV8xZnrVhm9XvyFwYz+soy12kOIYZFLEGCCAVlFFCE
jQitOikWErQfbeEfdP0SuRRyFcDIsYASNMiuH/wPfndrZSfGvaRgFGh/cZyPYaBjF6hVHOf72HFq
J4D/GbjSG/5SFZj5JL3S0MJHQM82cHHd0JQ94HIHGHgyZFN2JT9NIZsF3s/om9JA3y0QWPN6q+/j
9AFIUlfxG+DgEBjJUfZ6i3d3Nvf275l6fz+MS3KxGoYR/gAAAAZiS0dEAP8A/wD/oL2nkwAAAAlw
SFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB+YLFwo2Gs8+4dEAAAERSURBVEjH7ZW/SsUwFMa//KGQ
Wyhka0ffQ6QP0G6+iIhv0Nm9c0eHYOeCm8ud3EoXiwhSqJNLh6RxsXLVit5eAw79IHBOODk/Dicn
AVb9IDIZaZpuGGPHnHP2OcgY86KUugUwLgYkSXJljDmdDSIEnPPzsiwvFwPiOL6x1sbfBQoh7oUQ
D7/IuVVKXUwOnwxrLQAgiiJIKecOHr2tWQ3DgLZtwRg7AfAVoLWmYRgiy7LFDS2KAlVVkd29dwBj
LAKAPM8XA7qug+d5mAX4vh9qrdE0zUHXMgiCDz7d6QFxMQfU9aCtgH8EIIRo1xU8OgVYa43rCp7+
IuE4js+zT0Vd12dSymtK6UET3ff93fqP76VXznxN1iafwLQAAAAASUVORK5CYII=
}

View File

@ -22,6 +22,10 @@ proc GetFileMenu {m} {
-accelerator "Ctrl+S"
$m add command -label [::msgcat::mc "Close file"] -command {FileOper::Close}\
-accelerator "Ctrl+w"
$m add command -label [::msgcat::mc "Close all"] -command {FileOper::CloseAll}
$m add separator
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command {
set folderPath [FileOper::OpenFolderDialog]
if {$folderPath != ""} {
@ -31,7 +35,7 @@ proc GetFileMenu {m} {
}
}
$m add command -label [::msgcat::mc "Close folder"] -command {FileOper::CloseFolder}
#$m add command -label [::msgcat::mc "Open"] -command {FileDialog $tree open}\
#-font $fontNormal -accelerator "Ctrl+O" -state disable
$m add separator
@ -75,9 +79,9 @@ proc GetViewMenu {m} {
menu $m.panelSide
$m add cascade -label [::msgcat::mc "Panel side"] -menu $m.panelSide
$m.panelSide add radiobutton -label [::msgcat::mc "Left"] \
-variable cfgVariables(filesPanelPlace) -value left
-variable cfgVariables(filesPanelPlace) -value left -command ViewFilesTree
$m.panelSide add radiobutton -label [::msgcat::mc "Right"] \
-variable cfgVariables(filesPanelPlace) -value right
-variable cfgVariables(filesPanelPlace) -value right -command ViewFilesTree
$m add checkbutton -label [::msgcat::mc "Show the Menu"] -command ViewMenuBar \
-variable cfgVariables(menuShow) -onvalue true -offvalue false

View File

@ -38,8 +38,13 @@ namespace eval NB {
}
proc PressTab {w x y} {
global tree
if {[$w identify tab $x $y] ne ""} {
$w select [$w identify tab $x $y]
set nbItem [string trimleft [$w select] "$w."]
# puts $nbItem
append treeItemName "file" "::" $nbItem
Tree::SelectItem $treeItemName
} else {
return
}
@ -54,7 +59,11 @@ namespace eval NB {
}
proc NextTab {w step} {
global tree
set i [expr [$w index end] - 1]
if {[$w select] eq ""} {
return
}
set nbItemIndex [$w index [$w select]]
if {$nbItemIndex eq 0 && $step eq "-1"} {
$w select $i
@ -63,7 +72,14 @@ namespace eval NB {
} else {
$w select [expr $nbItemIndex + $step]
}
set nbItem [string trimleft [$w select] "$w."]
# puts $nbItem
append treeItemName "file" "::" $nbItem
Tree::SelectItem $treeItemName
set txt [$w select].frmText.t
focus -force $txt.t
if [winfo exists $txt] {
focus -force $txt.t
}
}
}

View File

@ -32,10 +32,13 @@ proc ViewFilesTree {{hotkey "false"}} {
.frmBody.panel forget .frmBody.frmTree
} else {
switch $cfgVariables(filesPanelPlace) {
"left" {
"left" {
.frmBody.panel insert 0 .frmBody.frmTree
}
"right" {
if {[lsearch -exact [.frmBody.panel panes] .frmBody.frmTree] != -1} {
.frmBody.panel forget .frmBody.frmTree
}
.frmBody.panel add .frmBody.frmTree
}
default {
@ -508,7 +511,7 @@ proc FindInFilesDialog {txt {args ""}} {
}
set win .find
if { [winfo exists $win] } { destroy $win }
if { [winfo exists $win] } { destroy $win; return false}
toplevel $win
wm transient $win .
wm overrideredirect $win 1
@ -636,6 +639,7 @@ proc FindInFilesDialog {txt {args ""}} {
focus -force $win.entryFind
}
# $win.lBox focus I001
return true
}
proc ShowMessage {title msg} {

View File

@ -136,4 +136,12 @@ namespace eval Tree {
return [$tree item $item -values]
}
}
proc SelectItem {treeItemName} {
global tree
if [$tree exists $treeItemName] {
$tree see $treeItemName
$tree selection set $treeItemName
}
}
}

View File

@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
######################################################
# Version: 2.0.0
# Release: alpha
# Build: 22112022145344
# Build: 23112022152902
######################################################
# определим текущую версию, релиз и т.д.