Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Open Recent file menu #50

Closed
wants to merge 1 commit into from
Closed

Conversation

oyarzun
Copy link
Collaborator

@oyarzun oyarzun commented Aug 31, 2015

use wx.FileHistory to open recently opened files from the file menu

use wx.FileHistory to open recently opened files from the file menu
@jreadey
Copy link
Member

jreadey commented Sep 29, 2015

@oyarzun, Thanks for your contribution! Can you send me your contact info to jreadey AT hdfgroup.org? We'd like you to submit a contributor's agreement for any code to be merged to the HDFGroup organization.

@jreadey
Copy link
Member

jreadey commented Oct 6, 2015

@oyarzun, it looks like the file history list will get longer and longer as more files are opened. Could you add a "clear" menu item to cleanup the history?

So the "Open Recent" menu would look like this:

Clear Recent

@ghost
Copy link

ghost commented Oct 6, 2015

How about the Recent n Files approach? Only n (n > 0) number of files most recently open are kept.

@oyarzun
Copy link
Collaborator Author

oyarzun commented Oct 6, 2015

It only keeps a maximum of 8 in the history.

self.filehistory = wx.FileHistory(8)

http://docs.wxwidgets.org/trunk/classwx_file_history.html#a30e3a3a1f92fc253cc0fc69eb6f27fd8

@ghost
Copy link

ghost commented Oct 6, 2015

Oops. Failed to notice that line.

jreadey added a commit that referenced this pull request Oct 6, 2015
@jreadey
Copy link
Member

jreadey commented Oct 6, 2015

Merged to develop branch.
I made one change in the interest of reducing 'magic numbers' in the code:

MAX_RECENT_FILES = 8
...
self.filehistory = wx.FileHistory(MAX_RECENT_FILES)

@jreadey
Copy link
Member

jreadey commented Oct 7, 2015

Has anyone tried this on Windows? I get an error on opening a file due to a no 'RemoveFileHistory' method on FileHistory.

@giumas
Copy link
Collaborator

giumas commented Oct 7, 2015

@jreadey : there are at least a couple of issues..

One is that the url creation is different on Windows (additional \).

Another issue is that RemoveFileToHistory method does not exist: http://wxpython.org/Phoenix/docs/html/FileHistory.html#FileHistory.RemoveFileFromHistory.

The first issue (only on Windows) has made evident the second bug that is not Windows-specific.

@jreadey
Copy link
Member

jreadey commented Oct 7, 2015

I'm not sure what's up RemoveFileFromHistory. It's there on my Mac environment: wx.version() == '3.0.0.0 osx-cocoa (classic)'.

@oyarzun - any thoughts on this? Can you patch the url setup and provide an alternative for RemoveFileFromHistory if that is not available on all platforms?

@giumas
Copy link
Collaborator

giumas commented Oct 7, 2015

@jreadey The issue is that in the current code is misspelled.. RemoveFileToHistory in place of RemoveFileFromHistory. Look at my PR: #68

Applying the changes in #68, it works on my Win7 machine.

@jreadey
Copy link
Member

jreadey commented Oct 7, 2015

Oh I see. This path was somehow getting triggered in Windows but not the Mac.

@jreadey jreadey mentioned this pull request Oct 9, 2015
20 tasks
@giumas
Copy link
Collaborator

giumas commented Oct 9, 2015

@jreadey Why is this PR still open?

@jreadey
Copy link
Member

jreadey commented Oct 9, 2015

Closing.

@jreadey jreadey closed this Oct 9, 2015
@hyoklee
Copy link
Member

hyoklee commented Oct 13, 2015

Why doesn't OPeNDAP URL appear in Open Recent menu? Does history work on local files only?

@giumas
Copy link
Collaborator

giumas commented Oct 13, 2015

The follow-on questions might be:

  • do we want to collect the urls?
  • if yes, do we want them on the same history list or in a dedicated one?

@hyoklee
Copy link
Member

hyoklee commented Oct 13, 2015

My vote is 'yes' for both. See the attached Panoply screenshot.
panoply_history

@jreadey
Copy link
Member

jreadey commented Oct 13, 2015

I think it will be best/easiest to put recent files/resources in the same history menu.

Is the wx FileHistory adaptable for strings that are not proper files?

oyarzun added a commit to oyarzun/hdf-compass that referenced this pull request Oct 13, 2015
@giumas giumas added this to the 0.6.0 milestone Oct 20, 2015
@oyarzun oyarzun deleted the recent-files branch October 20, 2015 20:53
@giumas giumas mentioned this pull request Oct 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants