prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Modify Job Badges printable to use one string per badge
  Currently the way the strings are broken for translation doesn't support all languages (for example: Māori has a word after the emphasis of the role).
  
  </issue>
  <code>
  [start of csunplugged/resources/generators/JobBadgesResourceGenerator.py]
  1 """Class for Job Badges resource generator."""
  2 
  3 from PIL import Image, ImageDraw
  4 from resources.utils.BaseResourceGenerator import BaseResourceGenerator
  5 from django.utils.translation import ugettext_lazy as _
  6 from utils.TextBoxDrawer import TextBoxDrawer
  7 
  8 
  9 class JobBadgesResourceGenerator(BaseResourceGenerator):
  10     """Class for Job Badges resource generator."""
  11 
  12     def data(self):
  13         """Create data for a copy of the Job Badges resource.
  14 
  15         Returns:
  16             A dictionary of the one page for the resource.
  17         """
  18         path = "static/img/resources/job-badges/job-badges"
  19         image_path = "{}.png".format(path)
  20         svg_path = "{}.svg".format(path)
  21         image = Image.open(image_path)
  22 
  23         draw = ImageDraw.Draw(image)
  24         textbox_drawer = TextBoxDrawer(image, draw, svg_path)
  25 
  26         hello_ids = [
  27             "programmer_hello1",
  28             "programmer_hello2",
  29             "tester_hello1",
  30             "tester_hello2",
  31             "bot_hello1",
  32             "bot_hello2",
  33         ]
  34 
  35         for hello_id in hello_ids:
  36             textbox_drawer.write_text_box(
  37                 hello_id,
  38                 _("Hello, I'm a"),
  39                 horiz_just="center"
  40             )
  41 
  42         for i in range(1, 3):
  43             textbox_drawer.write_text_box(
  44                 "programmer{}".format(i),
  45                 _("Programmer"),
  46                 horiz_just="center"
  47             )
  48             textbox_drawer.write_text_box(
  49                 "tester{}".format(i),
  50                 _("Tester"),
  51                 horiz_just="center"
  52             )
  53             textbox_drawer.write_text_box(
  54                 "bot{}".format(i),
  55                 _("Bot"),
  56                 horiz_just="center"
  57             )
  58 
  59         return {"type": "image", "data": image}
  60
  [end of csunplugged/resources/generators/JobBadgesResourceGenerator.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/csunplugged/resources/generators/JobBadgesResourceGenerator.py b/csunplugged/resources/generators/JobBadgesResourceGenerator.py
  --- a/csunplugged/resources/generators/JobBadgesResourceGenerator.py
  +++ b/csunplugged/resources/generators/JobBadgesResourceGenerator.py
  @@ -1,9 +1,20 @@
   """Class for Job Badges resource generator."""
   
   from PIL import Image, ImageDraw
  -from resources.utils.BaseResourceGenerator import BaseResourceGenerator
  +from utils.TextBoxDrawer import TextBox, TextBoxDrawer
   from django.utils.translation import ugettext_lazy as _
  -from utils.TextBoxDrawer import TextBoxDrawer
  +from resources.utils.BaseResourceGenerator import BaseResourceGenerator
  +from resources.utils.coords import calculate_box_vertices
  +
  +FONT_PATH = "static/fonts/PatrickHand-Regular.ttf"
  +FONT_SIZE = 200
  +TEXTBOX_WIDTH = 1000
  +TEXTBOX_HEIGHT = 275
  +LABEL_DATA = {
  +    "programmer": _("Hello, I'm a Programmer"),
  +    "tester": _("Hello, I'm a Tester"),
  +    "bot": _("Hello, I'm a Bot"),
  +}
   
   
   class JobBadgesResourceGenerator(BaseResourceGenerator):
  @@ -15,45 +26,38 @@
           Returns:
               A dictionary of the one page for the resource.
           """
  -        path = "static/img/resources/job-badges/job-badges"
  -        image_path = "{}.png".format(path)
  -        svg_path = "{}.svg".format(path)
  +        image_path = "static/img/resources/job-badges/job-badges.png"
           image = Image.open(image_path)
  -
           draw = ImageDraw.Draw(image)
  -        textbox_drawer = TextBoxDrawer(image, draw, svg_path)
  -
  -        hello_ids = [
  -            "programmer_hello1",
  -            "programmer_hello2",
  -            "tester_hello1",
  -            "tester_hello2",
  -            "bot_hello1",
  -            "bot_hello2",
  -        ]
  -
  -        for hello_id in hello_ids:
  -            textbox_drawer.write_text_box(
  -                hello_id,
  -                _("Hello, I'm a"),
  -                horiz_just="center"
  -            )
  -
  -        for i in range(1, 3):
  -            textbox_drawer.write_text_box(
  -                "programmer{}".format(i),
  -                _("Programmer"),
  -                horiz_just="center"
  -            )
  -            textbox_drawer.write_text_box(
  -                "tester{}".format(i),
  -                _("Tester"),
  -                horiz_just="center"
  -            )
  -            textbox_drawer.write_text_box(
  -                "bot{}".format(i),
  -                _("Bot"),
  -                horiz_just="center"
  -            )
  +        textbox_drawer = TextBoxDrawer(image, draw)
  +
  +        # coordinates of top left point of text box
  +        top_left_x_coords = [50, 1200]
  +        top_left_y_coord = 100
  +
  +        # Add text labels
  +        for label, label_text in LABEL_DATA.items():
  +            for top_left_x_coord in top_left_x_coords:
  +                vertices = calculate_box_vertices(
  +                    (top_left_x_coord, top_left_y_coord),
  +                    TEXTBOX_WIDTH,
  +                    TEXTBOX_HEIGHT
  +                )
  +                box = TextBox(
  +                    vertices=vertices,
  +                    width=TEXTBOX_WIDTH,
  +                    height=TEXTBOX_HEIGHT,
  +                    font_path=FONT_PATH,
  +                    font_size=FONT_SIZE,
  +                )
  +                textbox_drawer.write_text_box(
  +                    box,
  +                    label_text,
  +                    horiz_just="center",
  +                    vert_just="center",
  +                )
  +
  +            # increase y coord for next name tag down
  +            top_left_y_coord += 675
   
           return {"type": "image", "data": image}
  
verification_info: {"golden_diff": "diff --git a/csunplugged/resources/generators/JobBadgesResourceGenerator.py b/csunplugged/resources/generators/JobBadgesResourceGenerator.py\n--- a/csunplugged/resources/generators/JobBadgesResourceGenerator.py\n+++ b/csunplugged/resources/generators/JobBadgesResourceGenerator.py\n@@ -1,9 +1,20 @@\n \"\"\"Class for Job Badges resource generator.\"\"\"\n \n from PIL import Image, ImageDraw\n-from resources.utils.BaseResourceGenerator import BaseResourceGenerator\n+from utils.TextBoxDrawer import TextBox, TextBoxDrawer\n from django.utils.translation import ugettext_lazy as _\n-from utils.TextBoxDrawer import TextBoxDrawer\n+from resources.utils.BaseResourceGenerator import BaseResourceGenerator\n+from resources.utils.coords import calculate_box_vertices\n+\n+FONT_PATH = \"static/fonts/PatrickHand-Regular.ttf\"\n+FONT_SIZE = 200\n+TEXTBOX_WIDTH = 1000\n+TEXTBOX_HEIGHT = 275\n+LABEL_DATA = {\n+    \"programmer\": _(\"Hello, I'm a Programmer\"),\n+    \"tester\": _(\"Hello, I'm a Tester\"),\n+    \"bot\": _(\"Hello, I'm a Bot\"),\n+}\n \n \n class JobBadgesResourceGenerator(BaseResourceGenerator):\n@@ -15,45 +26,38 @@\n         Returns:\n             A dictionary of the one page for the resource.\n         \"\"\"\n-        path = \"static/img/resources/job-badges/job-badges\"\n-        image_path = \"{}.png\".format(path)\n-        svg_path = \"{}.svg\".format(path)\n+        image_path = \"static/img/resources/job-badges/job-badges.png\"\n         image = Image.open(image_path)\n-\n         draw = ImageDraw.Draw(image)\n-        textbox_drawer = TextBoxDrawer(image, draw, svg_path)\n-\n-        hello_ids = [\n-            \"programmer_hello1\",\n-            \"programmer_hello2\",\n-            \"tester_hello1\",\n-            \"tester_hello2\",\n-            \"bot_hello1\",\n-            \"bot_hello2\",\n-        ]\n-\n-        for hello_id in hello_ids:\n-            textbox_drawer.write_text_box(\n-                hello_id,\n-                _(\"Hello, I'm a\"),\n-                horiz_just=\"center\"\n-            )\n-\n-        for i in range(1, 3):\n-            textbox_drawer.write_text_box(\n-                \"programmer{}\".format(i),\n-                _(\"Programmer\"),\n-                horiz_just=\"center\"\n-            )\n-            textbox_drawer.write_text_box(\n-                \"tester{}\".format(i),\n-                _(\"Tester\"),\n-                horiz_just=\"center\"\n-            )\n-            textbox_drawer.write_text_box(\n-                \"bot{}\".format(i),\n-                _(\"Bot\"),\n-                horiz_just=\"center\"\n-            )\n+        textbox_drawer = TextBoxDrawer(image, draw)\n+\n+        # coordinates of top left point of text box\n+        top_left_x_coords = [50, 1200]\n+        top_left_y_coord = 100\n+\n+        # Add text labels\n+        for label, label_text in LABEL_DATA.items():\n+            for top_left_x_coord in top_left_x_coords:\n+                vertices = calculate_box_vertices(\n+                    (top_left_x_coord, top_left_y_coord),\n+                    TEXTBOX_WIDTH,\n+                    TEXTBOX_HEIGHT\n+                )\n+                box = TextBox(\n+                    vertices=vertices,\n+                    width=TEXTBOX_WIDTH,\n+                    height=TEXTBOX_HEIGHT,\n+                    font_path=FONT_PATH,\n+                    font_size=FONT_SIZE,\n+                )\n+                textbox_drawer.write_text_box(\n+                    box,\n+                    label_text,\n+                    horiz_just=\"center\",\n+                    vert_just=\"center\",\n+                )\n+\n+            # increase y coord for next name tag down\n+            top_left_y_coord += 675\n \n         return {\"type\": \"image\", \"data\": image}\n", "issue": "Modify Job Badges printable to use one string per badge\nCurrently the way the strings are broken for translation doesn't support all languages (for example: M\u0101ori has a word after the emphasis of the role).\n", "before_files": [{"content": "\"\"\"Class for Job Badges resource generator.\"\"\"\n\nfrom PIL import Image, ImageDraw\nfrom resources.utils.BaseResourceGenerator import BaseResourceGenerator\nfrom django.utils.translation import ugettext_lazy as _\nfrom utils.TextBoxDrawer import TextBoxDrawer\n\n\nclass JobBadgesResourceGenerator(BaseResourceGenerator):\n    \"\"\"Class for Job Badges resource generator.\"\"\"\n\n    def data(self):\n        \"\"\"Create data for a copy of the Job Badges resource.\n\n        Returns:\n            A dictionary of the one page for the resource.\n        \"\"\"\n        path = \"static/img/resources/job-badges/job-badges\"\n        image_path = \"{}.png\".format(path)\n        svg_path = \"{}.svg\".format(path)\n        image = Image.open(image_path)\n\n        draw = ImageDraw.Draw(image)\n        textbox_drawer = TextBoxDrawer(image, draw, svg_path)\n\n        hello_ids = [\n            \"programmer_hello1\",\n            \"programmer_hello2\",\n            \"tester_hello1\",\n            \"tester_hello2\",\n            \"bot_hello1\",\n            \"bot_hello2\",\n        ]\n\n        for hello_id in hello_ids:\n            textbox_drawer.write_text_box(\n                hello_id,\n                _(\"Hello, I'm a\"),\n                horiz_just=\"center\"\n            )\n\n        for i in range(1, 3):\n            textbox_drawer.write_text_box(\n                \"programmer{}\".format(i),\n                _(\"Programmer\"),\n                horiz_just=\"center\"\n            )\n            textbox_drawer.write_text_box(\n                \"tester{}\".format(i),\n                _(\"Tester\"),\n                horiz_just=\"center\"\n            )\n            textbox_drawer.write_text_box(\n                \"bot{}\".format(i),\n                _(\"Bot\"),\n                horiz_just=\"center\"\n            )\n\n        return {\"type\": \"image\", \"data\": image}\n", "path": "csunplugged/resources/generators/JobBadgesResourceGenerator.py"}]}