learning-credentials 0.3.1rc1__tar.gz → 0.3.1rc2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/CHANGELOG.rst +1 -0
  2. {learning_credentials-0.3.1rc1/learning_credentials.egg-info → learning_credentials-0.3.1rc2}/PKG-INFO +2 -1
  3. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/generators.py +4 -1
  4. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2/learning_credentials.egg-info}/PKG-INFO +2 -1
  5. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/pyproject.toml +1 -1
  6. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/tests/test_generators.py +3 -3
  7. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/LICENSE.txt +0 -0
  8. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/MANIFEST.in +0 -0
  9. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/README.rst +0 -0
  10. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/__init__.py +0 -0
  11. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/admin.py +0 -0
  12. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/api/__init__.py +0 -0
  13. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/api/urls.py +0 -0
  14. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/api/v1/__init__.py +0 -0
  15. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/api/v1/permissions.py +0 -0
  16. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/api/v1/urls.py +0 -0
  17. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/api/v1/views.py +0 -0
  18. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/apps.py +0 -0
  19. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/compat.py +0 -0
  20. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/conf/locale/config.yaml +0 -0
  21. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/exceptions.py +0 -0
  22. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/migrations/0001_initial.py +0 -0
  23. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/migrations/0002_migrate_to_learning_credentials.py +0 -0
  24. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/migrations/0003_rename_certificates_to_credentials.py +0 -0
  25. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/migrations/0004_replace_course_keys_with_learning_context_keys.py +0 -0
  26. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/migrations/0005_rename_processors_and_generators.py +0 -0
  27. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/migrations/0006_cleanup_openedx_certificates_tables.py +0 -0
  28. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/migrations/__init__.py +0 -0
  29. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/models.py +0 -0
  30. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/processors.py +0 -0
  31. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/settings/__init__.py +0 -0
  32. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/settings/common.py +0 -0
  33. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/settings/production.py +0 -0
  34. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/tasks.py +0 -0
  35. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/templates/learning_credentials/base.html +0 -0
  36. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/body.html +0 -0
  37. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/body.txt +0 -0
  38. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/from_name.txt +0 -0
  39. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/head.html +0 -0
  40. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/subject.txt +0 -0
  41. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials/urls.py +0 -0
  42. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials.egg-info/SOURCES.txt +0 -0
  43. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials.egg-info/dependency_links.txt +0 -0
  44. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials.egg-info/entry_points.txt +0 -0
  45. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials.egg-info/requires.txt +0 -0
  46. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/learning_credentials.egg-info/top_level.txt +0 -0
  47. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/setup.cfg +0 -0
  48. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/tests/test_models.py +0 -0
  49. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/tests/test_processors.py +0 -0
  50. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/tests/test_tasks.py +0 -0
  51. {learning_credentials-0.3.1rc1 → learning_credentials-0.3.1rc2}/tests/test_views.py +0 -0
@@ -27,6 +27,7 @@ Added
27
27
  * Support for \n in learning context names in PDF certificates.
28
28
  * Options for uppercase name and issue date in PDF certificates.
29
29
  * Option for defining character spacing for issue date in PDF certificates.
30
+ * Option for defining the horizontal offset of the issue date from its centered position (``issue_date_x``).
30
31
 
31
32
  Modified
32
33
  ========
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: learning-credentials
3
- Version: 0.3.1rc1
3
+ Version: 0.3.1rc2
4
4
  Summary: A pluggable service for preparing Open edX credentials.
5
5
  Author-email: OpenCraft <help@opencraft.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -187,6 +187,7 @@ Added
187
187
  * Support for \n in learning context names in PDF certificates.
188
188
  * Options for uppercase name and issue date in PDF certificates.
189
189
  * Option for defining character spacing for issue date in PDF certificates.
190
+ * Option for defining the horizontal offset of the issue date from its centered position (``issue_date_x``).
190
191
 
191
192
  Modified
192
193
  ========
@@ -46,7 +46,7 @@ def _get_user_name(user: User) -> str:
46
46
  return user.profile.name or f"{user.first_name} {user.last_name}"
47
47
 
48
48
 
49
- def _register_font(font_name: Any) -> str | None: # noqa: ANN401
49
+ def _register_font(font_name: str) -> str | None:
50
50
  """
51
51
  Register a custom font if specified in options. If not specified, use the default font (Helvetica).
52
52
 
@@ -134,6 +134,7 @@ def _write_text_on_template(template: PageObject, username: str, context_name: s
134
134
  pdf_canvas.setFillColorRGB(*hex_to_rgb(issue_date_color))
135
135
 
136
136
  issue_date_x = (template_width - pdf_canvas.stringWidth(issue_date)) / 2
137
+ issue_date_x += options.get('issue_date_x', 0)
137
138
  issue_date_y = options.get('issue_date_y', 120)
138
139
 
139
140
  issue_date_char_space = options.get(
@@ -215,6 +216,8 @@ def generate_pdf_credential(
215
216
  - context_name_color: The color of the context name on the credential (hexadecimal color code).
216
217
  - context_name_size: The font size of the context name on the credential. The default value is 28.
217
218
  - context_name_font: The font of the context name on the credential. It overrides the `font` option.
219
+ - issue_date_x: The horizontal offset for the issue date from its centered position
220
+ (positive values move right, negative values move left; default is 0).
218
221
  - issue_date_y: The Y coordinate of the issue date on the credential (vertical position on the template).
219
222
  - issue_date_color: The color of the issue date on the credential (hexadecimal color code).
220
223
  - issue_date_size: The font size of the issue date on the credential. The default value is 12.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: learning-credentials
3
- Version: 0.3.1rc1
3
+ Version: 0.3.1rc2
4
4
  Summary: A pluggable service for preparing Open edX credentials.
5
5
  Author-email: OpenCraft <help@opencraft.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -187,6 +187,7 @@ Added
187
187
  * Support for \n in learning context names in PDF certificates.
188
188
  * Options for uppercase name and issue date in PDF certificates.
189
189
  * Option for defining character spacing for issue date in PDF certificates.
190
+ * Option for defining the horizontal offset of the issue date from its centered position (``issue_date_x``).
190
191
 
191
192
  Modified
192
193
  ========
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "learning-credentials"
3
- version = "0.3.1-rc1"
3
+ version = "0.3.1-rc2"
4
4
  description = "A pluggable service for preparing Open edX credentials."
5
5
  dynamic = ["readme"]
6
6
  requires-python = ">=3.11"
@@ -42,8 +42,7 @@ def test_get_user_name():
42
42
  @patch("learning_credentials.generators.CredentialAsset.get_asset_by_slug")
43
43
  def test_register_font_without_custom_font(mock_get_asset_by_slug: Mock):
44
44
  """Test the _register_font falls back to the default font when no custom font is specified."""
45
- options = {}
46
- assert _register_font(options) is None
45
+ assert _register_font('') is None
47
46
  mock_get_asset_by_slug.assert_not_called()
48
47
 
49
48
 
@@ -86,6 +85,7 @@ def test_register_font_with_registration_failure(
86
85
  {
87
86
  'name_y': 250,
88
87
  'context_name_y': 200,
88
+ 'issue_date_x': 100,
89
89
  'issue_date_y': 150,
90
90
  'name_color': '123',
91
91
  'context_name_color': '#9B192A',
@@ -135,7 +135,7 @@ def test_write_text_on_template(mock_canvas_class: Mock, context_name: str, opti
135
135
  expected_name_y = options.get('name_y', 290)
136
136
  expected_context_name_x = (template_width - string_width) / 2
137
137
  expected_context_name_y = options.get('context_name_y', 220)
138
- expected_issue_date_x = (template_width - string_width) / 2
138
+ expected_issue_date_x = (template_width - string_width) / 2 + options.get('issue_date_x', 0)
139
139
  expected_issue_date_y = options.get('issue_date_y', 120)
140
140
 
141
141
  # Expected colors for setFillColorRGB method