REBOL [ 
File: %epu.r
Date: 6-Jun-2008
Title: "EPU" ;Epson Printer Utilities
Author: "AllRebbedUp"
Comment: {I would not have done this without the assistance of reboltalk forum members notchent & btiffin}
Purpose: {Simple GUI for accessing escputil on linux}
library: [
     level: 'intermediate
     platform: 'linux
     type: 'tool
     domain: 'gui
     tested-under: [view 2.7.6 on linux]
     support: none
     license: public-domain
     see-also: none
    ]
]

img: load 64#{
iVBORw0KGgoAAAANSUhEUgAAAG4AAABuCAYAAADGWyb7AAAAAXNSR0IArs4c6QAA
AAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gG
BQUIATMySQUAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAT
dklEQVR42u1de1QT17rfQcDWR9IEMIANhERLJLqwQhADFfFwKV3i46wIN6KprT3h
ippa2nWsVbk0i6sV6zmWrqYuy1Woz+OjBzjn0J4KVLFKMSCPVmgCIuFRICqkBREw
wNw/mskdw8xkJgTCY35/sciePXv243v8vr2/DQAFChTGD7RJ2m4XFos1j8PhvOTl
5RXo4+OzlMvlCv38/Dh8Pv8FHx8fVzabTRscHASdnZ1Qc3Pz04aGhl8bGxtbdDpd
TXNzc1V7e3t1S0tLXVdX1wMAgJGaCmMAOp3OEolEsQqF4pJare6H7Ay1Wt2vUCgu
iUSiWDqdzqJ6fBSSgMvl+stksgyNRmOExhkajcYok8kyuFyu/ySWSuMHDw8PT6lU
erivrw+aKOjr64OkUulhDw8PT2qELCAUCsNUKlUdNMGhUqnqhEJh2HQ3TmgikWiN
SqW6IhKJZtpSwY0bN55UVFTo7t+/X9PW1lar1+u1BoOhqbu7W9/d3d0F60c6nc5m
Mpm+bDbb39vbO4DH4wmXLVvGXbly5Sxb3ltWVjawc+fOjWVlZfkAAGjarLDAwMBI
W4yMU6dONcnl8iyxWCxhMBjM0baDwWAwxWKxRC6XZ506darJFqMmMDAwcsoPmKen
py8ZkdjW1j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Q0JTIZ4XHR29Cys0gzT5HWY92uLn4Tnp
yEj6ZNwGwePxlmBFrlGc65mTbkbi0WOWDvtkEJ8MBoOJ51A7hMYaK3C5XH9rohPe
+pecnJw7EVcgj8dbkpycnIu2hQ5NNI45YTyOmIEXz0Pz/Uw60JEHTZyio6N3WfPJ
UOJpM8BUg6enpy/WNgg0tLW1DSuVylumK2LG47aR2VFRUXKlUnkL7dQMzkSrs3vk
eoI6qpFExCfasWa5XJ4lFosl9tCJDAaDKRaLJXK5PAvvPBueWHSUQ+3I60toIpFo
jUqluiISiWyyvG7cuPGkoqJCd//+/Zq2trZavV6vNRgMTd3d3Xo4ox+dTmfR6XQ2
k8n0ZbPZ/t7e3gE8Hk+4bNky7sqVK2fZ8t6ysrKBnTt3biwrK8sHJFNETSkIhcIw
MiLUUVCpVHUTlv1wtPMulUoPo53PcxT6+vogqVR6eDI50Y4Ejcvl+stksgy0M+lj
DY1GY5TJZBkms55GDYeNoNPpLJFIFKtQKC7ZYtQQMTIUCsUlkUgUi3vB3kSa2ZN0
LF1YLNY8DofzkpeXV6CPj89SLpcr9PPz4/D5/Bd8fHxc2Ww2bXBwEHR2dkLNzc1P
Gxoafm1sbGzR6XQ1zc3NVe3t7dUtLS11XV1dDwCJfJYUKFCYjvg/GHc69MZUrcQA
AAAASUVORK5CYII=
}

view layout/size [
		backdrop effect [gradient 0x1 0.0.0 127.127.127]
		vh2 "Epson Printer Utilities" 320x20 center effect [gradient 1x1 255.0.0 0.0.255]
		across	
		pad 0x170	
		button "Ink Levels" [
				call/output "escputil -iur /dev/usb/lp0" inks: make string! 512
				parse inks [
				thru "Black" copy black-ink to newline
				thru "Cyan" copy cyan-ink to newline
				thru "Magenta" copy magenta-ink to newline
				thru "Yellow" copy yellow-ink to newline
				]
				prog1/data: (to integer! trim/all black-ink) / 100
				show prog1
				box1/text: (to integer! trim/all black-ink)
				show box1
				prog2/data: (to integer! trim/all cyan-ink) / 100
				show prog2
				box2/text: (to integer! trim/all cyan-ink)
				show box2
				prog3/data: (to integer! trim/all magenta-ink) / 100
				show prog3
				box3/text: (to integer! trim/all magenta-ink)
				show box3
				prog4/data: (to integer! trim/all yellow-ink) / 100
				show prog4
				box4/text: (to integer! trim/all yellow-ink)
				show box4
				]
		button "Clean Heads" [call ["escputil -cur /dev/usb/lp0"]]
		button "Test Pattern" [call ["escputil -nur /dev/usb/lp0"]]
		at 95x75 image img effect [emboss]
		at 50x75 prog1: progress gray black 20x100 with [data: 0.00]
		at 48x185 box1: box 24x24 "" font-size 12
		at 230x75 prog2: progress gray cyan 20x100 with [data: 0.00]
		at 228x185 box2: box 24x24 "" font-size 12
		at 270x75 prog3: progress gray magenta 20x100 with [data: 0.00]
		at 268x185 box3: box 24x24 "" font-size 12
		at 310x75 prog4: progress gray yellow 20x100 with [data: 0.00]	
		at 308x185 box4: box 24x24 "" font-size 12	
] 360x270