Commit Graph

253 Commits

Author SHA1 Message Date
Will McGugan
a6d7747f28 fix 5x5 2023-02-07 12:10:02 +00:00
Will McGugan
6c4adea608 update Mypy 2023-02-07 11:25:36 +00:00
Will McGugan
5930ebf82e remove _typing.py 2023-02-07 10:46:28 +00:00
Will McGugan
bcf382d2ff typing of Final 2023-02-07 09:06:08 +00:00
Dave Pearson
4adfe69ec9 Remove TreeNode as a pseudo-widget
This encourages importing it from `textual.widgets.tree` instead, keeping it
in line with the other changes made for #1637.

Note this is a breaking change.
2023-01-23 17:37:58 +00:00
Galmo13
affcb60d9b Fixed a typo
Fixed a "buy" by a "by".
2023-01-16 16:07:58 +01:00
Darren Burns
b9238f4651 Add 2022 year in review blog post 2022-12-20 17:24:19 +00:00
Dave Pearson
50dd8d095c Remove universal=True from bindings in 5x5
Not only has universal not changed to priority, these bindings are on the
screen and so have priority anyway. This means we can safely go back to how
5x5 was prior to 0.6.0.
2022-12-15 14:30:48 +00:00
Dave Pearson
0f25031735 Make the cursor keys work in 5x5 again
The cursor keys stopped working in 5x5 once binding inheritance was
introduced in 0.6.0 (see #1343). Making them `universal` keys here fixes the
issue. This won't be the final form of this change, but this fixes this
example so that it works with 0.6.0 (so anyone cloning down the code and
running with an installed 0.6.0 will get the full effect).

Once the final work resulting from #1343 takes place this will need a final
update (and should be a good test example for the changes).
2022-12-14 11:51:17 +00:00
Will McGugan
13a207bacc new blog post 2022-12-10 10:34:34 +00:00
Will McGugan
7ba70ada96 fix examples 2022-12-08 17:24:34 +00:00
Will McGugan
f7dade5a26 new tree control 2022-11-20 15:42:35 +00:00
Will McGugan
50d6e9736b tweak 2022-11-19 19:36:44 +00:00
Will McGugan
811dcd8eaf fix stable scrollbars 2022-11-19 17:21:23 +00:00
Will McGugan
e2f6e2f82d added directory tree 2022-11-19 11:57:25 +00:00
Will McGugan
dfd7b6c8d9 added API to nodes 2022-11-18 17:09:47 +00:00
Will McGugan
fed9e7a939 merge 2022-11-18 16:15:33 +00:00
Dave Pearson
50860b98b6 Update the 5x5 example to make use of callable screens
Now that #1054 has made it into main, make use of it.
2022-11-18 13:43:27 +00:00
Will McGugan
d9a0da91a4 fixed some rendering glitches 2022-11-17 16:59:29 +00:00
Dave Pearson
c881a9657f Add a Label widget
For the moment this does nothing more than inherit from a Static; but what
it does do is make it easier for someone to add text to their application
and to style it by styling all the Labels. Before now it would be common to
use a Static but if you try and style (or query) all Statics, you'd also get
things like Buttons, which inherit from Static.

See #1190
2022-11-16 15:03:24 +00:00
Will McGugan
39dced58e0 Merge pull request #1037 from Textualize/code-browser-improvements
Focus the directory tree in code browser example
2022-10-29 20:39:56 +01:00
Dave Pearson
daa69d4591 Fix spelling mistake in 5x5 CSS
Possibly not the worst bug ever found in Textual, but once seen you can't
unsee it.
2022-10-28 07:34:33 +01:00
Darren Burns
014fe42c42 Focus the directory tree 2022-10-27 14:30:22 +01:00
Will McGugan
842148d40f Merge pull request #1007 from davep/5x5-tidy
Tidy up some of the documentation in the FiveByFive example
2022-10-25 13:53:16 +01:00
Dave Pearson
7ebfb1e714 Make the game size Final
I mean... the clue is in the name of the game, right?
2022-10-25 08:57:00 +01:00
Dave Pearson
ce6ed54f37 Tidy up various class properties documentation
Rather than use the Sphinx-influenced '#:' style of comment, switch to the
more docstring-a-like approach used in the Google style.
2022-10-25 08:54:50 +01:00
Will McGugan
6f602f02c0 Add sensible error to query 2022-10-23 09:52:31 +01:00
Will McGugan
9d0f8f1e48 typing pride 2022-10-22 08:34:23 +01:00
Will McGugan
2358d9d568 fix for point key and keys in screenshot 2022-10-21 10:15:41 +01:00
Will McGugan
1db9327969 fix title setting 2022-10-20 21:57:31 +01:00
Dave Pearson
8a4a95315f Merge pull request #970 from davep/5x5
Switch the dark mode toggle to Ctrl+D
2022-10-20 20:54:28 +01:00
Dave Pearson
491a315aed Switch the dark mode toggle to Ctrl+D
It was on D (as in uppercase D, or shift-d), but I feel this was going to be
confusing given that there is still this slight mixup with the display of
letters in the footer, and what was bound, etc.

So... make it obvious what to press.

Remember, 'd' can't be used because it's a movement key in this game.
2022-10-20 20:42:48 +01:00
Will McGugan
d7cf152d0f Merge pull request #963 from davep/5x5
Initial pull of 5x5 into the Textual examples directory
2022-10-20 16:27:03 +01:00
Dave Pearson
8e1dcbd2e1 Add a wee bit of animation 2022-10-20 15:55:49 +01:00
Dave Pearson
e0cea53d2f Sweep up some on->filled naming changes 2022-10-20 14:49:30 +01:00
Dave Pearson
db976348cc Swap the docstrings away from Sphinx style to Google style
See https://github.com/Textualize/textual/pull/963#discussion_r1000547282
2022-10-20 14:46:18 +01:00
Dave Pearson
615a1997b9 Drop using __file__ to work out the name of the CSS file
See https://github.com/Textualize/textual/pull/963#discussion_r1000546514

Personally I prefer the approach I was using in that it's one less bit of
hard-coded metadata. On the other hand I can appreciate that reducing the
number of possibly-confusing things in an example plays better with people
who may be both new to Textual *and* to Python.
2022-10-20 14:26:28 +01:00
Dave Pearson
b19144abfe Rename "on" things to "filled" things
Because Textual uses on_ for event handlers there was the danger of a name
clash; so to keep things as clear as possible this renames anything to do
with "on" (method names, properties, style classes) so that it talks about
"filled" instead.

See https://github.com/Textualize/textual/pull/963#discussion_r1000544563
2022-10-20 14:11:00 +01:00
Dave Pearson
3e9b30ee2e Handle importing of Final for Python 3.7
See https://github.com/Textualize/textual/pull/963#pullrequestreview-1149139158
2022-10-20 14:04:14 +01:00
Dave Pearson
da0f3911fb Make Enter act as equals too
I suspect folk will hit enter when they mean = (see macOS calculator,
Windows calculator (I thin), etc...).
2022-10-20 13:40:15 +01:00
Dave Pearson
d7337c343e Make the calculator example keyboard-friendly again 2022-10-20 13:38:54 +01:00
Dave Pearson
685f13cfcd Drop the app namespace from some binding actions
It had been suggested to me that these would be needed, but in testing here
I'm not seeing that. So, until I find out otherwise, let's simplify things
and drop that.
2022-10-20 08:43:57 +01:00
Dave Pearson
c629826940 Be nice to the vi(m) crowd 2022-10-20 08:42:38 +01:00
Dave Pearson
4ab660a02a Drop 'h' as a help key01
I'm going to repurpos.e it
2022-10-20 08:37:51 +01:00
Dave Pearson
b3d8ebb2f4 Simplify the tests for a focused game cell 2022-10-19 21:28:50 +01:00
Dave Pearson
59fb6f1ec5 Declutter the status line 2022-10-19 21:23:17 +01:00
Dave Pearson
aa4e4fe2cc Move all the new game logic into the new game action 2022-10-19 21:18:21 +01:00
Dave Pearson
be997409e0 Add keyboard navigation
Uses arrow keys or WASD.

Also note moving the dark mode toggle off 'd' and onto 'D'.
2022-10-19 21:13:41 +01:00
Dave Pearson
851a759e67 Add a central method for getting a cell
Also settle focus on the middle cell at the start of a game -- this is the
start of adding keyboard navigation.
2022-10-19 20:50:19 +01:00
Dave Pearson
eb11984442 Simplify toggle_cells
Rather than repeat the same code over a number of lines, use a loop.
2022-10-19 20:42:25 +01:00