# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t


import adm
from wh import xlt
from Schema import Schema
from Table import Table
from Sequence import Sequence
from View import View
from Function import Function
  @staticmethod
  def GetInstances(parentNode):
    if parentNode.GetServer().fav_table:
      return [Favourites(parentNode)]
    return None

  def DoRefresh(self):
    for treename, fil in self.treeitems.items():
      tree=adm.trees[treename]
      favitem=fil[0] # tree.Collapse(favitem)
      for child in self.childnodes[:]:
        itemlist=child.treeitems.get(treename)
        if itemlist:
          for item in itemlist:
            if tree.IsChild(item, favitem):
              tree.DeleteItem(item)
        self.removeChild(child)
      self.properties=[]
      
  def GetProperties(self):
    self.properties=[]
    self.PopulateChildren()
    for child in self.childnodes:
      self.properties.append( (child.name, child.comment, child.GetIcon()))
    return self.properties
      
    

class Favourite(adm.Node):
  typename=xlt("Favourite")

# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t


# Path: modPg/Favourite.py
import adm
from wh import xlt
from Schema import Schema
from Table import Table
from Sequence import Sequence
from View import View
from Function import Function

  @staticmethod
  def GetInstances(parentNode):
    if parentNode.GetServer().fav_table:
      return [Favourites(parentNode)]
    return None

  def DoRefresh(self):
    for treename, fil in self.treeitems.items():
      tree=adm.trees[treename]
      favitem=fil[0] # tree.Collapse(favitem)
      for child in self.childnodes[:]:
        itemlist=child.treeitems.get(treename)
        if itemlist:
          for item in itemlist:
            if tree.IsChild(item, favitem):
              tree.DeleteItem(item)
        self.removeChild(child)
      self.properties=[]
      
  def GetProperties(self):
    self.properties=[]
    self.PopulateChildren()
    for child in self.childnodes:
      self.properties.append( (child.name, child.comment, child.GetIcon()))
    return self.properties
      
    

class Favourite(adm.Node):
  typename=xlt("Favourite")

  shortname=xlt("Favourite")