fix multiline order

This commit is contained in:
Yair 2024-01-07 10:44:23 +00:00
parent fed3a8f082
commit 2364d1ae6d
2 changed files with 23 additions and 7 deletions

14
readme
View File

@ -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:

16
txt.py
View File

@ -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}")