# Path: umit/icm/agent/I18N.py
#     LC_ALL = locale.setlocale(locale.LC_ALL,'')
#     LC_ALL = locale.setlocale(locale.LC_ALL, None)        
# LANG = None
# ENC = None
#     LANG = "en_US"
#     LANG = "zh_CN"
#     LANG = "pt"
#     LANG = "ja"
#     LANG, ENC = locale.getdefaultlocale()
#     ENC = "utf8"
#     LANG = "en_US"   
# 
# Path: umit/icm/agent/Application.py
# def main_is_frozen():
#     def __init__(self):
#     def _init_components(self, aggregator):
#     def _load_from_db(self):
#     def init_after_running(self, port=None, username=None, password=None,
#                            server_enabled=True, skip_server_check=False):
#     def check_aggregator_success(self,response):
#     def login_window_show(self):       
#     def check_aggregator_failed(self,message):
#     def login_without_gui(self):
#     def check_software_auto(self):
#     def register_agent(self, username, password):
#     def _handle_register(self, result):
#     def _handle_errback(self, failure):
#     def login(self, username, password, save_login=False, login_only=False):
#     def check_username(self,username="",password=""):
#     def _login_after_register_callback(self, message, username,
#                                        password, save_login, login_only):
#     def _handle_login_errback(self,failure):
#     def _handle_login(self, result, username, password, save_login,login_only=False):
#     def login_simulate(self):
#     def task_loop_manager(self):
#     def logout(self):
#     def _handle_logout(self, result):
#     def start(self, run_reactor=True, managed_mode=False, aggregator=None):
#     def quit_window_in_wrong(self,primary_text = "",secondary_text = ""):
#     def terminate(self):
#     def on_quit(self):
# class Application(object):
# 
# Path: umit/icm/agent/logger.py
# LOGLEVEL = 'DEBUG'


import pygtk
import gtk, gobject
from umit.icm.agent.I18N import _
from umit.icm.agent.Global import *
from umit.icm.agent.Application import theApp
from umit.icm.agent.logger import g_logger
from umit.icm.agent.gui.dashboard.DashboardListBase import  *
        from umit.icm.agent.gui.dashboard.DashboardListBase import TASK_ALL,TASK_SUCCESSED,TASK_FAILED        
        """
        """        
        self.task_list_dict = {}
        cnt = 0

        #########################
        #Get Task Details From DB
        rs = g_db_helper.get_task_sets(task_type=task_type)
        
        if rs == None:
            g_logger.info("Cannot load any Tasks from DB.")
            self.treeview.set_sensitive(True)
            self.store.clear()
            self.treeview.set_model(self.store) #It must be after the store update
            return
        
        for record in rs:
            self.task_list_dict[cnt] = {}
            self.task_list_dict[cnt]["sequence"]      = record[0]
            self.task_list_dict[cnt]["test_id"]       = record[1]
            self.task_list_dict[cnt]["website_url"]   = record[2]
            self.task_list_dict[cnt]["test_type"]     = record[3]
            self.task_list_dict[cnt]["service_name"]  = record[4]
            self.task_list_dict[cnt]["service_ip"]    = record[5]
            self.task_list_dict[cnt]["service_port"]  = record[6] 
            self.task_list_dict[cnt]["done_status"]   = record[7]
            self.task_list_dict[cnt]["done_result"]   = record[8]
            self.task_list_dict[cnt]["execute_time"]  = record[9]             
            cnt += 1
        

# Path: umit/icm/agent/I18N.py
#     LC_ALL = locale.setlocale(locale.LC_ALL,'')
#     LC_ALL = locale.setlocale(locale.LC_ALL, None)        
# LANG = None
# ENC = None
#     LANG = "en_US"
#     LANG = "zh_CN"
#     LANG = "pt"
#     LANG = "ja"
#     LANG, ENC = locale.getdefaultlocale()
#     ENC = "utf8"
#     LANG = "en_US"   
# 
# Path: umit/icm/agent/Application.py
# def main_is_frozen():
#     def __init__(self):
#     def _init_components(self, aggregator):
#     def _load_from_db(self):
#     def init_after_running(self, port=None, username=None, password=None,
#                            server_enabled=True, skip_server_check=False):
#     def check_aggregator_success(self,response):
#     def login_window_show(self):       
#     def check_aggregator_failed(self,message):
#     def login_without_gui(self):
#     def check_software_auto(self):
#     def register_agent(self, username, password):
#     def _handle_register(self, result):
#     def _handle_errback(self, failure):
#     def login(self, username, password, save_login=False, login_only=False):
#     def check_username(self,username="",password=""):
#     def _login_after_register_callback(self, message, username,
#                                        password, save_login, login_only):
#     def _handle_login_errback(self,failure):
#     def _handle_login(self, result, username, password, save_login,login_only=False):
#     def login_simulate(self):
#     def task_loop_manager(self):
#     def logout(self):
#     def _handle_logout(self, result):
#     def start(self, run_reactor=True, managed_mode=False, aggregator=None):
#     def quit_window_in_wrong(self,primary_text = "",secondary_text = ""):
#     def terminate(self):
#     def on_quit(self):
# class Application(object):
# 
# Path: umit/icm/agent/logger.py
# LOGLEVEL = 'DEBUG'


# Path: umit/icm/agent/gui/dashboard/TaskTab.py
import pygtk
import gtk, gobject
from umit.icm.agent.I18N import _
from umit.icm.agent.Global import *
from umit.icm.agent.Application import theApp
from umit.icm.agent.logger import g_logger
from umit.icm.agent.gui.dashboard.DashboardListBase import  *
        from umit.icm.agent.gui.dashboard.DashboardListBase import TASK_ALL,TASK_SUCCESSED,TASK_FAILED        

        """
        """        
        self.task_list_dict = {}
        cnt = 0

        #########################
        #Get Task Details From DB
        rs = g_db_helper.get_task_sets(task_type=task_type)
        
        if rs == None:
            g_logger.info("Cannot load any Tasks from DB.")
            self.treeview.set_sensitive(True)
            self.store.clear()
            self.treeview.set_model(self.store) #It must be after the store update
            return
        
        for record in rs:
            self.task_list_dict[cnt] = {}
            self.task_list_dict[cnt]["sequence"]      = record[0]
            self.task_list_dict[cnt]["test_id"]       = record[1]
            self.task_list_dict[cnt]["website_url"]   = record[2]
            self.task_list_dict[cnt]["test_type"]     = record[3]
            self.task_list_dict[cnt]["service_name"]  = record[4]
            self.task_list_dict[cnt]["service_ip"]    = record[5]
            self.task_list_dict[cnt]["service_port"]  = record[6] 
            self.task_list_dict[cnt]["done_status"]   = record[7]
            self.task_list_dict[cnt]["done_result"]   = record[8]
            self.task_list_dict[cnt]["execute_time"]  = record[9]             
            cnt += 1
        

        g_logger.info("Loaded %d tasks from DB." % len(rs)) 