xpuz.pages.editor
¤
GUI page for editing and making crosswords and their words. Only allows for the creation and editing of new crosswords, not pre-installed ones.
CrosswordPane
¤
CrosswordPane(container: CTkFrame, master: EditorPage)
Bases: CTkFrame, Addons
The left half of EditorPage. Contains a preview of all the user's
crosswords, providing the ability to edit them or add new ones.
Source code in src/xpuz/pages/editor.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | |
_add
¤
_add() -> None
Default all forms to empty, and allow the user to define the data for a new crossword.
Source code in src/xpuz/pages/editor.py
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | |
_export
¤
_export() -> None
Export all of the user's crosswords into a json file.
Source code in src/xpuz/pages/editor.py
659 660 661 662 663 664 | |
_get_cword_dirname
¤
Return the final name of the updated/new crossword's directory, appending a hyphen (if the user specified name doesn't end in one) and the casefolded difficulty.
Source code in src/xpuz/pages/editor.py
753 754 755 756 757 758 759 760 761 762 763 764 765 766 | |
_import
¤
_import() -> None
Allow the user to add new crosswords from a JSON file that was exported through xpuz.
Source code in src/xpuz/pages/editor.py
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
_remove
¤
_remove() -> None
Remove a crossword from the OS file system.
Source code in src/xpuz/pages/editor.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 | |
_reset
¤
_reset() -> None
Revert all the states of the widgets in CrosswordPane to their
default values.
Source code in src/xpuz/pages/editor.py
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | |
_toggle_forms
¤
An extension to the method in EditorPage of the same name to
configure the state of the difficulty optionmenu.
Source code in src/xpuz/pages/editor.py
697 698 699 700 701 702 703 | |
_update_difficulty
¤
_update_difficulty(difficulty: str) -> None
Find the english version of difficulty and update
self.difficulty.
Source code in src/xpuz/pages/editor.py
686 687 688 689 690 691 692 693 694 695 | |
_write
¤
_write() -> None
Update/write a crossword based on form data.
Source code in src/xpuz/pages/editor.py
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | |
EditorPage
¤
EditorPage(master: Base)
Bases: CTkFrame, Addons
Base page for editor.py. Consists of some utility methods required
only by CrosswordPane and WordPane, as well as the title bar and contains
for the aforementioned two classes.
Source code in src/xpuz/pages/editor.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
_get_user_category_path
¤
_get_user_category_path() -> PathLike
Find where to access categories from, whether that is in the package or in the system documents.
Source code in src/xpuz/pages/editor.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | |
_handle_scroll
¤
_handle_scroll(event: Event) -> None
Scroll one of the two scrollable frames depending on the user's cursor position.
Source code in src/xpuz/pages/editor.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
_reset_forms
¤
Remove all the content from the forms in forms.
Source code in src/xpuz/pages/editor.py
458 459 460 461 462 463 464 465 | |
_set_form_defaults
¤
Set the default of each form in forms to the respective value
in args. Requires len(args) to be equal to len(forms).
Source code in src/xpuz/pages/editor.py
467 468 469 470 471 472 | |
_toggle_forms
¤
Enable or disable all the forms in forms.
Source code in src/xpuz/pages/editor.py
451 452 453 454 455 456 | |
_write_data
¤
Write data to a crossword's info.json or definitions.json.
Source code in src/xpuz/pages/editor.py
474 475 476 477 478 | |
unbind_
¤
unbind_() -> None
Remove bindings which can be detected on different pages.
Source code in src/xpuz/pages/editor.py
391 392 393 394 395 396 | |
Form
¤
Form(
master: CTkFrame,
name: str,
validation_func: Callable,
pane_name: str,
b_confirm: CTkButton,
tooltip: str,
pane_instance: Optional[bool] = None,
)
Bases: Addons
Encapsulation of a CTkEntry, CTkLabel and CTkButton to construct a field to input data pertaining to a crossword's info or its words.
Contains features such as default value detection, text colour modification based on incorrect value, and tooltips to provide constraints for input.
Source code in src/xpuz/pages/editor.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
_all_valid_values
staticmethod
¤
Return true if any form in forms contains an invalid value.
Source code in src/xpuz/pages/editor.py
132 133 134 135 | |
_any_nondefault_values
staticmethod
¤
Return true if any form in forms contains a nondefault value.
Source code in src/xpuz/pages/editor.py
127 128 129 130 | |
_check_default
¤
_check_default() -> None
Update the reset field button, and check if the confirm button should be updated as well.
Source code in src/xpuz/pages/editor.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
_update_confirm_button
¤
_update_confirm_button(
pane: CTkFrame, b_confirm: CTkButton
) -> None
Enable or disable the confirm button based on the form content.
Source code in src/xpuz/pages/editor.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
focus
¤
focus() -> None
Focus self._form. Must be done after a small delay, or else the
button press that triggered this method will be handled after it actually
sets focus to the form.
Source code in src/xpuz/pages/editor.py
188 189 190 191 192 193 | |
grid
¤
grid(*args, **kwargs) -> None
Wrapper method for gridding self._frame.
Source code in src/xpuz/pages/editor.py
155 156 157 | |
put
¤
Wipe self._form and insert text.
Source code in src/xpuz/pages/editor.py
199 200 201 202 203 204 205 206 | |
set_default
¤
Update self.default to text, and put it into the entry.
Source code in src/xpuz/pages/editor.py
250 251 252 253 254 255 256 257 | |
set_invalid
¤
set_invalid() -> None
Set the text colour of self._form to red, signifying it contains
an incorrect value.
Source code in src/xpuz/pages/editor.py
224 225 226 227 228 229 | |
set_state
¤
set_state(state: str) -> None
Set the state of self._form and self._label.
Source code in src/xpuz/pages/editor.py
208 209 210 211 212 213 214 215 | |
set_valid
¤
set_valid() -> None
Set the text colour of self._form to black or white, depending
on the appearance mode, signifying it has a valid value.
Source code in src/xpuz/pages/editor.py
217 218 219 220 221 222 | |
unfocus
¤
unfocus() -> None
Remove focus from the entry by bringing focus to a pane.
Source code in src/xpuz/pages/editor.py
184 185 186 | |
wipe
¤
wipe() -> None
Remove all characters from self._form.
Source code in src/xpuz/pages/editor.py
195 196 197 | |
FormParser
¤
_parse_clue
staticmethod
¤
_parse_clue(form: Form) -> None
Parse a crossword clue form contents.
Source code in src/xpuz/pages/editor.py
299 300 301 302 303 304 305 306 | |
_parse_name
staticmethod
¤
_parse_name(form: Form) -> None
Parse the crossword name form contents.
Source code in src/xpuz/pages/editor.py
261 262 263 264 265 266 267 268 269 270 271 272 | |
_parse_symbol
staticmethod
¤
_parse_symbol(form: Form) -> None
Parse the crossword symbol form contents.
Source code in src/xpuz/pages/editor.py
274 275 276 277 278 279 280 281 | |
_parse_word
staticmethod
¤
_parse_word(form: Form) -> None
Parse a crossword's word form contents.
Source code in src/xpuz/pages/editor.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
UserCrosswordBlock
¤
UserCrosswordBlock(
master: CrosswordPane,
container: CTkScrollableFrame,
name: str,
value: int,
flash: bool = False,
)
Bases: CTkFrame, Addons, BlockUtils
A small frame that displays a crossword's name and provides a radiobutton to select it.
See browser.py for implementations similar to this.
Source code in src/xpuz/pages/editor.py
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | |
_on_selection
¤
_on_selection() -> None
Apply the information of this block to the crossword forms, and configure the widget states appropriately.
Source code in src/xpuz/pages/editor.py
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 | |
_populate
classmethod
¤
_populate(
master: CrosswordPane,
flash_these: Optional[List[str]] = None,
) -> None
Put all of the user crosswords into master.preview
(CTkScrollableFrame) as user crossword blocks.
Source code in src/xpuz/pages/editor.py
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | |
UserWordBlock
¤
Bases: CTkFrame, Addons, BlockUtils
A small frame that displays a crossword's word and provides a radiobutton to select it.
See browser.py for implementations similar to this.
Source code in src/xpuz/pages/editor.py
1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | |
_on_selection
¤
_on_selection() -> None
Apply the information of this block to the word forms, and configure the widget states appropriately.
Source code in src/xpuz/pages/editor.py
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | |
_populate
classmethod
¤
Put all of the words of a user crossword into master.preview
(CTkScrollableFrame) as user word blocks.
Source code in src/xpuz/pages/editor.py
1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 | |
WordPane
¤
WordPane(container: CTkFrame, master: EditorPage)
Bases: CTkFrame, Addons
The right half of EditorPage. Contains a preview of all the words
present in the currently selected crossword.
Source code in src/xpuz/pages/editor.py
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | |
_add
¤
_add() -> None
Default all forms to empty, and allow the user to define the data for a new/existing word.
Source code in src/xpuz/pages/editor.py
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | |
_remove
¤
_remove() -> None
Remove a word/clue pair from the crossword's definitions
Source code in src/xpuz/pages/editor.py
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 | |
_reset
¤
_reset() -> None
Revert all the states of the widgets in WordPane to their
default values.
Source code in src/xpuz/pages/editor.py
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | |
_write
¤
_write() -> None
Update a word or write a new one to a crossword's definitions.
Source code in src/xpuz/pages/editor.py
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 | |