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

Suggest file / folder save location or name #444

Open
JDsnyke opened this issue Jun 6, 2019 · 5 comments
Open

Suggest file / folder save location or name #444

JDsnyke opened this issue Jun 6, 2019 · 5 comments
Labels
Milestone

Comments

@JDsnyke
Copy link

JDsnyke commented Jun 6, 2019

Is there a way to suggest a file name or location when using 'ask_save_file' for example? If not, it would be a useful feature to have in future releases...

@ccoupe ccoupe added the Normal label Jun 6, 2019
@ccoupe
Copy link

ccoupe commented Jun 6, 2019

The last time I looked at this problem I found that it wasn't an easy to do or not portable. FWIW, osx and gtk (and windows) have opposite defaults. One opens the same as the last selection and one open somewhere else. Depending on what you want, both are a disappoint. They are incredibly slow too as they cache all the icons. Let's keep this issue open.

@ccoupe ccoupe added this to the 3.3.8 milestone Jun 9, 2019
@ccoupe
Copy link

ccoupe commented Jun 9, 2019

In Gtk3 (Linux and Windows) this does seem doable although the gnome wizards think it's not good policy - like they've never been wrong before! I haven't checked cocoa docs yet for OSX but it's one of those options that doesn't have to be cross platform, IMO. We already accept a option hash for those dialogs so dir: <dir_path> and file: <filename>. On the native side of things there is some work since that code is troublesome and to use a technical term, 'limping on life support'. It needs a rethink/rework.

@ccoupe
Copy link

ccoupe commented Jun 10, 2019

@JDsnyke , For a workaround the panel for the file chooser is pretty flexible. You can add directories to it and they stick through a reboot. Just right click the directory and "bookmark" it.

ccoupe pushed a commit that referenced this issue Jun 10, 2019
* gtk - move dialog code from gtk.c to gtk/dialogs.c
* cocoa - first attempt
@ccoupe
Copy link

ccoupe commented Jun 11, 2019

I love finding undocumented things in Shoes! There was code in there to filter by file types. I added the suggest 'dir:' and while I was there I added a 'hidden:' option to show the hidden dot files. I've wanted that option frequently.
Here's a little test script

Shoes.app do
  stack do
    flow do
		  para "Start Here: "
		  @el = edit_line 
		  #@el.text = Dir.getwd
		  button "Open" do
		    fp = ask_open_file title: "My App wants", dir: @el.text, 
            types: {"Ruby" => "*.rb", "All" => "*"}, hidden: true 
		    if fp 
		      @el.text = File.dirname(fp)
		      @msgbox.append fp+"\n"
		    end
		  end
		end
	  @msgbox = edit_box width: 300
	end
end

One other change. If you don't specify any options, it's likely to open in your HOME folder. Also the 'types' option doesn't work on OSX but that's OK. Beta's at the usual place - The 64 bit exe only works on win10.

@JDsnyke
Copy link
Author

JDsnyke commented Jun 11, 2019

Good stuff @ccoupe! I'll test out the beta when I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants