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 Tue 25 Nov 2014, 17:07
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Learning GtkDialog (hopefully) -- and I have questions...
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Wed 26 Feb 2014, 20:15    Post_subject:  Learning GtkDialog (hopefully) -- and I have questions...  

Let me start by saying that programming is not a strength of mine! I have a hard time with this stuff... but I'm determined Twisted Evil

The ultimate goal here is to create an LXLauncher style "netbook interface" for Puppy, using GtkDialog... I realize that I'm well away from achieving that, but I'd like to see how far I can get.

Eventually what I want is for this interface to sit on top of JWM, replacing the bottom tray. The interface will have tabs...
Home
Filesystem
Graphics
Internet
Productivity
Entertainment
Utility
Config
More specifically... Internet also contains the "Network" submenu; Productivity combines Document, Business, and Personal; Entertainment combines (most of) Multimedia and Fun; CD burning tools and the like are (if possible) merged into Utility, and Config incorporates Desktop, System, and Setup.

"Home" is a special tab which contains quick links to commonly needed items -- it serves as the desktop, if you will. It links to the ConnectWizard, defaultbrowser, defaultwordprocessor, and rxvt (Terminal), as well as showing the currently-available drives and partitions (sda1,sda2,sdb1,sr0,etc). The drive icons hot-update lets say every five seconds (this can very easily change -- but they must update without restarting JWM or X).

Program icons displayed within the interface's tabs should change the same way that the JWM PuppyMenu changes -- running "fixmenus" in a terminal should update things.

*ahem*

So the first question is --

I want the interface to be fullscreen, with no titlebar and no frame/border around the window. I know that I want to use a GtkNotebook widget as the primary component -- that widget will implement the tabs and contain the icons.

What I don't know is how to actually /do/ that. I have an idea but I don't know if it's permissible... basically, embed a widget inside another widget. In this case, create a GtkWindow that has no 'decorations' (titlebar,frame/border,etc) and is fullscreen, and then stick the GtkNotebook inside the GtkWindow.

Can I do that? and in either case, is there a better way?

_________________

Back to top
View user's profile Send_private_message 
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Thu 27 Feb 2014, 13:34    Post_subject:  

Help? Sad
_________________

Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2278

PostPosted: Thu 27 Feb 2014, 13:42    Post_subject:  

"I want the interface to be fullscreen, with no titlebar and no frame/border around the window."
Instead of running "on top of JWM", simply run your program without any WM at all -on bare X, that is.
OTOH, JWM can maybe disable all window decoration.
Back to top
View user's profile Send_private_message 
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Thu 27 Feb 2014, 14:59    Post_subject:  

I still need a WM of some sort -- after all, the launcher I'm (hopefully) making is only a launcher, and not a WM itself. It could be one of the 'trayless' WMs (IIRC OpenBox is like that) but I do need a WM.

What I'm wanting is basically LXLauncher, but configurable in meaningful ways. (IIRC LXLauncher was basically abandoned mid-development.)

EDIT: to be more clear -- the 'notebook' widget in GtkDialog is what I'm wanting to be fullscreen and undecorated -- and the only thing that I want that way. That's the launcher. Anything it launches needs to have the decorations -- title bar, min/max/close buttons, and window frame/border -- the works.

_________________

Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2386
Location: UK

PostPosted: Thu 27 Feb 2014, 20:31    Post_subject: Re: Learning GtkDialog (hopefully) -- and I have questions...  

Quote:
I want the interface to be fullscreen, with no titlebar and no frame/border around the window.

Do this in your /root/.jwm/jwm-personal, to give the option to disable that stuff to any app:

<Group>
<Class>my_classname</Class>
<Option>noborder</Option>
<Option>notitle</Option>
</Group>

(... note... gtkdialog also can use 'decorated="false"' (see below) ... )

Then you need to force your GUI to fill the screen... So use xwininfo to get the screen height and width:

Code:
export WIDTH=`xwininfo -root | grep Width | cut -f2 -d':' `
export HEIGHT=`xwininfo -root | grep Height | cut -f2 -d':' `


...

Then in the top of your gtkdialog GUI you can add this (height and width are reduced a little from actual screen size, and decorated=false hides the window title etc):

Code:
export GUI='<window height-request="'$((HEIGHT-25))'" width-request="'$((WIDTH-25))'" decorated="false">
... blah ...
</window>'


NOTE: if the GUI freezes when you run it, make the $HEIGHT and $WIDTH smaller - do $((HEIGHT-50)) or something ...

Then at the end of the script, when you load up the GUI and run gtkdialog, add this class stuff at the end:

Code:
gtkdialog --program MYGUI --class=my_classname

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Fri 28 Feb 2014, 00:23    Post_subject:  

Thanks, sc0ttman, that looks quite helpful. I'll look it over when I'm not so sleepy (quarter to midnight here) Wink
_________________

Back to top
View user's profile Send_private_message 
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Fri 28 Feb 2014, 12:23    Post_subject:  

That's definitely useful. I think that will answer that question.

Next: this is a kinda basic one that the documents online don't go into. I've looked, and they just don't explain.

How do I do the beginning part of the GtkDialog script, so that it will open the GtkNotebook with the proper tabs and such, and then populate it with icons?

_________________

Back to top
View user's profile Send_private_message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2386
Location: UK

PostPosted: Fri 28 Feb 2014, 15:17    Post_subject:  

Gtkdialog needs a string passed to it, and that *is* the GUI - it doesnt need to be populated or manipulated after creating it - it just needs to be executed by gtkdialog...

The easiest way to do it (IMHO) is something like this:

Code:
#!/bin/sh

#set some variables ... just as examples of how to customise the GUI before it loads
export mytitle="My program name"
export version=0.1
export tab=1   #will load the 2nd tab, the 1st tab is zero
export button_label_1="Click Me!"
export button_label_2="Click Me Too!"
export WIDTH=300

# create the GUI string ..

export MY_GUI_STRING='<window title="'$mytitle' '$version'" width-request="'$WIDTH'">
<vbox>
   <notebook labels="first|second" page="'$tab'">
      <frame>
         <text><label>"first tab"</label></text>
         <button>
            <label>'$button_label_1'</label>
            <input file>/usr/local/lib/X11/pixmaps/draw24.png</input>
         </button>
      </frame>
      <frame>
         <text><label>"second tab"</label></text>
         <button>
            <label>'$button_label_2'</label>
            <input file stock="gtk-execute"></input>
         </button>
      </frame>
   </notebook>
   <button cancel></button>
</vbox>
</window>'


#run gtkdialog, using the GUI string above

gtkdialog --program MY_GUI_STRING


#gui is now closed

exit 0

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send_private_message 
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Fri 28 Feb 2014, 16:20    Post_subject:  

Wow, that's half the app written there, just about -- thank you SO MUCH!!
_________________

Back to top
View user's profile Send_private_message 
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Sat 01 Mar 2014, 15:09    Post_subject:  

OK, now the doozy -- how can I load applications into this thing...? Ideally I'd pull from JWM's /etc/xdg/menus/*.menu files, but I'm not sure I can do that. Alternatively, how do I read the *.desktop files in /usr/share/applications so that I can drop icons and text into the GtkNotebook?
_________________

Back to top
View user's profile Send_private_message 
Bert


Joined: 30 Jun 2006
Posts: 975

PostPosted: Sun 02 Mar 2014, 08:46    Post_subject:  

There are possibly better ways, but this is how I would do it:

Code:
#!/bin/sh

#set some variables ... just as examples of how to customise the GUI before it loads
export mytitle="My program name"
export version=0.1
export tab=1   #will load the 2nd tab, the 1st tab is zero
export button_label_1="Seamonkey Composer"
export button_label_2="Abiword"
export button_label_3="MtPaint"
export WIDTH=500

# create the GUI string ..

export MY_GUI_STRING='<window title="'$mytitle' '$version'" width-request="'$WIDTH'">
<vbox>
   <notebook labels="Document|Graphic" page="'$tab'">
      <frame>
         <text use-markup="true"><label>"<b>Document</b>"</label></text>
         <button>
            <label>'$button_label_1'</label>
            <input file>/usr/local/lib/X11/pixmaps/www24.png</input>
            <action>/usr/local/bin/defaulthtmleditor</action>
         </button>
         <button height-request="30" width-request="30">
            <label>'$button_label_2'</label>
            <input file>/usr/local/lib/X11/pixmaps/word24.png</input>
            <action>/usr/bin/abiword</action>
         </button>
      </frame>
      <frame>
         <text use-markup="true"><label>"<b>Graphic</b>"</label></text>
         <button>
            <label>'$button_label_3'</label>
            <input file>/usr/local/lib/X11/pixmaps/paint24.png</input>
            <action>/usr/bin/mtpaint</action>
         </button>
      </frame>
   </notebook>
   <hbox homogeneous="true">
   <button cancel></button>
   </hbox>
</vbox>
</window>'


#run gtkdialog, using the GUI string above

gtkdialog --program MY_GUI_STRING


#gui is now closed

exit 0



_________________


Back to top
View user's profile Send_private_message 
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Sun 02 Mar 2014, 11:19    Post_subject:  

Yes, but that hard-codes the applications in... with no easy way to change them. I want 'dynamic' loading of the applications -- the same way that the PuppyMenu works -- something (be it the *.menu files or a set of custom shell scripts) polls the *.desktop files and updates the icons in the launcher.

Would be really nifty to have proper icons that can be double-clicked, but that will wait till later... Wink

_________________

Back to top
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Sun 02 Mar 2014, 14:48    Post_subject:  

Maybe these two examples will give any clue?

Remove the '.gz' extension and make executable.
apps-in-Xdialog.gz
Description  Remove the '.gz' extension
gz

 Download 
Filename  apps-in-Xdialog.gz 
Filesize  1.87 KB 
Downloaded  92 Time(s) 
apps-in-gtkdialog.gz
Description  Remove the '.gz' extension
gz

 Download 
Filename  apps-in-gtkdialog.gz 
Filesize  4.15 KB 
Downloaded  104 Time(s) 

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send_private_message 
Bert


Joined: 30 Jun 2006
Posts: 975

PostPosted: Sun 02 Mar 2014, 15:26    Post_subject:  

Brilliant, RHS!
(as usual..)

Wouldn't the gtk menu widget be a better option for starhawk's goal than the notebook widget?
Just thinking out loud Wink

_________________


Back to top
View user's profile Send_private_message 
starhawk

Joined: 22 Nov 2010
Posts: 3142
Location: Everybody knows this is nowhere...

PostPosted: Sun 02 Mar 2014, 16:25    Post_subject:  

...except that I *want* the notebook widget. It has a tabbed interface which is what I'm looking for.

RSH, I'll look at your stuff later today... I'm looking forward to checking it out Wink

_________________

Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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
[ Time: 0.0935s ][ Queries: 12 (0.0041s) ][ GZIP on ]