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 Sat 17 Nov 2018, 11:16
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
GtkDialog File Selector Work Around 0.1
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message
LazY Puppy

Joined: 21 Nov 2014
Posts: 2007
Location: Germany

PostPosted: Fri 21 Nov 2014, 18:29    Post subject:  GtkDialog File Selector Work Around 0.1
Subject description: A work around for the use of the GtkDialog File Sector from a Menu Entry of a GtkDialog Program


Yes, it's me. Today I have changed my User Name to LazY Puppy and also established a E-Mail Adress, lazy-puppy@xxx.xx. Just for some conceptional continuity.

Ok, here we go...

For my GDAM Builder, a all new, complex Application, also huge in functionality I had the need to reduce Buttons inside of the GtkDialog Program. Since I really do like Menus, I decided to put all Buttons to open and/or save Files into a Menu instead. As soon as I began to rework this Application, I ran into the Problem, that one can't use the GtkDialog File Selector Widget from a Menu Entry. The only thing that works is the Chooser Widget, which is really uncomfortable and should be deprecated (i.m.o.).

So I did some research in some Applications but found only the use of the Chooser Widget by Menu Entry - even in Zigbert's PMusic(!). Again I did start some Work to get the Problem solved.

My Solution depends on xdotool!

I have packaged this into the attached .pet Package for all GtkDialog Programmers, that may find it somehow useful. Also I have integrated Zigbert's Solution into this Package.

Files inside the Package:



# Examples for a call:

my_RSH_gtk_fileselect_workaround "Load" "/usr/bin" "*.cfg" "filename" "/tmp/my_return_file_containing_the_results.txt"
my_RSH_gtk_fileselect_workaround "Save as" "/usr/bin" "*.cfg" "savefilename" "/tmp/my_return_file_containing_the_results.txt"

Note: filename and savefilename are Modi for the File Selector - NOT File Names!

One could add an additional Parameter submitted at the last of all Parameters.



my_RSH_gtk_fileselect_workaround "Save as" "/usr/bin" "*.cfg" "savefilename" "/tmp/my_return_file_containing_the_results.txt" "0"

which could be 0 or any else Numeric Char. Submitted Parameter = 0 will use the File Selector Solution of my_RSH_gtk_fileselect_workaround any else submitted Parameter will bypass to either file_chooser or to file_saver, which then will be just the Chooser Widget in use.


Do use it only from a Menu Entry - NOT by a Button.

As for Keyboard Shortcuts used, like Strg-O: the File Selector will appear after the Strg (or Alt or Shift) Key is released.

How is this working?

It just creates a GtkDialog Window sized to 1x1 Pixel, containing a Entry Widget, invisible and sized to 1x1 Pixel plus a Button Widget sized 1x1 Pixel without Relief. The Button widget has: has-focus="true", has-default="true" and can-default="true", so it will definitely grab any Retrun Key pressed/submitted.

Right before the GtkDialog GUI appears on the Screen a different Script is executed: my_RSH_gtk_fileselect_workaround_hit_return.

This Script just waits 0.2 Seconds and sends Command xdotool key Return to the Window Manager. Since the sending of Return is useless while Pressing Strg, Alt or Shift, it is looped until a File is detected, which will only exist, if the 1x1 Pixel Button of the GtkDialog GUI has grabbed xdotool's sending of key Return.

So, the File Selector appears after releasing key Strg etc.pp.

Known issues:

When using this from a GUI Button the Loop will rarely come to an End if the Button is accidentally clicked twice. But just clicked once it works smoothly. Though, don't use it that way.


Filename  GtkDialog-FileSelector-WA-0.1.pet 
Filesize  3.53 KB 
Downloaded  97 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
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.2447s ][ Queries: 15 (0.1304s) ][ GZIP on ]