# 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/rpc/MessageFactory.py
# class MessageFactory(object):
#     """"""
#     _reader = BinaryReader()
#     _writer = BinaryWriter()
# 
#     #----------------------------------------------------------------------
#     #def __init__(self):
#         #"""Constructor"""
# 
#     @classmethod
#     def create(cls, msg_type):
#         return message_creator[msg_type]()
# 
#     @classmethod
#     def encode(cls, message):
#         cls._writer.reset()
#         msg_type = message.DESCRIPTOR.name
#         msg_type_id = message_type_to_id[msg_type]
#         msg_str = message.SerializeToString()
#         cls._writer.writeInt32(msg_type_id)
#         cls._writer.writeFixedLengthString(msg_str, len(msg_str))
#         return cls._writer.getString()
# 
#     @classmethod
#     def decode(cls, str_):
#         cls._reader.setString(str_)
#         msg_type_id = cls._reader.readInt32()
#         msg_type = message_id_to_type[msg_type_id]
#         message = cls.create(msg_type)
#         msg_str = cls._reader.readFixedLengthString(len(str_)-4)
#         message.ParseFromString(msg_str)
#         return message
# 
#     @classmethod
#     def encrypt(cls, str_):
#         pass
# 
#     @classmethod
#     def decrypt(cls, str_):
#         pass


import os, stat, time
import pygtk
import gtk
import gobject
from higwidgets.higwindows import HIGWindow
from deps.higwidgets.higboxes import HIGHBox, HIGVBox,hig_box_space_holder
from higwidgets.higlabels import HIGLabel
from higwidgets.higentries import HIGTextEntry, HIGPasswordEntry
from umit.icm.agent.I18N import _
from umit.icm.agent.Application import theApp
from google.protobuf.text_format import MessageToString
from umit.icm.agent.rpc.message import *
from umit.icm.agent.rpc.MessageFactory import MessageFactory
from umit.proto import messages_pb2

        """
        longtitude = self.longitude_entry.get_text()
        latitude   = self.latitude_entry.get_text()
        
        if longtitude != "" and latitude != "":
            self.location_user.longitude = float(longtitude)
            self.location_user.latitude  = float(latitude)
        else:
            #There we should add user preference logitude
            self.location_user.longitude = 0.0
            self.location_user.latitude  = 0.0
        
        defer_ = theApp.aggregator.get_events(self.location_user)
        defer_.addCallback(self.finish_get_events)
        defer_.addErrback(self.handler_error)
    
    def _refresh_list(self):
        """
        clear and load
        """
        self.listmodel.clear()
        self.__load_events()
        self.statusbar.push(0,_("Refresh the Events List!"))  
     
    def handler_error(self,failure):
        g_logger.error("Error in get events %s"%str(failure))
        self.statusbar.push(0,_("Error in Get Events From Aggregator!"))         
            
    def finish_get_events(self,message):
        if message is None:

# 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/rpc/MessageFactory.py
# class MessageFactory(object):
#     """"""
#     _reader = BinaryReader()
#     _writer = BinaryWriter()
# 
#     #----------------------------------------------------------------------
#     #def __init__(self):
#         #"""Constructor"""
# 
#     @classmethod
#     def create(cls, msg_type):
#         return message_creator[msg_type]()
# 
#     @classmethod
#     def encode(cls, message):
#         cls._writer.reset()
#         msg_type = message.DESCRIPTOR.name
#         msg_type_id = message_type_to_id[msg_type]
#         msg_str = message.SerializeToString()
#         cls._writer.writeInt32(msg_type_id)
#         cls._writer.writeFixedLengthString(msg_str, len(msg_str))
#         return cls._writer.getString()
# 
#     @classmethod
#     def decode(cls, str_):
#         cls._reader.setString(str_)
#         msg_type_id = cls._reader.readInt32()
#         msg_type = message_id_to_type[msg_type_id]
#         message = cls.create(msg_type)
#         msg_str = cls._reader.readFixedLengthString(len(str_)-4)
#         message.ParseFromString(msg_str)
#         return message
# 
#     @classmethod
#     def encrypt(cls, str_):
#         pass
# 
#     @classmethod
#     def decrypt(cls, str_):
#         pass


# Path: umit/icm/agent/gui/Event.py
import os, stat, time
import pygtk
import gtk
import gobject
from higwidgets.higwindows import HIGWindow
from deps.higwidgets.higboxes import HIGHBox, HIGVBox,hig_box_space_holder
from higwidgets.higlabels import HIGLabel
from higwidgets.higentries import HIGTextEntry, HIGPasswordEntry
from umit.icm.agent.I18N import _
from umit.icm.agent.Application import theApp
from google.protobuf.text_format import MessageToString
from umit.icm.agent.rpc.message import *
from umit.icm.agent.rpc.MessageFactory import MessageFactory
from umit.proto import messages_pb2

        """
        longtitude = self.longitude_entry.get_text()
        latitude   = self.latitude_entry.get_text()
        
        if longtitude != "" and latitude != "":
            self.location_user.longitude = float(longtitude)
            self.location_user.latitude  = float(latitude)
        else:
            #There we should add user preference logitude
            self.location_user.longitude = 0.0
            self.location_user.latitude  = 0.0
        
        defer_ = theApp.aggregator.get_events(self.location_user)
        defer_.addCallback(self.finish_get_events)
        defer_.addErrback(self.handler_error)
    
    def _refresh_list(self):
        """
        clear and load
        """
        self.listmodel.clear()
        self.__load_events()
        self.statusbar.push(0,_("Refresh the Events List!"))  
     
    def handler_error(self,failure):
        g_logger.error("Error in get events %s"%str(failure))
        self.statusbar.push(0,_("Error in Get Events From Aggregator!"))         
            
    def finish_get_events(self,message):
        if message is None:

            self.statusbar.push(0,_("No new Events from Aggregator!"))  
