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 21 Nov 2014, 06:54
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog1-1.3
Post new topic   Reply to topic View previous topic :: View next topic
Page 11 of 14 [207 Posts]   Goto page: Previous 1, 2, 3, ..., 9, 10, 11, 12, 13, 14 Next
Author Message
goingnuts

Joined: 07 Dec 2008
Posts: 783

PostPosted: Sat 23 Jun 2012, 10:40    Post subject:  

Another demo: gtkmplayer - very simple frontend for mplayer.
Contains also code for some more advanced functions (select audio and video driver + set audio speed) - change flag in gtkmplayer source to view.
Using "mplayer -slave" and fifo /tmp/mplayer-control to pass commands from gtk-frontend to mplayer.
gtkmplayer-0.1.pet
Description  demo for gtkdialog1 - simple frontend for mplayer
pet

 Download 
Filename  gtkmplayer-0.1.pet 
Filesize  11.59 KB 
Downloaded  408 Time(s) 
snap0008.png
 Description   
 Filesize   357.08 KB
 Viewed   1178 Time(s)

snap0008.png

Back to top
View user's profile Send private message Visit poster's website 
goingnuts

Joined: 07 Dec 2008
Posts: 783

PostPosted: Sat 06 Oct 2012, 18:41    Post subject:  

Yet another demo - backport/hack of SNS - Simple Network Setup - to use Gtkdialog1. Based on SNS from Puplite 5.0 kindly supplied by starhawk.
Attached pet is the first try and may not work and be buggy.
A bunch of helping progs attached as well, everything put in /bin to give preference for these applications and ease removal...
You will need Gtkdialog1 - get it in the first post.
snap0008.png
 Description   
 Filesize   19.95 KB
 Viewed   1157 Time(s)

snap0008.png

sns-retro-0.1.pet
Description  sns-retro/static dhcpcd, ethtool, ifplugstatus-0.18,
ndiswrapper (non-perl),wpa_cli,wpa_passphrase
and wpa_supplicant
pet

 Download 
Filename  sns-retro-0.1.pet 
Filesize  636.51 KB 
Downloaded  610 Time(s) 
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4376

PostPosted: Mon 08 Oct 2012, 21:55    Post subject: Re: Backport gtkdialog 0.59.8 to use gtk1/gtk2: gtkdialog1-1.0  

goingnuts wrote:
TODOS:
* <text> accept <input>command
* quotes in <action>command
* combobox <default>, accept <action append> and fill with command
* checkboxes: set value from variable/script[/url][/url]
* revise help text for --geometry
just checking on the TODOS
* quotes in <action>command
g_strescape(); ?
* revise help text for --geometry
from wary's gtkdialogX
Quote:
Usage:
gtkdialog [OPTION...]
Create dialog boxes and windows according to the given dialog description.For more information try 'info gtkdialog'.

Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options

GTK+ Options
--class=CLASS Program class as used by the window manager
--name=NAME Program name as used by the window manager
--screen=SCREEN X screen to use
--sync Make X calls synchronous
--gtk-module=MODULES Load additional GTK+ modules
--g-fatal-warnings Make all warnings fatal

Application Options:
-v, --version Print version information and exit.
-d, --debug Debug mode prints the processed characters.
-p, --program=variable Get the GUI description from the environment.
-g, --glade-xml=filename Get the GUI description from this Glade file.
-f, --file=filename Get the GUI description from a regular file.
-i, --include=filename Include the given file when executing.
-e, --event-driven=filename Execute the file as an event driven program.
-s, --stdin Get the GUI description from standard input.
-w, --no-warning Suppress warning messages.
-G, --geometry=[XxY][+W+H] The placement and the size of the window.
-c, --center Center the windows on the screen.
--print-ir Print the internal representation and exit.
--space-expand=state The "expand" state for packing all widgets.
--space-fill=state The "fill" state for packing all widgets.
--display=DISPLAY X display to use

thats the lowest hanging fruit, for the rest I'd have to compare Xdialog (the unpatched gtk1 version) and gtkdialog2-4 (my sdialog program may help too)
another TODO?
SVG capability via librsvg's included gdkpixbuf-loader (its one of the only ones that isn't distributed with gdkpixbuf)
SVG would add a ton of capabilities

also I submitted a patch to gtkdialog-trunk that used some gtk2 builtins for refreshing, that Thunor cleaned up, but I had previously used native inotify (may require a kernel update though ... Edit: nope - inotify was introduce in 2.6.13) if anyone is interested in that.

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

Joined: 07 Dec 2008
Posts: 783

PostPosted: Thu 11 Oct 2012, 12:35    Post subject:  

Thx for looking at this!
The quotes in <action>command seems to be related to the parser. gtkdialog-0.58.11 accepts
Code:
<action>echo "You pressed the button with the label."</action>
whereas gtkdialog-0.59.8 does not (errors out with "Error in line 6, near token 'quoted string': syntax error").

This might be a nice way to force separation of the gktdialog GUI-code and the shell-code but makes translation of existing scripts somewhat more challenging. Looking into lexer.l and the difference between the two version is still black magic to me...

The
Code:
-g,--geometry                     Set the position and/or size of the
                                   window, [XxY][+W+H].

is wrong for present version as the XxY sets the widthxheight and the +W+H sets position...
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3393
Location: Oregon

PostPosted: Thu 11 Oct 2012, 12:43    Post subject:  

How compatible is this version of gtkdialog1 with programs written to use gtkdialog that comes with puppy?
I ask because I tried running a few of the examples that come with gtkdialog by first copying them to a temporary directory and then editing them to use gtkdialog1.
I did not find any that worked.
Most had syntax errors.
So will this fork of gtkdialog be compatible with the gtkdialog scripts that permeate puppy?

And is this mod a matter of lessening CPU load?
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 783

PostPosted: Thu 11 Oct 2012, 15:11    Post subject:  

8-bit wrote:
How compatible is this version of gtkdialog1 with programs written to use gtkdialog that comes with puppy?
I ask because I tried running a few of the examples that come with gtkdialog by first copying them to a temporary directory and then editing them to use gtkdialog1.
I did not find any that worked.
Most had syntax errors.
So will this fork of gtkdialog be compatible with the gtkdialog scripts that permeate puppy?

And is this mod a matter of lessening CPU load?

Its quite compatible but most scripts needs "fine tuning". A lot of the formating tags are not supported and one of the main issues is the <window> tag which must be converted to a <wtitle></wtitle> tag and no </window> in the end of script...

The strength is that you can compile for both gtk1 & gtk2 and use the same scripts.

Another advantage is that with gtk1 & tinyxlb & uclibc one can compile a static version at reasonable size. So resource demand is quite low and speed is good.

I haven't seen puppy gtk-scripts that worked out of the box but some of them are easy to "port". Using the -d (debug) switch is a great tool to debug when converting scripts to GtkDialog1.
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4376

PostPosted: Thu 11 Oct 2012, 17:32    Post subject:  

simple "stocks" stock quote program ported
the un-backslashed quotes was an issue, but I just removed them in my script... seems like g_strescape might fix it or we could just know to backslash them in the script

mostly though just needed to strip most things out of the insides of tags...
stuff like:hover-selection="true", rules_hint="true", tooltip="" ...

remove/replace window tags:
replace '<window title="name">...more tags ...</window>' with:
'<wtitle>name</wtitle>...more tags ...'
stocks-0.1.pet
Description  very basic ... could use:
action refresh to update
action launchwindow to change stock symbols
pet

 Download 
Filename  stocks-0.1.pet 
Filesize  2.12 KB 
Downloaded  572 Time(s) 

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

Joined: 07 Dec 2008
Posts: 783

PostPosted: Fri 12 Oct 2012, 13:58    Post subject:  

technosaurus: Added your stock port under examples in first post - thx!

I did a quick test to see if the lexer.l rules could be used to filter out the "future" gtkdialog tags. By adding the following rule it seems that the <window some text> and the </window> can be ignored - but not tested intensively. Might work and be applicable with some of the other tags as well:
Code:
 /* remove </window> future tag */
"</window>".* { ; }
 /* remove <window * > future tag */
"<window".*(.|\n).*">" { ; }
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4376

PostPosted: Sat 20 Oct 2012, 20:16    Post subject:  

note: the variables don't get set after action completion, and before the next action

ex.
<action fileselection>FILEINFO</action>
<action>echo $FILEINFO</action>

was working on a mupdf gui when I noticed that it does wait for the 1st action to complete but the variable doesn't get set till some time after

tried refresh and Refresh: action in between but nada - any ideas?

(your mplayer frontend selected a file and then plays with a separate button works fine - but I was hoping to do a 1-step process)

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


Joined: 18 May 2008
Posts: 4376

PostPosted: Sat 20 Oct 2012, 22:47    Post subject:  

Posted a frontend for mupdf here:
http://www.murga-linux.com/puppy/viewtopic.php?p=659689#659689

Its a decent example of how to control windows that use keyboard shortcuts

there is a static mupdf too, but it also needs xdotool which I haven't built statically yet
http://code.google.com/p/semicomplete/
(scottman's vlc-gtk uses xdotool too)

EDIT: also notice that the file selection is limited to 32 character long paths - I think it may be using a *tag_attribute (see stringman.c)
I would recommend [80] at least - gcc stores 0-80 length char[] in the same amount of code

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

Joined: 07 Dec 2008
Posts: 783

PostPosted: Sun 21 Oct 2012, 02:35    Post subject:  

It might be that chooser acts different than fileselect - not sure and not home atm so cant test...
The fileselect action spawns a new window and all actions after the fileselect does not wait for fileselect to finish - I had same problem when trying to do a text editor with gtkdialog1
I will try later to look at the stringlength in fileselect - haven't tested if spaces are allowed but will test that as well
Looking forward to test your front-end to mupdf - your handling of the different versions of gtkdialog is a nice workaround!
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4376

PostPosted: Sun 21 Oct 2012, 02:52    Post subject:  

it may have just been spaces in the filenames now that I have looked further
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 783

PostPosted: Sun 21 Oct 2012, 12:31    Post subject:  

Here is a solution to the mupdf-gtk (as gtkdialog1 concerns):
Code:
export MESSAGE_DIALOG='
<vbox>
   <chooser>
      <height>300</height><width>600</width>
      <variable>FILE</variable>
      <default>/</default>
      <action when="file-activated">echo File: $FILE </action>
      <action when="selection-changed">echo Selection: $FILE</action>
      <action when="current-folder-changed">echo Folder: $FILE</action>
      <action>refresh:FILENAME</action>
   </chooser>
   <button>
      <label>OK</label>
      <action>mu_open $FILENAME</action>
      <action>closewindow:MESSAGE_DIALOG</action>
   </button>
</vbox>
'


and then revise the top part (below </menubar>) to:
   <hbox>
   <button>
      <label>Choose File</label>
      <action launchwindow>MESSAGE_DIALOG</action>
   </button>
      <entry>
         <variable>FILENAME</variable>
         <input>echo $FILE</input>
         
      </entry>
   </hbox>




And for the open in the File menu do this:
Code:
<menuitem>
            <label>Open</label>
            #<action type="fileselect">FILENAME</action>
            <action type="launch">MESSAGE_DIALOG</action>
         </menuitem>
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4376

PostPosted: Tue 23 Oct 2012, 23:51    Post subject:  

that worked, now just need to figure out a gtkdialog4 equivalent
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4376

PostPosted: Wed 24 Oct 2012, 22:01    Post subject:  

Any way to make passwords hidden in entry boxes that I am missing? I looked into adding tooltip capabilities, but not sure how to go about it... Mainly the tag part. Tooltips aren't technically an attribute, but they can be applied to any windowed widget (those that don't need an event box to handle events)
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 11 of 14 [207 Posts]   Goto page: Previous 1, 2, 3, ..., 9, 10, 11, 12, 13, 14 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.1003s ][ Queries: 13 (0.0072s) ][ GZIP on ]