def put_words(self, words): term.color(0) num_words = len(words) w = 0 # word index, e.g. words[w] # word loop while w < num_words: is_last_row = (self.cur_y == self.height-1) word = words[w] # select next word to print word_len = len(word) if is_last_row: word_fits = (self.cur_x + word_len + Pager.more_len <= self.width) # for the last row, also reserve space for a potential "(more)" prompt. else: word_fits = (self.cur_x + word_len <= self.width) if word_fits: self.put_word(word) w += 1 # advance to next word else: if not is_last_row: self.carriage_return() else: self.put_more_prompt() self.clear()
def main(): logging.info("Starting quill.") term.color(0, 7) term.clear() term.color(7, 0) T = Tab((0, 0), term.size, True) k = term.getkey() while k != "^C": T.handle(k) k = term.getkey() logging.info("Exiting.")
def draw(self, who): x, y = self.x, self.y term.color(7); term.go(x, y) term.put(who.name) term.go(x+13, y); term.color(9) term.put("%s/%s" % (who.hp, who.max_hp)) term.go(x+21, y); term.color(12) term.put("%s/%s" % (who.mp, who.max_mp))
def headerConfirm(message="TkkrLab barsystem"): term.header(message, 42, 97, 1, False) term.color(0) term.color()
def headerInfo(message="TkkrLab barsystem"): term.header(message, 44, 97, 1, False) term.color(0) term.color()
def headerWarning(message="TkkrLab barsystem"): term.header(message, 30, 103, 1, False) term.color(0) term.color()
def headerError(message="TkkrLab barsystem"): term.header(message, 41, 97, 1, False) term.color(0) term.color()
def msgConfirm(message): term.color(40, 92, 5) print(message) term.color(0) term.color()
def msgWarning(message): term.color(40, 93, 5) print(message) term.color(0) term.color()
def msgError(message): term.color(40, 91, 5) print(message) term.color(0) term.color()