Page 70 of 76

Posted: Fri 15 Jun 2018, 04:05
by MochiMoppel
disciple wrote:It seems the solution doesn't work if I try to use it with xdg-open
Works perfectly here.
Please check your xdg-open script. Mine accepts only 1 argument ($1), which in your case would be the URL..

[Edit]: Hmm..I tried to let xdg-open accept '>/dev/null' as an argument and trigger your error message. No success. Whatever I do your code just works :cry:
I don't think that bash would treat any redirection operator as a command argument (unless you pass is literally as a string).

Posted: Fri 15 Jun 2018, 06:15
by disciple
Ah, sorry, my mistake. It didn't just affect xdg-open - I'd got my test system mixed up and was using the early version of gtkwialog, which didn't have gtkdialog compatibility.

But thanks for testing, and would you be able to confirm whether you have a Puppy xdg-open or the "real" freedesktop.org version? I don't have the Puppy version here, and I'm keen to be sure I'm compatible with it!

Thanks.

Posted: Fri 15 Jun 2018, 06:40
by MochiMoppel
Puppy xdg-open

Posted: Fri 15 Jun 2018, 07:37
by wiak
disciple wrote:Ah, sorry, my mistake. It didn't just affect xdg-open - I'd got my test system mixed up and was using the early version of gtkwialog, which didn't have gtkdialog compatibility.
Yes, I thought you must be using gtkwialog (in -a or -b mode) rather than legacy gtkdialog. And, yes, with newest gtkwialog it will work with your example without any changes (since in legacy gtkdialog mode by default).

Should you be using either gtkwialog -a or -b modes, you have to remember no /bin/sh (or any other shell) is being used to execute the command (which is instead being fork/exec more directly), which means neither redirection nor job control with & will be in operation since these facilities are provided by a shell. So if you want redirection and job control you either have to use gtkwialog in default legacy gtkdialog mode or if using -a or -b modes, you need to start up a shell to process your command as follows (note that I prefer turning off stdout rather than just redirecting to /dev/null device since the latter is less efficient):

Code: Select all

#!/bin/sh

export HELP_DIALOG="
<window>
<vbox>
  <button>
   <label>Open murga link in browser</label>
   <action>sh -c "xdg-open http://www.murga-linux.com/puppy/viewtopic.php?p=149208#149208 1>&- &"</action>
  </button>
  <button ok>
  </button>
</vbox>
</window>
"

MAINGUI="`gtkwialog -b -p HELP_DIALOG`"

echo "hello"

gtkwialog -b -p HELP_DIALOG

echo "goodbye"

exit 0
wiak

Posted: Fri 15 Jun 2018, 07:42
by disciple
Thanks guys, I switched the latest version of gtkwialog back in when I realised.
I think gtkwialog is great, but I'm still writing for gtkdialog, as that is what everybody has at the moment.
BTW, are you still going to release the gtkwialog source?

Posted: Fri 15 Jun 2018, 07:57
by wiak
disciple wrote:Thanks guys, I switched the latest version of gtkwialog back in when I realised.
I think gtkwialog is great, but I'm still writing for gtkdialog, as that is what everybody has at the moment.
BTW, are you still going to release the gtkwialog source?
Yes, as I have stated, I will be releasing the gtkwialog source code. It will be guaranteed kept backwards compatible with legacy gtkdialog and also with its existing -a and -b alternative modes. However, as mentioned in its new dev thread, I am currently adding some further functionality on top of these and, following the forum issues I ran into the last time when I put up a for-testing-only-binary (which I have lost permission to delete), the newest version won't be released until I have fully tested it by myself. Thereafter, which may take quite a while, it will be published to DebianDog Organisation gtkwialog repository (not as a test binary only, but, yes, with GPL source). I don't work from the github repository, however, so nothing will appear there until my testing is complete. I'm enjoying programming it though since system level C program was always my own favorite computing pastime! :-)

EDIT: Whether anyone is actually planning to adopt it, I'm not sure, and it doesn't matter (other than I'm in no hurry when no-one but myself may use it anyway!) - I will be using it myself from now on though since my own legacy gtkdialog apps need converted for use under dash system shells too and I find this by far the easiest way with my own programs in practice and I'll also be able to add in some new InterProcessComms optional functionality (simple without adding any detrimental bloat really), which I've long wished was available.

wiak

Posted: Tue 17 Jul 2018, 08:42
by smokey01
Is it possible to limit the list displayed by a combobox? See screeny. I would like to only display about 10 items.

Is there a better way to do this in gtkdialog, maybe with another widget?

Thanks

Posted: Tue 17 Jul 2018, 23:52
by don570
Is it possible to limit the list displayed by a combobox?
A programmer made a patch that allows a search in comboboxtext and
comboboxentry
https://github.com/oshazard/gtkdialog/issues/43
comboboxtext:
User presses a key, the next item that begins with that case insensitive char
is selected and it'll wrap back to the first.
_____________________________________________

Posted: Wed 18 Jul 2018, 18:52
by SFR
smokey01 wrote:Is it possible to limit the list displayed by a combobox? See screeny. I would like to only display about 10 items.

Is there a better way to do this in gtkdialog, maybe with another widget?

Thanks
Hey Smokey

The closest thing I've found is wrap-width property for comboboxtext, with which you can at least use multiple columns.

Greetings!

Posted: Wed 18 Jul 2018, 19:40
by technosaurus
smokey01 wrote:Is it possible to limit the list displayed by a combobox? See screeny. I would like to only display about 10 items.

Is there a better way to do this in gtkdialog, maybe with another widget?

Thanks
You can always use programming to limit the entries to X and have an additional entry for next X and/or previous X.

Posted: Wed 18 Jul 2018, 21:20
by seaside
smokey01 ,

You might consider List -

Code: Select all

	<list  vscrollbar-policy="0">
This would not be a dropdown, but would prevent the choice items from dropping below the window.

Cheers,
s

Posted: Wed 18 Jul 2018, 22:04
by smokey01
don570 wrote:A programmer made a patch that allows a search in comboboxtext and
comboboxentry
https://github.com/oshazard/gtkdialog/issues/43
comboboxtext:
User presses a key, the next item that begins with that case insensitive char
is selected and it'll wrap back to the first.
_____________________________________________
Thanks don570 but I'm not sure how this will help if everyone's system is not patched. Not sure if this will do what I want.

Cheers

Posted: Wed 18 Jul 2018, 22:06
by smokey01
SFR wrote:
smokey01 wrote:Is it possible to limit the list displayed by a combobox? See screeny. I would like to only display about 10 items.

Is there a better way to do this in gtkdialog, maybe with another widget?

Thanks
Hey Smokey

The closest thing I've found is wrap-width property for comboboxtext, with which you can at least use multiple columns.

Greetings!
Thanks. Probably a good method to remember for future activities but not ideal for my situation.

Posted: Wed 18 Jul 2018, 22:07
by smokey01
technosaurus wrote:
smokey01 wrote:Is it possible to limit the list displayed by a combobox? See screeny. I would like to only display about 10 items.

Is there a better way to do this in gtkdialog, maybe with another widget?

Thanks
You can always use programming to limit the entries to X and have an additional entry for next X and/or previous X.
@technosaurus, sounds very interesting. Can you provide a working example so I can see what you mean.

Thanks

Posted: Wed 18 Jul 2018, 22:27
by smokey01
seaside wrote:smokey01 ,

You might consider List -

Code: Select all

	<list  vscrollbar-policy="0">
This would not be a dropdown, but would prevent the choice items from dropping below the window.

Cheers,
s
The combobox will keep the list contained within the height of screen where the comboboxtext over shoots the screen and looks quite untidy.

I am considering a tree widget as it is quite neat which I guess is similar to the list widget. The only problem with tree and list widgets they take up a lot of real estate. My issue with the combobox is people can edit the selected data which can break things.

See attached for a sneak preview of what I'm working on. It will be in the August newsletter.

Posted: Thu 19 Jul 2018, 15:52
by misko_2083
smokey01 wrote:
seaside wrote:smokey01 ,

You might consider List -

Code: Select all

	<list  vscrollbar-policy="0">
This would not be a dropdown, but would prevent the choice items from dropping below the window.

Cheers,
s
The combobox will keep the list contained within the height of screen where the comboboxtext over shoots the screen and looks quite untidy.

I am considering a tree widget as it is quite neat which I guess is similar to the list widget. The only problem with tree and list widgets they take up a lot of real estate. My issue with the combobox is people can edit the selected data which can break things.

See attached for a sneak preview of what I'm working on. It will be in the August newsletter.
Well, I would try with the button that launches the window.
That window would have a list widget (or any other widget, buttons, notebook...) and make it close when it loses the focus.

This is a quick hack with xdotool.

Code: Select all

#!/bin/sh

eval $(xdotool getmouselocation --shell)

[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog

TMPDIR=/tmp/gtkdialog/examples/"`basename $0`"
mkdir -p "$TMPDIR"

printf "First item\nSecond item\nThird item\nSmokey item\nWiak's Vodka\nNice Weather\nPuppy Linux\nLast Item" > "$TMPDIR"/inputfile

MAIN_DIALOG='
<window window_position="2" skip_taskbar_hint="true" decorated="false">
	<vbox>
		<list vscrollbar-policy="0">
			<variable>LIST</variable>
			<width>350</width>
			<height>150</height>
			<input file>'"$TMPDIR"'/inputfile</input>
			<output file>'"$TMPDIR"'/outputfile</output>
			<action>echo "The chosen item is "$LIST""</action>
		</list>
	</vbox>
</window>
'
export MAIN_DIALOG

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --class smokey --space-expand=true --space-fill=true --program=MAIN_DIALOG 2>/dev/null & gtkdiag_pid=$! ;;
esac

until win_id=$(xdotool search --onlyvisible --class smokey 2>/dev/null); do
	sleep .1
done

xdotool windowmove $win_id $X $Y

xdotool search --onlyvisible --class smokey  behave %@ blur windowkill & xdo_pid=$!

wait $gtkdiag_pid

kill $xdo_pid
exit 0
Maybe instead of moving the window xdotool windowmove $win_id $X $Y , when it's maped, gtkdialog --geometry would be better.

The trick is to position the window as close to the button as possible.

Posted: Fri 20 Jul 2018, 13:35
by misko_2083
^This window can be used as a stand-alone menu.

The window placement with window_position="2" is centered on the mouse position.

Code: Select all

#!/bin/sh

[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog

TMPDIR=/tmp/gtkdialog/examples/"`basename $0`"
mkdir -p "$TMPDIR"

printf "First item\nSecond item\nThird item\nSmokey item\nWiak's Vodka\nNice Weather\nPuppy Linux\nLast Item" > "$TMPDIR"/inputfile

MAIN_DIALOG='
<window window_position="2" skip_taskbar_hint="true" decorated="false">
	<vbox>
		<list vscrollbar-policy="0">
			<variable>LIST</variable>
			<width>350</width>
			<height>150</height>
			<input file>'"$TMPDIR"'/inputfile</input>
			<output file>'"$TMPDIR"'/outputfile</output>
			<action>echo "The chosen item is \"$LIST\""</action>
			<action>EXIT:0</action>
		</list>
	</vbox>
</window>
'
export MAIN_DIALOG

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --class smokey --space-expand=true --space-fill=true --program=MAIN_DIALOG 2>/dev/null & gtkdiag_pid=$! ;;
esac

until win_id=$(xdotool search --onlyvisible --class smokey 2>/dev/null); do
	sleep .1
done

xdotool search --onlyvisible --class smokey  behave %@ blur windowkill 2>/dev/null & xdo_pid=$!

wait $gtkdiag_pid

kill $xdo_pid 2>/dev/null
exit 0
I could try to calculate the relative position of the mouse pointer and based on that try to find the best position. But not sure if it's, as Americans say, "worth the trouble". :)

Image

gtkdialog - tips

Posted: Mon 23 Jul 2018, 19:51
by slippery60
I am trying to write a menu system that will execute various cli programs. Many of the programs need a variable like "output directory" or 'out_dir".

So in their frame I include a variable "out_dir". I would like to propagate the answer to any one of the "out_dir" entries to all of them.

I thought that if is use just 1 variable "out_dir". After the first entry, a refresh would fix all of the "out_dir" variables and the user would not have to entry the variable again. But that didn't work.

Can this be done? and how?

Thanks

Posted: Mon 23 Jul 2018, 21:06
by smokey01
Thanks misko_2083. I have settled with the tree widget.

Re: gtkdialog - tips

Posted: Tue 24 Jul 2018, 02:43
by MochiMoppel
slippery60 wrote:I thought that if is use just 1 variable "out_dir". After the first entry, a refresh would fix all of the "out_dir" variables and the user would not have to entry the variable again. But that didn't work.
Can this be done? and how?
Certainly possible but it depends on how you set and store your variable.
I find it hard to grasp your problem from your description. A simple example would help. Or post the code that "didn't work".