Posted to tcl by Meliorator at Wed Mar 28 17:12:58 GMT 2012view raw
- package require Tcl 8.5
- package require Tk 8.5
- package require sqlite3
-
- namespace eval StationLogos {
-
- variable logo_database
- variable load_logos_progress
-
- variable SCRIPTDIR [file dirname [info script]]
-
- source [file join $SCRIPTDIR Tools FastResize.tcl]
- source [file join $SCRIPTDIR StationLogos_ui.tcl]
-
- array set logo_database {
-
- path {C:\Users\piLL\AppData\Roaming\XBMC\userdata\Database\TV19.db}
- table {`channels`}
- station_name {`sChannelName`}
- logo_path {`sIconPath`}
- station_number {`idChannel`}
- station_numbers {}
- }
-
- set logo_database(command) [namespace current]::StationLogosDb
- }
-
- proc StationLogos::GetLogo {logo_path} {
-
- set logo_thumb [image create photo -width 64 -height 64]
-
- if {[file exists $logo_path]} {
-
- set logo_image [image create photo -file $logo_path]
-
- resize $logo_image 64 64 $logo_thumb
-
- image delete $logo_image
- }
-
- return $logo_thumb
- }
-
- proc StationLogos::Init {root args} {
-
- variable logo_database
-
- if {$::argv0 == [info script]} {
-
- wm title $root StationLogos
- wm geometry $root 740x540+30+30
-
- sqlite3 $logo_database(command) $logo_database(path)
-
- wm protocol $root WM_DELETE_WINDOW [namespace current]::DeInit
-
- if {[catch { UserInterface $root } err]} {
-
- StationLogosDb close
- # bgerror $err
- exit 1
- }
- }
- }
-
- proc StationLogos::DeInit {} {
-
- variable logo_database
-
- $logo_database(command) close
-
- namespace delete [namespace current]
-
- exit 0
- }
-
- StationLogos::Init .