mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Export txt version of kneeboard pages
This commit is contained in:
parent
b4b19d3ad5
commit
199467f31b
@ -10,6 +10,7 @@
|
||||
* **[Modding]** Support for A-7E Corsair II (presumed latest available version)
|
||||
* **[Squadrons]** Added many new squadron's by Adecarcer
|
||||
* **[Plugins]** Updated 'expl_table' in Splash Damage script.
|
||||
* **[Mission Generation]** Also save kneeboards in txt-format, found under "kneeboards" within Retribution's installation folder after pressing take-off.
|
||||
|
||||
## Fixes
|
||||
* **[New Game Wizard]** Settings would not persist when going back to a previous page.
|
||||
|
||||
@ -89,6 +89,7 @@ class KneeboardPageWriter:
|
||||
self.x = page_margin
|
||||
self.y = page_margin
|
||||
self.line_spacing = line_spacing
|
||||
self.text_buffer: List[str] = []
|
||||
|
||||
@property
|
||||
def position(self) -> Tuple[int, int]:
|
||||
@ -117,6 +118,13 @@ class KneeboardPageWriter:
|
||||
self.draw.text(self.position, text, font=font, fill=fill)
|
||||
width, height = self.draw.textsize(text, font=font)
|
||||
self.y += height + self.line_spacing
|
||||
self.text_buffer.append(text)
|
||||
|
||||
def flush_text_buffer(self) -> None:
|
||||
self.text_buffer = []
|
||||
|
||||
def get_text_string(self) -> str:
|
||||
return "\n".join(x for x in self.text_buffer)
|
||||
|
||||
def title(self, title: str) -> None:
|
||||
self.text(title, font=self.title_font, fill=self.foreground_fill)
|
||||
@ -139,6 +147,8 @@ class KneeboardPageWriter:
|
||||
|
||||
def write(self, path: Path) -> None:
|
||||
self.image.save(path)
|
||||
print(path.with_suffix(".txt"))
|
||||
path.with_suffix(".txt").write_text(self.get_text_string())
|
||||
|
||||
@staticmethod
|
||||
def wrap_line(inputstr: str, max_length: int) -> str:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user