[wingide-users] Getting path to a file in a project window

Wingware Support support at wingware.com
Mon Jan 4 20:30:38 MST 2010

Mitchell L Model wrote:
> I had asked support about the following:
>     I would like to be able to click something -- probably 
> right-button menu --
>     and select and command that places the path to the clicked file 
> (in the Project Manager)
>     to the clipboard. I can't find anyplace in the GUI that contains 
> that information, though I
>     assume I could get it by scripting. (Although even then, it might 
> be tricky -- it isn't the current
>     window's file I want, it's a file I select from the Project 
> Manager that might not even be open.)
> and got back information about writing an extension and putting it on 
> the menu. Here is what I have.
> It adds a "File paths to clipboard" to the project menu; selecting it 
> inserts the full path to each of the
> files currently selected in the Project pane, one to a line. (I don't 
> know how to get the menu command
> to be title cased.) Thanks Stephan!
> def file_paths_to_clipboard():
>     names = wingapi.gApplication.GetCurrentFiles()
> wingapi.gApplication.fSingletons.fGuiMgr.fClipboard.set_text('\n'.join(names)) 
> file_paths_to_clipboard.contexts = [wingapi.kContextProject()]

Thanks for posting this. You can alter the label used in menus by 
setting the label attribute on the script. For example in this case, 
file_paths_to_clipboard.label = "something".

Note that you can also post things like this to the just- announced 



Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list