Tiny < 100b Apps - text editor, image viewer, calendar....

Stuff that has yet to be sorted into a category.
Message
Author
User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

Tiny < 100b Apps - text editor, image viewer, calendar....

#1 Post by technosaurus »

Here is a simple gtkdialog3 script that I wrote

#! /bin/sh
export PV='<window><button><input file>'$1'</input></button></window>'
gtkdialog3 --program=PV

I can make a pet if anyone is interested.

in the mean time just save it as a text file, change the permissions and drag an image file to it

or by command line
./whatever_ you_name_it /path/to/image
Last edited by technosaurus on Sun 29 Mar 2009, 00:47, edited 1 time in total.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#2 Post by aragon »

hi technosaurus,

i think alternatively you could use

Code: Select all

<pixmap>...</pixmap>
instead of <button> (as there is no aktion to define). Like this:

Code: Select all

#! /bin/sh
export PV='<window><pixmap><input file>'$1'</input></pixmap></window>'
gtkdialog3 --program=PV 
A question (i'm not running puppy right now): What does happen, if the pic is larger than the screen?

aragon

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#3 Post by disciple »

A question (i'm not running puppy right now): What does happen, if the pic is larger than the screen?
You only see what fits on the screen (with either the pixmap or button version. If you then maximise the window you can see the whole picture.
Interestingly, on a slow computer, with a large picture, the button version seems to take about 3-4 times as long to load the picture.
Also, I notice that by clicking (or clicking and dragging, or something) on the picture I can crash the button version, but not the pixmap version.

I have previously wondered whether I could build an image browser that displays exif thumbnails using jhead and gtkdialog, but I couldn't get gtkdialog to display the output of a command... I still wonder if it is possible.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#4 Post by zigbert »

but I couldn't get gtkdialog to display the output of a command... I still wonder if it is possible.
If you redirect the output to a file, you can. Pmusic works that way. - The playing song changes in the progress bar.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#5 Post by zigbert »

To scale picture to fit screen you can use 'resizepng'.

Fullscreen view would be something like:

Code: Select all

WIDTH=`xrandr -q | grep '*' | egrep "[0-9]+[ ]*x[ ]*[0-9]+" -o | cut -d "x" -f 1`
HEIGHT=`xrandr -q | grep '*' | egrep "[0-9]+[ ]*x[ ]*[0-9]+" -o | cut -d "x" -f 2`
resizepng $1 /tmp/pv.png $WIDTH $HEIGHT 50

export PV='<window><pixmap><input file>/tmp/pv.png</input></pixmap></window>'
gtkdialog3 --program=PV

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#6 Post by disciple »

To scale picture to fit screen you can use 'resizepng'.
Does that only work with png files? I guess there are other programs anyway :)

You can also specify window geometry with gtkdialog can't you?
If you redirect the output to a file, you can.
Yes I know, but I don't want to :)
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#7 Post by zigbert »

Does that only work with png files?
Works for jpg too (possible more, I haven't tested. But output will be only png


Sigmund

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#8 Post by 01micko »

This works for jpeg... may be inefficient

Code: Select all

#! /bin/bash
WIDTH=`xrandr -q | grep '*' | egrep "[0-9]+[ ]*x[ ]*[0-9]+" -o | cut -d "x" -f 1`
HEIGHT=`xrandr -q | grep '*' | egrep "[0-9]+[ ]*x[ ]*[0-9]+" -o | cut -d "x" -f 2`
Scale2pic $1 /tmp/pv.jpg $WIDTH $HEIGHT 50

export PV='<window><pixmap><input file>/tmp/pv.png</input></pixmap></window>'
gtkdialog3 --program=PV

Scale2pics must be presenthttp://murga-linux.com/puppy/viewtopic.php?t=29184
Puppy Linux Blog - contact me for access

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#9 Post by vovchik »

Dear Puppians,

I have been using the following code as my standard gif viewer for about a year:

Code: Select all

#! /bin/bash

# -----------------
# get pic info
# -----------------

mypic=$1
mypicinfo=`file "$mypic"`
mypicbase=`basename $mypic`

# -----------------
# make pic gui
# -----------------

export show_pic='
<window title="PShowPic: '$mypicbase'" icon-name="gtk-refresh">
	<vbox>
		<frame>
			<pixmap>
				<input file>'$mypic'</input>
			</pixmap>
		</frame>
		<hbox>
			<button help>
				<action>"gtkdialog3 --program=show_pic_help --center"</action>
			</button>
		</hbox>
	</vbox>
</window>
'
# -----------------
# make help gui
# -----------------

export show_pic_help='
<window title="PshowPic Info" icon-name="gtk-about">
	<vbox>
		<frame>
			<text use-markup="true">
				<label>"<b>'$mypicinfo'</b>"</label>
			</text>
			<hbox>
				<button cancel></button>
			</hbox>
		</frame>
	</vbox>
</window>
'

# ---------------
# display main gui
# ---------------

gtkdialog3 --program=show_pic --center 
What is nice about this general solution is that GTK's pixbuf function is much faster than most dedicated animated gif viewers. I added a little info screen that calls "file" to retrieve a bit of information about the pixmap. The little script is attached. I made an association in rox to use this viewer by default for gifs.

With kind regards,
vovchik
Attachments
pshowpic.tar.gz
(458 Bytes) Downloaded 578 times

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#10 Post by dejan555 »

You're using this for a year and now u post it?
Shame on u! :oops:
LOL, I'm kiding, this is great guys, maybe for some lightweight/striped puplets, or we can make rox right click -> View image or smtng like that
gtkview LOL :lol:

Anyway, where can I find examples for gtk dialogs or some basic structure?
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#11 Post by technosaurus »

there are examples in the devx.sfs but you really don't need it to make a gtkdialog3 program - go here instead
http://xpt.sourceforge.net/techdocs/lan ... gExamples/

I tried to make a simple text editor but the "default text" doesn't seem to like carriage returns... turned out to be a 200b line editor/notepad ... guess it would be ok for adding/changing things to end of files like the registry in wine
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#12 Post by dejan555 »

thanks technosaurus, I'll look at that.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#13 Post by vovchik »

Dear dejean555,

Sorry for not posting that script sooner. Turns out I actually did it about two years ago (yes, shame on me) :(

In order to test the other gif/pic viewers you might have on your machine, try downloading the following gif sample (an interesting optical illusion where the woman spins either clockwise or counterclockwise, depending on your mood).

Most of the other dedicated viewers that I have tried stutter on this one - but not the script. Not only is small sometimes beautiful, it is sometimes better in all respects - perhaps a little like Puppy itself.

With kind regards,
vovchik

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

#14 Post by ttuuxxx »

[quote="vovchik"]Dear Puppians,

I have been using the following code as my standard gif viewer for about a year:

I usually right click on gif images, then select open with -->mozilla and it opens in Seamonkey animated, When I tried it with the gif image you supplied it was much slower on mozilla that that code you posted. ever think of somehow adding that code to GPicView, since it doesn't do gif images.
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#15 Post by technosaurus »

Don't forget about Xdialog

Here is a very simple text editor using Xdialog... only 60b

Code: Select all

#!/bin/sh
echo -e "`Xdialog --stdout --editbox $1 0 0`" > $1


and an image viewer... only 43b

Code: Select all

#!/bin/sh
Xdialog --icon $1 --msgbox "" 0 0


and a calendar... only 41b

Code: Select all

#!/bin/sh
Xdialog --calendar "" 0 0 0 0 0
almost any command line utility (or combination) can be made into a gui this way
For more info on Xdialog see
http://www.gnu-darwin.org/ProgramDocume ... g/box.html
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#16 Post by 01micko »

@techno

These look good for my 486... sick of waiting for mtpaint to load just to view an image... that works fine.... the calendar is ok on my main box but I get the Xdialog help when I run it on the 486. With the editor I get that result on both machines (Xdialog help).

The 486 runs fat_free2.16dillo and my fast box is on 4.2.

Any ideas? (And I checked that all spaces were correct)

Cheers

Mick
Puppy Linux Blog - contact me for access

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#17 Post by technosaurus »

Some of the ' ` and " are easy to mistype - I'll upload them

the editor requires a filename to be passed to it - it can be a blank file
you can either drag a file to it or (using the name I gave it)... in a terminal type

Code: Select all

Xedit <filename>
the calendar can take text for a name in the "" <---double quotes

for a bonus I added in my webcam recorder

#!/bin/sh
rxvt -e ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 -f avi cam.avi
Attachments
Xprogs.tar.bz2
(374 Bytes) Downloaded 395 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#18 Post by 01micko »

Thanks technosaurus

Yeah I tried the 'drag to' method... funny, named mine Xeditor :lol:

Anyhoo I'll see how I go with your packaged versions.

Cheers

Mick
Puppy Linux Blog - contact me for access

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#19 Post by technosaurus »

oops - forgot the audio for the webcam recorder

#!/bin/sh
rxvt -e ffmpeg -f oss -i /dev/audio -f video4linux2 -s qvga -i /dev/video0 a.avi
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
recobayu
Posts: 387
Joined: Wed 15 Sep 2010, 22:48
Location: indonesia

#20 Post by recobayu »

Sophisticated!
I like puppy linux, all of your very small apps, techno..

Post Reply