You've already forked adareducer
mirror of
https://github.com/AdaCore/adareducer.git
synced 2026-02-12 13:10:07 -08:00
For the benefit of the development environment, or any users who only "git clone" this repository and work from it. Fix the testsuite using this. Rename the "adareducer" source dir to "ada_reducer"
48 lines
992 B
Python
48 lines
992 B
Python
# In some environment (e.g. Windows), this module is not disfunctional
|
|
try:
|
|
from curses import wrapper
|
|
except ModuleNotFoundError:
|
|
wrapper = None
|
|
|
|
|
|
debug = False
|
|
debug = True
|
|
|
|
|
|
class Window(object):
|
|
def __init__(self):
|
|
self.characters_removed = 0
|
|
|
|
def run(self, engine):
|
|
self.engine = engine
|
|
if debug or wrapper is None:
|
|
self.engine.run()
|
|
else:
|
|
wrapper(self.main)
|
|
|
|
def add_chars_removed(self, count):
|
|
"""Tell the gui that count characters have been removed"""
|
|
self.characters_removed += count
|
|
self.log(f"Total characters removed: {self.characters_removed}")
|
|
|
|
def main(self, stdscr):
|
|
self.scr = stdscr
|
|
self.scr.clear()
|
|
|
|
self.engine.run()
|
|
self.scr.refresh()
|
|
self.scr.getkey()
|
|
|
|
def log(self, msg):
|
|
if debug:
|
|
print(msg)
|
|
else:
|
|
self.scr.addstr(0, 0, str(msg))
|
|
|
|
|
|
GUI = Window()
|
|
|
|
|
|
def log(msg):
|
|
GUI.log(msg)
|