cygnusnow / ulipad

Automatically exported from code.google.com/p/ulipad
0 stars 0 forks source link

improvement, add_current_directory menu in pop menu of dirbrowser #218

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
import functools
def OnAddCurrentPath(self,event):
    item = self.tree.GetSelection()
    if not self.is_ok(item): 
        print item , 'is not ok'
        return
    filename = self.get_node_filename(item)
    if self.isFile(item):
        item = self.tree.GetItemParent(item)
        filename = self.get_node_filename(item)
    path = filename
    if path:
        self.addpath(path)
        if self.pref.open_project_setting_dlg:
            wx.CallAfter(self.OnSetProject)

# use static popup menu
def addmenu(app):
    app.OnAddCurrentPath = functools.partial(OnAddCurrentPath,app)
    app.popmenulist.extend( [('IDPM_ADD', [
      (99, 'IDPM_ADD_CURDIR', tr('Add Current Directory'), wx.ITEM_NORMAL, 
         'OnAddCurrentPath', ''),   
    ]), ])
Mixin.setPlugin('dirbrowser', 'init', addmenu)

Original issue reported on code.google.com by sunyi...@gmail.com on 29 Nov 2009 at 3:49

Attachments:

GoogleCodeExporter commented 9 years ago
This feature seems good, but I want to know how do you know the current 
directory is? 
And ulipad supports drag and drop from explorer, so I think this feature seems 
not very 
necessary. What do you think? 

Original comment by limo...@gmail.com on 29 Nov 2009 at 5:11

GoogleCodeExporter commented 9 years ago
When the mouse right click on the selected item inside the dirbrowser, you will 
know 
from the tree.GetSelection. I just inserted another handler into the 
dirbrowser.init.addmenu. As I don't know how to use mixin to pass the function 
of 
OnAddCurrentPath, I use functools.
the implementation is based on the existing feature. I find it is faster than 
drag and 
drop and should work under linux.

Original comment by sunyi...@gmail.com on 29 Nov 2009 at 5:21

GoogleCodeExporter commented 9 years ago
So you mean you want to add sub-folder in one top directory? So because you've 
add the 
top folder why you want to add sub-folder again?

Original comment by limo...@gmail.com on 29 Nov 2009 at 5:52

GoogleCodeExporter commented 9 years ago
it is faster to access them from top folder than open folder by folder from a 
common 
root.
I treat dirbrowser as a shortcut to browse the projects I am working on.
For example on the top folder I keep one entry for /aaa/bbb/ulipad
I will also keep one entry for /aaa/bbb/ulipad/modules/wxctrl
so that I don't have to always click ulipad, scroll to modules, then scroll to 
modules 
click modules, then click wxctrl.
you know there are lots of files under ulipad.

Original comment by sunyi...@gmail.com on 29 Nov 2009 at 5:58

GoogleCodeExporter commented 9 years ago
I've merged your code to DirBrowser.py. Fixed.

Original comment by limo...@gmail.com on 1 Dec 2009 at 5:10