-
Notifications
You must be signed in to change notification settings - Fork 0
/
biblepix-setup.tcl
executable file
·84 lines (66 loc) · 2.6 KB
/
biblepix-setup.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env tclsh
# ~/Biblepix/biblepix-setup.tcl
# Main Setup program for BiblePix, starts Setup dialogue
# Called by User via Windows/Unix Desktop entry
# If called by BiblePix-Installer, this is the first file downloaded + executed
################################################################################
# Version: 4.1
# Authors: Peter Vollmar & Joel Hochreutener, biblepix.vollmar.ch
# Updated: 5jan23 pv
package require Tk
#Verify location & source vars
set rootdir "[file dirname [info script]]"
set Globals "[file join $rootdir prog src share globals.tcl]"
#Set initial FTP message & progress bar
destroy .updateFrame
frame .updateFrame -padx 40 -pady 50 -borderwidth 20
pack .updateFrame -fill y -expand true
label .updateFrame.pbTitle -justify center -bg lightblue -fg black -borderwidth 10 -textvar pbTitle
ttk::progressbar .updateFrame.progbar -mode indeterminate -length 200
pack .updateFrame.pbTitle .updateFrame.progbar
append errText {Update not possible! You must download and rerun the BiblePix Installer from www.vollmar.ch/biblepix} \n {Aktualisierung nicht möglich!Sie müssen den BibelPix-Installer herunterladen und neu laufen lassen.}
#Exit if Globals not found
if [catch {source $Globals} res] {
lappend pbTitle $errText $res
.updateFrame.pbTitle conf -bg orange
after 7000 {exit}
} else {
#Get current version before update
set curVersion $version
#In case of GIT download: makeDirs
makeDirs
#Set initial texts if missing
source $SetupTools
set updatingHttp "Updating BiblePix program files..."
set noConnHttp "No connection for BiblePix update"
# 1. D O H T T P U P D A T E (if not initial)
if [catch {sourceHTTP} res] {
set pbTitle $errText
.updateFrame.pbTitle conf -bg orange
after 7000 {exit}
} else {
.updateFrame.progbar start
if [info exists InitialJustDone] {
set pbTitle $uptodateHttp
} else {
##start downloading process; $httpError is validated by SetupMainFrame
set pbTitle $updatingHttp
catch {runHTTP 0} httpError
}
#Copy photos after first run of Installer or if Config missing
if { [info exists InitialJustDone] || ![file exists $Config] } {
#source $SetupTexts
#source $SetupTools
after idle {
catch {NewsHandler::QueryNews $msg::resizingPic orange}
copyAndResizeSamplePhotos
}
}
.updateFrame.progbar stop
pack forget .updateFrame.pbTitle .updateFrame.progbar .updateFrame
}
# 2. B U I L D M A I N G U I
source $SetupMainFrame
#Delete any stale program files/fonts/directories/TWD files
after idle {deleteOldStuff}
}