docstr: Handle a context menu request
code: def on_context_menu(self, event):
      """Handle a context menu request"""
      index = self.GetFocusedItem()
      if index.ID is None:
          fn_context_menu = self.fn_empty_context_menu
          fn_do_menu_command = self.fn_do_empty_context_menu_command
          arg = None
      else:
          item = self.GetItemData(index)
          if item is None:
              # Is a folder
              fn_context_menu = self.fn_folder_context_menu
              fn_do_menu_command = self.fn_do_folder_menu_command
              arg = self.GetItemText(index)
          else:
              fn_context_menu = self.fn_context_menu
              fn_do_menu_command = self.fn_do_menu_command
              arg = list(
                  set(
                      self.GetItemData(ident).url
                      for ident in self.GetSelections()
                  )
              )
  
      if fn_context_menu is None or fn_do_menu_command is None:
          return
      pos = event.GetPosition()
      pos = self.ScreenToClient(pos)
      item_list = fn_context_menu(arg)
      if len(self.context_menu_ids) < len(item_list):
          self.context_menu_ids += [
              wx.NewId()
              for _ in range(len(self.context_menu_ids), len(item_list))
          ]
      menu = wx.Menu()
      for idx, (key, display_name) in enumerate(item_list):
          menu.Append(self.context_menu_ids[idx], display_name)
  
      def on_menu(event):
          idx = self.context_menu_ids.index(event.Id)
          fn_do_menu_command(arg, item_list[idx][0])
  
      self.Bind(wx.EVT_MENU, on_menu)
      try:
          self.PopupMenu(menu, pos)
      finally:
          self.Unbind(wx.EVT_MENU, handler=on_menu)
          menu.Destroy()
  
imports: import logging
  import os
  import sys
  import uuid
  from urllib.request import url2pathname
  from urllib.parse import urlparse
  import wx
  import wx.lib.scrolledpanel
  from cellprofiler_core.pipeline import ImageFile
  from cellprofiler_core.preferences import report_progress
label_desc: Use image node_id 42 for calling the PathListCtrl obj's underlying member method code with example usage: obj.on_context_menu(event) without return types