def announce_vote_options(self, client=None): """display the vote options to all players or the given player""" def write(txt, client=None): if txt[0] == '/': # if line starts with '/', then it won't be displayed by the BF3 server txt = ' ' + txt if client: self.console.write(("admin.say", txt, 'player', client.cid )) else: self.console.write(("admin.say", txt, 'all')) for two_options in two_by_two(self.current_vote_session.getOptions()): options = [ljust("/%s %s" % x, pct=48) for x in two_options] write(" | ".join(options), client)
def test_in_game(self): print """admin.say "%s | %s" all """ % (ljust('<[({ hello world ! })]>', 48), ljust('<[({ hello world ! })]>', 48)) print """admin.say "%s | %s" all """ % (center('<[({ hello world ! })]>', 48), center('<[({ hello world ! })]>', 48)) print """admin.say "%s | %s" all """ % (rjust('<[({ hello world ! })]>', 48), rjust('<[({ hello world ! })]>', 48))
def test_ljust(self): self.assertAlmostEqual(50, width(ljust('<[({ hello world ! })]>', 50)), delta=2) self.assertAlmostEqual(50, width(ljust(' ', 50)), delta=2) self.assertAlmostEqual(50, width(ljust('fqs 654651 sq1fqs ]@ /o', 50)), delta=2)