Hello

I'm working on a way to open any task's attachment through the TaskPopupMenu.

To do so I have created a new class of dynamic menu (please see below). My main 
problem at the moment is to identify the task selected.
In the class definition when I use the following instruction:

self.viewer.curselection()           #viewer is a TaskViewer taken from the 
TaskPopupMenu

I get the following error: 

AttributeError: `TaskViewer' object has no attribute `widget'

For info I want to use this instruction in the "getUICommands" (see below) in 
the following loop:

        for task in self.viewer.curselection():
            for attachment in task.attachments():
                ….

Do you have any idea about this error?

Thanks in advance.

New Class:

class OpenAttachmentsMenu(DynamicMenu):
    def __init__(self, mainwindow,tasks, viewer, settings):
        self.tasks = tasks
        self.viewer = viewer
        self.settings = settings
        super(OpenAttachmentsMenu, self).__init__(mainwindow)
        
    def registerForMenuUpdate(self):
        self._window.Bind(wx.EVT_MENU_OPEN, self.onUpdateMenu)
           
    def updateMenuItems(self):
        newCommands = self.getUICommands()
        self.clearMenu()
        self.fillMenu(newCommands)
     
    def fillMenu(self, uiCommands):
        self.appendUICommands(*uiCommands)

    def getUICommands(self):
        commands = []
        return commands    


Reply via email to