Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 03 Jul 2015, 13:19
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Tiny < 100b Apps - text editor, image viewer, calendar....
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [23 Posts]   Goto page: 1, 2 Next
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4520

PostPosted: Wed 25 Mar 2009, 22:07    Post subject:  Tiny < 100b Apps - text editor, image viewer, calendar....
Subject description: Yes that's bytes not Kb
 

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

_________________
Web Programming - Pet Packaging 100 & 101

Last edited by technosaurus on Sat 28 Mar 2009, 20:47; edited 1 time in total
Back to top
View user's profile Send private message 
aragon

Joined: 15 Oct 2007
Posts: 1698
Location: Germany

PostPosted: Thu 26 Mar 2009, 04:38    Post subject:  

hi technosaurus,

i think alternatively you could use

Code:
<pixmap>...</pixmap>


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

Code:
#! /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

_________________
PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6529
Location: Auckland, New Zealand

PostPosted: Thu 26 Mar 2009, 05:45    Post subject:  

Quote:
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.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6035
Location: Valåmoen, Norway

PostPosted: Thu 26 Mar 2009, 06:00    Post subject:  

Quote:
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.
_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 6035
Location: Valåmoen, Norway

PostPosted: Thu 26 Mar 2009, 06:07    Post subject:  

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

Fullscreen view would be something like:
Code:
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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
disciple

Joined: 20 May 2006
Posts: 6529
Location: Auckland, New Zealand

PostPosted: Thu 26 Mar 2009, 06:12    Post subject:  

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

Does that only work with png files? I guess there are other programs anyway Smile

You can also specify window geometry with gtkdialog can't you?

Quote:
If you redirect the output to a file, you can.
Yes I know, but I don't want to Smile
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6035
Location: Valåmoen, Norway

PostPosted: Thu 26 Mar 2009, 06:43    Post subject:  

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


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 7957
Location: qld

PostPosted: Thu 26 Mar 2009, 07:28    Post subject:  

This works for jpeg... may be inefficient
Code:
#! /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

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Thu 26 Mar 2009, 08:09    Post subject:  

Dear Puppians,

I have been using the following code as my standard gif viewer for about a year:
Code:
#! /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
pshowpic.tar.gz
Description 
gz

 Download 
Filename  pshowpic.tar.gz 
Filesize  458 Bytes 
Downloaded  348 Time(s) 
Back to top
View user's profile Send private message 
dejan555


Joined: 30 Nov 2008
Posts: 2755
Location: Montenegro

PostPosted: Thu 26 Mar 2009, 11:11    Post subject:  

You're using this for a year and now u post it?
Shame on u! Embarassed
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 Laughing

Anyway, where can I find examples for gtk dialogs or some basic structure?

_________________
Dpup 487 | Puppy Gallery | My photo gallery | mtPaint works
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
technosaurus


Joined: 18 May 2008
Posts: 4520

PostPosted: Thu 26 Mar 2009, 11:46    Post subject:  

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/language/gtkdialog/gtkde02-GtkdialogExamples/

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

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
dejan555


Joined: 30 Nov 2008
Posts: 2755
Location: Montenegro

PostPosted: Thu 26 Mar 2009, 12:35    Post subject:  

thanks technosaurus, I'll look at that.
_________________
Dpup 487 | Puppy Gallery | My photo gallery | mtPaint works
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Thu 26 Mar 2009, 15:28    Post subject:  

Dear dejean555,

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

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
Back to top
View user's profile Send private message 
ttuuxxx


Joined: 05 May 2007
Posts: 10883
Location: Ontario Canada,Sydney Australia

PostPosted: Fri 27 Mar 2009, 04:28    Post subject:  

[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 Smile
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4520

PostPosted: Sat 28 Mar 2009, 11:39    Post subject:  

Don't forget about Xdialog

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

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




and an image viewer... only 43b

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




and a calendar... only 41b

Code:
#!/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/ProgramDocuments/xdialog/box.html

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [23 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1104s ][ Queries: 12 (0.0176s) ][ GZIP on ]