Skip to content

Commit 1c48031

Browse files
chore: fill scanning and printing messages to match full width
1 parent 0b181ca commit 1c48031

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/bot/routers/printing/printing_tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
77

88
from src.bot.fsm_data import FSMData
9+
from src.bot.shared_messages import MAX_WIDTH_FILLER
910
from src.config_schema import Printer
1011
from src.modules.printing.entity_models import JobAttributes, JobStateEnum, PrinterStatus
1112

@@ -23,7 +24,7 @@ def format_draft_message(
2324
assert "sides" in data
2425
assert "copies" in data
2526

26-
caption = "Document is ready to be printed\n"
27+
caption = f"Document is ready to be printed{MAX_WIDTH_FILLER}\n"
2728
total_papers = count_of_papers_to_print(
2829
pages=data["pages"],
2930
page_ranges=data["page_ranges"],
@@ -110,7 +111,7 @@ def format_printing_message(
110111
display_sides = html.bold("One side") if data["sides"] == "one-sided" else html.bold("Two sides")
111112
display_layout = html.bold(html.quote(LAYOUT))
112113
caption = (
113-
html.bold("🖨 Printing job:\n")
114+
html.bold(f"🖨 Printing job:{MAX_WIDTH_FILLER}\n")
114115
+ html.italic(f"⦁ Printer: {display_printer}\n")
115116
+ html.italic(f"⦁ Copies: {display_copies}\n")
116117
+ html.italic(f"⦁ Layout: {display_layout}\n")

src/bot/routers/scanning/scanning_tools.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
66

77
from src.bot.fsm_data import FSMData
8+
from src.bot.shared_messages import MAX_WIDTH_FILLER
89
from src.config_schema import Scanner
910

1011

@@ -64,17 +65,17 @@ def empty_inline_space_remainder(string):
6465
text = ""
6566
if data["mode"] == "manual":
6667
text += (
67-
html.bold("📠 Manual Scan.\n")
68+
html.bold(f"📠 Manual Scan.{MAX_WIDTH_FILLER}\n")
6869
+ "Please place your document on the scanner glass.\n"
6970
+ "You will be able to scan multiple pages one-by-one.\n\n"
7071
)
7172
elif data["mode"] == "auto":
7273
text += (
73-
html.bold("📠 Auto Scan.\n")
74+
html.bold(f"📠 Auto Scan.{MAX_WIDTH_FILLER}\n")
7475
+ "Please place all your papers in the automatic feeder on top of the printer.\n\n"
7576
)
7677
else:
77-
text += html.bold("📠 Scan.\n") + "Not ready. Configure the options first"
78+
text += html.bold(f"📠 Scan.{MAX_WIDTH_FILLER}\n") + "Not ready. Configure the options first\n\n"
7879

7980
if scanner:
8081
text += f"🖨 {scanner.display_name}\n"
@@ -98,11 +99,11 @@ def format_scanning_header(data: FSMData, scanner: Scanner | None) -> str:
9899

99100
text = ""
100101
if data["mode"] == "manual":
101-
text += html.bold("📠 Manual Scan:\n")
102+
text += html.bold(f"📠 Manual Scan:{MAX_WIDTH_FILLER}\n")
102103
elif data["mode"] == "auto":
103-
text += html.bold("📠 Auto Scan:\n")
104+
text += html.bold(f"📠 Auto Scan:{MAX_WIDTH_FILLER}\n")
104105
else:
105-
text += html.bold("📠 Scan:\n")
106+
text += html.bold(f"📠 Scan:{MAX_WIDTH_FILLER}\n")
106107
text += (
107108
html.italic(f"⦁ Scanner: {display_scanner}\n")
108109
+ html.italic(f"⦁ Quality: {display_quality}\n")
@@ -145,10 +146,9 @@ def format_scanning_paused_message(
145146
) -> tuple[str, InlineKeyboardMarkup | None]:
146147
caption = format_scanning_header(data, scanner)
147148
if is_finished:
148-
caption += html.italic("✅ Finished")
149+
caption += html.italic("✅ Finished\n")
149150
else:
150-
caption += html.italic("✅ Completed")
151-
caption += " " * 100 + "‍"
151+
caption += html.italic("✅ Completed\n")
152152

153153
if is_finished:
154154
return caption, None

src/bot/shared_messages.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from aiogram.fsm.state import default_state
44
from aiogram.types import CallbackQuery, Message
55

6+
MAX_WIDTH_FILLER = " " * 100 + "‍"
7+
68
HELP_HTML_MESSAGE = """
79
🖨 <b>@InnoPrintBot</b> is a bot for printing & scanning documents with <b>Innopolis University printers</b>.
810

0 commit comments

Comments
 (0)