📄 tkpppoe.in
字号:
160.227 107.355 159.328 107.355 158.316 107.468 \
157.416 107.58 156.405 107.58 155.28 107.693 154.268 \
107.693 153.144 107.693 152.02 107.693 150.783 \
107.805 149.546 107.805 148.309 107.805 147.073 \
107.693 145.836 107.693 144.711 107.693 143.587 \
107.693 142.463 107.58 141.338 107.58 140.327 \
107.468 139.315 107.355 138.303 107.355 137.403 \
107.243 136.504 107.131 135.604 106.906 133.918 \
106.793 133.131 106.681 132.456 106.456 131.669 \
106.343 130.995 105.894 129.196 105.332 127.622 \
104.769 126.497 104.095 125.598 103.42 125.148 \
102.633 124.923 101.846 125.148 101.059 125.598 \
100.497 126.497 99.822 127.622 99.373 129.196 98.81 \
130.995 98.698 131.669 98.586 132.456 98.473 133.131 \
98.361 133.918 98.248 134.817 98.023 136.504 97.911 \
137.403 97.799 138.303 97.799 139.315 97.686 140.327 \
97.686 141.338 97.574 142.463 97.574 143.587 97.461 \
144.711 97.461 145.836 97.461 147.073 97.461 148.309 \
-fill $bg -outline {} -width 1 -tags logo
$c create polygon 122.309 156.292 126.919 \
156.292 124.67 130.545 122.309 156.292 -fill $bg \
-outline {} -width 1 -tags logo
$c create polygon 142.435 142.688 146.145 \
142.688 147.607 142.35 148.506 140.889 148.731 \
140.327 149.068 138.865 149.181 137.965 149.293 \
137.066 149.405 136.054 149.405 134.93 149.405 \
133.805 149.405 132.456 149.405 131.332 149.405 \
130.208 149.293 129.308 149.181 128.409 148.956 \
127.734 148.056 126.272 146.595 125.823 142.435 \
125.823 142.435 142.688 -fill $bg -outline {} -width \
1 -tags logo
$c create polygon 111.515 228.924 111.515 \
227.575 111.066 225.664 108.705 221.391 108.255 \
220.042 108.255 219.142 108.255 218.58 108.255 \
218.13 107.805 217.681 106.793 218.58 104.994 \
220.941 104.432 221.953 102.633 224.202 102.183 \
224.764 101.621 225.214 99.822 228.474 97.461 \
233.197 97.461 234.096 97.461 234.995 97.911 235.445 \
98.361 236.007 99.822 236.457 102.633 236.457 \
104.432 235.445 105.894 234.995 106.343 234.546 \
106.793 234.546 107.805 233.646 110.616 230.835 \
111.515 229.824 111.515 229.374 111.515 228.924 \
-fill $bg -outline {} -width 1 -tags logo
$c create polygon 161.211 269.175 160.986 \
267.826 160.649 266.927 160.199 266.477 159.3 \
266.364 158.4 266.477 157.838 266.927 157.613 \
267.826 157.388 269.175 157.388 278.17 157.613 \
279.294 157.838 279.969 159.3 280.981 160.199 \
280.643 160.649 279.969 160.986 279.294 161.211 \
278.17 161.211 269.175 -fill $bg -outline {} -width \
1 -tags logo
$c create polygon 224.848 273.448 223.836 \
273.448 222.825 273.56 222.15 273.673 221.588 \
273.897 220.913 274.684 220.688 275.809 220.688 \
278.17 220.801 279.294 221.138 279.969 221.7 280.643 \
222.487 280.981 223.612 280.643 224.399 279.969 \
224.736 279.294 224.848 278.17 224.848 273.448 -fill \
$bg -outline {} -width 1 -tags logo
$c create polygon 253.969 269.175 253.744 \
267.826 253.406 266.927 252.732 266.477 251.607 \
266.364 250.708 266.477 250.146 266.927 249.696 \
269.175 249.696 272.548 253.969 272.548 253.969 \
269.175 -fill $bg -outline {} -width 1 -tags logo
}
#***********************************************************************
# %PROCEDURE: LoadConnectionInfo
# %ARGUMENTS:
# None
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Loads the connection information into the global ConnectionInfo variable
#***********************************************************************
proc LoadConnectionInfo {} {
global ConnectionInfoFile ConnectionInfo PasswordFile
set ConnectionInfo {}
if {![file exists $ConnectionInfoFile]} {
return
}
set problem [catch {
set fp [open $ConnectionInfoFile "r"]
while {1} {
if {[gets $fp line] < 0} {
break
}
set line [string trim $line]
if {[string match "#*" $line]} {
continue
}
if {"$line" == ""} {
continue
}
set ConnectionInfo $line
break
}
close $fp
} err]
if {$problem} {
tk_dialog .err Error "[m {Error loading configuration file:}] $err" error 0 OK
}
# Try loading and merging passwords if the password file is readable
set passwords {}
if {![file readable $PasswordFile]} {
return
}
set fp [open $PasswordFile "r"]
while {1} {
if {[gets $fp line] < 0} {
break
}
set line [string trim $line]
if {[string match "#*" $line]} {
continue
}
if {"$line" == ""} {
continue
}
set passwords $line
break
}
close $fp
# Merge passwords
foreach thing $passwords {
set name [value $thing ConnectionName]
set password [value $thing Password]
set conn [GetConnection $name]
if {"$conn" != ""} {
lappend conn Password $password
ReplaceConnection $conn
}
}
}
#***********************************************************************
# %PROCEDURE: GetConnection
# %ARGUMENTS:
# name -- name of connection
# %RETURNS:
# key/value pair listing connection configuration, or "" if not found.
#***********************************************************************
proc GetConnection { name } {
global ConnectionInfo
foreach thing $ConnectionInfo {
if {[value $thing ConnectionName] == "$name"} {
return $thing
}
}
return ""
}
#***********************************************************************
# %PROCEDURE: DeleteConnection
# %ARGUMENTS:
# name -- name of connection
# %RETURNS:
# Nothing, but deletes connection named "$name"
#***********************************************************************
proc DeleteConnection { name } {
global ConnectionInfo ConfigDir
set newInfo {}
set found 0
foreach thing $ConnectionInfo {
if {[value $thing ConnectionName] == "$name"} {
set found 1
} else {
lappend newInfo $thing
}
}
if {!$found} {
return
}
set ConnectionInfo $newInfo
SaveConnectionInfo
# Delete the config file
set fname [file join $ConfigDir conf.$name]
catch { file delete $fname }
BuildConnectionMenu
if {[GetCurrentConnection] == $name} {
if {[llength $ConnectionInfo] == 0} {
SwitchConnection ""
} else {
set name [value [lindex $ConnectionInfo 0] ConnectionName]
SwitchConnection $name
}
}
}
#***********************************************************************
# %PROCEDURE: ReplaceConnection
# %ARGUMENTS:
# conn -- new name/value pairs
# %RETURNS:
# Nothing, but replaces connection in ConnectionInfo. If no such
# connection exists, appends new connection.
#***********************************************************************
proc ReplaceConnection { conn } {
global ConnectionInfo
set name [value $conn ConnectionName]
set newInfo {}
set found 0
foreach thing $ConnectionInfo {
if {[value $thing ConnectionName] == "$name"} {
lappend newInfo $conn
set found 1
} else {
lappend newInfo $thing
}
}
if {!$found} {
lappend newInfo $conn
}
set ConnectionInfo $newInfo
}
proc DeletePPPoEConnection {} {
set conn [GetCurrentConnection]
if {"$conn" == ""} {
return
}
set ans [tk_dialog .confirm "[m {Confirm Deletion - RP-PPPoE}]" "[m {Are you sure you wish to delete the connection}] `$conn'?" warning 0 No Yes]
if {$ans} {
DeleteConnection $conn
}
}
#***********************************************************************
# %PROCEDURE: CreateMainDialog
# %ARGUMENTS:
# None
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Creates the main window
#***********************************************************************
proc CreateMainDialog {} {
global ConnectionInfoFile
global ConnectionInfo
global Admin
wm title . "RP-PPPoE"
wm iconname . "PPPoE"
frame .f1
label .l1 -text "Connection: "
menubutton .m1 -text "" -indicatoron 1 -menu .m1.menu -relief raised
menu .m1.menu -tearoff 0
pack .l1 .m1 -in .f1 -side left -expand 0 -fill x
canvas .c -width 40 -height 20
pack .c -in .f1 -side left -expand 0 -fill none
# Draw the LED's
.c create rectangle 10 1 30 8 -outline "#808080" -fill "#A0A0A0" -tags xmitrect
.c create rectangle 10 10 30 18 -outline "#808080" -fill "#A0A0A0" -tags recvrect
frame .buttons
button .start -text "[m {Start}]" -command "StartPPPoEConnection"
button .stop -text "[m {Stop}]" -command "StopPPPoEConnection"
button .exit -text "[m {Exit}]" -command "exit"
canvas .graph -width 1 -height 1
if {[file writable $ConnectionInfoFile]} {
set Admin 1
pack .f1 -side top -expand 1 -fill both
pack .buttons -side top -expand 0 -fill x
button .delete -text "[m {Delete}]" -command "DeletePPPoEConnection"
button .new -text "[m {New Connection...}]" -command "NewPPPoEConnection"
button .props -text "[m {Properties...}]" -command "EditConnectionProps"
pack .graph -in .f1 -side left -expand 1 -fill both
pack .start .stop .delete .props .new .exit -in .buttons -side left -expand 0 -fill none
} else {
s
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -