mirror of
https://bitbucket.org/svk28/rac-gui
synced 2024-12-04 18:46:52 +00:00
Функции по работе с JSON
This commit is contained in:
parent
9ab792d761
commit
2503187e59
@ -7,6 +7,8 @@
|
||||
###########################################
|
||||
|
||||
proc Quit {} {
|
||||
global servers_list
|
||||
puts [tcl2json $servers_list]
|
||||
exit
|
||||
}
|
||||
|
||||
@ -30,7 +32,7 @@ proc TreePress {tree} {
|
||||
}
|
||||
|
||||
proc SetGlobalVarFromTreeItems {tree id} {
|
||||
global host server active_cluster infobase profile_name dir rac_cmd_for_host rac_cmd
|
||||
global host server active_cluster infobase profile_name dir rac_cmd_for_host rac_cmd servers_list
|
||||
set parent [$tree parent $id]
|
||||
set values [$tree item $id -values]
|
||||
set key [lindex [split $id "::"] 0]
|
||||
@ -52,15 +54,23 @@ proc SetGlobalVarFromTreeItems {tree id} {
|
||||
close $orig_file
|
||||
}
|
||||
work_server {set server $values}
|
||||
cluster {set active_cluster $values}
|
||||
infobase {set infobase $values}
|
||||
cluster {
|
||||
set active_cluster $values
|
||||
#dict set servers_list $host $values
|
||||
}
|
||||
infobase {
|
||||
set infobase $values
|
||||
#dict set servers_list $host $active_cluster infobases $values
|
||||
}
|
||||
profile {set profile_name $values}
|
||||
}
|
||||
|
||||
if {$parent eq ""} {
|
||||
return
|
||||
} else {
|
||||
SetGlobalVarFromTreeItems $tree $parent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
proc InsertItemsWorkList {lst} {
|
||||
@ -340,31 +350,31 @@ proc GetWorkTreeRow {} {
|
||||
return $lst
|
||||
}
|
||||
|
||||
proc CreateInfoBasesJSONfile {} {
|
||||
proc CreateInfoBasesJSONfile {serversList} {
|
||||
global default dir
|
||||
puts $serversList
|
||||
puts [tcl2json $serversList]
|
||||
set info_base_json_file [file join $dir(work) infobases.lst]
|
||||
set jsonStr { \
|
||||
{
|
||||
"servers":[
|
||||
{ "server-id": "server_id1",
|
||||
set jsonStr {
|
||||
{
|
||||
"servers":[
|
||||
{ "server-id": "server_id1",
|
||||
"clusters": [
|
||||
{"cluster-id": "cluster_id_1", "infobases": [
|
||||
{"infobase-uid": "infobase_uid_1", "infobase-user":"infobase_user", "infobase-pwd":"infobase_pwd"},
|
||||
{"infobase-uid": "infobase_uid_2", "infobase-user":"infobase_user", "infobase-pwd":"infobase_pwd"}]
|
||||
}
|
||||
]
|
||||
},
|
||||
{ "server-id": "server_id2",
|
||||
"clusters": [
|
||||
{"cluster-id": "cluster_id_1", "infobases": [
|
||||
{"infobase-uid": "infobase_uid_1", "infobase-user":"infobase_user", "infobase-pwd":"infobase_pwd"},
|
||||
{"infobase-uid": "infobase_uid_2", "infobase-user":"infobase_user", "infobase-pwd":"infobase_pwd"}]
|
||||
}
|
||||
]
|
||||
},
|
||||
{ "server-id": "server_id2",
|
||||
"clusters": [
|
||||
{"cluster-id": "cluster_id_1", "infobases": [
|
||||
{"infobase-uid": "infobase_uid_1", "infobase-user":"infobase_user", "infobase-pwd":"infobase_pwd"},
|
||||
{"infobase-uid": "infobase_uid_2", "infobase-user":"infobase_user", "infobase-pwd":"infobase_pwd"}]
|
||||
}
|
||||
]}
|
||||
]}
|
||||
]}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace eval Run {} {}
|
||||
@ -2464,3 +2474,4 @@ proc Del::inet {tree host profile_name} {
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -57,3 +57,4 @@ proc jsonget {json args} {
|
||||
return $json
|
||||
}
|
||||
|
||||
|
||||
|
32
lib/theme.tcl
Normal file
32
lib/theme.tcl
Normal file
@ -0,0 +1,32 @@
|
||||
######################################################
|
||||
# Rac GUI
|
||||
# Graphical theme settings
|
||||
#
|
||||
# Distributed under GNU Public License
|
||||
# Author: Sergey Kalinin svk@nuk-svk.ru
|
||||
# Home page: https://nuk-svk.ru
|
||||
# Git repos: https://bitbucket.org/svk28/rac-gui
|
||||
|
||||
|
||||
######################################################
|
||||
|
||||
# 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
|
||||
#option add *Treeview.Foreground red interactive
|
||||
# #option add *Frame.Background $editor(bg) interactive
|
||||
# option add *ScrollableFrame.Background $editor(bg) interactive
|
||||
# option add *ScrolledWindow.Background $editor(bg) interactive
|
||||
|
48
rac_gui.tcl
48
rac_gui.tcl
@ -2,20 +2,23 @@
|
||||
# Tcl ignores the next line -*- tcl -*- \
|
||||
exec wish "$0" -- "$@"
|
||||
|
||||
######################################################
|
||||
# Rac GUI
|
||||
# 1C RAC (tm) grafical user interface
|
||||
# Distributed under GNU Public License
|
||||
# Author: Sergey Kalinin svk@nuk-svk.ru
|
||||
# Home page: https://nuk-svk.ru
|
||||
# Git repos: https://bitbucket.org/svk28/rac-gui
|
||||
#
|
||||
# version: 1.1.0
|
||||
# release: 1
|
||||
#
|
||||
######################################################
|
||||
|
||||
package require msgcat
|
||||
package require json
|
||||
package require json::write
|
||||
|
||||
######################################################
|
||||
# Rac GUI
|
||||
# Distributed under GNU Public License
|
||||
# Author: Sergey Kalinin svk@nuk-svk.ru
|
||||
# Home page: https://bitbucket.org/svk28/rac-gui
|
||||
#
|
||||
# version: 1.0.3
|
||||
# release: 1
|
||||
#
|
||||
######################################################
|
||||
# Устанавливаем текущий каталог
|
||||
set dir(root) [pwd]
|
||||
|
||||
@ -83,6 +86,8 @@ source [file join $dir(lib) gui.tcl]
|
||||
source [file join $dir(work) rac_gui.cfg]
|
||||
|
||||
# Читаем файл со списком серверов 1С
|
||||
#set serversList [dict create servers]
|
||||
|
||||
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} {
|
||||
@ -92,27 +97,10 @@ if [file exists [file join $dir(work) 1c_srv.cfg]] {
|
||||
set rac_cmd_for_host($host) [lindex $l 1]
|
||||
}
|
||||
.frm_tree.tree insert {} end -id "server::$host" -text "$host" -values "$host"
|
||||
# готовим конфиг
|
||||
dict set servers_list $host clusters {}
|
||||
}
|
||||
}
|
||||
|
||||
# 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
|
||||
#option add *Treeview.Foreground red interactive
|
||||
# #option add *Frame.Background $editor(bg) interactive
|
||||
# option add *ScrollableFrame.Background $editor(bg) interactive
|
||||
# option add *ScrolledWindow.Background $editor(bg) interactive
|
||||
CreateInfoBasesJSONfile $servers_list
|
||||
|
||||
CreateInfoBasesJSONfile
|
||||
|
Loading…
Reference in New Issue
Block a user