diff --git a/readme b/readme index afa9f07..650a0c0 100644 --- a/readme +++ b/readme @@ -5,6 +5,20 @@ brother_ql -b pyusb -m QL-550 -p usb://0x04f9:0x2016 print -l 62 pefectFake.jpg byobu new-window -n 'printer' 'cd ~/printBash && bash switch.sh' ``` +``` + + + + +sudo systemctl daemon-reload +#to reload the systemd manager configuration. +#Run +sudo systemctl enable switch.service +#to enable the service to start at boot. +#Run +sudo systemctl start switch.service +#to start the service immediately. +``` To command the camera in the terminal I suggest to use the fswebcam package. To install: diff --git a/txt.py b/txt.py index deed706..e85e73e 100644 --- a/txt.py +++ b/txt.py @@ -63,27 +63,29 @@ def map_to_keyboard_hebrew(input_text): def rtl_text_wrap(text, width): words = text.split() - # Reverse the order of words for RTL language - words = words[::-1] - lines = [] current_line = [] current_line_length = 0 - for word in words: # No need to reverse the words list again + for word in words: if current_line_length + len(word) <= width: - current_line.append(word) - current_line_length += len(word) + 1 # +1 for the space + current_line.insert(0, word) # Insert word at the beginning of the current line + current_line_length += len(word) + 1 else: + # When the line exceeds the width, finalize the current line lines.append(' '.join(current_line)) current_line = [word] current_line_length = len(word) + 1 - lines.append(' '.join(current_line)) # Add the last line + # Add the last line to the lines list + lines.append(' '.join(current_line)) + return '\n'.join(lines) + + while True: user_input = input("Type something (or press Enter to generate image): ") logging.info(f"User input: {user_input}")