Question about Shell Script (#!/bin/sh)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#41 Post by jpeps »

RSH wrote: It seems to be impossible to realize my exact suggestion of a GUI List using checkboxes to just click on item to enable or disable it - using gtkdialog.
Maybe we can spark some interest?

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#42 Post by amigo »

The greq (that'a a 'queue') GUI tool lets you put a check box under any of its' limited number of widgets.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#43 Post by jpeps »

amigo wrote:The greq (that'a a 'queue') GUI tool lets you put a check box under any of its' limited number of widgets.
Great! Maybe a link? I couldn't find anything. Thanks

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#44 Post by Keef »

Google got me here....
http://greq.berlios.de/

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#45 Post by seaside »


jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#46 Post by jpeps »

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.
Attachments
gnewpet-greq.png
(58.39 KiB) Downloaded 848 times

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

#47 Post by Moose On The Loose »

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.

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#48 Post by seaside »

Could this be used-

Code: Select all

<tree selection-mode="3"
It gives you multiple selection capability with a scroll bar.

Cheers,
s

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#49 Post by RSH »

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?
Attachments
tree-works.jpg
(31.81 KiB) Downloaded 794 times
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#50 Post by seaside »

RSH,
But how to distinguish (sort out) the selected and unselected items?
All the selected items are returned separated in this variable-

Code: Select all

<variable>TREECHOICES</variable>
Cheers,
s

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#51 Post by jpeps »

Not as pretty as checklists, but works nicely. <ctrl> clicking returns multiple items.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#52 Post by RSH »

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: Select all

echo $TREE1 > /tmp/list
To write the whole selection as single lines into a text file use

Code: Select all

for i in $TREE1;
	do
		echo $i >> /tmp/list
	done
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#53 Post by jpeps »

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
Attachments
gnewpet-4.1.pet
(2.47 KiB) Downloaded 510 times
gnewpet-tree.png
(66.6 KiB) Downloaded 778 times

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#54 Post by jpeps »

added a "select-all" button for batch

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#55 Post by seaside »

jpeps,

Nicely done.

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

Code: Select all

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

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#56 Post by RSH »

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: Select all

  <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: Select all

for i in $TREEOUTPUT;
   do
      echo $i >> /tmp/list
   done
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#57 Post by jpeps »

Figured a way to do the scrollable checklist with a createcheckbox function within a scrollable vbox
Attachments
gnewpet-checkbox.png
(65.1 KiB) Downloaded 771 times

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#58 Post by RSH »

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

Output after running gnewpet:

Code: Select all

** (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?
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#59 Post by RSH »

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

Clicking on "Select Pets" opens another empty window. :shock:

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

Clicking OK inside full list window executes nothing. :shock: :?

Batch list in /tmp/batch is existing :!:
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#60 Post by jpeps »

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
Attachments
gnewpet-5.2.pet
(2.74 KiB) Downloaded 600 times
gnewpet.png
(78.54 KiB) Downloaded 886 times
Last edited by jpeps on Mon 23 Jan 2012, 09:15, edited 3 times in total.

Post Reply