Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Ink levels GUI
Pages: [1] Print
Author Topic: Ink levels GUI  (Read 475 times)
AllRebbedUp
Newbie
*
Offline Offline

Posts: 12


View Profile
Ink levels GUI
« on: June 01, 2008, 05:28:26 PM »

Hello Rebolers

I am trying to create a simple GUI to display printer ink levels amongst other things.
Normally i would have to run these commands from a console/terminal (i am using linux)

Here is my first mock up of it:
(the progress bars show how i would like the ink levels displayed)

Code:
REBOL []

view layout/size [
h2 "Epson Printer Utilities" 300x20 center
guide
button "Ink Levels" [call ["escputil -iur /dev/usb/lp0"]]
button "Clean Heads" [call ["escputil -cur /dev/usb/lp0"]]
button "Test Pattern" [call ["escputil -nur /dev/usb/lp0"]]
return
box 200x150 gray
at 160x60 progress gray black 20x100 with [data: 0.76]
at 200x60 progress gray cyan 20x100 with [data: 0.16]
at 240x60 progress gray magenta 20x100 with [data: 0.16]
at 280x60 progress gray yellow 20x100 with [data: 0.15]
] 350x220

While i know it certainly isn't perfect code wise,
clicking on the buttons "Clean Heads" and "Test Pattern"
does at least do what it says.


My question is:
How can i get the result of running the command for "Ink Levels"
to be shown in the progress bars. (maybe with the actual percentage beneath each bar)

If the command is run in a normal console (not the rebol console)
this is an example of the output one would get:

Code:
# escputil -iur /dev/usb/lp0
Escputil version 5.0.1, Copyright (C) 2000-2006 Robert Krawitz
Escputil comes with ABSOLUTELY NO WARRANTY; for details type 'escputil -l'
This is free software, and you are welcome to redistribute it
under certain conditions; type 'escputil -l' for details.

Ink color       Percent remaining
Black                      76
  Cyan                      16
   Magenta                      16
Yellow                      15
#

If this is possible and anybody could explain how to go about this
or offer any advice i would be grateful.

ARU

Logged
btiffin
Jr. Member
**
Offline Offline

Posts: 58


View Profile
Re: Ink levels GUI
« Reply #1 on: June 02, 2008, 02:03:21 AM »

Hi,

   Looks like this could be a nice little utility.  CALL accepts a /OUTPUT refinement, and the parameter can be a string! So, first step could be

call/output "escputil -iur /dev/usb/lp0" inks: make string! 512
or
inks: copy ""    call/output "..." inks

Now you've got the stdout from escputil in the string INKS.  Then PARSE could be used to find the numbers

parse inks [
    thru "Black" copy black-ink to newline
    thru "Cyan" copy cyan-ink to newline
...
]

Now you'll have a trimmable string! black-ink with a bunch of leading spaces, the number and what ever spaces come in the output before the newline.

This was done quickly, and there are much smarter PARSE expressions that will avoid the need for  to integer! trim/all black-ink  but the trim is pretty simple and required no brains or testing for this post.

After that, you'll have integers that you can display, set progress with a color bar, etc, etc.

If you need more details, just ask.
Cheers
Logged
AllRebbedUp
Newbie
*
Offline Offline

Posts: 12


View Profile
Re: Ink levels GUI
« Reply #2 on: June 02, 2008, 06:19:29 AM »

Hello btiffin

Thankyou for your response,
but i dont understand what you say (i am a little thick). Embarrassed

All this parsing stuff etc goes right over my head.

Please could you elaborate on all of this for me, it really would help me learn what is what.

Sorry to be a pain.

ARU
Logged
notchent
Newbie
*
Offline Offline

Posts: 40


View Profile WWW
Re: Ink levels GUI
« Reply #3 on: June 03, 2008, 09:33:04 AM »

Hi Aru,

For more info about parse, take a look at:

http://musiclessonz.com/rebol_tutorial.html#section-28

To make the GUI work, you need to give a label to each progress bar (i.e., prog1, prog2, prog3, etc.), then you can set the data that Brian created (prog1/data: to integer! trim/all black-ink, prog2/data: to integer! trim/all cyan-ink, etc.), and then update the GUI (show prog1, show prog2, etc.)  Here's a quickie example that I haven't tested yet, but should get you going in the right direction: 

Code:
REBOL []

view layout/size [
h2 "Epson Printer Utilities" 300x20 center
guide
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
]
print rejoin [black-ink cyan-ink magenta-ink yellow-ink]
prog1/data: to integer! trim/all black-ink
show prog1
prog2/data: to integer! trim/all cyan-ink
show prog2
prog3/data: to integer! trim/all magenta-ink
show prog3
prog4/data: to integer! trim/all yellow-ink
show prog4
]
button "Clean Heads" [call ["escputil -cur /dev/usb/lp0"]]
button "Test Pattern" [call ["escputil -nur /dev/usb/lp0"]]
return
box 200x150 gray
at 160x60 prog1: progress gray black 20x100 with [data: 0.76]
at 200x60 prog2: progress gray cyan 20x100 with [data: 0.16]
at 240x60 prog3: progress gray magenta 20x100 with [data: 0.16]
at 280x60 prog4: progress gray yellow 20x100 with [data: 0.15]
] 350x220
Logged

AllRebbedUp
Newbie
*
Offline Offline

Posts: 12


View Profile
Re: Ink levels GUI
« Reply #4 on: June 03, 2008, 02:59:49 PM »

To notchent & btiffin

Thankyou both very much for your help.

I have now got it working as i wanted,
and there was no way i could have done it without your assistance.

My revised code is shown below.

Code:
REBOL []

view layout/size [
h2 "Epson Printer Utilities" 300x20 center
guide
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
]
print rejoin [black-ink cyan-ink magenta-ink yellow-ink]
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"]]
return
box 200x150 gray
at 160x60 prog1: progress gray black 20x100 with [data:0.00]
at 158x170 box1: box 24x24 "" font-size 12
at 200x60 prog2: progress gray cyan 20x100 with [data:0.00]
at 198x170 box2: box 24x24 "" font-size 12
at 240x60 prog3: progress gray magenta 20x100 with [data:0.00]
at 238x170 box3: box 24x24 "" font-size 12
at 280x60 prog4: progress gray yellow 20x100 with [data:0.00]
at 278x170 box4: box 24x24 "" font-size 12
] 350x220

Again thankyou both so much.

ARU
Logged
notchent
Newbie
*
Offline Offline

Posts: 40


View Profile WWW
Re: Ink levels GUI
« Reply #5 on: June 04, 2008, 01:16:34 PM »

I'm glad to see it's working Smiley  Be sure to take out the following line:

Code:
print rejoin [black-ink cyan-ink magenta-ink yellow-ink]
Logged

btiffin
Jr. Member
**
Offline Offline

Posts: 58


View Profile
Re: Ink levels GUI
« Reply #6 on: June 05, 2008, 01:23:45 AM »

AllRebbedUp; No problem.  I'm glad Nick stepped up and filled in the holes I left.

Again, the parse expressions I used were just quickies off the top of the head.  There are "more effecient" ways and tighter code, but it would take a little testing to ensure they worked etc.  For instance a PARSE sub-expression could skip over white space between the colour name and the value; but TRIM works.  Smiley

Be sure to check out Nick's most excellent tutorials (link at the bottom of his posts).  Much, much can be learned from them; but don't plan on absorbing all the information he has there in one sitting; and don't feel overwhelmed.   Bookmark it and revisit when you can.

REBOL is a fair to strange beast of a learning curve.  Some features are plain and simple and some are just, well ... not ... until you get it, then they seem simple after that.

Nice little app by the way.  rebol.org can always use another script for the repository.  Smiley

Cheers
Logged
AllRebbedUp
Newbie
*
Offline Offline

Posts: 12


View Profile
Re: Ink levels GUI
« Reply #7 on: June 05, 2008, 08:07:36 AM »

Hi notchent

Quote from: notchent
Be sure to take out the following line:

Code:
print rejoin [black-ink cyan-ink magenta-ink yellow-ink]

Ok ,but could you please explain why it was there if it is not required ?


Quote from: btiffin
Be sure to check out Nick's most excellent tutorials (link at the bottom of his posts).  Much, much can be learned from them; but don't plan on absorbing all the information he has there in one sitting; and don't feel overwhelmed.   Bookmark it and revisit when you can.

I have actually had it bookmarked for about 12 months now.

Quote from: btiffin
REBOL is a fair to strange beast of a learning curve.  Some features are plain and simple and some are just, well ... not ... until you get it, then they seem simple after that.

For sure, and i don't spend nearly as much time as i should in trying to learn it.

Quote from: btiffin
Nice little app by the way.  rebol.org can always use another script for the repository.  Smiley

Just registered there, and will add it (with both yourself and notchent given credit for assistance)
if that is OK with the both of you.


This is my final code:

Code:
REBOL [
Title: "EPU" ;Epson Printer Utilities
Date: 05-Jun-2008
Version: 0.0.1
File: %epu.r
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}
License: {Public Domain}
]

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
py8ZkdjW1jasVCpvRUVFyQEAs8ehibOjoq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WY92uLn4Tnp
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

I will wait for your replies before i put it up.

Once again thankyou both for your help with this.

ARU
Logged
notchent
Newbie
*
Offline Offline

Posts: 40


View Profile WWW
Re: Ink levels GUI
« Reply #8 on: June 05, 2008, 03:19:18 PM »

Hey Aru,

You're more than welcome to re-post any code that I've posted here - thanks for the credit Smiley

That little print line was just part of the debugging process for me, so that I could see what values were being returned by parse.  I put little print statements like that in code all the time to check variables values when I'm writing/testing.  I  forgot to take it out before posting here Smiley
Logged

AllRebbedUp
Newbie
*
Offline Offline

Posts: 12


View Profile
Re: Ink levels GUI
« Reply #9 on: June 05, 2008, 03:53:57 PM »

Hello notchent

Quote from: notchent
You're more than welcome to re-post any code that I've posted here - thanks for the credit Smiley
Ok mate, but the thanks really do go to yourself and btiffin.
I'll await for btiffin to reply then i will put it up on rebol.org.

Quote
That little print line was just part of the debugging process for me, so that I could see what values were being returned by parse.  I put little print statements like that in code all the time to check variables values when I'm writing/testing.  I  forgot to take it out before posting here Smiley

And thankyou for the explaination.

ARU
Logged
btiffin
Jr. Member
**
Offline Offline

Posts: 58


View Profile
Re: Ink levels GUI
« Reply #10 on: June 05, 2008, 05:48:50 PM »

Go right ahead;  And just so ya know, I'll take credit, but it isn't necessary.  Smiley  I'm a huge fan of seeing rebol.org grow.

Cheers and thanks
Logged
AllRebbedUp
Newbie
*
Offline Offline

Posts: 12


View Profile
Re: Ink levels GUI
« Reply #11 on: June 06, 2008, 06:35:57 AM »

notchent & btiffin

I have just uploaded it in the tools category.

Thanks again for your help,
i am sure i will be back soon for more, as i have an idea for yet another GUI.

In fact one already exists (not rebol), but it is dependant on python and whatnot,
and weighs in at around 110MB including its dependancies (absolutely outrageous). Shocked
Especially when you consider the fact that the OS i am running has an ISO size of only 87MB (Puppy Linux (Dingo))  Cool

What is this behemoth you ask ?
In a word wbarconf

See you soon

ARU
Logged
btiffin
Jr. Member
**
Offline Offline

Posts: 58


View Profile
Re: Ink levels GUI
« Reply #12 on: June 06, 2008, 02:06:34 PM »

All right ARU!  Well done.  rebol.org is a somewhat under utilized resource.  The more the merrier.

Looking forward.

Cheers
Logged
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Ink levels GUI
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 28, 2008, 10:40:36 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2231 Posts in 579 Topics by 1733 Members
Latest Member: tea lover gift basket

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc