filesnake / filesnake / gui /

from ..pygtkhelpers.delegates import ToplevelView
import gtk

class UserMenu(ToplevelView):
    Contextual menu for `UserList`

    It should be moved in `UserList` module?
    def __init__(self, parent):
        self.parent = parent        
        super(UserMenu, self).__init__()

    def create_ui(self,): = gtk.Menu()
        # sendfile and sendfolder are gtk.Actions
        self.userlist = self.parent.userlist.treeview
    def on_userlist__button_press_event(self, treeview, event):
        On right click on the userlist it spawns the MENU
        if event.button == 3:
            x = int(event.x)
            y = int(event.y)
            time = event.time
            pthinfo = treeview.get_path_at_pos(x, y)
            if pthinfo is not None:
                path, col, cellx, celly = pthinfo
                treeview.set_cursor( path, col, 0)
       None, None, None, event.button, time)
            return True