Page 61 of 76

Posted: Mon 28 Aug 2017, 10:52
by zigbert
:lol: :lol: :lol:

That means the solution is to combine a <chooser> in mode 0 (select file) with an <entry> holding the filename. Thank you.

Posted: Mon 28 Aug 2017, 11:22
by MochiMoppel
No, that's not what it meant. But if you somehow are able to achieve this with a separate <entry> widget I would be keen to see your solution :wink:

Posted: Mon 28 Aug 2017, 12:35
by zigbert
I am onto it :wink:

Posted: Mon 28 Aug 2017, 13:39
by zigbert
First draft:

Code: Select all

echo /usr/share/backgrounds > /tmp/savepath
echo "default.svg" > /tmp/savefile

echo ' 
<vbox> 
 <entry visible="false">
  <variable>SAVEPATH</variable>
  <input file>/tmp/savepath</input>
 </entry>
 <entry>
  <variable>SAVEFILE</variable>
  <input file>/tmp/savefile</input>
 </entry>
 <chooser action="0" create-folders="true" >
  <width>600</width> 
  <height>400</height> 
  <variable>SAVE_CHOOSER</variable>
  <default>'$(cat /tmp/savepath)'</default>
  <action signal="button-release-event" condition="command_is_true([[ -f \"$SAVE_CHOOSER\" ]] && echo true)">basename "$SAVE_CHOOSER" > /tmp/savefile</action> 
  <action signal="button-release-event" condition="command_is_true([[ -d \"$SAVE_CHOOSER\" ]] && echo true)">dirname "$SAVE_CHOOSER" > /tmp/savepath</action> 
  <action signal="button-release-event">refresh:SAVEFILE</action>
  <action signal="button-release-event">refresh:SAVEPATH</action> 
 </chooser>
 <hbox> 
  <button cancel></button> 
  <button>
   <label>Save</label>
   <input file stock="gtk-save"></input>
   <action>gxmessage "savefile: $SAVEPATH"/"$SAVEFILE"</action>
  </button> 
 </hbox> 
</vbox> 
' |  gtkdialog -s
Seems to work ok, but it doesn't update $SAVEPATH when pressing one of the path-buttons (second row in the gui). I got problems to control that...

Posted: Mon 28 Aug 2017, 14:58
by don570
Simple example to show left side buttons...

Code: Select all

echo '
<vbox width-request="300">
 <hbox>
                   
              <button  space-expand="false" space-fill="false"> 
            <label>"Action"</label> 
                      <input file stock="gtk-help"></input>
            <action>xmessage here</action>
      </button> 
       <button  space-expand="false" space-fill="false"> 
                      <input file stock="gtk-preferences"></input>

            <action>xmessage here</action>
      </button> 

       <text space-expand="true" space-fill="true">
            <label>""</label> 
       </text>  
       <button cancel></button>  
 </hbox>  
 

</vbox>' | gtkdialog -s 

Posted: Fri 01 Sep 2017, 06:55
by smokey01
Is it possible to change the background colour of the <edit> widget?

Posted: Fri 01 Sep 2017, 07:56
by MochiMoppel
smokey01 wrote:Is it possible to change the background colour of the <edit> widget?
Yes.

Posted: Fri 01 Sep 2017, 08:26
by smokey01
MochiMoppel wrote:
smokey01 wrote:Is it possible to change the background colour of the <edit> widget?
Yes.
Thanks.

Posted: Fri 01 Sep 2017, 20:38
by some1
Yes!

Posted: Sat 02 Sep 2017, 19:49
by don570
Here's another example of a colored background..
http://45.33.15.200/puppy/viewtopic.php ... dea#881811

___________________________________________________

Posted: Sat 09 Sep 2017, 03:46
by livernote1
Hello guys newbie here, help needed...

below i have provide two code from two different program but the problem here is how can i merge this two program. if u guys can see there is button continue below the date button,so i want to make the continue button will open the second program code that i have provide below. The second problem is the picture that i used on pixmap fuction is not showing the picture but show sign like it cant read the picture.. so thanks in advance.

Code: Select all


#!/bin/bash 
GTKDIALOG=gtkdialog 
export MAIN_DIALOG=' 
<window title="welcome" width-request="480" height-request="320"> 
<vbox>

	<frame>
		<text>
			<label> Welcome </label>
		</text>	
		<pixmap>
		<input file> /home/livernote/Desktop/L.jpg </input> 
		</pixmap>	
	</frame>
	
	<frame Label from command>
     <text>
       <label>This is a static text.</label>
       <input>date</input>
       <variable>DATE</variable>
     </text>
     <hbox>
       <button>
         <label>refresh</label>
         <action type="refresh">DATE</action>
       </button>
       <button> 
		 <label>Continue</label>
		 <action>
			<input file> /home/livernote/Desktop/my </input>
	     </action>
       </button>
 	</hbox>
   </frame>	

</vbox>
</window> 
' 
case $1 in 
-d | --dump) echo "$MAIN_DIALOG" ;; 
*) $GTKDIALOG --program=MAIN_DIALOG --center ;; 
esac 
------------

Code: Select all


#!/bin/bash 
GTKDIALOG=gtkdialog 
export MAIN_DIALOG=' 
<window title="welcome" width-request="480" height-request="320"> 
<hbox>

		<vbox space-expand="true" space-fill="true">
			
			<button>	 
			<label>1</label>  
			<action>echo "Button 1"</action> 
			</button>

			<button>	 
			<label>2</label>  
			<action>echo "Button 2"</action> 
			</button>
					
		</vbox>
</hbox>

</window> 
' 
case $1 in 
-d | --dump) echo "$MAIN_DIALOG" ;; 
*) $GTKDIALOG --program=MAIN_DIALOG --center ;; 
esac 
------------ 

Posted: Sat 09 Sep 2017, 05:09
by MochiMoppel
"Merge" two programs? It appears that you have 2 different scripts, each containing a MAIN_DIALOG, and that you are trying to call the second script from the first. Could be done with a simple button action <action>/path/to/my/secondscript.sh &</action>

You could also put both dialogs into 1 script and launch the second dialog from your first. Something like this:

Code: Select all

#!/bin/bash
export SUB_DIALOG=' 
<window> 
<vbox> 
 <text><label>SUB_DIALOG</label></text> 
 <button>
   <label>Close</label>
   <action>closewindow:SUB_DIALOG</action> 
 </button> 
</vbox> 
<variable>SUB_DIALOG</variable> 
</window>' 

export MAIN_DIALOG=' 
<window> 
<vbox> 
 <text><label>MAIN_DIALOG</label></text> 
 <button> 
   <label>Continue</label> 
   <action>launch:SUB_DIALOG</action> 
 </button> 
</vbox> 
</window>' 
gtkdialog -cp MAIN_DIALOG
More examples for launching child windows:
http://www.murga-linux.com/puppy/viewto ... 875#353875
http://www.murga-linux.com/puppy/viewto ... 300#758300

Your second question: Remove the surrounding whitespace or put the file path in quotes.

Posted: Sun 24 Sep 2017, 00:27
by recobayu
Hi All,
Can we make bigger icon on tree? How?
Thank You.

Posted: Wed 11 Oct 2017, 14:42
by torm
Hello ..again :)

To ansver my own strange question about how to move
an undecorated window with mouse only..

Turns out to be pretty simple.. GTK2, no external dependencies.
Just add gtkrc for named widgets.

Allows to move and close the window as usual, for fixed size window.
Added a resizable window with stock icon.
btw, window can also be moved with resize grip using middle mousebutton.

I hope it's any use, for skinned custom widgets or something like that..

JWM is known to "shape" even undecorated windows,
while it should look as on screenshot with most other WM-s.

edit: re-uploaded

added some extra cosmetics.

Posted: Thu 12 Oct 2017, 02:48
by MochiMoppel
export GTK2_RC_FILES
Without this fix your examples don't work.


Nice move functionality of the statusbar grip. But why would gtkrc theming provide a solution to your "strange question about how to move an undecorated window with mouse only"?

And how can I move the "fixed size" window with mouse only? OK, I can always use the JWM TaskList menu, but I assume that you were looking for a different way.

BTW: Resizing the "fixed size" window results in strange artifacts :cry:

Posted: Sat 14 Oct 2017, 07:02
by MochiMoppel
Today I wondered why one of my <pixmap> widgets recognizes key-press-event signals while another - seemingly identical - widget doesn't.

Turns out that it makes a difference if the pixmap is packed into a scrollable or (default) not scrollable box container.
I updated my collection of <eventbox> mysteries.

Posted: Sun 15 Oct 2017, 16:01
by torm
export GTK2_RC_FILES
..interesting, works as is on this system.. no need to export.


OK, I can always use the JWM TaskList menu,

..not using JWM if possible, while double checked with JWM, looks working.
Maybe should have made better mimic of window border.. ? Top gray area?

BTW: Resizing the "fixed size" window results in strange artifacts
.. will add resizable="false" when update.
Also some more detailed rc file to support dark themes ( for resizable window ) .

Posted: Tue 17 Oct 2017, 03:01
by livernote1
Guys help needed, been working with this progress bar if using the example like give in page page 1 it is working fine but after i change the action it seem the program is running on the background only the progress bar is just silence

Code: Select all

<frame Progress>
    <text>
      <label>Duplication process is happening.</label>
    </text>
    <progressbar>
      <input>dd if=/dev/sda of=/dev/sdb</input>
	  <action>launch:END_DIALOG</action>
    </progressbar>
  </frame>

Posted: Tue 17 Oct 2017, 14:01
by misko_2083
livernote1 wrote:Guys help needed, been working with this progress bar if using the example like give in page page 1 it is working fine but after i change the action it seem the program is running on the background only the progress bar is just silence

Code: Select all

<frame Progress>
    <text>
      <label>Duplication process is happening.</label>
    </text>
    <progressbar>
      <input>dd if=/dev/sda of=/dev/sdb</input>
	  <action>launch:END_DIALOG</action>
    </progressbar>
  </frame>
This is a way to show the progress bar with dd and pv in terminal.

Code: Select all

USB="/dev/sdb"
ISO_IMAGE="/path/to/ubuntu-15.04-desktop-amd64.iso"
SIZE=$(du -h -B1 "$ISO_IMAGE" | awk '{print $1}')

dd if="$ISO_IMAGE" | pv -s "$SIZE" | dd of="$USB" bs=4M oflag=dsync
With oflag=dsync dd will ask for completely synchronous output to disk. Slower but you'll have a progress bar.

Someone asked how to do this with yad.
To show this in a UI you need line by line output. For that add -n to pv.

Code: Select all

USB="/dev/sdb"
 ISO_IMAGE="/path/to/ubuntu-15.04-desktop-amd64.iso"
 SIZE=$(du -h -B1 "$ISO_IMAGE" | awk '{print $1}')

(dd if="$ISO_IMAGE" | pv -n -s "$SIZE" | dd of="$USB" bs=4M oflag=dsync) 2>&1 | \
  yad --center --borders=6 --title="Image writer" --text="$(echo -e "Writing $(basename "$ISO_IMAGE"):")"\
        --width=300 --progress --no-buttons --auto-close --image=system-run --window-icon=drive-removable-media-usb
You can apply something similar with gtkdialog.

Posted: Fri 20 Oct 2017, 20:46
by torm
Different versions of GTK2 and BASH..

fixed some,I hope ..