Permalink
Browse files

add_vpnprovider refactoring

  • Loading branch information...
pulpofred
pulpofred committed Mar 15, 2016
1 parent dcb627e commit 4578b9e36c4a351e3ba588d3cb7b7f6431633c98
@@ -23,57 +23,30 @@ namespace eval ::airvpn {
proc ::airvpn::create-import-frame {tab} {
variable name
variable dispname
variable newprofilename
set newprofilename [unique-profilename $dispname]
set ::${name}::newprofilename [unique-profilename $dispname]
set pconf $tab.$name
ttk::frame $pconf
ttk::label $pconf.profilelabel -text "Profile name" -anchor e
ttk::entry $pconf.profileinput -textvariable ::${name}::newprofilename
ttk::label $pconf.profileinfo -foreground grey
ttk::label $pconf.usernamelabel -text "Email address" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey
ttk::label $pconf.passwordlabel -text "$dispname password" -anchor e
ttk::entry $pconf.passwordinput -textvariable ::${name}::password
ttk::label $pconf.passwordinfo -foreground grey
ttk::frame $pconf.importline
ttk::button $pconf.importline.button -text "Import configuration" -command [list go ::${name}::ImportClicked $tab]
# must use non-ttk label for proper animated gif display
label $pconf.importline.img
img place 24/empty $pconf.importline.img
ttk::label $pconf.importline.msg
grid $pconf.importline.button -row 0 -column 0 -padx 10
grid $pconf.importline.img -row 0 -column 1 -padx 10 -pady 10
grid $pconf.importline.msg -row 0 -column 2 -padx 10 -pady 10
hypertext $pconf.link "Buy account on <https://fruho.com/redirect?urlid=airvpn&cn=$::model::Cn><airvpn.org>"
grid columnconfigure $pconf 0 -weight 4 -uniform 1
grid columnconfigure $pconf 1 -weight 4 -uniform 1
grid columnconfigure $pconf 2 -weight 4 -uniform 1
grid $pconf.profilelabel -row 1 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.profileinput -row 1 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.profileinfo -row 1 -column 2 -sticky news -pady 5
grid $pconf.usernamelabel -row 5 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.usernameinput -row 5 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.usernameinfo -row 5 -column 2 -sticky news -pady 5
grid $pconf.passwordlabel -row 7 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.passwordinput -row 7 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.passwordinfo -row 7 -column 2 -sticky news -pady 5
grid $pconf.importline -sticky news -columnspan 3
addprovider-gui-profilename $tab $name
addprovider-gui-username $tab $name $dispname
addprovider-gui-password $tab $name $dispname
addprovider-gui-importline $tab $name
hypertext $pconf.link "Buy account on <https://fruho.com/redirect?urlid=airvpn&cn=$::model::Cn><airvpn.org>"
grid $pconf.link -sticky news -columnspan 3 -padx 10 -pady 10
return $pconf
}
proc ::airvpn::add-to-treeview-plist {plist} {
variable name
variable dispname
$plist insert {} end -id $name -image [img load 16/logo_$name] -values [list $dispname]
}
# this is csp coroutine
proc ::airvpn::ImportClicked {tab} {
proc ::airvpn::ImportClicked {tab args} {
try {
variable name
variable dispname
@@ -23,44 +23,17 @@ namespace eval ::cactusvpn {
proc ::cactusvpn::create-import-frame {tab} {
variable name
variable dispname
variable newprofilename
set newprofilename [unique-profilename $dispname]
set ::${name}::newprofilename [unique-profilename $dispname]
set pconf $tab.$name
ttk::frame $pconf
ttk::label $pconf.profilelabel -text "Profile name" -anchor e
ttk::entry $pconf.profileinput -textvariable ::${name}::newprofilename
ttk::label $pconf.profileinfo -foreground grey
ttk::label $pconf.usernamelabel -text "$dispname username" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey -text "e.g. euahqiou"
ttk::label $pconf.passwordlabel -text "$dispname password" -anchor e
ttk::entry $pconf.passwordinput -textvariable ::${name}::password
ttk::label $pconf.passwordinfo -foreground grey
ttk::frame $pconf.importline
ttk::button $pconf.importline.button -text "Import configuration" -command [list go ::${name}::ImportClicked $tab]
# must use non-ttk label for proper animated gif display
label $pconf.importline.img
addprovider-gui-profilename $tab $name
addprovider-gui-username $tab $name $dispname "e.g. euahqiou"
addprovider-gui-password $tab $name $dispname
addprovider-gui-importline $tab $name
hypertext $pconf.link "Create free or premium account on <https://fruho.com/redirect?urlid=cactusvpn&cn=$::model::Cn><cactusvpn.com>"
img place 24/empty $pconf.importline.img
ttk::label $pconf.importline.msg
grid $pconf.importline.button -row 0 -column 0 -padx 10
grid $pconf.importline.img -row 0 -column 1 -padx 10 -pady 10
grid $pconf.importline.msg -row 0 -column 2 -padx 10 -pady 10
grid columnconfigure $pconf 0 -weight 4 -uniform 1
grid columnconfigure $pconf 1 -weight 4 -uniform 1
grid columnconfigure $pconf 2 -weight 4 -uniform 1
grid $pconf.profilelabel -row 1 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.profileinput -row 1 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.profileinfo -row 1 -column 2 -sticky news -pady 5
grid $pconf.usernamelabel -row 5 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.usernameinput -row 5 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.usernameinfo -row 5 -column 2 -sticky news -pady 5
grid $pconf.passwordlabel -row 7 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.passwordinput -row 7 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.passwordinfo -row 7 -column 2 -sticky news -pady 5
grid $pconf.importline -sticky news -columnspan 3
grid $pconf.link -sticky news -columnspan 3 -padx 10 -pady 10
return $pconf
}
@@ -72,7 +45,7 @@ proc ::cactusvpn::add-to-treeview-plist {plist} {
}
# this is csp coroutine
proc ::cactusvpn::ImportClicked {tab} {
proc ::cactusvpn::ImportClicked {tab args} {
try {
variable name
variable dispname
@@ -16,59 +16,30 @@ namespace eval ::cyberghost {
proc ::cyberghost::create-import-frame {tab} {
variable name
variable dispname
variable newprofilename
set newprofilename [unique-profilename $dispname]
set ::${name}::newprofilename [unique-profilename $dispname]
set pconf $tab.$name
ttk::frame $pconf
ttk::label $pconf.profilelabel -text "Profile name" -anchor e
ttk::entry $pconf.profileinput -textvariable ::${name}::newprofilename
ttk::label $pconf.profileinfo -foreground grey
addprovider-gui-profilename $tab $name
ttk::frame $pconf.select
ttk::label $pconf.select.msg -text "Select configuration files" -anchor e
ttk::button $pconf.select.button -image [img load 16/logo_from_file] -command [list go ::from_file::SelectFileClicked $pconf]
grid $pconf.select.msg -row 0 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.select.button -row 0 -column 1 -sticky e -padx 5 -pady 5
grid columnconfigure $pconf.select 0 -weight 1
ttk::label $pconf.selectinfo -foreground grey
ttk::label $pconf.usernamelabel -text "VPN username" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey -text "e.g. 4384732_8j3StDv8Uw"
ttk::label $pconf.passwordlabel -text "VPN password" -anchor e
ttk::entry $pconf.passwordinput -textvariable ::${name}::password
ttk::label $pconf.passwordinfo -foreground grey
ttk::frame $pconf.importline
ttk::button $pconf.importline.button -state disabled -text "Import configuration" -command [list go ::${name}::ImportClicked $tab $name]
# must use non-ttk label for proper animated gif display
label $pconf.importline.img
img place 24/empty $pconf.importline.img
ttk::label $pconf.importline.msg
grid $pconf.importline.button -row 0 -column 0 -padx 10
grid $pconf.importline.img -row 0 -column 1 -padx 10 -pady 10
grid $pconf.importline.msg -row 0 -column 2 -padx 10 -pady 10
hypertext $pconf.link "Only premium accounts and no support for auto import. See <https://fruho.com/howto/2><howto.>"
grid columnconfigure $pconf 0 -weight 4 -uniform 1
grid columnconfigure $pconf 1 -weight 4 -uniform 1
grid columnconfigure $pconf 2 -weight 4 -uniform 1
grid $pconf.profilelabel -row 1 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.profileinput -row 1 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.profileinfo -row 1 -column 2 -sticky news -pady 5
grid $pconf.select -row 4 -column 0 -sticky news -columnspan 2
grid $pconf.selectinfo -row 4 -column 2 -sticky news
grid $pconf.usernamelabel -row 5 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.usernameinput -row 5 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.usernameinfo -row 5 -column 2 -sticky news -pady 5
grid $pconf.passwordlabel -row 7 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.passwordinput -row 7 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.passwordinfo -row 7 -column 2 -sticky news -pady 5
grid $pconf.importline -sticky news -columnspan 3
addprovider-gui-username $tab $name $dispname "e.g. 4384732_8j3StDv8Uw"
addprovider-gui-password $tab $name $dispname
addprovider-gui-importline $tab $name
hypertext $pconf.link "Only premium accounts and no support for auto import. See <https://fruho.com/howto/2><howto.>"
grid $pconf.link -sticky news -columnspan 3 -padx 10 -pady 10
return $pconf
}
proc ::cyberghost::add-to-treeview-plist {plist} {
variable name
variable dispname
@@ -12,19 +12,17 @@ namespace eval ::from_file {
}
proc ::from_file::create-import-frame {tab} {
variable name
variable dispname
variable newprofilename
set newprofilename [unique-profilename "My Profile"]
set ::${name}::newprofilename [unique-profilename "My Profile"]
set pconf $tab.$name
ttk::frame $pconf
ttk::label $pconf.profilelabel -text "Profile name" -anchor e
ttk::entry $pconf.profileinput -textvariable ::${name}::newprofilename
ttk::label $pconf.profileinfo -foreground grey
addprovider-gui-profilename $tab $name
ttk::frame $pconf.select
ttk::label $pconf.select.msg -text "Select configuration files" -anchor e
ttk::button $pconf.select.button -image [img load 16/logo_from_file] -command [list go ::from_file::SelectFileClicked $pconf]
@@ -33,27 +31,11 @@ proc ::from_file::create-import-frame {tab} {
grid columnconfigure $pconf.select 0 -weight 1
ttk::label $pconf.selectinfo -foreground grey
ttk::frame $pconf.importline
ttk::button $pconf.importline.button -state disabled -text "Import configuration" -command [list go ::${name}::ImportClicked $tab $name]
# must use non-ttk label for proper animated gif display
label $pconf.importline.img
img place 24/empty $pconf.importline.img
ttk::label $pconf.importline.msg
grid $pconf.importline.button -row 0 -column 0 -padx 10
grid $pconf.importline.img -row 0 -column 1 -padx 10 -pady 10
grid $pconf.importline.msg -row 0 -column 2 -padx 10 -pady 10
hypertext $pconf.link "<https://fruho.com/howto/1><How to get config files?>"
grid columnconfigure $pconf 0 -weight 4 -uniform 1
grid columnconfigure $pconf 1 -weight 4 -uniform 1
grid columnconfigure $pconf 2 -weight 4 -uniform 1
grid $pconf.profilelabel -row 1 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.profileinput -row 1 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.profileinfo -row 1 -column 2 -sticky news -pady 5
grid $pconf.select -row 4 -column 0 -sticky news -columnspan 2
grid $pconf.selectinfo -row 4 -column 2 -sticky news
grid $pconf.importline -sticky news -columnspan 3
addprovider-gui-importline $tab $name
grid $pconf.link -sticky news -columnspan 3 -padx 10 -pady 10
return $pconf
}
@@ -20,66 +20,35 @@ namespace eval ::hideipvpn {
variable newprofilename ""
variable username ""
variable password ""
}
proc ::hideipvpn::create-import-frame {tab} {
variable name
variable dispname
variable newprofilename
set newprofilename [unique-profilename $dispname]
set ::${name}::newprofilename [unique-profilename $dispname]
set pconf $tab.$name
ttk::frame $pconf
ttk::label $pconf.profilelabel -text "Profile name" -anchor e
ttk::entry $pconf.profileinput -textvariable ::${name}::newprofilename
ttk::label $pconf.profileinfo -foreground grey
ttk::label $pconf.usernamelabel -text "VPN username" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey -text "e.g. uwdnowqd"
ttk::label $pconf.passwordlabel -text "VPN password" -anchor e
ttk::entry $pconf.passwordinput -textvariable ::${name}::password
ttk::label $pconf.passwordinfo -foreground grey -text "e.g. eowguqie"
ttk::frame $pconf.importline
ttk::button $pconf.importline.button -text "Import configuration" -command [list go ::${name}::ImportClicked $tab]
# must use non-ttk label for proper animated gif display
label $pconf.importline.img
img place 24/empty $pconf.importline.img
ttk::label $pconf.importline.msg
grid $pconf.importline.button -row 0 -column 0 -padx 10
grid $pconf.importline.img -row 0 -column 1 -padx 10 -pady 10
grid $pconf.importline.msg -row 0 -column 2 -padx 10 -pady 10
addprovider-gui-profilename $tab $name
addprovider-gui-username $tab $name $dispname "e.g. uwdnowqd"
addprovider-gui-password $tab $name $dispname
addprovider-gui-importline $tab $name
hypertext $pconf.link "Create account on <https://fruho.com/redirect?urlid=hideipvpn&cn=$::model::Cn><HideIpVPN website>"
grid columnconfigure $pconf 0 -weight 4 -uniform 1
grid columnconfigure $pconf 1 -weight 4 -uniform 1
grid columnconfigure $pconf 2 -weight 4 -uniform 1
grid $pconf.profilelabel -row 1 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.profileinput -row 1 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.profileinfo -row 1 -column 2 -sticky news -pady 5
grid $pconf.usernamelabel -row 5 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.usernameinput -row 5 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.usernameinfo -row 5 -column 2 -sticky news -pady 5
grid $pconf.passwordlabel -row 7 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.passwordinput -row 7 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.passwordinfo -row 7 -column 2 -sticky news -pady 5
grid $pconf.importline -sticky news -columnspan 3
grid $pconf.link -sticky news -columnspan 3 -padx 10 -pady 10
return $pconf
}
proc ::hideipvpn::add-to-treeview-plist {plist} {
variable name
variable dispname
$plist insert {} end -id $name -image [img load 16/logo_$name] -values [list $dispname]
}
# this is csp coroutine
proc ::hideipvpn::ImportClicked {tab} {
proc ::hideipvpn::ImportClicked {tab args} {
try {
variable name
variable dispname
@@ -18,49 +18,20 @@ namespace eval ::ibvpn {
}
proc ::ibvpn::create-import-frame {tab} {
variable name
variable dispname
variable newprofilename
set newprofilename [unique-profilename $dispname]
set ::${name}::newprofilename [unique-profilename $dispname]
set pconf $tab.$name
ttk::frame $pconf
ttk::label $pconf.profilelabel -text "Profile name" -anchor e
ttk::entry $pconf.profileinput -textvariable ::${name}::newprofilename
ttk::label $pconf.profileinfo -foreground grey
ttk::label $pconf.usernamelabel -text "Username (Email)" -anchor e
ttk::entry $pconf.usernameinput -textvariable ::${name}::username
ttk::label $pconf.usernameinfo -foreground grey -text ""
ttk::label $pconf.passwordlabel -text "$dispname password" -anchor e
ttk::entry $pconf.passwordinput -textvariable ::${name}::password
ttk::label $pconf.passwordinfo -foreground grey
ttk::frame $pconf.importline
ttk::button $pconf.importline.button -text "Import configuration" -command [list go ::${name}::ImportClicked $tab]
# must use non-ttk label for proper animated gif display
label $pconf.importline.img
addprovider-gui-profilename $tab $name
addprovider-gui-username $tab $name $dispname
addprovider-gui-password $tab $name $dispname
addprovider-gui-importline $tab $name
hypertext $pconf.link "Create free or premium account on <https://fruho.com/redirect?urlid=ibvpn&cn=$::model::Cn><ibvpn.com>"
img place 24/empty $pconf.importline.img
ttk::label $pconf.importline.msg
grid $pconf.importline.button -row 0 -column 0 -padx 10
grid $pconf.importline.img -row 0 -column 1 -padx 10 -pady 10
grid $pconf.importline.msg -row 0 -column 2 -padx 10 -pady 10
grid columnconfigure $pconf 0 -weight 4 -uniform 1
grid columnconfigure $pconf 1 -weight 4 -uniform 1
grid columnconfigure $pconf 2 -weight 4 -uniform 1
grid $pconf.profilelabel -row 1 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.profileinput -row 1 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.profileinfo -row 1 -column 2 -sticky news -pady 5
grid $pconf.usernamelabel -row 5 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.usernameinput -row 5 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.usernameinfo -row 5 -column 2 -sticky news -pady 5
grid $pconf.passwordlabel -row 7 -column 0 -sticky news -padx 5 -pady 5
grid $pconf.passwordinput -row 7 -column 1 -sticky news -padx 5 -pady 5
grid $pconf.passwordinfo -row 7 -column 2 -sticky news -pady 5
grid $pconf.importline -sticky news -columnspan 3
grid $pconf.link -sticky news -columnspan 3 -padx 10 -pady 10
return $pconf
}
@@ -72,7 +43,7 @@ proc ::ibvpn::add-to-treeview-plist {plist} {
}
# this is csp coroutine
proc ::ibvpn::ImportClicked {tab} {
proc ::ibvpn::ImportClicked {tab args} {
try {
variable name
variable dispname
Oops, something went wrong.

0 comments on commit 4578b9e

Please sign in to comment.