コード例 #1
0
ファイル: managui.py プロジェクト: Helianthella/manachat
    def on_start(self):
        if config.getboolean('Other', 'log_network_packets'):
            import os
            import tempfile

            logfile = os.path.join(tempfile.gettempdir(), "netlog.txt")
            netlog.setLevel(logging.INFO)
            fh = logging.FileHandler(logfile, mode="w")
            fmt = logging.Formatter("[%(asctime)s] %(message)s",
                                    datefmt="%Y-%m-%d %H:%M:%S")
            fh.setFormatter(fmt)
            netlog.addHandler(fh)

        monsterdb.read_monster_db()
        itemdb.load_itemdb('itemdb.txt')

        dbgh = DebugLogHandler(self)
        dbgh.setFormatter(
            logging.Formatter("[%(asctime)s] %(message)s", datefmt="%H:%M"))
        debuglog.addHandler(dbgh)
        debuglog.setLevel(logging.INFO)

        net2 = DebugLogHandler(self)
        net2.setFormatter(
            logging.Formatter("[%(asctime)s] %(message)s", datefmt="%H:%M"))
        net2.setLevel(logging.ERROR)
        netlog.addHandler(net2)

        plugins.load_plugins(config)

        handlers.app = self

        import chat
        chat.pp_actions = ()

        # self.reconnect()

        Clock.schedule_once(self.update_online_list, 0.2)
        Clock.schedule_interval(self.update_online_list, 35)
        Clock.schedule_interval(self.update_loop, 0)
        Clock.schedule_once(self.show_menu, 1.5)
コード例 #2
0
ファイル: managui.py プロジェクト: mekolat/manachat
    def on_start(self):
        if config.getboolean('Other', 'log_network_packets'):
            import os
            import tempfile

            logfile = os.path.join(tempfile.gettempdir(), "netlog.txt")
            netlog.setLevel(logging.INFO)
            fh = logging.FileHandler(logfile, mode="w")
            fmt = logging.Formatter("[%(asctime)s] %(message)s",
                                    datefmt="%Y-%m-%d %H:%M:%S")
            fh.setFormatter(fmt)
            netlog.addHandler(fh)

        monsterdb.read_monster_db()
        itemdb.load_itemdb('itemdb.txt')

        dbgh = DebugLogHandler(self)
        dbgh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s",
                                            datefmt="%H:%M"))
        debuglog.addHandler(dbgh)
        debuglog.setLevel(logging.INFO)

        net2 = DebugLogHandler(self)
        net2.setFormatter(logging.Formatter("[%(asctime)s] %(message)s",
                                            datefmt="%H:%M"))
        net2.setLevel(logging.ERROR)
        netlog.addHandler(net2)

        plugins.load_plugins(config)

        handlers.app = self

        # self.reconnect()

        Clock.schedule_once(self.update_online_list, 0.2)
        Clock.schedule_interval(self.update_online_list, 35)
        Clock.schedule_interval(self.update_loop, 0)
        Clock.schedule_once(self.show_menu, 1.5)
コード例 #3
0
ファイル: managui.py プロジェクト: Tezer123/manachat
    def on_start(self):
        if config.getboolean('Other', 'log_network_packets'):
            import os
            import tempfile

            logfile = os.path.join(tempfile.gettempdir(), "netlog.txt")
            netlog.setLevel(logging.INFO)
            fh = logging.FileHandler(logfile, mode="w")
            fmt = logging.Formatter("[%(asctime)s] %(message)s",
                                    datefmt="%Y-%m-%d %H:%M:%S")
            fh.setFormatter(fmt)
            netlog.addHandler(fh)

        monsterdb.read_monster_db()

        dbgh = DebugLogHandler(self)
        dbgh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s",
                                            datefmt="%H:%M"))
        debuglog.addHandler(dbgh)
        debuglog.setLevel(logging.INFO)

        plugins.load_plugins(config, 'chatlogfile')

        handlers.app = self

        net.login(host=config.get('Server', 'host'),
                  port=config.getint('Server', 'port'),
                  username=config.get('Player', 'username'),
                  password=config.get('Player', 'password'),
                  charname=config.get('Player', 'charname'))

        self.root.map_w.tile_size = config.getint('GUI', 'tile_size')

        Clock.schedule_once(self.update_online_list, 0.2)
        Clock.schedule_interval(self.update_online_list, 35)
        Clock.schedule_interval(self.update_loop, 0)
コード例 #4
0
ファイル: tmwcli.py プロジェクト: Tezer123/manachat
    config.read('../manachat.ini')

    rootLogger = logging.getLogger('')
    rootLogger.addHandler(logging.NullHandler())

    dbgh = CursesDebugLogHandler()
    dbgh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s",
                                        datefmt="%H:%M"))
    debuglog.addHandler(dbgh)
    debuglog.setLevel(logging.INFO)

    fh = logging.FileHandler("/tmp/netlog.txt", mode="w")
    fh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s",
                                      datefmt="%Y-%m-%d %H:%M:%S"))
    netlog.addHandler(fh)
    netlog.setLevel(logging.INFO)

    cui.init()

    plugin_list = config.get('Core', 'plugins').split()
    plugins.load_plugins(config, *plugin_list)
    monsterdb.read_monster_db('../monsterdb.txt')
    itemdb.load_itemdb('../itemdb.txt')

    online_users = OnlineUsers(config.get('Other', 'online_txt_url'))
    online_users.start()
    side_bar_updater = SideBarUpdater(cui.players_win, online_users)
    side_bar_updater.start()

    net.login(host=config.get('Server', 'host'),
              port=config.getint('Server', 'port'),
コード例 #5
0
    rootLogger = logging.getLogger('')
    rootLogger.addHandler(logging.NullHandler())

    dbgh = DebugLogHandler()
    dbgh.setFormatter(
        logging.Formatter("[%(asctime)s] %(message)s",
                          datefmt="%Y-%m-%d %H:%M:%S"))
    debuglog.addHandler(dbgh)
    debuglog.setLevel(logging.INFO)

    config = ConfigParser()
    config.read('manachat.ini')

    if config.getboolean('Other', 'log_network_packets'):
        from loggers import netlog
        netlog.setLevel(logging.INFO)
        fh = logging.FileHandler('/tmp/netlog.txt', mode="w")
        fmt = logging.Formatter("[%(asctime)s] %(message)s",
                                datefmt="%Y-%m-%d %H:%M:%S")
        fh.setFormatter(fmt)
        netlog.addHandler(fh)

    load_itemdb('itemdb.txt')
    read_monster_db('monsterdb.txt')

    plugins.load_plugins(config)

    net.login(host=config.get('Server', 'host'),
              port=config.getint('Server', 'port'),
              username=config.get('Player', 'username'),
              password=config.get('Player', 'password'),