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
|
itcl::class NewTable {
inherit itk::Widget
private variable fileName
private variable g_isNewFile 1
private variable _table_type BINARY
private method _close {}
private method create_new_fits_table {type}
public method go {}
constructor {args} {
global checkBBgColor
global g_titleFont
if { [llength $args] != 1} {
error "Too many args in NewTable"
_close
}
set fileName [lindex $args 0]
if { [file exist $fileName] == 1 } {
set g_isNewFile 0
}
iwidgets::radiobox $itk_interior.type -labeltext "Table Type" \
-labelfont g_titleFont \
-labelpos nw -selectcolor $fvPref::checkBBgColor
pack $itk_interior.type -fill x -expand 1
$itk_interior.type add BINARY -text "Binary"
$itk_interior.type add ASCII -text "ASCII"
$itk_interior.type select BINARY
#$itk_component(tabletype) add BINARY -text "Binary"
#$itk_component(tabletype) add ASCII -text "ASCII"
#$itk_component(tabletype) select BINARY
}
destructor {}
}
itcl::body NewTable::go {} {
set _table_type [$itk_interior.type get]
create_new_fits_table $_table_type
_close
}
itcl::body NewTable::create_new_fits_table {type} {
if { $g_isNewFile ==1 } {
set filemode 2
} else {
set filemode 1
}
if { [catch {set fitscmd [fits open $fileName $filemode]} err] == 1 } {
error $err
return
}
if { $g_isNewFile == 0} {
$fitscmd move [$fitscmd info nhdu]
}
if { $_table_type == "ASCII" } {
$fitscmd put ahd 1 0 {} {} {} {} "ASCIITable" 0
} else {
$fitscmd put bhd 1 0 {} {} {} "BinTable"
}
$fitscmd close
}
itcl::body NewTable::_close {} {
itcl::delete object $this
}
|