2018-05-16 11:17:27 +00:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
# Tcl ignores the next line -*- tcl -*- \
|
|
|
|
|
exec wish "$0" -- "$@"
|
|
|
|
|
|
|
|
|
|
######################################################
|
|
|
|
|
# Rac GUI
|
|
|
|
|
# Distributed under GNU Public License
|
|
|
|
|
# Author: Sergey Kalinin svk@nuk-svk.ru
|
|
|
|
|
# Home page: https://bitbucket.org/svk28/rac-gui
|
|
|
|
|
######################################################
|
|
|
|
|
|
|
|
|
|
set dir(root) [pwd]
|
|
|
|
|
|
2018-05-20 15:03:02 +00:00
|
|
|
|
set dir(work) [file join $env(HOME) .rac_gui]
|
|
|
|
|
if {[file exists $dir(work)] == 0 } {
|
|
|
|
|
file mkdir $dir(work)
|
|
|
|
|
}
|
2018-06-15 10:11:09 +00:00
|
|
|
|
set dir(msg) "[file join $dir(root) msgs]"
|
|
|
|
|
set dir(lib) "[file join $dir(root) lib]"
|
2018-05-20 15:03:02 +00:00
|
|
|
|
|
|
|
|
|
if {[file exists [file join $dir(work) rac_gui.cfg]] ==0} {
|
|
|
|
|
file copy [file join [pwd] rac_gui.cfg] [file join $dir(work) rac_gui.cfg]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
source [file join $dir(work) rac_gui.cfg]
|
|
|
|
|
|
2018-06-15 10:11:09 +00:00
|
|
|
|
if {[file exists $rac_cmd] == 0} {
|
|
|
|
|
set rac_cmd [tk_getOpenFile -initialdir $env(HOME) -parent . -title "Укажите путь до rac" -initialfile rac]
|
|
|
|
|
file copy [file join $dir(work) rac_gui.cfg] [file join $dir(work) rac_gui.cfg.bak]
|
|
|
|
|
set orig_file [open [file join $dir(work) rac_gui.cfg.bak] "r"]
|
|
|
|
|
set file [open [file join $dir(work) rac_gui.cfg] "w"]
|
|
|
|
|
while {[gets $orig_file line] >=0 } {
|
|
|
|
|
if {[string match "set rac_cmd*" $line]} {
|
|
|
|
|
puts $file "set rac_cmd $rac_cmd"
|
|
|
|
|
} else {
|
|
|
|
|
puts $file $line
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
close $file
|
|
|
|
|
close $orig_file
|
|
|
|
|
#return "$host:$port"
|
|
|
|
|
file delete [file join $dir(work) 1c_srv.cfg.bak]
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
puts "Found $rac_cmd"
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-16 11:17:27 +00:00
|
|
|
|
set dir(msg) "[file join $dir(root) msgs]"
|
|
|
|
|
set dir(lib) "[file join $dir(root) lib]"
|
|
|
|
|
|
|
|
|
|
## SETTINGS ENVIRONMENT LANGUAGE ##
|
|
|
|
|
if [info exists env(LANG)] {
|
|
|
|
|
set locale $env(LANG)
|
|
|
|
|
} else {
|
|
|
|
|
set locale $locale
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::msgcat::mclocale $locale
|
|
|
|
|
::msgcat::mcload $dir(msg)
|
|
|
|
|
|
2018-06-22 11:13:19 +00:00
|
|
|
|
set cluster_user ""
|
|
|
|
|
set cluster_pwd ""
|
|
|
|
|
set agent_user ""
|
|
|
|
|
set agent_pwd ""
|
2018-05-16 11:17:27 +00:00
|
|
|
|
## LOAD FILE ##
|
|
|
|
|
# Load modules but maain.tcl must last loaded
|
|
|
|
|
foreach modFile [lsort [glob -nocomplain [file join $dir(lib) *.tcl]]] {
|
|
|
|
|
if {[file tail $modFile] ne "gui.tcl"} {
|
|
|
|
|
source $modFile
|
|
|
|
|
puts "Loaded module $modFile"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
source [file join $dir(lib) gui.tcl]
|
2018-05-20 15:03:02 +00:00
|
|
|
|
source [file join $dir(work) rac_gui.cfg]
|
|
|
|
|
|
|
|
|
|
if [file exists [file join $dir(work) 1c_srv.cfg]] {
|
|
|
|
|
set f [open [file join $dir(work) 1c_srv.cfg] "RDONLY"]
|
|
|
|
|
while {[gets $f line] >=0} {
|
|
|
|
|
.frm_tree.tree insert {} end -id "server::$line" -text "$line" -values "$line"
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-24 08:37:34 +00:00
|
|
|
|
# set editor(fg) grey
|
|
|
|
|
# set editor(bg) black
|
|
|
|
|
# option add *Entry.Foreground $editor(fg) interactive
|
|
|
|
|
# option add *Entry.Background $editor(bg) interactive
|
|
|
|
|
# option add *Label.Foreground $editor(fg) interactive
|
|
|
|
|
# option add *Label.Background $editor(bg) interactive
|
|
|
|
|
# option add *Checkbox.Foreground $editor(fg) interactive
|
|
|
|
|
# option add *Checkbox.Background $editor(bg) interactive
|
|
|
|
|
# option add *Checkbutton.Foreground $editor(fg) interactive
|
|
|
|
|
# option add *Checkbutton.Background $editor(bg) interactive
|
|
|
|
|
# option add *Combobox.Foreground $editor(fg) interactive
|
|
|
|
|
# option add *Combobox.Background $editor(bg) interactive
|
|
|
|
|
# option add *Listbox.Foreground $editor(fg) interactive
|
|
|
|
|
# option add *Listbox.Background $editor(bg) interactive
|
|
|
|
|
# option add *TreeView.Background $editor(bg) interactive
|
2018-06-06 09:35:20 +00:00
|
|
|
|
#option add *Treeview.Foreground red interactive
|
2018-05-24 08:37:34 +00:00
|
|
|
|
# #option add *Frame.Background $editor(bg) interactive
|
|
|
|
|
# option add *ScrollableFrame.Background $editor(bg) interactive
|
|
|
|
|
# option add *ScrolledWindow.Background $editor(bg) interactive
|
2018-06-22 11:13:19 +00:00
|
|
|
|
|
|
|
|
|
|