###############################################################################
# File:        guAutoManagersListView.py
# Appointment: List of Sciences
# Project:     GalaxyU
# Author:      AR
# History:
# 06.04.2014 Created
###############################################################################
import wxTools
import guObjects
import guApp
import guListView

import wx


#===============================================================================
# List control
#===============================================================================
class CAutoManagersViewCtrl(guListView.CListViewCtrlWithBuilder):
    #---------------------------------------------------------------------------
    def __init__(self, parent, aListCreator):
        guListView.CListViewCtrlWithBuilder.__init__(self, parent, aListCreator)
        
    #---------------------------------------------------------------------------
    # Redefined virtual
    def PrepareBuilder(self, aBuilder):
        # Add columns
        aBuilder.AddColumn("Nation", lambda data: data.NationName)
        aBuilder.AddColumn("Name", lambda data: data.Name)
        aBuilder.AddColumn("Activity", lambda data: 'ON' if data.IsActive else 'OFF', wx.LIST_FORMAT_CENTRE)
        aBuilder.AddColumn("Priority", lambda data: str(data.Priority), wx.LIST_FORMAT_RIGHT, True)
        aBuilder.AddColumn("Stars", lambda data: data.StarsInfo)
        aBuilder.AddColumn("Info", lambda data: data.Info)

#-------------------------------------------------------------------------------

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# Shows a list of Sciences
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
def ShowList():
    return guApp.Application.WindowsCollection.RegisterAndShow(\
        lambda: guListView.CListViewFrame(\
            guApp.Application.GetMainWindow(),
            lambda: guApp.Application.GetReport().AutoManagers,
            lambda panel, aListCreator: CAutoManagersViewCtrl(panel, aListCreator),
            "CAutoManagersViewCtrl", 
            "Automated managers"))
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
