Skip to content

Feature Request? Multi-column list to have values clickable/selectable as single cell of an array #330

@ericmarceau-rogers

Description

@ericmarceau-rogers

The YAD code-segment used for context is presented later in the full script below.

Code Segment:

	choice=$(yad --list --title "ACTION - Choose Architecture" \
	--text "Double-Click on your selection:\n" \
	--no-headers \
	--column-align=c \
	--column="Options1":100 \
	--column="Options2":100 \
	--column="Options3":100 \
	--column="Options4":100 \
	${hostArch} ${archOptions} \
	--width=500 --height=250  | sed 's+[|]$++' )
Image

ISSUE #1

Originally, I only had one column. Key-press on "Return" or double-click on "row" reported correctly a single-value, which was usable.

My question to a group in the UbuntuMATE Community came back with a suggestion of using multiple instances of "--column".

Unfortunately, using that approach, as shown above, resullts in all values displayed on a single, multi-column row, being returned as a response.

The reported string, "amd64|alpha|arm|arm64", is not the single "amd64" which is what I was looking for.

My expectation was that each individual row-item would have been separately selectable, and that hitting the "OK" button would have returned the first value in the first column, namely "amd64" as the "default" response.

Don't know how feasible/difficult it would be to make that happen, if it isn't already possible to specify that somehow using existing options.

ISSUE #2

I could not identify an option to specify that the columns would be evenly spread out, similar to the "--buttons-layout=spread"option used for individual buttons. This would seem to be an intuitively logical option to have, but I can't identify it if it is there.

ISSUE #3

I could not identify an option to specify that the title string "must be fully displayed", rather than result in the partly-visible title shown in the above snapshot. Is there any possibility of eventually having such an option which, conceivably, would force an adjustment to the effective "--width" value, it it needs to be increased to make that fully visible?

ISSUE #4

Once again, what I perceive as natural and intuitive expectation is to have the option to present a set of data in an "array of buttons", possibly specified in the following manner:

  • --column-array = 4x100 : 5x20 [: 3x4]

where

  • 4x100 represents 4 columns, 100 pixels wide
    and
  • 5x10 represents 5 rows, 20 pixels high
    and
  • [:3x4] represents the optional specification of a non-button spacing between the columns and rows, 3 pixels between columns, 4 pixels between rows

and the values in the subsequent list would be "slotted" on each of the resulting buttons in the array. What would be nice would be the additional option to specify "fill rows in one column before filling the next column, and so on (recognizably more complex logic) which, in my mind, would be more intuitive for the users.



Thank you for your due consideration of this proposal.

More importantly ... Stay Safe!


CONTEXT:

Don't know if my issues are because of the version installed with my current Distro installation:

dpkg-query --show extrepo

	extrepo	0.9

lsb_release -a

	Distributor ID:	Ubuntu
	Description:	Ubuntu 22.04.5 LTS
	Release:	22.04
	Codename:	jammy

Full Script:

#!/bin/sh

###
###	Script to report availability of non-Distro repositories
###	for user-selected Architecture (default is that of computer)
###
###	The "extrepo" command offers a method which offers better
###	integration of such repositories for managing and security
###

###
###	
###
	#--wrap-width=10 \
	#--wrap-cols=1,2,3,4 \
selectArch()
{
	choice=$(yad --list --title "ACTION - Choose Architecture" \
	--text "Double-Click on your selection:\n" \
	--no-headers \
	--column-align=c \
	--column="Options1":100 \
	--column="Options2":100 \
	--column="Options3":100 \
	--column="Options4":100 \
	${hostArch} ${archOptions} \
	--width=500 --height=250  | sed 's+[|]$++' )
}

	########################################################################
	########################################################################

hostArch=$( dpkg-architecture -q DEB_BUILD_ARCH )

tmp="/tmp/extrepo.$$.raw.txt"

extrepo search >"${tmp}"

archOptions=$( awk '{
	posA=index( $0, "Architectures:" ) ;
	if( posA > 0 ){
		gsub( /Architectures: /, "", $0 ) ;
		for( i=1 ; i <= NF ; i++ ){
			print $i ;
		} ;
	} ;
}' <"${tmp}" | sort | uniq | awk -v harch="${hostArch}" '{ if( $1 != "all" && $1 != harch ){ printf("%s ", $1 ) ; } ; }' )

selectArch

if [ -z "${choice}" ]
then
	echo "\n Process abandoneed!\n" >&2 ; exit 1
fi

	####################################################################################
	###
	###	Typical report format for repositories
	###
	####################################################################################

	#Found sury_apache2:
	#---
	#description: Ondřej Surý's package repository
	#gpg-key-checksum:
	#  sha256: 59961c0e0d9c9415c2a6b8cf7355bc48254ab53c7e1b8211b683eb459353da81
	#gpg-key-file: sury_apache2.asc
	#policy: main
	#source:
	#  Architectures: amd64 armhf arm64
	#  Components: main
	#  Suites: bookworm
	#  Types: deb deb-src
	#  URIs: https://packages.sury.org/apache2

	####################################################################################

awk -v arch="${choice}" 'BEGIN{
	capture=0 ;
	indx=0 ;
	archCount=0 ;
	split("", datLine ) ;
}{
	posA=index( $0, "Architectures:" ) ;
	if( posA > 0 ){
		#  Architectures: amd64 armhf arm64
		archMatch=0 ;
		rem=substr( $0, posA+15 ) ;
		n=split( rem, vals ) ;
		for( j=1 ; j <= n ; j++ ){
			if( vals[j] == arch ){
				archMatch=1 ;
				break
			} ;
		} ;
	} ;
	if( index( $0, "Found" ) == 1 ){
		if( archMatch == 1 && indx > 1 ){
			archCount++ ;
			for( i=1 ; i <= indx ; i++ ){
				print datLine[i] ;
			} ;
			archMatch=0 ;
			split("", datLine ) ;
		} ;
		capture=1 ;
		indx=1 ;
	} ;
	if( capture == 1 ){
		indx++ ;
		datLine[indx]=$0 ;
	} ;
}END{
	if( archMatch == 1 && indx > 1 ){
		archCount++ ;
		for( i=1 ; i <= indx ; i++ ){
			print datLine[i] ;
		} ;
	} ;
	printf("\nMatches on \"%s\" Architecture: %d\n", arch, archCount ) ;
}' <"${tmp}"


exit


Cross-reference to discussion which triggered the above request:

Note: that posting also includes an updated version of the script using the single-column approach, because was unable to identify how to specify, if possible, the the multi-column approach (using buttons or not).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions