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 21 Oct 2014, 15:58
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Question about Shell Script (#!/bin/sh)
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 4 of 5 Posts_count   Goto page: Previous 1, 2, 3, 4, 5 Next
Author Message
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Mon 16 Jan 2012, 05:23    Post_subject:  

A little tricky, but I found a way to get it working. I don't think it has a scroll bar, which makes it kind of useless for long lists. Maybe an idea for our own gtkdialog development, though, since I'm sure it would get used a lot.
gnewpet-greq.png
 Description   
 Filesize   58.39 KB
 Viewed   787 Time(s)

gnewpet-greq.png

Back to top
View user's profile Send_private_message 
Moose On The Loose


Joined: 24 Feb 2011
Posts: 528

PostPosted: Mon 16 Jan 2012, 11:26    Post_subject:  

jpeps wrote:
A little tricky, but I found a way to get it working. I don't think it has a scroll bar, which makes it kind of useless for long lists. Maybe an idea for our own gtkdialog development, though, since I'm sure it would get used a lot.


I just thought of a way to do long lists. Here is the basic idea:

Place a button above and below the space where a subset of the full list is shown.

When someone clicks on the up button, the dialog closes, and a new one opens with the list scrolled down by 1/2 the length of the sub-list you are showing. Te script needs to keep track of the state ON/OFF of the items in the full list and give the subset back with the right combination of check marks.

I have made a thing that works like a combo-box but allows the user entry to be filtered on a keystroke basis. This used the fact that there is an event for the loss of focus. If the scrolled list is done in its own box, this trick could be used to make the list a stand alone thing.
Back to top
View user's profile Send_private_message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: Mon 16 Jan 2012, 16:35    Post_subject:  

Could this be used-

Code:
<tree selection-mode="3"


It gives you multiple selection capability with a scroll bar.

Cheers,
s
Back to top
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Mon 16 Jan 2012, 17:22    Post_subject:  

Quote:
Could this be used-

Code:
<tree selection-mode="3"


This works fine. It ( selection-mode="3") gives you the possibility to select several files.

But how to distinguish (sort out) the selected and unselected items?
tree-works.jpg
 Description   
 Filesize   31.81 KB
 Viewed   714 Time(s)

tree-works.jpg


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

Joined: 11 Apr 2007
Posts: 887

PostPosted: Mon 16 Jan 2012, 19:25    Post_subject:  

RSH,

Quote:
But how to distinguish (sort out) the selected and unselected items?


All the selected items are returned separated in this variable-
Code:
<variable>TREECHOICES</variable>


Cheers,
s
Back to top
View user's profile Send_private_message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Tue 17 Jan 2012, 03:44    Post_subject:  

Not as pretty as checklists, but works nicely. <ctrl> clicking returns multiple items.
Back to top
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Tue 17 Jan 2012, 05:13    Post_subject:  

jpeps wrote:
Not as pretty as checklists, but works nicely.

Yes, checklists would be my favorite as well, but "tree" is also usable. I'd just never heard about the attribute "selection-mode". Everything i'd tried gives me only single-file-selection. But this one works and i can use it for my work.

To put the whole selection into a text file use
Code:
echo $TREE1 > /tmp/list


To write the whole selection as single lines into a text file use
Code:
for i in $TREE1;
   do
      echo $i >> /tmp/list
   done

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

Joined: 31 May 2008
Posts: 3220

PostPosted: Tue 17 Jan 2012, 06:02    Post_subject:  

Here's a version using tree. In batch mode, the "batch copy" button opens the tree list. Select with <ctrl> click, and then push the "select pets" button.
This opens an editable box for final selection. Push the "Make Pets" button for creation in /tmp

edit: added a "select all" button in tree list
gnewpet-4.1.pet
Description 
pet

 Download 
Filename  gnewpet-4.1.pet 
Filesize  2.47 KB 
Downloaded  291 Time(s) 
gnewpet-tree.png
 Description   
 Filesize   66.6 KB
 Viewed   712 Time(s)

gnewpet-tree.png

Back to top
View user's profile Send_private_message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Tue 17 Jan 2012, 13:08    Post_subject:  

added a "select-all" button for batch
Back to top
View user's profile Send_private_message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: Tue 17 Jan 2012, 14:46    Post_subject:  

jpeps,

Nicely done.

I've found it easier to build gtkdialog menu items this way-
Code:

for i in *.files;do
i=${i//.files/}
LIST="$LIST<item>"$i"</item>"
done
echo $LIST # becomes input variable item list for combobox


It grabs only the ".files", cuts off the ".files" extension, and makes up the list variable all in one shot.

Regards,
s
Back to top
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Tue 17 Jan 2012, 15:40    Post_subject:  

seaside wrote:
jpeps,

Nicely done.

I've found it easier to build gtkdialog menu items this way-
Code:

for i in *.files;do
i=${i//.files/}
LIST="$LIST<item>"$i"</item>"
done
echo $LIST # becomes input variable item list for combobox


It grabs only the ".files", cuts off the ".files" extension, and makes up the list variable all in one shot.



I do use this one, which works also fine. It uses original funcItemCreate.

Code:
  <tree selection-mode="3" stock="gtk-file">
    <label>"'$WFNALST'"</label>
    <height>200</height><width>300</width>
   '"$(funcItemCreate)"'
    <variable>TREEOUTPUT</variable>
  </tree>


To write complete selection as single lines into a text file use
Code:

for i in $TREEOUTPUT;
   do
      echo $i >> /tmp/list
   done

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

Joined: 31 May 2008
Posts: 3220

PostPosted: Wed 18 Jan 2012, 03:38    Post_subject:  

Figured a way to do the scrollable checklist with a createcheckbox function within a scrollable vbox
gnewpet-checkbox.png
 Description   
 Filesize   65.1 KB
 Viewed   688 Time(s)

gnewpet-checkbox.png

Back to top
View user's profile Send_private_message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Wed 18 Jan 2012, 13:56    Post_subject:  

I select "Batch Mode" then clicking on "Batch Copy" - nothing happens.

Output after running gnewpet:
Code:
** (gtkdialog:31852): WARNING **: create_tree(): A TreeView with no label.
**
ERROR:automaton.c:1833:connect_tree_signals: assertion failed: (tree_view != NULL && Attr != NULL)
Aborted
sh-4.1#


jpeps wrote:
Figured a way to do the scrollable checklist with a createcheckbox function within a scrollable vbox


Yes, this is exactly, what i'd meant and it looks good. Does it work or is it just step 1?

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


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Thu 19 Jan 2012, 01:31    Post_subject:  

Inserting "<label>Batch Pets</label>" after <tree selection-mode="3"> inside your gnewpet script executes the batch window - but it is empty. Confused

Clicking on "Select Pets" opens another empty window. Shocked

Clicking on "Select All" opens a window with all files listed. Smile

Clicking OK inside full list window executes nothing. Shocked Confused

Batch list in /tmp/batch is existing Exclamation

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

Joined: 31 May 2008
Posts: 3220

PostPosted: Thu 19 Jan 2012, 04:49    Post_subject:  

Here's a version using gtkdialog checkboxes:

version 5.1 Put checklist in it's own scrollable vbox. Thanks RSH
version 5.2 1/23/12 Restored file report function
gnewpet.png
 Description   
 Filesize   78.54 KB
 Viewed   765 Time(s)

gnewpet.png

gnewpet-5.2.pet
Description 
pet

 Download 
Filename  gnewpet-5.2.pet 
Filesize  2.74 KB 
Downloaded  317 Time(s) 

Edited_times_total
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 4 of 5 Posts_count   Goto page: Previous 1, 2, 3, 4, 5 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.0915s ][ Queries: 12 (0.0119s) ][ GZIP on ]