Skip to content

Commit

Permalink
Merge branch 'release/7.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbonothing64 committed May 22, 2024
2 parents 414eff7 + 7173046 commit bd17fcb
Show file tree
Hide file tree
Showing 26 changed files with 116 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge-dependency-updates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.0.0
uses: dependabot/fetch-metadata@v2.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/crowdin-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
uses: actions/checkout@v4

- name: Upload or update source files to Crowdin
uses: crowdin/[email protected].2
uses: crowdin/[email protected].4
with:
upload_sources: true

- name: Download Chinese (simplified) translations
uses: crowdin/[email protected].2
uses: crowdin/[email protected].4
with:
upload_sources: false
download_translations: true
Expand All @@ -42,7 +42,7 @@ jobs:
config: crowdin.yaml

- name: Download French translations
uses: crowdin/[email protected].2
uses: crowdin/[email protected].4
with:
upload_sources: false
download_translations: true
Expand All @@ -60,7 +60,7 @@ jobs:
config: crowdin.yaml

- name: Download German translations
uses: crowdin/[email protected].2
uses: crowdin/[email protected].4
with:
upload_sources: false
download_translations: true
Expand All @@ -78,7 +78,7 @@ jobs:
config: crowdin.yaml

- name: Download Indonesian translations
uses: crowdin/[email protected].2
uses: crowdin/[email protected].4
with:
upload_sources: false
download_translations: true
Expand All @@ -96,7 +96,7 @@ jobs:
config: crowdin.yaml

- name: Download Italian translations
uses: crowdin/[email protected].2
uses: crowdin/[email protected].4
with:
upload_sources: false
download_translations: true
Expand All @@ -114,7 +114,7 @@ jobs:
config: crowdin.yaml

- name: Download Te Reo Māori translations
uses: crowdin/[email protected].2
uses: crowdin/[email protected].4
with:
upload_sources: false
download_translations: true
Expand All @@ -132,7 +132,7 @@ jobs:
config: crowdin.yaml

- name: Download Turkish translations
uses: crowdin/[email protected].2
uses: crowdin/[email protected].4
with:
upload_sources: false
download_translations: true
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/test-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ jobs:
- name: Create coverage file
run: docker compose -f docker-compose.local.yml run --rm --user="root" django coverage xml -i
- name: Upload coverage file
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./csunplugged/coverage.xml
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-resources:
name: Tests - Resources
Expand All @@ -80,10 +82,12 @@ jobs:
- name: Create coverage file
run: docker compose -f docker-compose.local.yml run --rm --user="root" django coverage xml -i
- name: Upload coverage file
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./csunplugged/coverage.xml
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-management:
name: Tests - Management
Expand All @@ -96,10 +100,12 @@ jobs:
- name: Create coverage file
run: docker compose -f docker-compose.local.yml run --rm --user="root" django coverage xml -i
- name: Upload coverage file
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./csunplugged/coverage.xml
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-style:
name: Tests - Style
Expand Down
2 changes: 1 addition & 1 deletion csunplugged/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Module for Django system configuration."""

__version__ = "7.4.1"
__version__ = "7.5.0"
1 change: 1 addition & 0 deletions csunplugged/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@
# ------------------------------------------------------------------------------
CSRF_TRUSTED_ORIGINS = [
"https://www.csunplugged.org",
"https://cs-unplugged-dev.csse.canterbury.ac.nz",
]
3 changes: 1 addition & 2 deletions csunplugged/config/settings/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
# CSRF
# ------------------------------------------------------------------------------
CSRF_TRUSTED_ORIGINS = [
"https://www.csunplugged.org",
"https://cs-unplugged-dev.csse.canterbury.ac.nz",
"https://*.canterbury.ac.nz",
"https://cs-unplugged.localhost",
]
6 changes: 3 additions & 3 deletions csunplugged/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"browserify": "17.0.0",
"child_process": "1.0.2",
"codemirror": "5.65.6",
"cssnano": "6.1.2",
"cssnano": "7.0.1",
"blockly": "10.4.3",
"details-element-polyfill": "2.4.0",
"fancy-log": "2.0.0",
Expand All @@ -20,7 +20,7 @@
"gulp-error-handle": "1.0.1",
"gulp-filter": "9.0.1",
"gulp-if": "3.0.0",
"gulp-imagemin": "9.0.0",
"gulp-imagemin": "9.1.0",
"gulp-postcss": "10.0.0",
"gulp-sass": "5.1.0",
"gulp-sourcemaps": "3.0.0",
Expand All @@ -35,7 +35,7 @@
"postcss": "8.4.38",
"postcss-flexbugs-fixes": "5.0.2",
"reveal.js": "5.1.0",
"sass": "1.75.0",
"sass": "1.77.2",
"scratchblocks": "3.6.4",
"vinyl-buffer": "1.0.1",
"yargs": "17.7.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def data(self):
font_path = "static/fonts/PatrickHand-Regular.ttf"
font = ImageFont.truetype(font_path, 600)
BASE_COORD_X = IMAGE_SIZE_X / 2
BASE_COORD_Y = image_size_y - 100
BASE_COORD_Y = image_size_y - 150
image_size_y = image_size_y + 300

pages = []
Expand All @@ -69,7 +69,8 @@ def data(self):
background.paste(image, mask=image)
draw = ImageDraw.Draw(background)
text = str(number)
text_width, text_height = draw.textsize(text, font=font)
left, top, right, bottom = draw.textbbox((0, 0), text, font=font)
text_width, text_height = right - left, bottom - top
coord_x = BASE_COORD_X - (text_width / 2)
coord_y = BASE_COORD_Y - (text_height / 2)
draw.text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def data(self):
font_path = "static/fonts/PatrickHand-Regular.ttf"
font = ImageFont.truetype(font_path, 200)
TEXT_COORDS = [
(525, 1341),
(1589, 1341),
(525, 2889),
(1589, 2889),
(525, 1311),
(1589, 1311),
(525, 2859),
(1589, 2859),
]

pages = []
Expand All @@ -75,7 +75,8 @@ def data(self):
draw = ImageDraw.Draw(image)
for number in range(image_bits - 4, image_bits):
text = str(pow(2, number))
text_width, text_height = draw.textsize(text, font=font)
left, top, right, bottom = draw.textbbox((0, 0), text, font=font)
text_width, text_height = right - left, bottom - top
coord_x = TEXT_COORDS[number % 4][0] - (text_width / 2)
coord_y = TEXT_COORDS[number % 4][1] - (text_height / 2)
draw.text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def add_dots(self, image, column_width, show_bits_value):
coord_x_increment = column_width
coord_x = coord_x_start
base_image_coord_y = IMAGE_SIZE_Y * 0.2
base_text_coord_y = IMAGE_SIZE_Y * 0.4
base_text_coord_y = IMAGE_SIZE_Y * 0.38
dots_value = 1

while coord_x > 0:
Expand Down Expand Up @@ -204,7 +204,8 @@ def add_dots(self, image, column_width, show_bits_value):

if show_bits_value:
text = str(dots_value)
text_width, text_height = draw.textsize(text, font=SMALL_FONT)
left, top, right, bottom = draw.textbbox((0, 0), text, font=SMALL_FONT)
text_width, text_height = right - left, bottom - top
text_coord_x = coord_x - (text_width / 2)
text_coord_y = base_text_coord_y - (text_height / 2)
draw.text(
Expand Down Expand Up @@ -267,7 +268,8 @@ def add_digit_values(self, image, column_width, value_type, on):

while coord_x < IMAGE_SIZE_X:
if value_type == "binary":
text_width, text_height = draw.textsize(text, font=FONT)
left, top, right, bottom = draw.textbbox((0, 0), text, font=FONT)
text_width, text_height = right - left, bottom - top
text_coord_x = coord_x - (text_width / 2)
text_coord_y = base_coord_y - (text_height * .7)
draw.text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ def data(self):
angle = start_angle + (angle_between_numbers * number)
x_coord = radius * cos(angle) + x_center
y_coord = radius * sin(angle) + y_center
text_width, text_height = draw.textsize(text, font=font)
left, top, right, bottom = draw.textbbox((0, 0), text, font=font)
text_width, text_height = right - left, bottom - top
text_coord_x = x_coord - (text_width / 2)
text_coord_y = y_coord - (text_height / 2)
text_coord_y = y_coord - (text_height / 2) - 40
draw.text(
(text_coord_x, text_coord_y),
text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ def add_pixel_labels(self, image, draw, page_start_column, page_columns,
)

# Draw text
text_width, text_height = draw.textsize(text, font=self.FONT)
left, top, right, bottom = draw.textbbox((0, 0), text, font=self.FONT)
text_width, text_height = right - left, bottom - top
text_coord_x = (column * self.BOX_SIZE) + (self.BOX_SIZE / 2) - (text_width / 2)
text_coord_y = (row * self.BOX_SIZE) + (self.BOX_SIZE / 2) - (text_height / 2)
draw.text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
from resources.utils.BaseResourceGenerator import BaseResourceGenerator
from django.utils.translation import gettext_lazy as _
from resources.utils.resource_parameters import EnumResourceParameter, BoolResourceParameter

IMAGE_PATH = "static/img/resources/searching-cards/{}-cards-{}.png"
X_BASE_COORD = 1803
X_COORD_DECREMENT = 516
Y_COORD = 240
Y_COORD = 200
FONT_PATH = "static/fonts/PatrickHand-Regular.ttf"
FONT = ImageFont.truetype(FONT_PATH, 200)

Expand Down Expand Up @@ -94,7 +95,8 @@ def data(self):
coord_x = X_BASE_COORD
for number in page_numbers:
text = str(number)
text_width, text_height = draw.textsize(text, font=FONT)
left, top, right, bottom = draw.textbbox((0, 0), text, font=FONT)
text_width, text_height = right - left, bottom - top
draw.text(
(coord_x - (text_width / 2), Y_COORD - (text_height / 2)),
text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def data(self):
ratio = min(height_ratio, width_ratio)
width *= ratio
height *= ratio
image = image.resize((int(width), int(height)), Image.ANTIALIAS)
image = image.resize((int(width), int(height)), Image.LANCZOS)
if image_number % 2 == 0:
page = card_outlines.copy()
draw = ImageDraw.Draw(page)
Expand Down Expand Up @@ -169,9 +169,10 @@ def data(self):
else:
(x, y) = card_centers[1]

text_width, text_height = draw.textsize(text_string, font=font)
left, top, right, bottom = draw.textbbox((0, 0), text_string, font=font)
text_width, text_height = right - left, bottom - top
coord_x = x - (text_width / 2)
coord_y = y - (text_height / 1.5)
coord_y = y - text_height
draw.text(
(coord_x, coord_y),
text_string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ def data(self):
coord_x_increment = 204
for number in numbers:
text = str(number)
text_width, text_height = draw.textsize(text, font=font)
left, top, right, bottom = draw.textbbox((0, 0), text, font=font)
text_width, text_height = right - left, bottom - top
coord_x = base_coord_x - (text_width / 2)
coord_y = base_coord_y - (text_height / 2)
coord_y = base_coord_y - (text_height / 1.2)
draw.text(
(coord_x, coord_y),
text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def resize_encode_resource_image(image, max_pixel_height):
ratio = max_pixel_height / height
width *= ratio
height *= ratio
image = image.resize((int(width), int(height)), Image.ANTIALIAS)
image = image.resize((int(width), int(height)), Image.LANCZOS)
# Convert from Image object to base64 string
image_buffer = BytesIO()
image.save(image_buffer, format="PNG")
Expand Down
Loading

0 comments on commit bd17fcb

Please sign in to comment.