Add paned window for main interface. Refactoring Add form. Change some config file options

This commit is contained in:
Sergey Kalinin 2018-06-03 13:36:21 +03:00
parent 60e6b4e0ac
commit 8d11556947
5 changed files with 107 additions and 98 deletions

View File

@ -61,6 +61,7 @@ proc Run::infobases {tree host values} {
set lst [RunCommand infobase::$values "infobase summary --cluster=$active_cluster list $host"]
set l [split $lst "&"]
puts $lst
foreach i $l {
set base_list [split $i ":"]
if {[string trim [lindex $base_list 0]] eq "infobase"} {
@ -84,6 +85,7 @@ proc Run::infobase {tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster --infobase=$values $host"]
set l [split $lst "&"]
foreach i $l {
set base_list [split $i ":"]
@ -95,6 +97,7 @@ proc Run::List:Base {tree host values par} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster --infobase=$values $host"]
puts $lst
set l [split $lst "&"]
foreach i $l {
set base_list [split $i ":"]
@ -185,6 +188,7 @@ proc InsertItemsWorkList {lst} {
}
proc RunCommand {root par} {
global dir rac_cmd cluster
puts $par
set pipe [open "|$rac_cmd $par" "r"]
set lst ""
while {[gets $pipe line]>=0} {
@ -243,8 +247,7 @@ proc DebugInfo {widget f} {
} else {
puts $msg
}
}
}
while {[gets $f line]>=0} {
puts "$line"
$widget insert {} end -text "$line" -values "$line"
@ -331,17 +334,38 @@ proc Add {} {
set key [lindex [split $id "::"] 0]
if {$key eq "" || $key eq "server"} {
set host [ Add::server ]
return
}
puts "$key, $id , $values"
Add::$key .frm_tree.tree $host $values
}
proc AddToplevel {lbl img} {
if [winfo exists .add] {destroy .add}
toplevel .add
wm title .add $lbl
#wm iconphoto .add server_grey_64
ttk::label .add.lbl -image $img
set frm [ttk::labelframe .add.frm -text $lbl -labelanchor nw]
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command { }
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
return $frm
}
namespace eval Add {} {}
proc Add::server {} {
global default
toplevel .add
set frm [ttk::labelframe .add.frm -text "Добавление основного сервера" -labelanchor nw]
set frm [AddToplevel "Добавление основного сервера" server_grey_64]
label $frm.lbl_host -text "Адрес сервера"
entry $frm.ent_host
@ -354,28 +378,21 @@ proc Add::server {} {
grid $frm.ent_port -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command {
#set frm_btn [frame .add.frm_btn -border 0]
.add.frm_btn.btn_ok configure -command {
set host [SaveMainServer [.add.frm.ent_host get] [.add.frm.ent_port get]]
.frm_tree.tree insert {} end -id "server::$host" -text "$host" -values "$host"
destroy .add
return $host
}
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
pack $frm $frm_btn -padx 5 -pady 5 -expand true -fill x
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
}
proc Add::servers {tree host values} {
global default dedicate_manager using_central_server
set dedicate_manager "none"
set using_central_server "normal"
#set active_cluster $values
toplevel .add
wm title .add "Добавление рабочего сервера"
#wm iconphoto .add server_grey_64
ttk::label .add.lbl -image server_grey_64
set frm [ttk::labelframe .add.frm -text "Добавление рабочего сервера" -labelanchor nw]
set frm [AddToplevel "Добавление рабочего сервера" server_grey_64]
label $frm.lbl_server_desc -text "Описание сервера"
entry $frm.ent_server_desc
label $frm.lbl_host -text "Адрес сервера"
@ -434,12 +451,7 @@ proc Add::servers {tree host values} {
grid $frm.lbl_central_server -row 11 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_central_server -row 11 -column 1 -sticky nw -padx 5 -pady 5
#grid $frm.btn_ok -row 2 -column 1 -sticky nw -padx 5 -pady 5
#grid $frm.btn_cancel -row 2 -column 1 -sticky se -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command {
.add.frm_btn.btn_ok configure -command {
RunCommand "" "server insert \
--agent-host=[.add.frm.ent_host get] \
--agent-port=[.add.frm.ent_port get] \
@ -457,12 +469,6 @@ proc Add::servers {tree host values} {
Run::servers $tree $host $active_cluster
destroy .add
}
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
}
proc Add::work_server {tree host values} {
Add::servers $tree $host $values
@ -481,21 +487,19 @@ proc Add::infobases {tree host values} {
set dbms [lindex $default(dbms) 0]
set block_shedule on
toplevel .add
wm title .add "Добавление информационной базы"
ttk::label .add.lbl -image database_grey_64
set frm [ttk::labelframe .add.frm -text "Добавление информационной базы" -labelanchor nw]
set frm [AddToplevel "Добавление информационной базы" database_grey_64]
label $frm.lbl_infobase_name -text "Имя информационной базы"
entry $frm.ent_infobase_name
label $frm.lbl_infobase_descr -text "Описание"
entry $frm.ent_infobase_descr
label $frm.lbl_secure_connect -text "Защищённое соединение"
set combo_secure_level [ttk::combobox $frm.cb_secure_level\
-textvariable secure_level -values $default(secure_level)]]
-textvariable secure_level -values $default(secure_level)]
label $frm.lbl_host -text "Адрес сервера баз данных"
entry $frm.ent_host
label $frm.lbl_base_type -text "Тип СУБД"
ttk::combobox $frm.cb_base_type -textvariable dbms -values $default(dbms)]
ttk::combobox $frm.cb_base_type -textvariable dbms -values $default(dbms)
label $frm.lbl_base_name -text "База данных"
entry $frm.ent_base_name
label $frm.lbl_db_user -text "Имя пользователя базы данных"
@ -543,19 +547,16 @@ proc Add::infobases {tree host values} {
grid $frm.lbl_block_shedule -row 12 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.cb_block_shedule -row 12 -column 1 -sticky nw -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
#set active_cluster $values
# Проверяем значение чекбокса и выставляем соответсвющую опцию
if {$create_db eq "true"} {
set db_create "--create-database"
} else {
set db_create ""
}
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command {
.add.frm_btn.btn_ok configure -command {
if {$create_db eq "true"} {
set db_create "--create-database"
} else {
set db_create ""
}
RunCommand "" "infobase create $db_create \
--name=[.add.frm.ent_infobase_name get] \
--dbms=$dbms \
@ -564,33 +565,24 @@ proc Add::infobases {tree host values} {
--locale=[.add.frm.ent_locale get] \
--db-user=[.add.frm.ent_db_user get] \
--db-pwd=[.add.frm.ent_db_pass get] \
--descr=[.add.frm.ent_infobase_descr get] \
--date-offset=$date_offset
--security-level=$secure_level
--scheduled-jobs-deny=$block_shedule
--license-distribution=$license_distribution
--cluster=$active_cluster $host"
--descr=\"[.add.frm.ent_infobase_descr get]\" \
--date-offset=$date_offset \
--security-level=$secure_level \
--scheduled-jobs-deny=$block_shedule \
--license-distribution=$license_distribution \
--cluster=$active_cluster $host"
Run::infobases $tree $host $active_cluster
destroy .add
}
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
}
proc Add::cluster {tree host values} {
global default
toplevel .add
wm title .add "Добавление кластера"
ttk::label .add.lbl -image cluster_grey_64
set frm [ttk::labelframe .add.frm -text "Добавление кластера" -labelanchor nw]
set frm [AddToplevel "Добавление кластера" cluster_grey_64]
label $frm.lbl_host -text "Адрес основного сервера"
entry $frm.ent_host
#$frm.ent_host insert end $host
label $frm.lbl_port -text "Порт"
entry $frm.ent_port
$frm.ent_port insert end $default(port)
@ -604,22 +596,20 @@ proc Add::cluster {tree host values} {
grid $frm.lbl_cluster_name -row 2 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_cluster_name -row 2 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command {
.add.frm_btn.btn_ok configure -command {
RunCommand "" "cluster insert \
--host=[.add.frm.ent_host get] \
--port=[.add.frm.ent_port get] \
--name=[.add.frm.ent_cluster_name get] $host"
Run::server $tree $host ""
destroy .add
}
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
# ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
# grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
# grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
# grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
# pack $frm_btn.btn_cancel -side right
# pack $frm_btn.btn_ok -side right -padx 10
}
proc SaveMainServer {host port} {
global dir
@ -629,6 +619,3 @@ proc SaveMainServer {host port} {
return "$host:$port"
}

View File

@ -1,9 +1,9 @@
######################################################
# Rac GUI
# Distributed under GNU Public License
# Distributed under GNU Public License
# Author: Sergey Kalinin svk@nuk-svk.ru
# Copyright (c) "http://nuk-svk.ru"
# 2018, https://bitbucket.org/svk28/rac-gui
# Copyright (c) "http://nuk-svk.ru" 2018
# https://bitbucket.org/svk28/rac-gui
######################################################
@ -21,7 +21,16 @@ wm iconname . "1C Rac Gui"
wm protocol . WM_DELETE_WINDOW Quit
wm overrideredirect . 0
wm positionfrom . user
#ttk::style configure TPanedwindow -background blue
#ttk::style configure Sash -sashthickness 5
set frm_tool [frame .frm_tool]
pack $frm_tool -side left -fill y
ttk::panedwindow .panel -orient horizontal -style TPanedwindow
pack .panel -expand true -fill both
pack propagate .panel false
ttk::style theme use clam
@ -35,7 +44,8 @@ set frm_tree [frame .frm_tree]
ttk::scrollbar $frm_tree.hsb1 -orient horizontal -command [list $frm_tree.tree xview]
ttk::scrollbar $frm_tree.vsb1 -orient vertical -command [list $frm_tree.tree yview]
set tree [ttk::treeview $frm_tree.tree -xscrollcommand [list $frm_tree.hsb1 set] -yscrollcommand [list $frm_tree.vsb1 set]]
set tree [ttk::treeview $frm_tree.tree -show tree \
-xscrollcommand [list $frm_tree.hsb1 set] -yscrollcommand [list $frm_tree.vsb1 set]]
grid $tree -row 0 -column 0 -sticky nsew
grid $frm_tree.vsb1 -row 0 -column 1 -sticky nsew
@ -49,7 +59,14 @@ bind $frm_tree.tree <ButtonRelease> "TreePress $frm_tree.tree"
set frm_work [frame .frm_work]
ttk::scrollbar $frm_work.hsb -orient horizontal -command [list $frm_work.tree_work xview]
ttk::scrollbar $frm_work.vsb -orient vertical -command [list $frm_work.tree_work yview]
set tree_work [ttk::treeview $frm_work.tree_work -class TreeView -show headings -columns "par val" -displaycolumns "par val" -xscrollcommand [list $frm_work.hsb set] -yscrollcommand [list $frm_work.vsb set]]
set tree_work [
ttk::treeview $frm_work.tree_work -class TreeView \
-show headings -columns "par val" -displaycolumns "par val"\
-xscrollcommand [list $frm_work.hsb set] \
-yscrollcommand [list $frm_work.vsb set]
]
#$tree_work heading par -text "Параметр" -anchor center
#$tree_work heading val -text "Значение" -anchor center
#set tree_work [ttk::treeview $frm_work.tree_work \
#$tree_work heading Creator -text "Creator" -anchor center
@ -60,8 +77,9 @@ grid $frm_work.vsb -row 0 -column 1 -sticky nsew
grid $frm_work.hsb -row 1 -column 0 -sticky nsew
grid columnconfigure $frm_work 0 -weight 1
grid rowconfigure $frm_work 0 -weight 1
#pack $tree_work -expand true -fill both
pack $frm_tool -side left -fill y
pack $frm_tree $frm_work -side left -expand true -fill both
#.panel add $frm_tool -weight 1
.panel add $frm_tree -weight 1
.panel add $frm_work -weight 1

View File

@ -1,6 +1,6 @@
######################################################
# Rac GUI
# Distributed under GNU Public License
# Distributed under GNU Public License
# Author: Sergey Kalinin svk@nuk-svk.ru
# Copyright (c) "http://nuk-svk.ru" 2018
# https://bitbucket.org/svk28/rac-gui
@ -295,19 +295,19 @@ image create photo database_grey_64 -data {
EVaVHD9ehhjkDjfpje4zTmT/ATAIDSxy76orAAAAAElFTkSuQmCC
}
image create photo ok_grey_24 -data {
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAA
CxMAAAsTAQCanBgAAAAHdElNRQfiBRsMHyO+h8lPAAACkklEQVQ4y22UW0hUURSGv7Wny1QmmjaK
DxIZkSJklvUQhJla9hBUlEUX6fIwR0KzHiwiKoKMHvKhmHOGoJLSgiDoJpIGEURi1oOQGJhMCF1k
jKnEQIdZPWh5Droe1/7/f/+b9e8leMrKppzN5BPAEKWXdtrsfjdCXOBMPSu7SfdKENPHcs6OTCNY
5YRZAsR5pV18FcNiLZRi/MA3rXPuewjWfr2BnxEcabS/TMkH06Vaa1kkY5y2r/4nWCU8YT797KPb
Trj9PJCv0psrdykgTpXdAgJWpr5mqfRT4X3e5B3L+S4LeKKFMqTrnX4DnJaljHBgJri1Ulrllixk
H1ENyEUwVhZ7gJt0T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65GmlEmKUZN1m2AR0
OpHp8Or1egQfY9JgR8CO0aZQZsiDmezUztOLZADNockJ8EaQPEMAGJ7o1M+umfuPMH6cjUBEjv3r
aAxINi7N1F/Pxn9YqwCqC/QSEKcyNOoNxSyimk0aXJbP2ygD2q2d2qPNAFzJeOtymQL8MvQCa+GU
ygs6gDS9zUNygS5z7bwGpzysA3rFOkiTJshxIlCdoh2snjz+ozucNtcIUxgkiXpDB0NipM4yEIr5
N/B+0vFNNxw0SBIj+tTYX7QF9DBrARpHfSU8B30XOuaJyAo5CbTSZ0AaGJAk7gSXAVz/6aviqNnl
gWfqPdI1yhknMRHvcn0k/ql4W2KrW12bpZA4h+y74APo/lQ0qBUE2Etq0Yfu391T4PQ1JyQsOcSp
t8PeL7qFMNlAnJd06rCgyVJEKX5gSOuclmlLIJglZ9nNInU1FWLyWC84AzNsDQBrCeWUkU+mIlHt
k3ZtdTwf6y/SqfVpjKc5gQAAAABJRU5ErkJggg==
}

View File

@ -23,5 +23,10 @@ set default(ram_sec) 0
# Объём памяти рабочих процессов, до которого сервер считается производительным
set default(ram_work) 0
set default(dbms) [list PostgreSQL MSSQLServer IBMDB2 OracleDatabase]
set default(secure_level) [list выключено "только соединение" постоянно]
# Уровни безопасности соединения:
# 0 - выключено
# 1 - только соединение
# 2 - постоянно
set default(secure_level) [list 0 1 2]
set default(date_offset) [list 0 2000]

View File

@ -76,4 +76,3 @@ if [file exists [file join $dir(work) 1c_srv.cfg]] {
# option add *ScrollableFrame.Background $editor(bg) interactive
# option add *ScrolledWindow.Background $editor(bg) interactive