import gkeepapi # type: ignore
-import constants
+import kiosk_constants
import file_writer
import renderer
import kiosk_secrets as secrets
contents = contents.replace(
"\u2610 ", '<LI><INPUT TYPE="checkbox"> '
)
- contents = linkify.sub(r'<a href="\1">\1</a>', contents)
+ #contents = linkify.sub(r'<a href="\1">\1</a>', contents)
individual_lines = contents.split("\n")
num_lines = len(individual_lines)
- max_length = 0
contents = ""
for x in individual_lines:
length = len(x)
- if length > max_length:
- max_length = length
leading_spaces = len(x) - len(x.lstrip(" "))
leading_spaces //= 2
leading_spaces = int(leading_spaces)
<HR style="border-top:3px solid white;">
"""
)
- if num_lines >= 12 and max_length < 120:
+ if num_lines >= 12:
logger.debug(
- f"{num_lines} lines (max={max_length} chars): two columns"
+ f"{num_lines} lines: two column mode"
)
f.write('<TABLE BORDER=0 WIDTH=100%><TR valign="top">')
f.write(
f.write("</UL></FONT></TD></TR></TABLE></DIV>\n")
else:
logger.debug(
- f"{num_lines} lines (max={max_length} chars): one column"
+ f"{num_lines} lines: one column mode"
)
f.write(f"<FONT><UL>{contents}</UL></FONT>")
f.write("</DIV>")
else:
logger.debug(f"Note is empty, deleting {filename}.")
- _ = os.path.join(constants.pages_dir, filename)
+ _ = os.path.join(kiosk_constants.pages_dir, filename)
try:
os.remove(_)
except:
# Test
+#logger.setLevel(logging.DEBUG)
+#ch = logging.StreamHandler()
+#ch.setLevel(logging.DEBUG)
+#formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+#ch.setFormatter(formatter)
+#logger.addHandler(ch)
#x = gkeep_renderer({"Test", 1234})
#x.periodic_render("Test")