Persistently Strange Behavior.... (Open location after running Pfind) [SOLVED]

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
User avatar
Subito Piano
Posts: 75
Joined: Fri Sep 04, 2020 6:08 pm
Location: UPSTATE New York
Has thanked: 17 times
Been thanked: 11 times
Contact:

Persistently Strange Behavior.... (Open location after running Pfind) [SOLVED]

Post by Subito Piano »

This I've noticed consistently through many, many iterations of Puppy. I search for a file using Pfind ((MENU>FILESYSTEM>PFIND FILE FINDER), see the file I want, right-click on it, choose "SHOW LOCATION," and receive the error message, "This operation requires single selection. Please select ONE file." I close the error message popup, right-click the file again, again choosing "SHOW LOCATION," and rox-filer opens the location without issue.

This has been going on literally for years, every time i search for a file -- eh, it's one of those things I live with, but it kinda nags at me: what's the issue here??? (IDK if Pfind behaves this way in Slacko.)

Has anyone else expereinced this issue?

Last edited by Subito Piano on Wed Jul 12, 2023 8:42 pm, edited 1 time in total.

"God is love" - I John 4:16
Member since 2007. Currently running Fossa on a 2012 MacBook Air.
Still using Xenial 32 on my trusty 2007 IBM T60 warhorse. ♥
(A/V Linux for live softsynth needs)

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by MochiMoppel »

Subito Piano wrote: Tue Jul 11, 2023 1:23 am

Has anyone else expereinced this issue?

Yes. :mrgreen:

You get this error message because nothing is selected at this point. So the message should read "Please select a file". When the message closes you will observe that the right-clicked file is now selected, thus a new attempt to execute a right-click command will succeed. [Edit] ...will succeed only if you right-click the same file. If you right-click other files you will avoid the error message but the command will always act on the previously selected file, not the file you curently right-clicked :twisted:
This bug affects all commands, not just "Show location". It gets worse when you select on one of commands in the upper menu section, e.g. "Move" or "Open as text". Pfind will assume that all files are selected ... with potentially nasty consequenses.

You can avoid all this by first left-clicking on the file(s) to select them, then use the right-click commands.

Last edited by MochiMoppel on Tue Jul 11, 2023 4:46 am, edited 1 time in total.
User avatar
rockedge
Site Admin
Posts: 6553
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2757 times
Been thanked: 2629 times
Contact:

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by rockedge »

@Subito Piano Yes I see this behavior. It is I believe caused by the fact nothing is really selected directly after the search is finished and shows the results.

So the search finishes, and the files found are displayed and one takes the mouse cursor and goes to a file and right-clicks the mouse and the menu appears. Here one clicks "Show Target" and the error message appears!! This happens because the file is not really selected yet. To prevent the error message go to a file in the search results, then left-click to first select that file and now right-click and "Show Target" works as expected.

In summary, no file is actually selected from the output list so any action from the right-click menu will send that warning to select One file at least.

Screenshot(3).jpg
Screenshot(3).jpg (36.57 KiB) Viewed 814 times

That is why after the error the second round and beyond will work with the right-click menu. :ugeek:

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by MochiMoppel »

rockedge wrote: Tue Jul 11, 2023 2:44 am

after the error the second round and beyond will work with the right-click menu. :ugeek:

Unfortunately not :(

User avatar
bigpup
Moderator
Posts: 6999
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 913 times
Been thanked: 1528 times

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by bigpup »

I too have seen this error pop up for years using Pfind.

Left click to highlight a listed item.

Then right click on it to get choices.

Seems to work best.

I have noticed if you delay a few seconds, before choosing from the right click menu.
Seems to work more trouble free.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
bigpup
Moderator
Posts: 6999
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 913 times
Been thanked: 1528 times

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by bigpup »

This is the code in /usr/local/pfind (line 698)

Code: Select all

-show_location)
	if [ `echo "$TREE" | wc -l` != 1 ] || [ ! "$TREE" ]; then #not single selection
		TXT1="<b>$(gettext 'This operation requires single selection. Please select ONE file.')</b>"
		. $PROGPATH/box_ok
		exit 0

Anyone see anything wrong with the code??

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
Subito Piano
Posts: 75
Joined: Fri Sep 04, 2020 6:08 pm
Location: UPSTATE New York
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by Subito Piano »

OK -- never thought of that, I'm used to being able to simply right click to execute options on a particular file (e.g., in rox-filer, right clicking automatically selects the file, then one picks to "open as text" or "copy" or whatever. Thanks, all --

@bigpup Agreed..."the things nobody tells us..." It took ten years before I found out why my word processor would suddenly overwrite the existing text instead of inserting it! :lol: (solution: toggling the "insert" key)

"God is love" - I John 4:16
Member since 2007. Currently running Fossa on a 2012 MacBook Air.
Still using Xenial 32 on my trusty 2007 IBM T60 warhorse. ♥
(A/V Linux for live softsynth needs)

Burunduk
Posts: 256
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 7 times
Been thanked: 127 times

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by Burunduk »

I have Pfind 6.3 on Fossapup64-9.5. There is a clear intention to do something in this situation in /usr/local/pfind/func line 115:

Code: Select all

-rightclick_menu)
	#external menu
	if [ $BUTTON = 3 ]; then
		echo -n > /tmp/pfind-tmp$PROGPID
		if [ `echo "$TREE" | wc -l` != 1 ] || [ ! "$TREE" ]; then SENSITIVE='<sensitive>false</sensitive>'; fi #not single selection

As you can see, the variable SENSITIVE is set when no or many items are selected. It should make the right-click menu inactive but the variable is never used. Maybe using it could have some unwanted side effects, I don't know. On Fossa, inserting the sensitive directive seems to work correctly - menu is only usable if exactly one item is selected. Insert '$SENSITIVE' right before </window> (line 136):

Code: Select all

		 <action signal="focus-out-event">EXIT:exit</action>
		 '$SENSITIVE'
		</window>'

I think it would be better to show no menu at all because it cannot be used anyway. With the following modification, a right-click shows the context menu if one item is selected and selects an item (as a left-click does) otherwise - just replace SENSITIVE='<sensitive>false</sensitive>' with exit on line 115:

Code: Select all

-rightclick_menu)
	#external menu
	if [ $BUTTON = 3 ]; then
		echo -n > /tmp/pfind-tmp$PROGPID
		if [ `echo "$TREE" | wc -l` != 1 ] || [ ! "$TREE" ]; then exit; fi #not single selection

Alternatively, this only hides the right-click menu when no item is selected. For multiple selection the menu works:

Code: Select all

-rightclick_menu)
	#external menu
	if [ $BUTTON = 3 ]; then
		echo -n > /tmp/pfind-tmp$PROGPID
		if [ ! "$TREE" ]; then exit; fi #no selection

But it's still confusing though: the right-click menu operates on the previously selected row and not on the one under the mouse pointer.

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by MochiMoppel »

bigpup wrote: Tue Jul 11, 2023 12:17 pm

Code: Select all

-show_location)
	if [ `echo "$TREE" | wc -l` != 1 ] || [ ! "$TREE" ]; then #not single selection
		TXT1="<b>$(gettext 'This operation requires single selection. Please select ONE file.')</b>"
		. $PROGPATH/box_ok
		exit 0

Anyone see anything wrong with the code??

Nothing wrong with this code. Works perfectly.

Burunduk wrote: Tue Jul 11, 2023 7:07 pm

But it's still confusing though: the right-click menu operates on the previously selected row and not on the one under the mouse pointer.

This is what I meant when I used the "b" word. This is the real bug here, the rest are mere annoyances.
It should be fixed and I'm sure it can be fixed, but this has to happen in the pfind main script. The "button-press-event" code in the <tree> widget looks wrong.

In line 282 of /usr/local/pfind/pfind change
<action signal="button-press-event">. '$PROGPATH'/func -rightclick_menu</action>
to
<action signal="button-release-event">. '$PROGPATH'/func -rightclick_menu</action>

Burunduk
Posts: 256
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 7 times
Been thanked: 127 times

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by Burunduk »

MochiMoppel wrote: Wed Jul 12, 2023 3:57 am

In line 282 of /usr/local/pfind/pfind change
<action signal="button-press-event">. '$PROGPATH'/func -rightclick_menu</action>
to
<action signal="button-release-event">. '$PROGPATH'/func -rightclick_menu</action>

Congratulations, you've fixed this! A small tip: to preserve the multiple selection keep holding ctrl or shift key until the right-click.
Now I can forget about Pfind again, never used it - it's too complicated for me.

User avatar
Subito Piano
Posts: 75
Joined: Fri Sep 04, 2020 6:08 pm
Location: UPSTATE New York
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: Persistently Strange Behavior.... (Open location after running Pfind)

Post by Subito Piano »

@MochiMoppel Wow! That is so cool! Kudos, you've got mad skills. :thumbup2:

"God is love" - I John 4:16
Member since 2007. Currently running Fossa on a 2012 MacBook Air.
Still using Xenial 32 on my trusty 2007 IBM T60 warhorse. ♥
(A/V Linux for live softsynth needs)

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Persistently Strange Behavior.... (Open location after running Pfind) [SOLVED]

Post by MochiMoppel »

@Subito Piano I guess "mad" nails it. Poking around in funny code of an application that I don't even use :lol:

Doing so I found another configuration mistake. When clicking on "Show location" Pfind was originally designed to open a ROX-Filer window and jump to the selected file. It doesn't do this anymore. Instead it will only open the directory where the file resides and then you will have to find the file by eyeballing through a potentially long list of files.

Here is how you can get the original behavior back:
In the upper menu of Pfind go to File => Configure => "Settings" tab => Default File manager. Here change defaultfilemanager to rox., then press "OK". That's it.

Some technical background:
Originally Pfind was created with "rox" as the only file manager, allowing the rox -s command to jump to a file. 12 years ago, when users demanded support for other file managers, zigbert added this code to the -show_location function:

Code: Select all

if [ $FILEMANAGER = rox ]; then
	exec rox -s "$TREE" 2> /tmp/pfind-error$PROGPID
else
	exec $FILEMANAGER "${TREE%/*}/" 2> /tmp/pfind-error$PROGPID
fi

The FILEMANAGER variable is set in the file /usr/local/pfind/pfindrc, and originally it was set to "rox". So far, so good.
However some time after that it was changed to "defaultfilemanager", which may sound like a good idea, but someone understanding above code will realize that now rox -s will never be executed, even if defaultfilemanager is scripted to execute rox. I noticed this setting in @radky 's BM64 and @rockedge 's FP96.
IMO should be changed back, probably in woof-CE.

Burunduk
Posts: 256
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 7 times
Been thanked: 127 times

Re: Persistently Strange Behavior.... (Open location after running Pfind) [SOLVED]

Post by Burunduk »

MochiMoppel wrote: Fri Jul 14, 2023 8:01 am

Poking around in funny code of an application that I don't even use :lol:

As I've said before, neither do I. But what about the rox-filer itself? It's my favorite file manager and it worked well until this forum thread. Now I've opened it, selected a file, right-clicked another one, and - déjà vu! - got the context menu for the first. You understand the gtk mechanics far better than me. Do you have any thoughts how to solve this problem too?
Or is it a problem at all if it remained unnoticed for such a long time? Nonetheless, it would be nice to make it work as Xfe does - change a single selection but preserve the multiple one on a displaced right-click.

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Persistently Strange Behavior.... (Open location after running Pfind) [SOLVED]

Post by MochiMoppel »

Burunduk wrote: Fri Jul 14, 2023 9:34 am

But what about the rox-filer itself? It's my favorite file manager and it worked well until this forum thread. Now I've opened it, selected a file, right-clicked another one, and - déjà vu! - got the context menu for the first. You understand the gtk mechanics far better than me. Do you have any thoughts how to solve this problem too?
Or is it a problem at all if it remained unnoticed for such a long time?

Sorry for the very late reply. I didn't quite understand what you mean, and as the problem was declared "solved" and everybody seemed to be happy, I didn't check further.

But now I have second thoughts. Yes, that's how ROX-Filer works, and no, I don't think it's a problem. I rather think that the behavior of pFind before the "bugfix" was better. The rule is: Make selection first, then right click for the context menu. Always 2 steps. Do not try to make a selection with right click.

With the new "bugfix" it becomes difficult to right click a selection of multiple files.
I've now ran into the same problem with one of my own applications and I therefore implemented the behavior of ROX. I agree that the solution of Xfe is much more intuitive. Unfortunately it's impossible to achieve with gtkdialog.

User avatar
Subito Piano
Posts: 75
Joined: Fri Sep 04, 2020 6:08 pm
Location: UPSTATE New York
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: Persistently Strange Behavior.... (Open location after running Pfind) [SOLVED]

Post by Subito Piano »

Sounds like users now have a choice which way they would like Pfind to work. Freedom and (relative) ease to modify...isn't that one of the main reasons ppl. choose Linux, and particularly Puppy? :)

"God is love" - I John 4:16
Member since 2007. Currently running Fossa on a 2012 MacBook Air.
Still using Xenial 32 on my trusty 2007 IBM T60 warhorse. ♥
(A/V Linux for live softsynth needs)

Post Reply

Return to “Users”