The time now is Tue 18 Jun 2013, 22:11
All times are UTC - 4 |
|
Page 31 of 54 Posts_count |
Goto page: Previous 1, 2, 3, ..., 29, 30, 31, 32, 33, ..., 52, 53, 54 Next |
| Author |
Message |
Argolance

Joined: 06 Jan 2008 Posts: 1404 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Sun 11 Mar 2012, 12:17 Post_subject:
|
|
Merci...
_________________

|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Sat 09 Jun 2012, 11:50 Post_subject:
|
|
I switched out the find_pixmap code in my compile with this - speeds up not finding missing images with locate (especially if it is missing) and gives a convenient way to tell where the global gtkdialog images are (using an environment variable - GTKDIALOG_PIXMAP_DIR) - better suggestions welcome though
| Quote: | char *find_pixmap(char *filename)
{
char tmp[128];
static char *line = NULL;
static uint length = 0;
FILE *locate;
if (access(filename, R_OK) == 0)
return filename;
//snprintf(tmp, 127, "/usr/share/icons/Bluecurve/16x16/stock/%s",
snprintf(tmp, 127, "/usr/share/pixmaps/%s", filename);
tmp[127] = '\0';
if (access(tmp, R_OK) == 0)
return strdup(tmp);
snprintf(tmp, 127, "/usr/share/mini-icons/%s", filename);
tmp[127] = '\0';
if (access(tmp, R_OK) == 0)
return strdup(tmp);
snprintf(tmp, 127, "%s/%s",getenv("GTKDIALOG_PIXMAP_DIR"), filename);
tmp[127] = '\0';
if (access(tmp, R_OK) == 0)
return strdup(tmp);
return 0;
} |
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 1404 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Mon 11 Jun 2012, 10:35 Post_subject:
|
|
Hello,
Did not test this yet... but guess that, at first sight, the small "amateur" I am finds these code lines impressive and somewhat "hermetic"... !
Thank you a lot!
_________________

|
|
Back to top
|
|
 |
sklimkin
Joined: 11 Jul 2012 Posts: 8
|
Posted: Wed 11 Jul 2012, 17:38 Post_subject:
gtkdialog-C-example |
|
The site http://code.google.com/p/gtkdialog/ wasn't updated for a long time.
Can be here will on a subject.
gtkdialog has many good examples bash-script.
The author Laszlo Pere has given possibility to do the program and in C-language, but an example of such program only one (and very small).
Program possibilities gtkdialog in this case are much poorer, than at bash-script.
Some users can write on bash-script worse, than on C-language (as I for example).
Considering it I has made an example in C-language.
Designs gtkdialog for C-language don't allow for example such things:
<window window_position = "1" title = "System Tools">
Or:
<action when = "file-activated"> echo File: $FILE </action>
It managed to be bypassed in such a way:
"<action> cat [echo $FILE] | zenity - text-info - width=720 - height=400 - title $FILE </action>"
But even with such restrictions it was interesting to me to make the program which doesn't demand heavy libraries (so I anyway think).
If will consider it possible add my example in/gtkdialog/examples/
 |
| Description |
|
| Filesize |
89.2 KB |
| Viewed |
798 Time(s) |

|
| Description |
gtkdialog example code C-language
|

Download |
| Filename |
gtkdialog-C-example-32bit.tar.gz |
| Filesize |
95.22 KB |
| Downloaded |
140 Time(s) |
|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 499 Location: Mishawaka IN
|
Posted: Fri 27 Jul 2012, 15:58 Post_subject:
|
|
Hello Everyone,
I made me a notebook like menu for Manna OS, but iI have one problem that I need help with.
When I hit a button the menu stays open. How do I close it after hitting a button?
Code.
| Quote: | #! /bin/bash
export MAIN_DIALOG='
<window title="Manna Menu" icon-name="Bible">
<vbox>
<notebook labels="Bible Software|Books|Dictionaries">
<frame>
<hbox>
<button>
<input file>/usr/share/icons/hicolor/48x48/apps/bibletime.png</input>
<label>bibletime</label>
<action type="exec">bibletime</action>
</button>
<vbox>
<text wrap="true" width-chars="50"><label>An excellent stand alone program. There are a lot of books one can get for this and maps as well.</label></text>
</vbox>
</hbox>
<hbox>
<button>
<input file>/usr/share/pixmaps/75DE_BibleAnalyzer4.0.png</input>
<label>BibleAnalyzer</label>
<action type="exec">bibleanalyzer4.sh</action>
</button>
<vbox>
<text wrap="true" width-chars="50"><label>An excellent program to disect the Word and get more out of it. It has many ways in which one can do this. This has others resources one can buy.</label></text>
</vbox>
</hbox>
<hbox>
<button>
<input file>/usr/share/pixmaps/esword.png</input>
<label>e-sword</label>
<action type="exec">/usr/bin/e-Sword.sh</action>
</button>
<vbox>
<text wrap="true" width-chars="50"><label>There is a lot of free Bibles and other resources plus you can get step books (examples) as well. There is also bibles and books you can buy too.</label></text>
</vbox>
</hbox>
<hbox>
<button>
<input file>/usr/share/pixmaps/CB2C_theword.0.png</input>
<label>theWord</label>
<action type="exec">theword.sh</action>
</button>
<vbox>
<text wrap="true" width-chars="50"><label>This program is one in which you can open up more than just one book, bible or any other window. There is a lot of resources for this program on line to get.</label></text>
</vbox>
</hbox>
</frame>
<frame>
<vbox>
<text wrap="true" width-chars="50"><label>Books will be coming soon.</label></text>
</vbox>
</frame>
<frame>
<vbox>
<text wrap="true" width-chars="50"><label>Dictionaries will be coming soon as well. There will be more stuff added as time goes by.</label></text>
</vbox>
</frame>
</notebook>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
</window>
'
gtkdialog --program=MAIN_DIALOG |
Any ideas?
thanks
|
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 573
|
Posted: Fri 27 Jul 2012, 16:46 Post_subject:
|
|
| oldyeller wrote: | | When I hit a button the menu stays open. How do I close it after hitting a button? |
This is what you need, I believe:
| Code: | #! /bin/bash
export MAIN_DIALOG='
<button>
<label>Launch Abiword</label>
<action>abiword &</action>
<action type="exit">exiting completed</action>
</button>
'
gtkdialog --program=MAIN_DIALOG |
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 499 Location: Mishawaka IN
|
Posted: Fri 27 Jul 2012, 17:28 Post_subject:
|
|
Thanks SFR,
That worked!!! but didn't need to put launch in the <label>
Thanks
|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 499 Location: Mishawaka IN
|
Posted: Wed 01 Aug 2012, 21:30 Post_subject:
|
|
Hello again
I am have been trying to view+ and view- for my text but not sure if the code is right
| Quote: | #!/bin/sh
GTKDIALOG=gtkdialog
funcbtnCreate() {
echo '<button>
<label>'"$2"'</label>
<input file stock="'$3'"></input>
<action>echo "'"$4"' '$1'"</action>
<action type="'"$2"'">'$1'</action>
</button>'
}
export MAIN_DIALOG='
<window title="Text Advanced" resizable="false">
<vbox>
<vbox border-width="10" spacing="10">
<text use-markup="true">
<label>"<span fgcolor='"'black'"' bgcolor='"'white'"'> Text from file inside a scrollable vbox </span>"</label>
</text>
<vbox scrollable="true" width="600" height="300">
<text wrap="false" xalign="0">
<variable>txt0</variable>
<label>This is a static text.</label>
<input file>'/usr/local/Manna/t.txt'</input>
</text>
</vbox>
<hbox homogeneous="true">
'"$(funcbtnCreate txt0 viewmag gtk-view Bigger)"'
'"$(funcbtnCreate txt0 Enable gtk-yes Enabling)"'
'"$(funcbtnCreate txt0 Clear gtk-clear Clearing)"'
'"$(funcbtnCreate txt0 Fileselect gtk-file "Inserting into")"'
'"$(funcbtnCreate txt0 Refresh gtk-refresh Refreshing)"'
</hbox>
</vbox>
<hseparator></hseparator>
<hbox homogeneous="true">
<button use-stock="true" label="gtk-ok" has-focus="true"></button>
</hbox>
</vbox>
</window>
'
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
|
Any help would be great
Thanks
|
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3033 Location: Oregon
|
Posted: Thu 09 Aug 2012, 05:37 Post_subject:
|
|
I tried running your script from a terminal to see what was happening after changing the inputfile line to a file I had.
It displayed that file fine in the text window.
But... Instead of displaying the contents of a file from the File Selection button, it returns and displays the file name and that is being used as the input.
So that is strange.
Also, the $ variables I would have thought were command line variables given externally to the script.
But I have not worked with gtkdialog in a while, so take this reply for a grain of salt.
|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 499 Location: Mishawaka IN
|
Posted: Thu 09 Aug 2012, 15:54 Post_subject:
|
|
Hi 8-bit,
this code is form an example that I messed around with and had know idea what I was doing.
Here is my thought I want to be able to have books/text in a window that would be able to zoom-out/in so it could be read.
I am slowly learning how to do all of this though.
|
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3033 Location: Oregon
|
Posted: Mon 13 Aug 2012, 01:29 Post_subject:
|
|
I see that that code was derived from one of the examples in gtkdialog.
But to me, it appears to be missing something in that using the "fileselect" one would think that it would display the contents of that file in the txt0 window. It instead only displays the filename (with path) returned by fileselect in the txt0 window.
If I change the "$0" in line 25 to "$1" and start the text_advanced script from a terminal with a filename as a parameter, it does display the file in the scrollable box.
It just bugs me that the fileselect button does not display the contents of the file chosen.
As to the display of the file contents, are you wanting to be able to change the font size of the display for those with poor eyesight?
There appears to be no controls in the script for that currently.
|
|
Back to top
|
|
 |
oldyeller

Joined: 15 Nov 2011 Posts: 499 Location: Mishawaka IN
|
Posted: Mon 13 Aug 2012, 04:21 Post_subject:
|
|
| 8-bit wrote: | I see that that code was derived from one of the examples in gtkdialog.
But to me, it appears to be missing something in that using the "fileselect" one would think that it would display the contents of that file in the txt0 window. It instead only displays the filename (with path) returned by fileselect in the txt0 window.
If I change the "$0" in line 25 to "$1" and start the text_advanced script from a terminal with a filename as a parameter, it does display the file in the scrollable box.
It just bugs me that the fileselect button does not display the contents of the file chosen.
As to the display of the file contents, are you wanting to be able to change the font size of the display for those with poor eyesight?
There appears to be no controls in the script for that currently. |
Yes that is what I would like to do, but do not know how? any ideas?
|
|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 1404 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Mon 13 Aug 2012, 09:22 Post_subject:
|
|
Hello,
I didn't verify and am not sure at all, but is the export line not missing?
| Quote: | #!/bin/sh
GTKDIALOG=gtkdialog
funcbtnCreate() {
echo '<button>
<label>'"$2"'</label>
<input file stock="'$3'"></input>
<action>echo "'"$4"' '$1'"</action>
<action type="'"$2"'">'$1'</action>
</button>'
}
export -f funcbtnCreate |
Cordialement.
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3845
|
Posted: Mon 13 Aug 2012, 14:18 Post_subject:
|
|
| Argolance wrote: | I didn't verify and am not sure at all, but is the export line not missing
. | just an FYI. It is more portable to put all of the functions in a separate file and source it in the main script with:then use gtkdialog's include parameter ... Otherwise you are stuck using bash (busybox ash is up to 10 times faster, depending on the operation) unfortunately everyone keeps passing on the unportable export method, so there is a lot of bash dependent code that has a #!/bin/sh when it really should be #!/bin/bash
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3033 Location: Oregon
|
Posted: Mon 13 Aug 2012, 14:40 Post_subject:
|
|
As to sizing, if you want a bigger display window for the text, just change line 15 from resizable="false" to resizable="true".
You can then grab a corner of the window and drag it to the size you want.
That is the full display window and not just the text window on it.
But as I previously stated, the fileselect returns and displays the file name with path into the text window where one would have thought it should display the contents of the selected file in the window.
|
|
Back to top
|
|
 |
|
|
Page 31 of 54 Posts_count |
Goto page: Previous 1, 2, 3, ..., 29, 30, 31, 32, 33, ..., 52, 53, 54 Next |
|
|
Rules_post_cannot Rules_reply_cannot Rules_edit_cannot Rules_delete_cannot Rules_vote_cannot You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|