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 Wed 18 Oct 2017, 07:39
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog - tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 76 of 82 [1219 Posts]   Goto page: Previous 1, 2, 3, ..., 74, 75, 76, 77, 78, 79, 80, 81, 82 Next
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 1365
Location: Japan

PostPosted: Tue 23 Aug 2016, 01:02    Post subject:  

Back to topic and to the confusing "resizable" attribute. It turns out that I used it before for the exact purpose it was invented. It removes the "Resize" item from the window menu and prevents user resizing.

With its surprising side effects I can now solve a problem that puzzled me for a long time.

I've created a tiny image viewer with the pixmap widget. Pretty much like Viewnior it uses one dialog window to read images one after another. The problem is that while the dialog window will automatically expand when reading an image bigger than the previous image (that's good!), it will not shrink when the following image is smaller. This puts ugly empty space around the image (see screenshot).

With resizable="false" the window will expand as well, but it will also shrink, adapting window size always to the size of the image. Very neat.
window_resizable_true_false.png
 Description   
 Filesize   106.77 KB
 Viewed   590 Time(s)

window_resizable_true_false.png

Back to top
View user's profile Send private message 
peebee


Joined: 21 Sep 2008
Posts: 2919
Location: Worcestershire, UK

PostPosted: Tue 06 Sep 2016, 07:50    Post subject: [SOLVED]  

Fixed by @MochiMoppel - thank you - http://www.murga-linux.com/puppy/viewtopic.php?p=922479#922479
_________________
LxPup = Puppy + LXDE

Last edited by peebee on Thu 08 Sep 2016, 11:45; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
torm


Joined: 07 Mar 2015
Posts: 121

PostPosted: Tue 06 Sep 2016, 14:13    Post subject:  

<action signal="type">activity</action>
if "button-release-event" is the event
does GtkStatusbar widget support that?
Or there is no release event.. ?? it appears to accept button press event..
Maybe I'm barking at the wrong tree, dunno.. zzz Sad
Or any good workaround Rolling Eyes
Back to top
View user's profile Send private message 
B.K. Johnson

Joined: 12 Oct 2009
Posts: 631

PostPosted: Tue 06 Sep 2016, 14:50    Post subject:  

Post made in wrong thread - DELETED
_________________
B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM

Back to top
View user's profile Send private message 
B.K. Johnson

Joined: 12 Oct 2009
Posts: 631

PostPosted: Tue 06 Sep 2016, 15:50    Post subject: Request for gtkdialog lint(er), formatter/pretty printer  

I chose to place this request here rather than under REQUESTS. No ruffled feathers, I hope.

Is there a lint(er) a.k.a. code formatting tool; a.k.a. pretty-printer (to screen) for gtkdialog code?
I would not want one that automatically lints as I type. I think I would find that really distracting. I'd rather use a linter that processes my code after I’ve finished my work.

_________________
B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM

Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1365
Location: Japan

PostPosted: Tue 06 Sep 2016, 22:31    Post subject:  

torm wrote:
<action signal="type">activity</action>
if "button-release-event" is the event
does GtkStatusbar widget support that?

Needs an eventbox to work:
Code:
#! /bin/sh
echo '
<window width-request="200">
    <eventbox>
        <statusbar>
            <input>echo "Click me!"</input>
        </statusbar>
        <action signal="button-press-event">beep</action>
        <action signal="button-release-event">beep -f100</action>
    </eventbox>
</window>'|gtkdialog -s
Back to top
View user's profile Send private message 
recobayu


Joined: 15 Sep 2010
Posts: 274
Location: indonesia

PostPosted: Fri 09 Sep 2016, 00:31    Post subject:  

Alhamdulillah..
Finally, I can make button align to left. Try this code:
Code:

#!/bin/sh
export gui='
<window>
   <vbox>
      <hbox space-fill="true" space-expand="true">
         <button space-fill="false" space-expand="false">
            <input file>/root/puppy-reference/midi-icons/archive48.png</input>
            <label>another okay</label>
         </button>
         <text xalign="0">
            <label>""</label>
         </text>
      </hbox>
   
      <hbox space-fill="true" space-expand="true">
         <button xalign="0" space-fill="false" space-expand="false">
            <input file>/root/puppy-reference/midi-icons/chat48.png</input>
            <label>okay</label>
         </button>
         <text>
            <label>""</label>
         </text>
      </hbox>
   
      <hbox space-fill="true" space-expand="true">
         <button space-fill="false" space-expand="false">
            <input file>/root/puppy-reference/midi-icons/connect48.png</input>
            <label>okay again</label>
         </button>
         <text>
            <label>""</label>
         </text>
      </hbox>
   
      <hbox space-fill="true" space-expand="true">
         <button space-fill="false" space-expand="false">
            <input file>/root/puppy-reference/midi-icons/save48.png</input>
            <label>loooong and over again okay</label>
         </button>
         <text>
            <label>""</label>
         </text>
      </hbox>
   </vbox>
</window>'
gtkdialog -p gui

But, how to make the button's width tobe same?

Edit:
we can smooth it by relief="2" in button tag.
alignlefttextbutton.png
 Description   left align
 Filesize   13.44 KB
 Viewed   385 Time(s)

alignlefttextbutton.png

Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1365
Location: Japan

PostPosted: Fri 09 Sep 2016, 01:49    Post subject:  

recobayu wrote:
But, how to make the button's width tobe same?

First 2 button same width, no space-fill attributes, no vertical expansion,
Third button unchanged for comparison. It would be nice if icons+labels could also be left aligned, but that might be impossible without space padding the labels.
Code:
#! /bin/sh
export gui='
 <window>
    <vbox>
       <hbox>
          <button space-expand="false" width-request="200">
             <input file>/root/puppy-reference/midi-icons/archive48.png</input>
             <label>another okay</label>
          </button>
          <text space-expand="true" label=""></text>
       </hbox>

       <hbox>
          <button space-expand="false" width-request="200">
             <input file>/root/puppy-reference/midi-icons/chat48.png</input>
             <label>okay</label>
          </button>
          <text space-expand="true" label=""></text>
       </hbox>

      <hbox space-fill="true" space-expand="true">
          <button space-fill="false" space-expand="false">
             <input file>/root/puppy-reference/midi-icons/save48.png</input>
             <label>loooong and over again okay</label>
          </button>
          <text>
             <label>""</label>
          </text>
       </hbox>
      </vbox>
 </window>'
 gtkdialog -p gui
left-aligned_buttons.png
 Description   
 Filesize   12.8 KB
 Viewed   397 Time(s)

left-aligned_buttons.png

Back to top
View user's profile Send private message 
recobayu


Joined: 15 Sep 2010
Posts: 274
Location: indonesia

PostPosted: Fri 09 Sep 2016, 02:08    Post subject:  

Thank you Mochi, but your icon and text are not left aligned anymore (first button and second). I want to make the button same width and left aligned. If it is not possible, I think relief="2" is the solution.
Last edited by recobayu on Fri 09 Sep 2016, 02:28; edited 1 time in total
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1365
Location: Japan

PostPosted: Fri 09 Sep 2016, 02:26    Post subject:  

recobayu wrote:
Thank you Mochi, but your icon and text are not left aligned anymore (first button and second).
What do you mean by "not anymore". Icons and text in your examples were also not left aligned. Only buttons are left aligned. As I said, that's something that may be impossible.

Quote:
I want to make the button same width and left aligned.
That's what they are now. The buttons (not the button icons+texts !) are same widths and aligned to left window edge.
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 931

PostPosted: Sat 10 Sep 2016, 08:16    Post subject:  

@recobayu , just a suggestion, why don't you move the text outside the button, so you can have all buttons left-aligned and same size, and text labels left-aligned and merged with background color?
_________________
Fatdog64-710|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
recobayu


Joined: 15 Sep 2010
Posts: 274
Location: indonesia

PostPosted: Sat 10 Sep 2016, 19:42    Post subject:  

step wrote:
@recobayu , just a suggestion, why don't you move the text outside the button, so you can have all buttons left-aligned and same size, and text labels left-aligned and merged with background color?

Thank You, Step. If I do that, the clickable area is just on the icon. But with label inside button, its easier to hover and click. Here is my exploration:
http://murga-linux.com/puppy/viewtopic.php?p=922659#922659
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1365
Location: Japan

PostPosted: Sat 10 Sep 2016, 22:34    Post subject:  

recobayu wrote:
Here is my exploration:
http://murga-linux.com/puppy/viewtopic.php?p=922659#922659
...which is the same as your earlier code, the code you wanted to change, only without button reliefs. IMHO this makes it worse. You camouflage the fact that the buttons and therefore the click area are all of different size and the user has no clue anymore where to click. Keeping the cursor on the right side (to drag the slider) and then moving a little left to hit a button becomes a hit & miss game.

You are trying again to mimic the tree widget using buttons. Stay with the tree.
Back to top
View user's profile Send private message 
Geoffrey


Joined: 30 May 2010
Posts: 2301
Location: Queensland

PostPosted: Tue 27 Sep 2016, 22:49    Post subject:  

A simple solution to make strikethrough text.



Code:
#!/bin/sh
#
STRIKE="$(readlink -e "$0")"
sleep 0.3
[ `pidof "$(basename "$STRIKE")" -o %PPID | wc -w` -gt 1 ] && exit 1

touch /tmp/strikethrough

export DIALOG='
<window title="StrikeThrough" icon-name="gtk-strikethrough">
   <vbox>
      <edit wrap-mode="3">
         <variable>EDIT</variable>
         <height>150</height>
         <width>500</width>
      </edit>
      <vbox>
      <edit file-monitor="true" auto-refresh="true" wrap-mode="3" editable="false">
         <height>150</height>
         <input file>/tmp/strikethrough</input>
      </edit>
      </vbox>
      <hbox homogeneous="true">
      <hbox>
         <button cancel></button>
         <button>
            <label>Create</label>
            <input file stock="gtk-ok"></input>
            <action>`echo "$EDIT" | sed "s/./&\xCC\xB6/g" > /tmp/strikethrough`</action>
            </button>
        </hbox>
      </hbox>
   </vbox>
</window>'

gtkdialog --program=DIALOG
strikethrough.jpg
 Description   
 Filesize   37.4 KB
 Viewed   199 Time(s)

strikethrough.jpg


_________________
Carolina: Recent Repository Additions

Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Wed 28 Sep 2016, 03:36    Post subject:  

Geoffrey
Thanks for this one - interesting!

I have put your code in the new post about Text managing

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 76 of 82 [1219 Posts]   Goto page: Previous 1, 2, 3, ..., 74, 75, 76, 77, 78, 79, 80, 81, 82 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.0768s ][ Queries: 13 (0.0145s) ][ GZIP on ]