Skip to content

Commit

Permalink
Update gen_controls.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Sid220 committed Apr 23, 2024
1 parent 3b46106 commit 93b5fab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/gen_controls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import os
import re
import json
from reportlab.lib.utils import ImageReader
from reportlab.pdfgen import canvas
from PIL import Image

file_path = os.path.split(os.path.realpath(__file__))[0] + '/'


def extract_comments(text):
pattern = r'/\*RHRXBox\s*\n\s*\*Type:\s*(\d+)\s*\n\s*\*Btn:\s*(\d+)\s*\n\s*\*Desc:\s*(.*?)\*/'
Expand All @@ -13,7 +16,7 @@ def extract_comments(text):


def open_file():
java_file_path = 'src/main/java/frc/robot/Robot.java'
java_file_path = file_path + '../src/main/java/frc/robot/Robot.java'
with open(java_file_path, 'r') as file:
java_code = file.read()

Expand Down Expand Up @@ -64,7 +67,7 @@ def draw_text(c, btn, text):


def to_pdf(btns, type_id):
controller_image = Image.open("xbox" + str(type_id) + ".png")
controller_image = Image.open(file_path + "xbox" + str(type_id) + ".png")

reportlab_pil_img = ImageReader(controller_image)

Expand Down

0 comments on commit 93b5fab

Please sign in to comment.