| 661 | |
| 662 | messagequeue = [] # add messages generated during loading here |
| 663 | class Message: |
| 664 | def __init__(self, msg): |
| 665 | if not 'window' in globals(): |
| 666 | print(msg) # dump it to console just in case |
| 667 | messagequeue.append(msg) # but we'll display this later |
| 668 | return |
| 669 | self.batch = pyglet.graphics.Batch() |
| 670 | self.label = pyglet.text.Label(msg, |
| 671 | font_name=self.fontlist_serif, |
| 672 | color=cfg.COLOR_TEXT, |
| 673 | batch=self.batch, |
| 674 | multiline=True, |
| 675 | width=(4*window.width)/5, |
| 676 | font_size=calc_fontsize(14), |
| 677 | x=width_center(), y=height_center(), |
| 678 | anchor_x='center', anchor_y='center') |
| 679 | window.push_handlers(self.on_key_press, self.on_draw) |
| 680 | self.on_draw() |
| 681 | |
| 682 | def on_key_press(self, sym, mod): |
| 683 | if sym: |
| 684 | self.close() |
| 685 | return pyglet.event.EVENT_HANDLED |
| 686 | |
| 687 | def close(self): |
| 688 | return window.remove_handlers(self.on_key_press, self.on_draw) |
| 689 | |
| 690 | def on_draw(self): |
| 691 | window.clear() |
| 692 | self.batch.draw() |
| 693 | return pyglet.event.EVENT_HANDLED |
| 694 | |
| 695 | def load_last_user(lastuserpath): |
| 696 | path = os.path.join(get_data_dir(), lastuserpath) |
no outgoing calls