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 Fri 28 Nov 2014, 11:52
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 59 of 64 [956 Posts]   Goto page: Previous 1, 2, 3, ..., 57, 58, 59, 60, 61, 62, 63, 64 Next
Author Message
don570


Joined: 10 Mar 2010
Posts: 3385
Location: Ontario

PostPosted: Thu 31 Oct 2013, 19:18    Post subject:  

Tree widget is a
more powerful version of list widget.

I put a couple of examples of the tree widget in my

gtkdialog tutorial manual under 'refresh'

_____________________________________

Last edited by don570 on Sat 02 Nov 2013, 15:45; edited 1 time in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Fri 01 Nov 2013, 00:56    Post subject:  

Hi don570; Thanks for the reply, and thanks for the docs.

I used to work with GtkDialog`s tree, it was a little difficult to control, but it was a "tree".
All the examples I see now are lists. Doesn`t it do a real tree any more?

Hello again SFR; I think you may be right, but as I said above GtkDialog used to have one.
That was probably back in GTK+ 2.


Trying to get GTK widgets to behave is always a struggle. Only the basic level of control.
Like the List, simple 1 click selection is about all there is, as is the case for most widgets.

# I`m using the List as a Tree by indenting the text 2 spaces for each sub dir. level.
It seems the $FOLDER string lags the input. And Buttons 2 and 3 don`t select of course.
Code:
#! /bin/bash

Path='/'
offX=2
offSet=0

ItemList() {
   eq20="===================="                  # 20 "=" characters
   Indent=`echo "${eq20:0:$((offX*offSet))}" |sed 's/=/ /g'`   # convert = to space

   FolderList=`find /$1 -maxdepth 1 -type d |sed "1d;s#^.*$1/##" |sort`

   items=$(echo "$FolderList" |while read I
   do
      echo "<item>\"$Indent $I\"</item>"                  # make gtkD items
   done)
   echo "$items"
}

ClkList() {

echo -e " |$1|    |$2|"

   LN=`echo "$Items" |grep -n "$1"`
   tmp=`echo "$Items" |head -n ${LN%:*}`            # first part of list
   tmp=$tmp`echo -e "\n`ItemList $1`\n"`            # new sub list
   tmp=$tmp`echo "$Items" |tail -n +$((${LN%:*}))`      # last part of list
echo "$tmp"
exit
   Items=$(echo "$FileList" |while read I
   do
      echo "$Indent<item>$I</item>"

      if [ "$I" = "$1" ];then
         subItems=`ls $1`
         echo "$FileList" |while read I
         do
            echo "$Indent<item>$I</item>"
         done
      fi
   done)
}

export btnFLAG
   
Items=`ItemList`

export Items
export -f ItemList ClkList ClkBtn

export FILER_DIALOG='
  <vbox>
    <list>
      <variable>FOLDER</variable>
      '$Items'
      <action signal="button-press-event">ClkList "$BUTTON" "$FOLDER"</action>
    </list>
    <hbox>
     <button ok></button>
     <button cancel></button>
    </hbox>
  </vbox>
'
gtkdialog --program=FILER_DIALOG
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Wed 06 Nov 2013, 03:03    Post subject: GtkDialog doesn`t have "action refresh"?  

I tried it with the combobox and the list, the only widget the docs. show it with is the progressbar.

I want the combobox selection to clear/refresh the list box. Or another combobox.
Code:
export MIRRORS_DLG='
<window title=" Ubuntu Mirrors.">
<vbox>
  <text><label>Set World Region       </label></text>
  <combobox>
    <variable>REGION</variable>
   <item>North America</item>
   <item>Europe</item>
   <item>Asia</item>
   <item>Africa</item>
   <item>Australia</item>
   <item>New Zealand</item>
    <action type="refresh">MIRROR</action>
  </combobox>
  <list>
    <variable>MIRROR</variable>
    <input>'$Path'/mirrors.ubu REGION</input>
  </list>
  <hbox>
   <button ok></button>
   <button cancel></button>
  </hbox>
 </vbox>
</window>
'
gtkdialog --program=MIRRORS_DLG
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3385
Location: Ontario

PostPosted: Thu 07 Nov 2013, 13:21    Post subject:  

to sunburnt.....

Your script of nov1 has terminal errors reported..

function ClkBtn not found and head -n is not acceptable option.

___________________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3385
Location: Ontario

PostPosted: Thu 07 Nov 2013, 13:26    Post subject:  

To sunburnt ...

your script from yesterday

combobox can't emit a signal. whereas comboboxtext,
comboboxentry,and buttons can emit a signal, so use one of them.

Here's an example of a comboboxtext widget emitting a signal to a tree
widget.

Code:

#!/bin/sh
# Refresh tree example -   comboboxtext  gives signal


function print_selection() {   # show the TREE VALUE
xmessage  "This is selection of TREE  =  $TREE

Note that value is passed
to functions for further processing."
}
export -f print_selection


export FOLDER=/root/.config  #  must use export to show properly at launch -  not sure if needed??


# comboboxtext emits the refresh signal
export REFRESH_EXAMPLE='
<window title="application">

<hbox>
    <frame Choose a dotdir in /root>         
             <comboboxtext tooltip-text="List contents of your dotdirs">
             <variable>FOLDER</variable>
             <item>/root/.config</item>
             <item>/root/.cache</item>
             <item>/root/.jwm</item>
             <item>/root/.icons</item>
             <action>refresh:TREE</action>
             </comboboxtext>           
    </frame>

<hbox>   
<vbox width-request="300">
    <text use-markup="true"><label>"<b>Contents of dotdir</b>"</label></text>
       
             <tree>
             <height>300</height>
             <label>""</label>
             <variable>TREE</variable>
             <input>ls "$FOLDER"</input>
             </tree>         
    <hbox>
             <button>
             <label>function</label>
             <action>print_selection</action>     
             </button>   
             <button cancel>         
             </button>
    </hbox>
</vbox>   
</hbox>   
</hbox>
</window>'

gtkdialog -c  --program REFRESH_EXAMPLE
echo "Program has finished"





________


Here's another example I've just written but it's a comboboxtext widget
refreshing another comboboxtext widget. The interesting thing
is the function that is used. Notice that an action directive
of the first comboboxtext executes the function.


__________
comboboxtext_refresh.sh.gz
Description  remove fake extension
gz

 Download 
Filename  comboboxtext_refresh.sh.gz 
Filesize  1.23 KB 
Downloaded  204 Time(s) 
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Thu 07 Nov 2013, 14:39    Post subject:  

Thank you don570; Show me the code as Linus Torvalds says. Very good.!
I`ve never seen the comboboxtext widget before, just the bare combo that`s enabled I think.
I see the "refresh" action line is the older style that I`m use to using, but no "clear" line.

# In your example, the tree is a grid with one column. I need a dir. tree for the left panel.
Xdialog`s tree really is a tree with node branches, but it`s a dialog so it`s not usable.
### Is there a "treebox" or some other widget, or a tree style modifier, or tree actions.?

### Is it possible to get the index of a combo, list, or table? Better than text some times.

I`ve got nearly everything reading and writing files just to get it to work.
# Figured out the returned GtkDialog variables: eval `/path/gtkApp`
Thanks again... Terry B.
mirrorGUItable.png
 Description   New GUI with Table. Much nicer.
 Filesize   19.01 KB
 Viewed   391 Time(s)

mirrorGUItable.png

mirrorGUI.png
 Description   As you can see, I need a grid to line up the bps speeds... Maybe a GridListBox.?
 Filesize   9.93 KB
 Viewed   451 Time(s)

mirrorGUI.png

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


Joined: 10 Mar 2010
Posts: 3385
Location: Ontario

PostPosted: Tue 12 Nov 2013, 18:22    Post subject:  

To get gtkdialog to work with the official Ubuntu distro
you should go to launchpad.net and search for 'gtkdialog'

For instance here is a package I got for Precise....

https://launchpad.net/~dnjl/+archive/build/+build/4306078

___________________________________________________
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Tue 12 Nov 2013, 18:28    Post subject:  

Thanks again Don; Dnld the GtkDialog, will see what it`s got to offer.

### Is there a "treebox" or some other widget, or a tree style modifier, or tree actions.?

There are now 2 combo widgets, are there other trees or how to control sub nodes?


### Is it possible to get the index of a combo, list, or table? Better than text some times.
.
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Wed 13 Nov 2013, 09:25    Post subject: Anyone want to test gmould ?  

Anyone want to test buggy gmould ? Smile
Its not finish or anywhere near complete but...as is basis,
just to check out whats available SmileSmileSmile

http://murga-linux.com/puppy/viewtopic.php?p=736697 - Thread
http://gmould.blogspot.com/ - Blog
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Wed 13 Nov 2013, 11:13    Post subject:  

I already don`t like GtkDialog, but it`s what Puppy`s got, so...
Too bad it wasn`t made on top of GTK+ instead. Why go through GtkDialog?
But there`s Glade, so talk about reinventing your wheels. Could improve on it.
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Wed 13 Nov 2013, 14:14    Post subject:  

Yep, its reinventing the wheel if compared to glade.
But why not, gtkdialog can call glade file, true, but look in the last 10 pages. We can count how many thats glade generated, pretty low
or is it people who use glade did not have issues with gtkdialog ? Surprised

I wonder why the whole Gnome community miss gtkdialog. It can be much more if people give it a thought and help extend it. Declarative programming is the future and people still stuck with C and C++.

Anyway since its backend is mostly bash/sh powered, we cant achieve much I guess. But the real problem is the widget, its quite primitive.

Yeah, I too looking for a real tree. gtkdialog treeview is NOT a tree, so frustrating.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Wed 13 Nov 2013, 21:16    Post subject:  

It use to have one, but I don`t know how to make it work anymore.
As technosaurus blogged, GTK sucks. My take... It sucks badly.
XML syntax is another suck arse item. It`s a crappy way to describe anything.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6458
Location: Auckland, New Zealand

PostPosted: Thu 14 Nov 2013, 04:38    Post subject:  

Quote:
It use to have one

Are you sure you're not mixing gtkdialog up with something else? I don't think I've ever seen one.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1101

PostPosted: Thu 14 Nov 2013, 05:26    Post subject:  

disciple wrote:
Quote:
It use to have one

Are you sure you're not mixing gtkdialog up with something else? I don't think I've ever seen one.

Maybe it was Xdialog..?
Code:
Xdialog --treeview "A tree" 0 0 5 tag1 item1 on 0 tag2 item2 on 1 tag3 item3 on 2

Greetings!
Screenshot.png
 Description   
 Filesize   11.28 KB
 Viewed   285 Time(s)

Screenshot.png


_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
CatDude


Joined: 03 Jan 2007
Posts: 1497
Location: UK

PostPosted: Thu 14 Nov 2013, 05:46    Post subject:  

Hi

Widget Reference
Examples

If it's not what you are talking about, then please ignore.

CatDude
.

_________________

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 59 of 64 [956 Posts]   Goto page: Previous 1, 2, 3, ..., 57, 58, 59, 60, 61, 62, 63, 64 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.1306s ][ Queries: 12 (0.0254s) ][ GZIP on ]