bugGNU Octave - Bugs: bug #44216, Bind <RETURN> to...


bug #44216: Bind <RETURN> to double-click in File Browser

Submitter:  Rik <rik5>
Submitted:  Mon 09 Feb 2015 08:10:53 PM UTC
Category:  GUI Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


( Jump to the original submission )

Tue 10 Feb 2015 07:17:59 PM UTC, comment #8: 

Thanks for the patch, more elegant than implementing an event filter (I wasn't aware of the activated signal). I have pushed the patch with changeset

Torsten Lilge <ttl>
Project Member
Tue 10 Feb 2015 04:32:41 PM UTC, comment #7: 

Dan's patch works for me.  I'm not a GUI expert so I'll let Torsten give the final review and blessing.

Rik <rik5>
Project Administrator
Tue 10 Feb 2015 08:40:57 AM UTC, comment #6: 

Simple fix for the original bug.  Changeset attached.

(file #33044)

Dan Sebald <sebald>
Tue 10 Feb 2015 07:53:34 AM UTC, comment #5: 

Yes, you are correct.  I was thinking about the file dialog in the editor.  OK, I see now.  Yes, nothing happens upon hitting return in the dock file browser on my system.  If I double-click a file, then the file is opened.

However, this double click action seems odd.  I have a file in the directory "freqz.m.old" which when I double click does not open a the file.  Instead, the editor goes to the tab of a previously opened file.  Change the tab, and double-clicking "freqz.m.old" goes back to that tab.  It seems as though the wrong file is being opened, when in fact the intention is probably to only allow opening M files.

Accepting return in addition to double click should be straightforward.  What to do with selecting non M-files?

Regarding the current directory thing.  It seems to me that the current directory is the same as the last opened file in the editor, including the scenario of these files being opened at launch.  I can sort of see the logic to that, but I sort of prefer starting out where Octave was launched from.  Maybe I will just have to get used to it.  I've discovered a bug in which closing all the tabs in the editor, exiting Octave and then relaunching opens all the tabs once again.  But I can't repeat the bug now... wait I think I just was able to repeat.

Dan Sebald <sebald>
Tue 10 Feb 2015 05:57:45 AM UTC, comment #4: 

Dan, I have the impression that we are talking about different things. To my understanding, Rik's post is related to the dock widget with the file browser whereas you are referring to the  file browser of the editor's file dialog, is that correct?

Torsten Lilge <ttl>
Project Member
Mon 09 Feb 2015 10:51:20 PM UTC, comment #3: 

Feel free to fix this one.  I'll try too, as it shouldn't be difficult.  One might have to disable

  fileDialog->setAttribute (Qt::WA_DeleteOnClose);

and have the file_editor issue the close upon properly handling the keyPressEvent.

As long as we're looking at this, we should address the "directory of last open" being remembered across sessions.  So, when I open the directory starts out, in some cases, in an obscure directory from some session months ago.  Should we have the memory last only for the session?  Or maybe a setting for remember file open/close directory across sessions?  (I just looked at the Preferences|Editor tab, lots of new stuff there!)

Hmm, I just tried again and the behavior of hitting return seems correct if I start out in the directory that first comes up, rather than navigate and then attempt to open.  Perhaps the problem is something as simple as the directory+file combo not being correct (i.e., nothing is happening for you because the constructed path/file can't be found).

Dan Sebald <sebald>
Mon 09 Feb 2015 09:32:35 PM UTC, comment #2: 

On my system (ubuntu 14.04), <return> does not work.

There are some key bindings for navigating (https://qt-project.org/doc/qt-4.7/qtreeview.html#id-be174046-6ddf-4521-9695-e824f750d653) but <return> or something else emulating a double-click is missing. Reimplementing keyPressEvent and catching the <return> key should do the job.

Torsten Lilge <ttl>
Project Member
Mon 09 Feb 2015 09:04:45 PM UTC, comment #1: 

On my system, this behavior seems to work properly, but only for directories.  I see a dotted outline following the name, e.g., I type "o-c-t-a-v-e" from my root directory, the directory is highlighted, hitting return displays the contents of the ./octave directory.  But if I then type "d-e-c-2-b-i-n" and return I get seemingly random behavior, some other file is loaded, or some strange directory contents are displayed.

I'll look into this one later today.

Dan Sebald <sebald>
Mon 09 Feb 2015 08:10:53 PM UTC, original submission:  

This is totally minor, but I can navigate the file browser with cursor keys or by typing the first letter of a directory name.  But when I type <RETURN> the action, such as loading the file or changing into the directory is not executed.

For real File Browsers like Konqueror or Windows Explorer the <RETURN> key does initiate an action.

Another usefulmo addition would be to have the highlight bar follow the active element when navigating with the alphabet.  When I type the first letter of a directory or file a small black underline bar moves to the correct position, but the highlight bar remains stuck on the original entry.

Rik <rik5>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #33044:  octave-filedialog-djs2015feb10.patch added by sebald (2KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.





    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-10 ttl StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2015-02-10 rik5 StatusNone Patch Submitted
    2015-02-10 sebald Attached File- Added octave-filedialog-djs2015feb10.patch, #33044

    Back to the top

    Powered by Savane 3.9