Beispiel #1
0
    def __init__(self, config, db_file):
        self._conf = config
        self._db_file = db_file

        # The module emtraffic has a really really WEIRD behavior. It will NOT save any data
        # expense update to the physical sqlite file if you don't EXPLICITELY order it to do it.
        # Traditionally it only do it when a connection is closed, but this is difficult to
        # guarantee because TGCM or the OS could crash, power loss, etc.
        #
        # This counter attempts to palliate it, because it stores the number of data updates has
        # been done, and every time it reaches SYNC_EVERY_N_UPDATES it will order emtraffic to
        # write its changes to the disk
        self._num_updates = 0

        # emtraffic initialization
        emtraffic.global_init()
        emtraffic.set_db_file(self._db_file)
        emtraffic.set_version(int(self._conf.get_version().split(".")[0]), \
                int(self._conf.get_version().split(".")[1]), 0, \
                self._conf.get_version() + ".0")

        self._traffics = {}
        for is_roaming in (False, True):
            tag = self.__get_tag(is_roaming)
            traffic = emtraffic.Traffic()
            traffic.set_type(tag)
            self._traffics[is_roaming] = traffic

        emtraffic.update_traffic_history()
Beispiel #2
0
    def __init__(self, config, db_file):
        self._conf = config
        self._db_file = db_file

        # The module emtraffic has a really really WEIRD behavior. It will NOT save any data
        # expense update to the physical sqlite file if you don't EXPLICITELY order it to do it.
        # Traditionally it only do it when a connection is closed, but this is difficult to
        # guarantee because TGCM or the OS could crash, power loss, etc.
        #
        # This counter attempts to palliate it, because it stores the number of data updates has
        # been done, and every time it reaches SYNC_EVERY_N_UPDATES it will order emtraffic to
        # write its changes to the disk
        self._num_updates = 0

        # emtraffic initialization
        emtraffic.global_init()
        emtraffic.set_db_file(self._db_file)
        emtraffic.set_version(int(self._conf.get_version().split(".")[0]), \
                int(self._conf.get_version().split(".")[1]), 0, \
                self._conf.get_version() + ".0")

        self._traffics = {}
        for is_roaming in (False, True):
            tag = self.__get_tag(is_roaming)
            traffic = emtraffic.Traffic()
            traffic.set_type(tag)
            self._traffics[is_roaming] = traffic

        emtraffic.update_traffic_history()
if not os.path.exists("PPPManager"):
	sys.path.append(os.path.join(os.path.dirname(sys.argv[0]),"../backend"))

import MSD     

sys.path.append(MSD.msd_eggs_dir)

def main():
	# register the gettext function for the whole interpreter as "_"
	__builtin__._ = gettext.gettext
	
	#creo el lock
	f = None
	try:
		f = open(MSD.lock_file,"w")
		f.write("%s" % os.getpid())
	finally:
		if f is not None:
			f.close()
			
        x = MSD.MSDMainWindow()
        gtk.main()

if __name__ == '__main__':
    emsync.global_init()
    emtraffic.global_init()
    main()
    emtraffic.global_end()
    emsync.global_end()