xpuz.pages.browser
¤
GUI page for searching, viewing and loading available crosswords, as well as exporting loaded crosswords.
BrowserPage
¤
BrowserPage(master: Base)
Bases: CTkFrame, Addons
Provides an interface to view available crosswords, set a preference for the word count, generate a crossword based on the selected parameters, and launch the crossword webapp to complete the generated crossword.
Source code in src/xpuz/pages/browser.py
64 65 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 | |
_configure_word_count_prefs
¤
_configure_word_count_prefs(state: str) -> None
Configure all the word_count preference widgets to an either an interactive or disabled state (interactive when selecting a crossword, disabled when a crossword has been loaded).
Source code in src/xpuz/pages/browser.py
524 525 526 527 528 529 530 531 532 | |
_handle_scroll
¤
_handle_scroll(
event: Event, container: CTkScrollableFrame
) -> None
Scroll the center scroll frame only if the viewable width is greater than the scroll region. This prevents weird scroll behaviour in cases where the above condition is inverted.
Source code in src/xpuz/pages/browser.py
464 465 466 467 468 469 470 471 472 473 474 475 | |
_load
¤
_load() -> None
Gather data and use _create_app to initialise the Flask app on a
new thread.
Source code in src/xpuz/pages/browser.py
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | |
_on_cword_selection
¤
_on_cword_selection(wrapper: CrosswordWrapper) -> None
Called by an instance of CrosswordBlock, which passes the
data for its given crossword into this method. The method then saves
this data, deselects any previous word count radiobutton selections,
reconfigures the values of the custom word count optionmenu to be
compatible with the newly selected crossword, and reconfigures the
max word count label to show the correct maximum word count.
Source code in src/xpuz/pages/browser.py
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
_on_wc_sel
¤
_on_wc_sel(button_name: str) -> None
Configure custom word count optionmenu based on radiobutton selection.
Source code in src/xpuz/pages/browser.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
_on_webview_close
¤
_on_webview_close() -> None
Update self.webview_open to false when the user closes the
webview.
Source code in src/xpuz/pages/browser.py
534 535 536 537 538 | |
_open_app_embedded
¤
_open_app_embedded(url: str) -> None
Start a webview with the webview module.
Source code in src/xpuz/pages/browser.py
540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
_reset_scroll_frame
¤
_reset_scroll_frame() -> None
Set the x position of the center scroll frame to the start.
Source code in src/xpuz/pages/browser.py
414 415 416 | |
_reset_search
¤
_reset_search() -> None
Remove all text from the search box and regenerate the placeholder text.
Source code in src/xpuz/pages/browser.py
406 407 408 409 410 411 412 | |
_rollback_states
¤
_rollback_states() -> None
Set all the widgets back to their default states (seen when opening the crossword browser).
Source code in src/xpuz/pages/browser.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |
_search_crossword
¤
_search_crossword(query: str) -> None
Regenerate all the crossword blocks based on a crossword name query.
Source code in src/xpuz/pages/browser.py
391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
_update_segbutton_text_colours
¤
_update_segbutton_text_colours(
view: str, sb: CTkSegmentedButton
) -> None
Configure all segmented button colours in sb to have
a black text colour if unselected, otherwise, set the text colour to
white.
Source code in src/xpuz/pages/browser.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
change_browser_view
¤
change_browser_view(callback: Optional = None) -> None
Change the browser view to Flattened or Categorical.
Source code in src/xpuz/pages/browser.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
load
¤
load() -> None
Initialise the crossword and web app.
Source code in src/xpuz/pages/browser.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | |
open_app
¤
open_app() -> None
Open the crossword web app at a port read from Base.cfg.
Source code in src/xpuz/pages/browser.py
555 556 557 558 559 560 561 562 563 564 565 566 567 | |
terminate
¤
terminate() -> None
Reconfigure the states of the GUIs buttons and terminate the app.
Source code in src/xpuz/pages/browser.py
569 570 571 572 573 574 575 576 577 578 579 580 581 | |
unbind_
¤
unbind_() -> None
Remove bindings which can be detected on different pages.
Source code in src/xpuz/pages/browser.py
386 387 388 389 | |
CategoryBlock
¤
CategoryBlock(
container: CTkScrollableFrame,
master: BrowserPage,
name: str,
fp: PathLike,
value: int,
)
Bases: CTkFrame, Addons, BlockUtils
A frame containing the name of a crossword category and a buttons to open/close all the crosswords contained within that category. Opening a category block will remove all other category blocks and display only the crosswords within that category.
Source code in src/xpuz/pages/browser.py
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | |
_close
¤
_close() -> None
Remove all crossword info blocks, and regenerate the category blocks.
Source code in src/xpuz/pages/browser.py
842 843 844 845 846 847 848 849 850 851 852 | |
_open
¤
_open() -> None
View all crossword info blocks for a specific category.
Source code in src/xpuz/pages/browser.py
831 832 833 834 835 836 837 838 839 840 | |
_populate
classmethod
¤
_populate(master: BrowserPage) -> None
Instantiate all the base category blocks and put them in the central scroll container.
Source code in src/xpuz/pages/browser.py
762 763 764 765 766 767 768 769 770 771 772 773 774 775 | |
CrosswordBlock
¤
CrosswordBlock(
master: BrowserPage,
container: CTkScrollableFrame,
category: str,
name: str,
value: int,
category_object: Optional[CategoryBlock] = None,
)
Bases: CTkFrame, Addons, BlockUtils
A frame containing a crosswords name, as well data read from its
corresponding info.json file, including total definitions/word count,
difficulty, and a symbol to prefix the crosswords name. A variable amount
of these is created based on how many crosswords each category contains.
Source code in src/xpuz/pages/browser.py
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | |
_populate
classmethod
¤
_populate(
master: BrowserPage, category: CategoryBlock
) -> None
Instantiate all the base crossword blocks for a given category and put them in the central scroll container.
Source code in src/xpuz/pages/browser.py
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | |
_populate_all
classmethod
¤
_populate_all(
master: BrowserPage, query: Optional[str] = None
) -> None
Instantiate all the base crossword blocks and sort them holistically
by difficulty suffix, putting them in the central scroll container only
if they match the provided query parameter (if it is not None).
Source code in src/xpuz/pages/browser.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | |