Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
TODO
Done
- Design an import dialog
- Open it when dropping images
- Open it via a menu entry
- Add additional images via a dialog option
- Edit card properties and copies count
- Edit custom cards in the page card table view
- Editing custom cards in the document does not trigger a re-draw in the document renderer, because the pixmap does not change
- A custom card registry holding a reference to all created custom cards during the application runtime
- Can be a static CardDatabase class attribute
- Obtain the registered custom card when the user adds additional copies via the import wizard
- When the user does this, and edits the card via the CardListTable in the dialog, propagate changes to the copies already in the document.
Fix for saving/loading, keeping image quality
- The file hash was based on the scaled QPixmap PNG encoding. This may be unstable. (DONE. Hash is now based on the untouched source image bytes)
- The save file should save the original file unmodified, so that different sizes can be derived without progressing generational quality losses. Scaling must be done at image load time (DONE)
- The file hash alone is insufficient as a key. Needs a composite key including the card size (POINT OBSOLETE)
- Image size is no longer part of the CustomCard data. It can be used to create cards of arbitrary size. Actual size depends on the page the card is on. (DONE)
Fix idea
- Create CustomCard class, implementing the Card API (DONE)
- Holds the original pixmap in a private attribute (DONE)
- Uses a cached property to return the pixmap scaled according the the size setting (DONE)
- Remove the is_oversized flag from the CustomCardData table (DONE)
- Use the size hint in Page to create custom cards of appropriate size (DONE)
Not done yet
- Implement tests for all item editor delegates
- Implement switching card size between regular and oversized
Editing card size needs more work
- Handling this is needed:
- User adds a custom card as regular size
- Adds the same card image again, this time as oversized
- User edits the card size from regular to oversized, or vice versa
- This should merge both cards
- The custom card registry needs to update the map key from
custom_card_id
totuple(custom_card_id, card_size)
- Switching card sizes very likely creates a mixed page, so editing the size requires moving cards around
- Maybe ask via a message box "Edit all instances? [Yes/No]"
- Switching card size should use a new instance, because the pixmap is fixed to the current size.
Stretch goals
- DFC check card generation
- Link front sides with back sides so that a reference to the other side is available
- CheckCard needs property setters for all editable columns
- Editing a custom card should update the check card
50 most recent check-ins related to "custom_card_import_dialog"
2025-04-25
| ||
11:56 | Tests: Add fixture page_layout, returning a PageLayoutSettings instance created from settings. Use it everywhere, where code previously explicitly instantiated a PageLayuoutSettings. Validate the instance against the default settings. Leaf check-in: bd1ca5c600 user: thomas tags: custom_card_import_dialog | |
11:37 | Remove a broken test case and add additional validation to test_page_layout_compute_page_row_count(). Somewhere, a test alters the document settings without changing them back check-in: dfab6f5fde user: thomas tags: custom_card_import_dialog | |
2025-04-24
| ||
08:53 | scripts/update_translations.py: Remove locales that cannot be enabled, because their value is not registered as a valid choice in the settings validation code. check-in: 9d6c0fd1e3 user: thomas tags: custom_card_import_dialog | |
2025-04-23
| ||
21:55 | Fixed remaining failing document loader tests. check-in: 807ee85c4e user: thomas tags: custom_card_import_dialog | |
15:22 | CardDatabase: Use relative imports for typing and pathlib imports. Tighten the db_path type annotation from "str" to Literal[":memory:"] for in-memory databases check-in: 24eea93a04 user: thomas tags: custom_card_import_dialog | |
15:21 | DocumentLoader: Worker: Open a CardDatabase instance in __init__(). Copy the database from the parent, if it runs during unit tests. check-in: 512de63fb3 user: thomas tags: custom_card_import_dialog | |
14:50 | Tests: Refactor save file creation code. Use a helper function to populate the save file data, instead of running SQL queries in each test function that requires creating save data. check-in: 7d0ed2eb21 user: thomas tags: custom_card_import_dialog | |
14:49 | Register sqlite adapters for CardSize, CardSizes and CardType enums. check-in: cda943fc09 user: thomas tags: custom_card_import_dialog | |
2025-04-22
| ||
20:19 | Fix failing test test_subsequent_save_updates_settings(). Reduced the scope, only testing what the name states check-in: 30d05cf717 user: thomas tags: custom_card_import_dialog | |
20:00 | Use document-v7 in test_action_save_document.py and introduce some tighter signal timeouts in tests check-in: 05b9bb9b8e user: thomas tags: custom_card_import_dialog | |
09:59 | Fixed imports in tests, round 2 check-in: e56c4a03f1 user: thomas tags: custom_card_import_dialog | |
09:57 | Fix bad import check-in: fa56612fb9 user: thomas tags: custom_card_import_dialog | |
09:02 | Add tests for ConfigParser.get_quantity() and SectionProxy.get_quantity(). check-in: ca20d3b916 user: thomas tags: custom_card_import_dialog | |
08:47 | Refactored Card/CheckCard/CustomCard.requested_page_type(). Replace hard-coded magic numbers with use of the CardSizes enum that contains the image dimensions. check-in: 3851652812 user: thomas tags: custom_card_import_dialog | |
07:24 | Don't use hamcrest matcher anything(), since the value matcher of hasproperty() is optional check-in: 6e2deb8ef6 user: thomas tags: custom_card_import_dialog | |
07:22 | Ensure attribute compatibility between Card, and CustomCard/CheckCard check-in: e9ff57312c user: thomas tags: custom_card_import_dialog | |
2025-04-21
| ||
14:33 | test_card.py : Silence unused variable warnings check-in: 2b2c9063f3 user: thomas tags: custom_card_import_dialog | |
14:14 | Add Tests for CheckCard. Fix CheckCard.corner_color() and missing CheckCard.set_code check-in: 795559fc6f user: thomas tags: custom_card_import_dialog | |
11:54 | CardDatabase: No longer supply an empty oracle_id when constructing a CustomCard, as that is now a read-only property check-in: 3bbdfb2a35 user: thomas tags: custom_card_import_dialog | |
11:52 | Add tests for Card and CustomCard classes. Implement CustomCard.oracle_id, returning the empty string. check-in: 642da37028 user: thomas tags: custom_card_import_dialog | |
2025-04-19
| ||
11:14 | Fixed imports in moved test modules check-in: 536cd9f854 user: thomas tags: custom_card_import_dialog | |
11:12 | Move test modules for model modules into tests/model/ check-in: 62cd609f29 user: thomas tags: custom_card_import_dialog | |
2025-04-17
| ||
16:22 | CardListModel: Do not overwrite the card image tooltip with an oversized warning tooltip, if the custom card is oversized check-in: d1a1c6f9e2 user: thomas tags: custom_card_import_dialog | |
16:14 | Remove an unused function from ui/common.py check-in: e380b47cc6 user: thomas tags: custom_card_import_dialog | |
15:59 | Cleaned up some imports and use from imports to shorten typing annotations. Renamed get_image_for_tooltip_display() to get_card_image_tooltip(). Refactored image scaling in get_card_image_tooltip() to use a better-suited overload that requires less parameters for the same effect check-in: b7c6e5cdd7 user: thomas tags: custom_card_import_dialog | |
2025-04-14
| ||
15:24 | Implement a shared custom card registry in the CardDatabase class. check-in: 4b6b452415 user: thomas tags: custom_card_import_dialog | |
2025-04-13
| ||
16:12 | DocumentLoader: Add a TODO check-in: 0c1b9f3264 user: thomas tags: custom_card_import_dialog | |
16:05 | DocumentLoader: Close the save file db as soon as possible, or when validating data fails. This ensures that SQLite journal files don't stick around longer than needed and releases database locks early. The same document can now be loaded multiple times in a row without hitting a "database is locked" error. check-in: f8b3ef3ac8 user: thomas tags: custom_card_import_dialog | |
2025-04-12
| ||
17:55 | Reworked handling custom cards. Introduced class CustomCard, holding custom cards. It keeps the original file in memory as a plains bytes sequence and loads it in the size determined by the card size attribute. This avoids re-encoding the file for saving purposes. The user file is kept untouched. check-in: af561c08a0 user: thomas tags: custom_card_import_dialog | |
16:40 | DocumentLoader: Directly unpack a tuple, instead of assigning it first check-in: 21f7478ac1 user: thomas tags: custom_card_import_dialog | |
16:39 | Fixed broken Card.image_file() property check-in: 05307855c7 user: thomas tags: custom_card_import_dialog | |
16:33 | Rewritten ActionSaveDocument: Reworked saving custom card images, now storing the original, unaltered image file. check-in: f5bae255c5 user: thomas tags: custom_card_import_dialog | |
14:08 | DocumentLoader: Remove remaining reference to CustomCardData.oversized column. Harden the type validator by checking that deserialized document dimensions are lengths. check-in: 68fc88155f user: thomas tags: custom_card_import_dialog | |
14:05 | CustomCard: Declare as a dataclasses class check-in: f1b732290f user: thomas tags: custom_card_import_dialog | |
13:14 | Implement class CustomCard, which will be used to hold custom cards. It stores the supplied image in a dedicated attribute, so that the pixmap used for rendering can be freely set to any supported size without having to do re-scaling passes that degrade quality over time. check-in: 7ac8f1cc7b user: thomas tags: custom_card_import_dialog | |
12:50 | Moved Card, CheckCard, MTGSet and related type definitions from carddb.py into a dedicated module card.py check-in: f5c32b4505 user: thomas tags: custom_card_import_dialog | |
12:05 | Save file format: Remove is_oversized column from CustomCardData. check-in: 813e0e7609 user: thomas tags: custom_card_import_dialog | |
2025-04-11
| ||
20:47 | PageScene.on_data_changed(): Do not re-draw custom cards when editing their properties. check-in: d91380b4a3 user: thomas tags: custom_card_import_dialog | |
13:48 | Optimized updating the page overview when renaming custom cards. check-in: de3fad2611 user: thomas tags: custom_card_import_dialog | |
13:40 | Update the full page overview when renaming custom cards. This keeps the page overview in sync. check-in: c4f53f3c9b user: thomas tags: custom_card_import_dialog | |
13:10 | Moved to_list_of_ranges() from card_actions.py to natsort.py to make it available outside of the document controller modules. Properly signal data changes for all copies when editing custom cards. The page display still needs further fixes check-in: d45ecff50a user: thomas tags: custom_card_import_dialog | |
2025-04-10
| ||
11:55 | Replace the fancy multi selection behavior of the page content table with the default behavior of needing Ctrl to select multiple. check-in: 8c09f16da0 user: thomas tags: custom_card_import_dialog | |
11:46 | Renamed ComboBoxItemDelegate to CollectorNumberEditorDelegate and handle collector number editing for custom cards. Removed subclasses DocumentComboBoxItemDelegate and CardListComboBoxItemDelegate. Removed outdated tests. check-in: 1ba1688f46 user: thomas tags: custom_card_import_dialog | |
11:24 | Removed dead code from ComboBoxItemDelegate. Functionality of the removed parts is provided by other, dedicated delegate classes. check-in: c2f4c57455 user: thomas tags: custom_card_import_dialog | |
2025-04-09
| ||
18:12 | Add Card.is_custom_card property. It defines in one place how a custom card is identified, by having an empty oracle_id field. Avoids littering the code-base with "not card.oracle_id" statements. check-in: d11b61da21 user: thomas tags: custom_card_import_dialog | |
11:44 | LanguageEditorDelegate: Improve variable naming check-in: 134d0c5865 user: thomas tags: custom_card_import_dialog | |
11:32 | Extract index to Document instance resolution into a function. This is used by multiple item delegates to access the base Document instance from a given QModelIndex. Add additional docstrings. check-in: b39ed360ee user: thomas tags: custom_card_import_dialog | |
2025-04-08
| ||
21:50 | Add LanguageEditorDelegate class, implementing language selector for official cards and a language editor for custom cards. check-in: f5ebfa43dd user: thomas tags: custom_card_import_dialog | |
21:28 | Reworked how item delegates are stored. Since they are not accessed after creation and only kept as attributes to prevent the garbage collector from collecting them, put all into a tuple. check-in: 5fbda4453a user: thomas tags: custom_card_import_dialog | |
13:52 | Extract editing custom cards into a dedicated document action ActionEditCustomCard. This makes it possible to undo/redo edits to custom cards. check-in: 74ed86293b user: thomas tags: custom_card_import_dialog | |