Increase size of MUT's display

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

Increase size of MUT's display

#1 Post by davids45 »

New computers have large hard-drives and numerous optical and USB peripherals.
For those easily tempted, it is possible to create a swag of partitions on your ginormous hard-drive(s) and also plug in all your flash drives.
Suddenly the previously reliable MUT doesn't see these new additions.....or so I thought.
I finally twigged that the MUT display is of a fixed size (width and height) unlike Pmount which can grow off the screen under such proliferation.
I could enlarge the MUT box by dragging a corner with the mouse but this change was lost on re-booting.
After a Pfind hunt, I found I could enlarge the MUT box by altering its display setting as follows:
1) navigate to the file mut.tcl which hides at /usr/lib/mut/mut.tcl
2) "Open as text" (right mouse-click menu) this file
3) Scroll down about 80% toward the bottom to find the section headed "Create Display"
4) Find the line "Canvas" which has in green numbers, the width and height values.
5) Edit these values to suit your hardware extravagances (eg my height is now 550 to see most things)
6) Save the file
7) Re-start MUT to see if it's the right size. Repeat until bored.

David S.

User avatar
DC
Posts: 360
Joined: Sun 30 Apr 2006, 15:07
Location: Maidenhead, England

#2 Post by DC »

Have you tried pdrive ?

http://www.murga-linux.com/puppy/viewtopic.php?t=21200

it has a lot of features that MUT and pmount don't. Scrolling windows should interest you.
The only thing I still like about MUT is the colours and tux

DC

User avatar
Bahurim
Posts: 34
Joined: Sat 08 Sep 2007, 01:37

#3 Post by Bahurim »

Thanks davids45, great tip! I have been wanting to do that for a while now. Would you know how to increase the font sizes for easier readability?

Seems there is no love for MUT anymore besides me and Sage and now yourself. Typical that the mut always gets picked. ; )

I would really love to see a discussion on why Puppy needs 3 different drive mounters and why no one wants to modify MUT instead of starting new as in Pmount, Pdrive, etc... Is it the tcl or what?

User avatar
DC
Posts: 360
Joined: Sun 30 Apr 2006, 15:07
Location: Maidenhead, England

#4 Post by DC »

I still prefer MUT when I've not installed pdrive (liveCD etc) because of partition labels.Also pmount expands off the screen when lots of partitions / drives are involved.
When zigbert enhanced pmount to pdrive. Pdrive became of more use than MUT
Would you know how to increase the font sizes for easier readability?
I tried this a few months ago and you end up with the same problem as pmount. Lots of drives /partitions = MUT expands off the screen

DC

from memory
MUT was not being maintained.
pdrive is a branch from pmount by zigbert

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#5 Post by davids45 »

G'day,
Looking through the code again last night re your query on increasing the font size in the MUT display, I think it's a difficult problem for any quick fix as each MUT display line appears to contain pre-sized boxes as well as mixed texts.

Each line would have to be adjusted for each box as well as each text section.

A slight readability improvement could be to convert all the plain text to bold by adding "bold" after each font setting. Wherever you see a bracketed 'courier' or 'helvetica', type "bold" after it inside the bracket. Some texts already are bolded.

These font settings generally are followed by "-10" in green. This '10' is the font size, if you do want to change it, try increasing it to say 12 or 14, save the file, open MUT and see how the MUT display is altered. If you don't like it, change it back to the original or to the one you like.

You could also play around with the colours listed in the various lines which could improve readability. Even the grey background, if it helps.

David S.

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#6 Post by ttuuxxx »

Well I basically increased the text size change the colours to a readable yellow and here's the code. copy and paste it into Geany and save it as mut.tcl to usr/lib/mut

Code: Select all

#!/usr/bin/wish
#
# MUT written by Jesse Liley for Puppy Linux 2005
# bugs, fixes, suggestions, email: Jesse.Liley@gmail.com
#
# Free software, use at own risk! LGPL, please keep comments.
#
# Images used taken from Mandrake Linux download 10.0 /usr/share/icons
# So I hope they are free to distribute :-)
#

package require Tcl 8.4

#Here you can set mount points that MUT will not allow to be unmounted.
lappend NoUnmounts "/"  ; # This one is a generic for any Linux, its actually quite bad to unmount this one.
if {![file exists /etc/multisessionmediatype]} {
	# this file /etc/multisessionmediatype indicates that 
	lappend NoUnmounts "/mnt/home"  ; # This one is a Puppy Linux specific one, it is the container fs for pup001 file
}
#lappend NoUnmounts "/mnt/home" ; #add any more here, as many as you like, don't forget to uncomment.

#Puppy2 very specific: never unmount anything under /initrd/
lappend PuppyNoUnmount "/initrd/"

#Here you can set devices that start out not being scanned, e.g. for if the scan time takes a while and you don't really want to wait every refresh.
array unset NoScanMedia   ;# this line defines the array.
set NoScanMedia(fd0) "noscan"  ;# floppy disk is fd0
set NoScanMedia(fd1) "noscan"  ;# second floppy disk is fd1, this is ok if one or none floppy drives in system.
#set NoScanMedia(fd0) "noscan" ;# add others, replace fd0 with device name



# Here in this function you can change the scripted events attached to MUT click actions (mounting etc...)

proc trigger_external_event {event device} {
	set mounted 0
	set dev $device
	if {[info exists ::etc_fstab($dev)]} {
		set mntloc "$::etc_fstab($dev)"
	} else {
		set mntloc "/mnt/$dev"
	}
	# if we chose bad, allow fallback to some other location.
	foreach devpath [array names ::mounteds] {
		set d [lindex [split $devpath / ] end]
		set mp [lindex [split $::mounteds($devpath) | ] 0 ]
		if {$mp == $mntloc && $dev != $d} {
			set mntloc "/mnt/$dev"
		}
	}

	set rescan_delay 2000
	catch {
		set mntloc [lindex [split $::mounteds(/dev/$dev) |] 0]
		set mounted 1
	}
	if {$::debug} { puts "User clicked on action with device $event /dev/$dev $mntloc $mounted" }
	switch $event {
		"cdplay" {   ;# Commands to open application to play audio CD
				set cdinfo ""
				catch "exec $::mut/bin/cdrominfo /dev/$dev -p" cdinfo
				if {$::debug} {puts "got cdinfo for /dev/$dev, which is  $cdinfo"}
				if { [lindex [split $cdinfo '|'] 7] == "Audio" || [lindex [split $cdinfo '|'] 7] == "Mixed"} {
					catch "exec /usr/local/bin/gplaycd -c /dev/$dev &"
				}
				set rescan_delay 200
			}
		"cdmount" {  ;# Commands to open application to show data files on CD
				catch "exec mkdir $mntloc"
				set fs "iso9660"
				catch "exec mount /dev/$dev $mntloc -t iso9660"
				catch "exec rox -d $mntloc &"
# BK removed...				catch {exec "mount > /etc/mtab"}
				set rescan_delay 500
			}
		"cdunmount" {;# Commands to close application to show data files on CD
# BK added...
				catch "exec rox -D $mntloc"
				catch "exec fuser -k -m $mntloc"
# BK added...
				catch "exec sync"
				catch "exec umount $mntloc"
# BK removed...				catch {exec "mount > /etc/mtab"}
				set rescan_delay 500
			}
		"mount" {   ;# Commands to open application to show data files on disk
				catch "exec mkdir $mntloc"
				set fs ""
				catch "exec $::mut/bin/guess_fstype /dev/$dev" fs
				if {$::debug} {puts "got fs for /dev/$dev, which is $fs"}
# BK				if {$fs=="ntfs"} {
# BK					catch "exec ntfs-3g /dev/$dev $mntloc"
# BK				} else {
					catch "exec mount /dev/$dev $mntloc -t $fs"
# BK				}
				catch "exec rox -d $mntloc &"
#				set percentage ""
#				catch "exec df -h $mntloc | grep -v Filesystem | tr ' ' '\n' | grep %" percentage
# BK removed...				catch {exec "mount > /etc/mtab"}
				set rescan_delay 500
			}
		"unmount" { ;# Commands to close application to show data files on disk
# BK added...
				catch "exec rox -D $mntloc"
				if {$mounted} {
					catch "exec fuser -k -m $mntloc"
				}
# BK added...
				catch "exec sync"
				catch "exec umount $mntloc"
# BK removed...				catch {exec "mount > /etc/mtab"}
				set rescan_delay 400
			}
		"gxinedvd" { ;# Launch a dvd player
				catch "exec gxine dvd:/"
				set rescan_delay 2000
			}
		"rox"	{   ;# Launch file browser on already mounted partition/disk/cd
				catch "exec rox -d $mntloc &"
				set rescan_delay 200
			}
		"eject" {   ;# Eject disc media Cdrom DVD etc..
				if {$mounted} {
					catch "exec rox -D $mntloc"
					catch "exec fuser -k -m $mntloc"
# BK removed...
					catch "exec sync"
					catch "exec umount $mntloc"
# BK removed...					catch {exec "mount > /etc/mtab"}
				}
				catch "exec $::mut/bin/cdrominfo /dev/$dev -e"
				# This application locks up during the trayclose event, so rescan shortlyafter
				set rescan_delay 200
			}
		"trayclose" {;# Close tray holder mechanism on disc media Cdrom DVD etc..
				catch "exec $::mut/bin/cdrominfo /dev/$dev -c"
				# This application locks up during the trayclose event, so rescan shortlyafter
				set rescan_delay 200
			}
		"initrdswapoff" {;# unmount initrd swap filesystem
				catch "exec swapoff /initrd/dev/$dev"
				set rescan_delay 1000
			}
		"swapoff" {;# unmount swap filesystem
				catch "exec swapoff /dev/$dev"
				set rescan_delay 1000
			}
		"swapon" { ;# mount swap filesystem
				catch "exec swapon /dev/$dev"
				set rescan_delay 1000
			}
		"scan" {  ;# Activate Mut scanning this device (it may be slow to respond)
				array unset ::NoScanMedia $dev
				if {$::debug} {puts "names NoScan [array names ::NoScanMedia]"}
				set rescan_delay 100
			}
		"noscan" { ;# Deactivate Mut scanning this device (it may be slow to respond)
				set ::NoScanMedia($dev) "noscan"
				if {$::debug} {puts "names NoScan [array names ::NoScanMedia]"}
				set rescan_delay 100
			}
		"refresh" { ;# rescan now
				full_refresh_display
				set rescan_delay 0
			}
			default { msg "no code to run for event \"$event\"" }
	}
	return $rescan_delay
}

# This function calculates home path of application, yay, no need to configure it :-) even if symlinked to it.
# this is generic, it could apply to any tcl app that has an application directory structure.
proc homepath { } {
	set cmd "pwd"
	catch $cmd this_pwd
	if {[string index $::argv0 0] == "/"} {
		set path "$::argv0"
	} else {
		set path "$this_pwd/$::argv0"
	}
	# if it is a symlink from say /usr/local/bin/mut, follow the link.
	if { [file type $path] == "link" } {
		set path "$this_pwd/[file readlink $path]"
	}
	set path "$path/.."
	set plist [split $path "/"]
	set n [llength $plist]
	for {set i 0} {$i < $n} {incr i} {
		if {[lindex $plist $i] == "."} { 
			set a [expr "$i - 1" ]
			set b [expr "$i + 1" ]
			set plist [concat [lrange $plist 0 $a] [lrange $plist $b end ] ]
			incr n -1
		}
	}
	set n [llength $plist]
	set olist ""
	for {set i 0} {$i < $n} {incr i} {
		if {[lindex $plist $i] == ".."} {
			set olist [lrange $olist 0 [expr "[llength $olist]-2"]]
		} else {
			lappend olist [lindex $plist $i]
		}
	}
	set path "[join $olist "/"]/"
	return $path
}

proc in_rect {x y x1 y1 x2 y2} {
	if {$x >= $x1 && $x <= $x2 && $y >= $y1 && $y <= $y2} {return 1}
	return 0
}

set ::wx 100
set ::wy 100

proc show_icons {{wx unset} {wy unset}} {
	if {$wx == "unset"} {set wx $::wx} else {set ::wx $wx}
	if {$wy == "unset"} {set wy $::wy} else {set ::wy $wy}
	
	.boxc delete tux
	.boxc create image $wx $wy -image ::img::img(tux) -anchor se -tag tux
	set wid "[image width ::img::img(refresh)]"
	
	.boxc delete refresh
	.boxc create image $wx 0 -image ::img::img(refresh) -anchor ne -tag refresh
	set ::actions(refresh) [list refresh [expr "$wx - $wid"] 0 $wx "$wid" all]
	if {$::debug} {puts "actions(refresh) = $::actions(refresh)" }
}

proc full_refresh_display {} {
	.boxc delete all
	array unset ::actions
	set ::infolist {}
	run_full_scan
	Show_Devices
	show_icons
	if {[file exists /proc/bus/usb/devices]} {
		set ::last_hotplug [file mtime /proc/bus/usb/devices]
	}
}

proc quick_update_display {} {
	.boxc delete all
	array unset ::actions
	set ::infolist {}
	run_quick_update
	Show_Devices
	show_icons
}

proc check_click_action {x y} {
	set done false
	set rescan_delay 2000
	foreach id [array names ::actions *] {
		set action $::actions($id)
		foreach {x1 y1 x2 y2} [lrange $action 1 4] {
			if {[in_rect $x $y $x1 $y1 $x2 $y2]} {
				#puts "event trigger [lindex $action 0] for [lindex $action 5]"
				set done true
				set rescan_delay [trigger_external_event [lindex $action 0] [lindex $action 5]]
			}
		}
	}
	if {$done == true } { 
		if {$rescan_delay != 0} {after $rescan_delay full_refresh_display }
	}
} 

proc msg { msg } {
	tk_dialog .msg "Message Window" $msg info 0 OK
}

proc remove_empties str {
	set i 0
	set i [lsearch $str {}]
	while {$i >= 0} {
		set str [lreplace $str $i $i]
		set i [lsearch $str {}]
	}
	return $str
}
proc grab_fs_vol {fs dev} {
	set results ""
	if {$fs == "ext2" || $fs == "ext3"} {set fs "ext2"}
	if {[lsearch [list "iso9660" "vfat" "ext2"] $fs]=={}} {
		if {$::debug} {puts "Unknown fs $fs for grab_fs_vol"}
		return ""
	}
	catch "exec $::mut/bin/label_$fs /dev/$dev" results
	set results [lindex [split $results "\n"] 0]
	set results [string trimleft [string trimright $results]]
	return $results
}

proc majorBus__get_list {} {
	set rec false
	array unset ::majorBus
	array unset ::majorBusRev
	catch {
		set fid [open "/proc/devices" r]
		if {$::debug} {puts "in majorBus__get_list"}
		while {![eof $fid]} {
			gets $fid str
			set line [remove_empties [split $str " "]]
			if {$rec == true && [lindex $line 1] > 1} {
				set ::majorBus([lindex $line 0]) [lindex $line 1]
				set ::majorBusRev([lindex $line 1]) [lindex $line 0]
	if {$::debug} {puts " ::majorBus([lindex $line 0]) $::majorBus([lindex $line 0]) "}
			}
			if {[lindex $line 0 ] == "Block"} {set rec true}
		}
		close $fid
	}
}

# scan media or model file.
proc scan_ide_medium {bus lun scan_me} {
	if {$bus=="" || $lun=="" || $scan_me==""} {return ""}
	set medium ""
	catch {
		set bd_fd [open "/proc/ide/$bus/$lun/$scan_me" r]
		gets $bd_fd medium
		close $bd_fd
	}
	return $medium
}

proc main_or_part {str} {
	for {set i 0} {$i < [string length $str] } {incr i} {
		if {[string index $str $i] >= "0" && [string index $str $i] <= "9"} {
			if {[string range $str $i end] >= 1 && [string range $str $i end] <= 16} {
				return part
			}
		}
	}
	return main
}

proc diskStats26__get_list {quick} {
	set rec false
	array unset ::diskStats
	catch {
		set fid [open "/proc/diskstats" r]
		if {$::debug} {puts "in diskStats26__get_list"}
		while {![eof $fid]} {
			gets $fid str
			set line [remove_empties [split $str " "]]
			foreach did $::grabdevs {
				if {[string range [lindex $line 2] 0 1] == $did} {
					set media ""
					if {$did == "fd"} {
						set media floppy
					}
					if {$did == "hd"} {
						if {[main_or_part [lindex $line 2]] == "main"} {
							set media [scan_ide_medium $::majorBus([lindex $line 0]) [lindex $line 2] "media"]
						} else {
							set media part
						}
					}
					if {$did == "sd"} {
						if {[main_or_part [lindex $line 2]] == "main"} {
							set media disk
						} else {
							set media part
						}
					}
					if {$did == "scd" || $did=="sr"} {
						if {[main_or_part [lindex $line 2]] == "main"} {
							set media cdrom
						} else {
							set media part
						}
					}
					set ::diskStats([lindex $line 2]) "[lindex $line 0].[lindex $line 1].$::majorBus([lindex $line 0]).$media"
					if {$::debug} {puts "set ::diskStats([lindex $line 2]) $::diskStats([lindex $line 2])"}
				}
			}
			if {[lindex $line 0 ] == "Block"} {set rec true}
		}
		close $fid
	}
}

proc diskStats24__get_list {quick} {
	set rec false
	array unset ::diskStats
	if {$::debug} {puts "in diskStats24__get_list"}
	set addfd false
	catch {
		if {$::majorBusRev(fd)  >= 0} {
			set ::diskStats(fd0) "$::majorBusRev(fd).0.fd.floppy"
			if {$::debug} {puts "set ::diskStats(fd0) $::diskStats(fd0)"}
			#second floppy disk here:
			#set ::diskStats(fd1) "$::majorBusRev(fd).1.fd.floppy"
			#if {$::debug} {puts "set ::diskStats(fd1) $::diskStats(fd1)"}
		}
	}
	foreach dev [lsort [array names ::partitions]] {
		set str $::partitions($dev)
		set line [remove_empties [list [lindex $str 1] [lindex $str 2] $dev ]]
		if {[llength $line] < 3 } {continue}
		foreach did $::grabdevs {
			if {[string range [lindex $line 2] 0 1] == $did} {
				set media ""
				if {$did == "fd"} {
					set media floppy
				}
				if {$did == "hd"} {
					if {[main_or_part [lindex $line 2]] == "main"} {
						set media [scan_ide_medium $::majorBus([lindex $line 0]) [lindex $line 2] "media"]
					} else {
						set media part
					}
				}
				if {$did == "sd"} {
					if {[main_or_part [lindex $line 2]] == "main"} {
						set media disk
					} else {
						set media part
					}
				}
				if {$did == "scd" || $did=="sr"} {
					if {[main_or_part [lindex $line 2]] == "main"} {
						set media cdrom
					} else {
						set media part
					}
				}
				set ::diskStats([lindex $line 2]) "[lindex $line 0].[lindex $line 1].$::majorBus([lindex $line 0]).$media"
				if {$::debug} {puts "set ::diskStats([lindex $line 2]) $::diskStats([lindex $line 2])"}
			}
		}
		if {[lindex $line 0 ] == "Block"} {set rec true}
	}
}

proc diskStats__get_list {quick} {
	if {$::Kernel_Version=="2.4"} {diskStats24__get_list $quick}
	if {$::Kernel_Version=="2.6"} {diskStats26__get_list $quick}
}

proc hexcharvalue char {
	if {$char == "a"} {return 10}
	if {$char == "b"} {return 11}
	if {$char == "c"} {return 12}
	if {$char == "d"} {return 13}
	if {$char == "e"} {return 14}
	if {$char == "f"} {return 15}
	if {$char >= 0 && $char <= 9} {return $char}
	if {$::debug} {puts "hexcharvalue got $char"}
	return 0
}

proc hx2dec str {
	if {[llength $str] == 1} {
		set v 0
		set i 0
		while {$i < [string length $str]} {
			set v [expr "16 * $v + [hexcharvalue [string index $str $i]]"]
			incr i
		}
		return $v
	} else {
		set v {}
		set i 0
		while {$i < [llength $str]} {
			lappend v [hx2dec [lindex $str $i]]
			incr i
		}
		return $v
	}
}

proc stat_type file {
	catch "exec /bin/stat -c %t|%T $file" info
	return [split $info |]
}

proc partitions__get_list {} {
	array unset ::partitions
	catch {
		set fid [open "/proc/partitions" r]
		while {![eof $fid]} {
			gets $fid str
			set shortlist [remove_empties [split $str]]
			set dev [lindex $shortlist 3]
			if {[llength $str] == 4 && [lindex $str 0] > 0 && [lindex $shortlist 2] > 1 } {
				set mytimer [clock clicks -milliseconds]
				set openok true
				set catchinfo ""
				if {$::Kernel_Version=="2.4" && [string range $dev 0 1] == "sd"} {
					# Sigh, we have to force the kernel to look at the hardware:
					if {[info exists ::NoScanMedia($dev)]} {
						if {$::debug} { puts "not scan $dev"}
					} else {
						set openok false
						catch {
							if {$::debug} { puts "about to scan $dev"}
							set bd_fd [open "/dev/$dev" r]
							close $bd_fd
							set openok true
						} catchinfo
					}
				}
				if {$openok == false} {
					if {$::debug} { puts "device not working? /dev/$dev  $catchinfo" }
					if {[info exists ::NoScanMedia($dev)]} {
						if {$::debug} {puts "already in NoScanMedia $::NoScanMedia($dev)"}
					} else {
						#if it exists but cannot be opened, make it a noscan object
						if {[file exists /dev/[lindex $shortlist 3] ] == 1} {
							set ::NoScanMedia([lindex $shortlist 3]) "noscan"
						}
					}
				}
				set time_length [expr "[clock clicks  -milliseconds] - $mytimer"]
				if {$::debug} { puts "open scan time is $time_length 1000ths of a second, $shortlist"}
				set ::partitions([lindex $shortlist 3]) \
					[list [format "%1.1f Mb" [expr "[lindex $shortlist 2]/1000.0"]] [lindex $shortlist 0] [lindex $shortlist 1]]
				if {$::debug} {puts "set  ::partitions($dev) = $::partitions($dev)"}
			}
			if {[llength $str] == 4 && [lindex $str 0] > 0 && [lindex $shortlist 2] == 1 } {
				set ::partitions($dev) "extended"
			}
		}
		close $fid
	}
	
	# we have to scan for extra devices here in kernel 2.4
	# Scan for IDE removable disc drives (cdroms)
	if {$::Kernel_Version=="2.4"} {
		set ide_devs [glob /dev/hd*]
		set ide_scan {}
		set devlist [array names ::partitions]
		foreach device $ide_devs {
			set dev [lindex [split $device / ] 2]
			set atpos [lsearch -exact $devlist $dev]
			if {$atpos < 0 && [string length $dev] == 3} {
				set found false
				set gl ""
				catch {
					set  gl [split [glob "/proc/ide/ide*/$dev"] /]
				}
				array unset ::cdromMedium $dev
				if {$gl == ""} {continue}
				set info ""
				lappend ide_scan $dev
				set info [hx2dec [stat_type "/dev/$dev"]]
				if {$info ==""} {continue}
				set ::partitions($dev) [concat "device" $info]
				if {$::debug} { puts "set  ::partitions($dev) = $::partitions($dev)" }
			}
		}
		if {$::debug} { puts "scan these devices... [lsort $ide_scan]" }
	}
	# Scan for SCSI/USB removable disc drives (cdroms)
	if {$::Kernel_Version=="2.4" || $::Kernel_Version=="2.6"} {
		set sr_devs [glob /dev/sr*]
		set sr_scan {}
		set devlist [array names ::partitions]
		foreach device $sr_devs {
			set dev [lindex [split $device / ] 2]
			set atpos [lsearch -exact $devlist $dev]
			if {$atpos < 0 && [string length $dev] == 3} {
				set found false
				set gl ""
				set cdinfo ""
				catch { exec $::mut/bin/cdrominfo /dev/$dev -p } cdinfo
				if {$cdinfo == ""} {continue}
				set info [split $cdinfo |]
				if {[llength $info ] < 10} {continue}
				lappend sr_scan $dev
				set info [hx2dec [stat_type "/dev/$dev"]]
				set ::partitions($dev) [concat "device" $info ]
				if {$::debug} { puts "set  ::partitions($dev) = $::partitions($dev)" }
			}
		}
		if {$::debug} { puts "scan these devices... [lsort $sr_scan]" }
	}
}

proc device_nodes__scan_for_make_additional {} {
	foreach name [lsort [array names ::partitions]] {
		if {[lsearch -exact $::existing_nodes $name] >= 0} {continue}
		set info ""
		set info [hx2dec [stat_type "/dev/$name"]]
		if {[lindex $info 0]>0 && [llength $info] ==2} {
			lappend ::existing_nodes $name
		} else {
			if {$::debug} {puts "ADDME $name info $info"}
			if {$::debug} {puts "makedevs /dev/$name b [lindex $::partitions($name) 1] [lindex $::partitions($name) 2] 0 16 s" }
			catch "exec makedevs /dev/$name b [lindex $::partitions($name) 1] [lindex $::partitions($name) 2] 0 16 s " ex_info
			if {$::debug} {puts "execute info $ex_info" }
		}
	}
	if {$::debug} {puts "devnodes include $::existing_nodes"}
}

proc cdromMedium_get_list {quick} {
	if {$quick=="true"} {return}
	array unset ::cdromMedium
	foreach dev [array names ::diskStats] {
		set ds [split $::diskStats($dev) '.']
		if {[lindex $ds 3] =="cdrom"} {
			catch "exec $::mut/bin/cdrominfo /dev/$dev -p" cdinfo
			set ::cdromMedium($dev) $cdinfo
			if {$::debug} {puts "set  ::cdromMedium($dev) which is $cdinfo"}
		}
	}
}

proc additional_scan_for {mnt} {
	set info [hx2dec [stat_type "/dev/$mnt"]]
	set m [lindex $info 0]
	set s [lindex $info 1]
	if {$m !="" && $s!= ""} {
		foreach dev [array names ::diskStats] {
			if {$m == [lindex [split $::diskStats($dev) .] 0] &&
				$s == [lindex [split $::diskStats($dev) .] 1]} {
				if {$dev !="" && $mnt !=""} {
					set ::etc_fstab($dev) "/mnt/$mnt"
					if {$::debug} {puts "set ::etc_fstab($dev) = $::etc_fstab($dev)"}
					return
				}
			}
		}
	}
}

proc etc_fstab__get_list {} {
	if {$::debug} {puts "in etc_fstab__get_list"}
	array unset ::etc_fstab 
	catch {
		set fid [open "/etc/fstab" r]
		while {![eof $fid]} {
			gets $fid str
			set sl [remove_empties [split $str]]
			set dev [lindex $sl 0]
			set mnt [lindex $sl 1]
			set dev [lindex [remove_empties [split $dev /]] end]
			if { $dev != "" &&
				$dev != "none" && 
				$dev != "tmpfs" && 
				$dev != "rootfs" && 
				$dev != "loop"} {
				if {$dev !="" && $mnt !=""} {
					set ::etc_fstab($dev) "$mnt"
					if {$::debug} {puts "set ::etc_fstab($dev) = $::etc_fstab($dev)"}
				}
			}
		}
	}
	close $fid
	additional_scan_for dvd
	additional_scan_for cdrom

	# Multisession DVD/CD should get mounted at /mnt/home if possible
	set myhome /mnt/myhome
	if {[file exists /etc/multisessionmediatype]} {
		set cdburnerdrive ""
		if {[file exists /etc/cdburnerdrive ]} {
			catch {
				set fid [open /etc/cdburnerdrive r]
				gets $fid cdburnerdrive
				close $fid
			}
		}
		if {$cdburnerdrive != ""} {
			set do_set true
			catch {
				if {$::etc_fstab($cdburnerdrive) == $myhome } {
					set do_set false
				}
			}
			if {$do_set} {
				set ::etc_fstab($cdburnerdrive) $myhome
				if {$::debug} {puts "set ::etc_fstab($cdburnerdrive) = $::etc_fstab($cdburnerdrive)"}
			}
		}
	}
}

proc remove_nonpath str {
	set i 0
	set keep {}
	while {$i < [llength $str]} {
		if {[string first / [lindex $str $i]] >= 0} { lappend keep [lindex $str $i] }
		incr i 
	}
	return $keep
}
proc filepath_nodetype path {
	# "symbolic link" "block special file" "directory" "regular file"
	catch "exec stat -c '%F' $path" info
	return $info
}
proc is_this_a_dev_node path {
	if {[filepath_nodetype $path] == "block special file"} {return true}
	return false
}
proc mounteds__get_list {} {
	if {$::debug} {puts "in mounteds__get_list"}

	set fs_list ""
	catch "exec mount" fs_list
	foreach line [split $fs_list '\n'] {
		set sl [remove_empties [split $line]]
		set dev [lindex $sl 0]
		set mnt [lindex $sl 2]
		if { [string compare -length 4 $dev "/dev"] == 0 && [string compare -length 9 $dev "/dev/fuse"] != 0} {
			set ::mounteds($dev) "$mnt|[join [lrange $sl 4 end ] |]"
			if {$::debug} { puts " ::mounteds($dev) = $::mounteds($dev)"}
		}
	}

# BK	catch "exec ps -e | grep -o ntfs\-3g.*" fs_list
# BK	if {$::debug} {puts "looking for ntfs-3g found $fs_list"}
# BK	foreach line [split $fs_list '\n'] {
# BK		set sl [remove_nonpath [split $line]]
# BK		if {[llength $sl] == 2} {
# BK			set dev [lindex $sl 0]
# BK			set mnt [lindex $sl 1]
# BK			if {[filepath_nodetype $mnt]  == "block special file"} { #swap 'em
# BK				set dev [lindex $sl 1]
# BK				set mnt [lindex $sl 0]
# BK			}
# BK			if {$::debug} {puts "dev $dev mnt $mnt"}
# BK			if { [string compare -length 4 $dev "/dev"] == 0} {
# BK				set ::mounteds($dev) "$mnt|ntfs-3g|"
# BK				if {$::debug} { puts " ::mounteds($dev) = $::mounteds($dev)"}
# BK			}
# BK		}
# BK	}

	# Kernel 2.6 swaps:
	# Filename                                Type            Size    Used    Priority
	# /dev/hda8                               partition       682720  0       -1


	catch {
		set fid [open "/proc/swaps" r]
		while {![eof $fid]} {
			gets $fid str
			set sl [remove_empties [split $str]]
			set swap [lindex $sl 0]
			if { [string compare -length 4 $swap "/dev"] == 0} {
				set ::mounteds($swap) "swap|swap|"
				if {$::debug} { puts " ::mounteds($swap) = $::mounteds($swap)"}
			}
			if { [string compare -length 11 $swap "/initrd/dev"] == 0} {
				set swap [string range $swap 7 end]
				set ::mounteds($swap) "initrdswap|initrdswap|"
				if {$::debug} { puts " ::mounteds($swap) = $::mounteds($swap)"}
			}
		}
		close $fid
	}
}

proc real_permit_unmount {mnt} {
	if {[llength [lsearch -inline -all -exact $::NoUnmounts $mnt]] > 0} { return false }
	foreach m $::PuppyNoUnmount {
		if {[string match "$m*" $mnt] == 1} { return false }
	}
	return true
}

proc permit_unmount {mnt} {
	set r [real_permit_unmount $mnt]
	if {$::debug} { puts " unmountable $mnt   $r "}
	return $r
}


# dmesg example:
# sd 6:0:0:0: Attached scsi removable disk sdb


proc scsi_host_to_sd_location {} {
	array unset ::scsi_drvr
	array unset ::scsi_node
	set info ""
	catch { exec dmesg -s 65535 } info  
	#puts " dmesg length [llength $info] "
	set lines [split $info \n]
	foreach line $lines {
		set sl [remove_empties [split $line]]
		if {[string range [lindex $sl 0] 0 3] == "scsi"} {
			set n [string range [lindex $sl 0] 4 end]
			#puts "scsi$n has driver: [lrange $sl 2 end]"
			if {[join [lrange $sl 2 end]] == "SCSI emulation for USB Mass Storage devices"} {
				set ::scsi_drvr($n) "usb_storage"
			} else {
				set ::scsi_drvr($n) [lrange $sl 2 end]
			}
		}
		if {[lindex $sl 0] == "sd"} {
			if {[lindex $sl 2] == "Attached"} {
				if {[lindex $sl 3] == "scsi"} {
					if {[lindex $sl 4] == "removable"} {
						set n [lindex [split [lindex $sl 1] :] 0]
						#puts "scsi$n == [lindex $sl 6] "
						set ::scsi_node([lindex $sl 6]) $n
					}
					if {[lindex $sl 4] == "disk"} {
						set n [lindex [split [lindex $sl 1] :] 0]
						#puts "scsi$n == [lindex $sl 5] "
						set ::scsi_node([lindex $sl 5]) $n
					}
				}
			}
		}
	}

#Jun 15 03:21:33 (none) user.info kernel: scsi2 : sata_nv
#Jun 15 03:21:33 (none) user.info kernel: scsi3 : sata_nv
#Jun 15 03:21:33 (none) user.notice kernel: sd 2:0:0:0: Attached scsi disk sda
#Jun 14 19:22:26 (none) user.info kernel: scsi4 : SCSI emulation for USB Mass Storage devices
#Jun 14 19:22:26 (none) user.info kernel: scsi5 : SCSI emulation for USB Mass Storage devices
#Jun 14 19:22:31 (none) user.notice kernel: sd 4:0:0:0: Attached scsi removable disk sdb
#Jun 14 19:22:31 (none) user.notice kernel: sd 4:0:0:1: Attached scsi removable disk sdc
#Jun 14 19:22:31 (none) user.notice kernel: sd 4:0:0:2: Attached scsi removable disk sdd
#Jun 14 19:22:31 (none) user.notice kernel: sd 4:0:0:3: Attached scsi removable disk sde
#Jun 14 19:22:31 (none) user.notice kernel: sd 5:0:0:0: Attached scsi removable disk sdf
#Jun 14 19:22:31 (none) user.notice kernel: sd 5:0:0:1: Attached scsi removable disk sdg
#Jun 15 03:21:33 (none) user.notice kernel: sd 2:0:0:0: Attached scsi disk sda


	set fid [open "/var/log/messages" r]
	while {![eof $fid]} {
		gets $fid str
		set sl [remove_empties [split $str]]
		if {[lindex $sl 4] == "user.info"} {
			if {[lindex $sl 5] == "kernel:"} {
				#puts "[string range [lindex $sl 6] 0 3]"
				if {[string range [lindex $sl 6] 0 3] == "scsi"} {
					set n [string range [lindex $sl 6] 4 end]
					#puts "scsi$n has driver: [lrange $sl 8 end]"
					if {[join [lrange $sl 8 end]] == "SCSI emulation for USB Mass Storage devices"} {
						set ::scsi_drvr($n) "usb_storage"
					} else {
						set ::scsi_drvr($n) [lrange $sl 8 end]
					}
				}
			}
		}
		if {[lindex $sl 6] == "sd"} {
			if {[lindex $sl 8] == "Attached"} {
				if {[lindex $sl 9] == "scsi"} {
					if {[lindex $sl 10] == "removable"} {
						set n [lindex [split [lindex $sl 7] :] 0]
						#puts "scsi$n == [lindex $sl 12] "
						set ::scsi_node([lindex $sl 12]) $n
					}
					if {[lindex $sl 10] == "disk"} {
						set n [lindex [split [lindex $sl 7] :] 0]
						#puts "scsi$n == [lindex $sl 11] "
						set ::scsi_node([lindex $sl 11]) $n
					}
				}
			}
		}
		
	}
	close $fid
}

proc scsi_or_usb_grabinfos {} {
	array unset ::scsi_N

	array unset scsi_ctrlr

	catch {
		set fid [open "/proc/scsi/scsi" r]
		set host_n ""
		set vend ""
		set modl ""
		while {![eof $fid]} {
			gets $fid str
			set sl [remove_empties [split $str]]
			if {[lindex $sl 0] == "Host:"} {
				set host_n [string map {scsi {}} [lindex $sl 1]]
				set scsi_ctrlr($host_n) "Present"
			}
			if {[lindex $sl 0] == "Vendor:"} {
				set m_at [lsearch $sl "Model:"]
				set r_at [lsearch $sl "Rev:"]
				set vend ""
				set modl ""
				if {0 != [expr $m_at-1]} {
					set vend [join [lrange $sl 1 [expr $m_at-1]]]
				}
				if {$m_at != [expr $r_at-1]} {
					set modl [join [lrange $sl [expr $m_at+1] [expr $r_at-1]]]
				}
			}
			if {[lindex $sl 0] == "Type:"} {
				set r_at [lsearch $sl "ANSI"]
				set type ""
				if {0 != [expr $m_at-1]} {
					set type [join [lrange $sl 1 [expr $r_at-1]]]
				}
				set ::scsi_N($host_n)  "$vend|$modl|$type"
				if {$::debug} { puts " ::scsi_N($host_n) = $vend|$modl|$type"}
			}
		}
		close $fid
	}
	
	catch {
		foreach ctrlr [array names scsi_ctrlr] {
			set hostis "scsi"
			catch {
				if {[string match -nocase *usb* $::scsi_drvr($ctrlr)] == 1} {
					set hostis "usb"
				}
			}
			catch {
				set fid [open "/proc/scsi/usb-storage/$ctrlr" r]
				while {![eof $fid]} {
					gets $fid str
					set hostis "usb"
				}
				close $fid
			}
			
			catch {
				if {[string match -nocase *sata* $::scsi_drvr($ctrlr)] == 1} {
					set hostis "sata"
				}
			}
			set vend [lindex [split $::scsi_N($ctrlr) |] 0]
			if {$vend == "ATA"} { 
				set hostis "sata"
			}
			#puts "scsi$ctrlr Host is really $hostis"
			set info $::scsi_N($ctrlr)
			set ::scsi_N($ctrlr) "$hostis|$info"
		}
	}
}


proc mainDeviceList__derive {} {
	set dev_list [lsort -dictionary [array names ::diskStats]]
if {$::debug} {puts "$$ dev_list  $dev_list"}
	set omit_parts "false"
	foreach dev $dev_list {
		
		if {[string match "$omit_parts*" $dev] == 1} {
			continue;
		}
		set omit_parts "false"
		
		set ds [split $::diskStats($dev) .]
		set dev_type [lindex $ds 3]
		set icon ""
		set fs ""
		set part ""
		set mnt ""
		set vol ""
		set hw_name ""
		set gui_cmds ""
		catch {set part [lindex $::partitions($dev) 0] }
		catch {set mnt [lindex [split $::mounteds(/dev/$dev) |] 0] }
		catch {set fs [lindex [split $::mounteds(/dev/$dev) |] 1] }
		if {$part == "extended"} { continue }
		set noscan false
		switch $dev_type {
			floppy {
				set fdinfo ""
				catch " exec $::mut/bin/fdinfo /dev/$dev" fdinfo
				if {[llength [split $fdinfo |]]>3} {
					set fdx [lindex [split $fdinfo |] 1]
					if {$fdx != 5} { set fdx 3 }
					set icon "fd$fdx"
				}
				catch {
					if {$::NoScanMedia($dev)=="noscan"} { set noscan true }
				}
			}
			disk {
				set icon "disk"
				set noscan true
				if {[lindex $ds 2] == "sd" } {
					catch {
						set ctrlr $::scsi_node($dev)
						set ctrlr_info [split $::scsi_N($ctrlr) |]
						set hw_name [lindex $ctrlr_info 2]
						set icon "[lindex $ctrlr_info 0]disk"
						#set driver $::scsi_drvr($ctrlr)
					}					
					
			#Here We check for SuperFloppy format:
					if {$part != "extended"} {
						set fsinfo ""
						catch "exec $::mut/bin/guess_fstype /dev/$dev" fsinfo
						if {$fsinfo != ""} {set fs $fsinfo}
						if {[lindex [split $fsinfo] 0] == "unknown"} {set fs ""}
						if {$fs != ""} {
							set parts 0
							set unknownparts 0
							foreach d $dev_list {
								if {[string match "$dev*" $d]==1} { 
									if {$d != $dev} {
										set fsinfo ""
										catch "exec $::mut/bin/guess_fstype /dev/$d" fsinfo
										if {$fsinfo == "unknown"} { incr unknownparts }
										incr parts
									}
								}
							}
							if {$parts == $unknownparts} {
								set noscan false
								set dev_type superfloppy
								set omit_parts "$dev"
							} else {
								set fs ""
							}
						}
					}
				} else {
					if {[string range [lindex $ds 2] 0 2] == "ide" } {
						set hw_name [scan_ide_medium [lindex $ds 2] $dev model]
					}
				}
			}
			part {
				set icon "none"
				set noscan false
				if {$fs == "" && $part != "extended"} {
					set fsinfo ""
					catch "exec $::mut/bin/guess_fstype /dev/$dev" fsinfo
					if {$fsinfo != ""} {set fs $fsinfo}
				}
			}
			cdrom {
				set cdinfo [split $::cdromMedium($dev) |]
				set dt [lindex $cdinfo 1]
				set ty [lindex $cdinfo 2]
				set ok1 "false"; set ok2 "false"
				set noscan true
				if {$dt=="DVD"} {set dt dvd ; set ok2 true}
				if {$dt=="CD"} {set dt cd ; set ok2 true}
				if {$ty=="R&W"} {set ty raw ; set ok1 true}
				if {$ty=="RO"} {set ty ro ; set ok1 true}
				if {$ok1 && $ok2} {set icon "$dt$ty"} else {set icon "cdhuh"}
				if {[lindex $cdinfo 4]=="SW_CLOSE" && [lindex $cdinfo 6]== "open" } {
					lappend gui_cmds cd_tray_close
					if { $::Kernel_Version=="2.4" } {
						lappend gui_cmds cd_disc_eject
					}
				}

				if {[lindex $cdinfo 5]=="SW_OPEN" && [lindex $cdinfo 6]== "closed"} {
					lappend gui_cmds cd_disc_eject
				}
				if {[lindex $cdinfo 7] == "Audio" || [lindex $cdinfo 7] == "Mixed"} { 
					if { [lindex $cdinfo 8] > 0 } {
						set fs [lindex $cdinfo 7]; set vol "[lindex $cdinfo 8] tracks" 
						lappend gui_cmds cd_play_audio
					}
				}
				if {[lindex $cdinfo 7] == "Data" || [lindex $cdinfo 7] == "Mixed"} {
					if {$dt=="dvd"} {lappend gui_cmds gxine_dvd_play}
					if { [lindex $cdinfo 9] > 0 } {
						set fs [lindex $cdinfo 7]; 
						set vol [grab_fs_vol iso9660 $dev]
						if {$mnt == ""} {lappend gui_cmds cd_disk_mount}
						if {$mnt != ""} {lappend gui_cmds cd_disk_unmount}
					}
				}
				if {[string range [lindex $ds 2] 0 2] == "ide" } {
					set hw_name [scan_ide_medium [lindex $ds 2] $dev model]
				}

			}
			default { if {$::debug} {puts "Unknown device type $dev_type on $dev"} }
		}
		if {$fs=="" && $noscan==false && $part!="extended"} {
			set fsinfo ""
			catch "exec $::mut/bin/guess_fstype /dev/$dev" fsinfo
			if {$fsinfo != ""} {set fs $fsinfo}
			if {$fs == "unknown"} { set fs "" }
		}

		if {$vol=="" && $noscan==false} {
			if {$fs == "unknown"} { set fs "" }
			if {$fs == "iso9660" && $vol==""} { set vol [grab_fs_vol iso9660 $dev] }
			if {$fs == "vfat"} { set vol [grab_fs_vol vfat $dev] }
			if {$fs == "ext2" || $fs == "ext3"} { set vol [grab_fs_vol $fs $dev] }
		}
		if {$dev_type == "floppy"} {
			if {$noscan} {
				set part "unknown"
				lappend gui_cmds scan
			} else {
				lappend gui_cmds dev_part_info
				if {$part == "" && $fs!=""} {
					set part "Disc"
					if {$mnt == ""} {
						lappend gui_cmds dev_mount 
					}
				} else {
					set part "No Disc"
				}
				lappend gui_cmds noscan
			}
			if {$mnt != ""} {
				lappend gui_cmds dev_rox
				if {[permit_unmount $mnt]} {
					lappend gui_cmds dev_unmount
				}
				lappend gui_cmds dev_part_mnt
			}
		}
		if {$dev_type == "superfloppy"} {
			lappend gui_cmds dev_part_info
			if {$mnt == ""} {
				lappend gui_cmds dev_mount 
			} else {
				lappend gui_cmds dev_rox
				if {[permit_unmount $mnt]} {
					lappend gui_cmds dev_unmount
				}
				lappend gui_cmds dev_part_mnt
			}
		}

		if {$::debug} {puts "test  $dev|$icon|$hw_name|$part|$mnt|$fs|$vol|[join $gui_cmds ,]|$dev_type|" }

		if {$icon=="none" && ($part =="" || $fs=="") && $mnt == "" &&  $vol == "" && [llength $gui_cmds] ==0} {continue}

		if {[llength $gui_cmds] ==0 && [string length $dev]==3 && [llength [lsearch -all $dev_list $dev*]] == 1 } {continue}
		lappend ::infolist "$dev|$icon|$hw_name|$part|$mnt|$fs|$vol|[join $gui_cmds ,]|$dev_type|"
		if {$::debug} {puts "::infolist  [lindex $::infolist end]"}
	}
}

proc grab_block_devices {{quick false}} {
	majorBus__get_list
	partitions__get_list
	device_nodes__scan_for_make_additional
	diskStats__get_list quick
	cdromMedium_get_list quick
	etc_fstab__get_list
	mounteds__get_list
	scsi_host_to_sd_location 
	scsi_or_usb_grabinfos
	mainDeviceList__derive
}

proc run_full_scan {} {
	array unset ::partitions
	array unset ::mounteds

	#scan hardware
	grab_block_devices true
}

proc run_quick_update {} {
	array unset ::partitions
	array unset ::mounteds

	#scan hardware
	grab_block_devices

}

proc usb_autoscan {{how refresh}} {
	if {[file exists /proc/bus/usb/devices]} {
		if {$how == "on"} {
			if {$::debug} {puts "usb_autoscan $how"}
			full_refresh_display
			after 2000 usb_autoscan refresh2000
			return
		}
		set hotplug [file mtime /proc/bus/usb/devices]
		if {$hotplug != $::last_hotplug} {
			if {$::debug} {puts "usb_autoscan $how now=$hotplug last=$::last_hotplug"}
			after 1000 full_refresh_display
			after 1500 usb_autoscan refresh1500
		} else {
			after 200 usb_autoscan refresh200
		}
	}
}

proc Create_Display {} {
	wm title . "Media Utility Tool $::Version"

	frame .box 

	label .status_bar -text "MUT $::Version, written by Jesse Liley for Puppy Linux 2005."
	pack .status_bar -in . -side bottom -fill x

	canvas .boxc -width 280 -height 350 -bd 0 -bg gray50 -highlightthickness 0 

	pack .box -in . -fill both -expand yes
	pack .boxc -in .box -fill both -expand yes

	bind .boxc <Button-1> { check_click_action %x %y }

	# Mouse Wheel scrolling.
	# bind .boxc <Button-4> { .boxc yview scroll -3 units }
	# bind .boxc <Button-5> { .boxc yview scroll 3 units }
	
	bind .boxc <Configure> {show_icons %w %h}
	full_refresh_display
}

proc set_box_trigger {itm dev y1 x1 width colour tex act} {
	upvar 1 $itm n
	set y2 [expr "11 + $y1"]
	set x2 [expr "$x1 + $width"]
	.boxc create rectangle $x1 $y1 $x2 $y2 -outline $colour
	.boxc create text [expr "$x1 + 4"] $y1 -anchor nw -text $tex -fill $colour -font {Helvetica -10 bold} 
	set ::actions($n) [list $act $x1 $y1 $x2 $y2 $dev]
	if {$::debug} {puts "actions($n) = [list $act $x1 $y1 $x2 $y2 $dev]" }
	incr n
}

proc max {a b} {
	if {$a > $b} {return $a}
	return $b
}

set ::clr(mount) "LightBlue"

proc Show_Devices {} {
	set index 1
	set n_itm 1
	set ypos 5
	set nextdev_ypos $ypos
	set start_horizontal_pos 50

	foreach str $::infolist {
		set l ".l$index"
		set info [split $str "|"]
		set xpos 110

		set dev [lindex $info 0]
		set icon [lindex $info 1]
		set hw_name [lindex $info 2]
		set part [lindex $info 3]
		set mnt [lindex $info 4]
		set fs [lindex $info 5]
		set vol [lindex $info 6]
		set guicmds [split [lindex $info 7] ,]
		set dev_type [lindex $info 8]
 
		if {$icon!="" && $icon!="none"} { # only devices have icons at this point
			set ypos [max $ypos $nextdev_ypos]
			set xpos 3
			set tex "$dev :: $hw_name"
			.boxc create image $xpos $ypos -anchor nw -image ::img::img($icon)
			set xpos [expr "$xpos + [image width ::img::img($icon)] + 3" ]
			.boxc create text $xpos $ypos -anchor nw -text $tex -fill White -font {Helvetica -10 bold }
			incr ypos 14
			incr xpos 5

			foreach cmd $guicmds {
				switch $cmd {
					gxine_dvd_play {
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 60 #E4FE33 "GxineDVD" "gxinedvd"
						incr xpos 60
					}
					dev_part_mnt {
						if {$mnt != "" } {
							.boxc create text $xpos [expr "$ypos + 4"] -anchor nw -text "$mnt" -fill $::clr(mount) -font {Courier -12 bold} 
							incr xpos [expr " 7 * [string length $mnt]"]
						}
					}
					dev_part_info {
						set d [lindex [split $dev '/'] end]
						set d [string trim $d "abcdefghijklmnopqrstuvwxyz/"]
						set tex "[string toupper $d] $fs"
						set v "$vol"
						incr xpos 8
						.boxc create text [expr "$xpos"] [expr "$ypos +4"] -anchor nw -text "$vol." -fill White -font {Courier -12  }
						.boxc create text [expr "$xpos-8"] [expr "$ypos -3"] -anchor nw -text $tex -fill #dfdfdf -font {Courier -12  }


						incr xpos [max [expr " 5 * [string length $tex]"] [expr "5+ 6 * [string length $v]"] ]

						set tex "$fs:$part"
						.boxc create text $xpos [expr "2 + $ypos"] -anchor nw -text "$part" -fill black -font {Helvetica -12 bold }
						incr xpos [expr " 6 * [string length $part]"]
					}
					dev_rox {
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 25 Yellow "Rox" "rox"
						incr xpos 25
					}
					dev_unmount {
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 56 Yellow "UnMount" "unmount"
						incr xpos 56
					}
					dev_mount {
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 41 Yellow "Mount" "mount"
						incr xpos 41
					}
					scan {
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 32 Yellow "Scan" "scan"
						incr xpos 32
					}
					noscan {
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 43 Yellow "NoScan" "noscan"
						incr xpos 43
					}
					cd_disk_mount {
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 41 Yellow "Mount" "cdmount"
						incr xpos 41
						if {$fs == "Mixed" || $fs=="Data"} {
							incr xpos 5
							.boxc create text $xpos [expr "2 + $ypos"] -anchor nw -text $vol -fill black -font {Helvetica -10 bold }
							incr xpos 27
						}
					}
					cd_disk_unmount {
						incr xpos 5
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 25 Yellow "Rox" "rox"
						incr xpos 25
						incr xpos 5
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 56 Yellow "UnMount" "cdunmount"
						incr xpos 56
						if {$fs == "Mixed" || $fs=="Data"} {
							incr xpos 6
							.boxc create text $xpos [expr "2 + $ypos"] -anchor nw -text $vol -fill black -font {Helvetica -12 bold }
							incr xpos [expr " 7 * [string length $vol] + 4"]

							incr xpos 5
							.boxc create text $xpos [expr "2 + $ypos"] -anchor nw -text "$mnt" -fill $::clr(mount) -font {Courier -12 bold}
							incr xpos [expr " 7 * [string length $mnt]"]
						}
					}
					cd_play_audio {
						incr xpos 6
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 56 Yellow "CD Player" "cdplay"
						incr xpos 56
					}
					cd_disc_eject {
						incr xpos 6
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 30 Yellow "Eject" "eject"
						incr xpos 30

						incr xpos 6
						.boxc create text $xpos [expr "2 + $ypos"] -anchor nw -text $fs -fill black -font {Helvetica -12 bold }
						incr xpos 25
					}
					cd_tray_close {
						incr xpos 6
						set_box_trigger n_itm $dev [expr "2 + $ypos"] $xpos 35 Yellow "Close" "trayclose"
						incr xpos 35
					}
					default { if {$::debug} {puts "Unhandled cmd $cmd"} }
				}
				incr xpos 4
			}
			set nextdev_ypos [expr "26 + $ypos"]
		}

		set xpos $start_horizontal_pos

		if { $dev_type == "part" } {
			set d [lindex [split $dev '/'] end]
			set d [string trim $d "abcdefghijklmnopqrstuvwxyz/"]
			set tex "[string toupper $d] $fs"

			.boxc create text [expr "$xpos"] [expr "$ypos +4"] -anchor nw -text "$vol." -fill White -font {Courier -12  }
			.boxc create text [expr "$xpos-8"] [expr "$ypos -3"] -anchor nw -text $tex -fill #000000 -font {Courier -12  }
			incr xpos 120
			.boxc create text $xpos $ypos -anchor ne -text $part -font {Helvetica -14}

			if {$mnt != "" && $fs != "Audio"} {
				if {$mnt != "" && $fs != "swap" && $fs != "initrdswap"} {
					incr xpos 5
					set_box_trigger n_itm $dev $ypos $xpos 26 Yellow "Rox" "rox"
					incr xpos 26
				}
				if {$mnt != ""} {
					if {$fs != "swap" && $fs != "initrdswap" &&[permit_unmount $mnt]} {
						incr xpos 5
						set_box_trigger n_itm $dev $ypos $xpos 56 Yellow "Unmount" "unmount"
						incr xpos 56
					}
					incr xpos 5
					.boxc create text $xpos [expr "2 + $ypos"] -anchor nw -text "$mnt" -fill $::clr(mount) -font {Courier -12 bold} 
					incr xpos [expr " 7 * [string length $mnt]"]
				}
				if {$fs == "swap"} {
					incr xpos 5
					set_box_trigger n_itm $dev $ypos $xpos 53 Yellow "Swap Off" "swapoff"
					incr xpos 53
				}
				if {$fs == "initrdswap"} {
					incr xpos 5
					set_box_trigger n_itm $dev $ypos $xpos 53 Yellow "Swap Off" "initrdswapoff"
					incr xpos 53
				}
			} elseif { $fs == "Audio" } {

			} elseif { $fs != "" && $fs != "unknown" && $part != ""} {
				if { $fs == "swap" } {
					incr xpos 5
					set_box_trigger n_itm $dev $ypos $xpos 58 Yellow "Use Swap" "swapon"
					incr xpos 58
				} else {
					if {$mnt == ""} {
						incr xpos 5
						set_box_trigger n_itm $dev $ypos $xpos 41 Yellow "Mount" "mount"
						incr xpos 41
					}
				}
			}
			incr ypos 19
			set nextdev_ypos [max [expr "10 + $ypos"] $nextdev_ypos]
		}
		incr index
	}

}



## Initialise global variables here:

set Version "0.1.1";                      # Version Number
set mut [homepath];                       # Home path to app directory, Now done automatically! :-)
set debug 0;                              # Choose output of debugging information, output is to stdout
set last_hotplug 0;                       # USB SCSI hotplug last refresh info, for hot [un]plug scanning.
set Kernel_Version ""

# get the Kernel version.
proc get_kv {} {
	set ::Kernel_Version "Unknown"
	catch "exec uname -r" full_number
	set ::Kernel_
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
Bahurim
Posts: 34
Joined: Sat 08 Sep 2007, 01:37

#7 Post by Bahurim »

I increased the size of the fonts in the box to 12 instead of 10 which helped readability but pushed the fonts slightly out of the static boxes. Ah well, at least I can read it easier.

In no way am I a 'hacker' / 'coder' so I have to ask is it possible to make the boxes adjustable? Would that cause other issues with spacing, etc...?

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#8 Post by ttuuxxx »

Bahurim wrote:I increased the size of the fonts in the box to 12 instead of 10 which helped readability but pushed the fonts slightly out of the static boxes. Ah well, at least I can read it easier.

In no way am I a 'hacker' / 'coder' so I have to ask is it possible to make the boxes adjustable? Would that cause other issues with spacing, etc...?
Maybe give the code i posted a shot, The colour i used is easier to read, Plus i changed the font size to 12 where needed.
it actually looks nicer :)
Attachments
mut.png
(30.26 KiB) Downloaded 859 times
Last edited by ttuuxxx on Fri 21 Dec 2007, 06:19, edited 1 time in total.
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#9 Post by davids45 »

G'day,
Thanxxx for that.
I'll give it a go after the Christmas salad.
David S.

don922
Posts: 433
Joined: Sat 19 Jan 2008, 07:58
Location: Nong Yai Buah

No Joy Trying To Help MUT

#10 Post by don922 »

Using SafePup213 (MUT 0.1.1)

I copied, pasted, deleted & renamed according to ttuuxxx instructions.

When I clicked the desktop MUT icon -- nothing happens.
When I selected the Menu item for MUT-- nothing happens.

I noticed that there has been a mut-debug file and a huge mut-debug-output.txt file created -- I guess by my trying to run the "new" mut.tcl. The analysis of these items are way beyond my skill level.

Any ideas what is going wrong? Would like MUT to look like ttuuxxx's picture posted here!
[color=green][i]Don -- Thailand[/i][/color]
[url=http://www.puppylinux.com][img]http://tinypic.com/4e0tojl.jpg[/img][/url]

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#11 Post by ttuuxxx »

Hi Its been some time since I did that to mut but hey I'm using puppy 4.2 and mut doesn't work on it because it doesn't have tcl,tk unlike the 2 series that did, So first I installed tcl/tk from the 2 series repo and made a package for you and tested, it works fine so here you go, just install it and run mut and enjoy :)
ttuuxxx
Attachments
mut-mod-ttuuxxx.pet
(54.81 KiB) Downloaded 456 times
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

don922
Posts: 433
Joined: Sat 19 Jan 2008, 07:58
Location: Nong Yai Buah

#12 Post by don922 »

Hey ttuuxxx Thank You very much for your fast work.

I ran into a problem with the download -- the downloaded file is named mut-mod-ttuuxxx.pet.bin.

I'm not sure how to handle it because of the bin included in the name. But, I will play with it tomorrow and see if I can get it to work.

Again, Thank You
[color=green][i]Don -- Thailand[/i][/color]
[url=http://www.puppylinux.com][img]http://tinypic.com/4e0tojl.jpg[/img][/url]

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#13 Post by CatDude »

Hi

Here is a screenshot of what mine looks like. 8)

CatDude
.
Attachments
mut.png
(39.77 KiB) Downloaded 612 times
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#14 Post by ttuuxxx »

CatDude wrote:Hi

Here is a screenshot of what mine looks like. 8)

CatDude
.
That looks really Nicce :wink: Catdude
The only thing I would change is the blue text font size, its way smaller than the rest, when I packaged up my version, I downloaded the Official Mut release from the repo and replaced the mut.tcl file and repackaged it so others could just install it fully if need be.
Maybe also you might want to do that for others also. since yours is very nice also.
ttuuxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#15 Post by CatDude »

Hello ttuuxxx
ttuuxxx wrote: The only thing I would change is the blue text font size, its way smaller than the rest
How does it look now ?
I have attached a copy of my edited mut.tcl and the icons, which i also edited.

CatDude
.
Attachments
mut.png
Bigger blue text.
(43.55 KiB) Downloaded 582 times
catdudes-mut.tar.gz
a copy of my edited mut.tcl and the icons
(32.02 KiB) Downloaded 392 times
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

Post Reply