Beispiel #1
0
Datei: ui.py Projekt: gnar/pyhack
  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()
Beispiel #2
0
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.")
Beispiel #3
0
Datei: ui.py Projekt: gnar/pyhack
  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))
Beispiel #4
0
def headerConfirm(message="TkkrLab barsystem"):
    term.header(message, 42, 97, 1, False)
    term.color(0)
    term.color()
Beispiel #5
0
def headerInfo(message="TkkrLab barsystem"):
    term.header(message, 44, 97, 1, False)
    term.color(0)
    term.color()
Beispiel #6
0
def headerWarning(message="TkkrLab barsystem"):
    term.header(message, 30, 103, 1, False)
    term.color(0)
    term.color()
Beispiel #7
0
def headerError(message="TkkrLab barsystem"):
    term.header(message, 41, 97, 1, False)
    term.color(0)
    term.color()
Beispiel #8
0
def msgConfirm(message):
    term.color(40, 92, 5)
    print(message)
    term.color(0)
    term.color()
Beispiel #9
0
def msgWarning(message):
    term.color(40, 93, 5)
    print(message)
    term.color(0)
    term.color()
Beispiel #10
0
def msgError(message):
    term.color(40, 91, 5)
    print(message)
    term.color(0)
    term.color()