#----------------------------------------------------------------------
# Authors:
#   Luis Felipe Strano Moraes
#
# Copyright (C) 2007 Authors
#
# Released under GNU GPL, read the file 'COPYING' for more information
# ----------------------------------------------------------------------

import appuifw
import e32
import e32db
import imclib

class IMCS60():
	def __init__(self):
		self.lock = e32.Ao_lock()

		self.old_title = appuifw.app.title
		appuifw.app.title = u"IMCPub"

		self.arguments, self.optional = imclib.get_information()
                self.imc_list = imclib.get_imc_list()
		
		self.exit_flag = False
		appuifw.app.exit_key_handler = self.abort

		self.data = []

	def abort(self):
		self.exit_flag = True
		self.lock.signal()

	def loop(self):
		try:
			self.lock.wait()
			while not self.exit_flag:
				self.refresh()
				self.lock.wait()
		finally:
			pass
		

def main():
	app = IMCS60()
	# TODO : open database 
	app.loop()
	
if __name__ = "__main__":
	main()

