Skip to content

Conversation

@davep
Copy link
Contributor

@davep davep commented Oct 19, 2022

I think this is in a good enough state to start to pull it in now. It has keyboard navigation, mouse navigation, a simple help screen, a simple win state display, etc. It demonstrates not using a default screen, etc. Colour needs some work, but I think the core implementation is pretty sound now.

Tweaks to make it more Textually idiomatic are welcome -- this is obviously written by someone who is still getting to know the framework.

davep added 10 commits October 19, 2022 16:47
Originally I was doing everything in the DOM, using just the primitive
widgets. Given that I recently created an actual GameCell widget (which
simply inherits from a Button, but still...) it makes sense to now have
row/col properties as part of that.
Rather than repeat the same code over a number of lines, use a loop.
Also settle focus on the middle cell at the start of a game -- this is the
start of adding keyboard navigation.
Uses arrow keys or WASD.

Also note moving the dark mode toggle off 'd' and onto 'D'.
davep added 3 commits October 20, 2022 08:37
I'm going to repurpos.e it
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.
Copy link
Member

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Just a few requests.

Once that's in, I might have a go at the stylesheet.

Copy link
Member

@darrenburns darrenburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change your import of Final to something like this?

import sys
if sys.version_info >= (3, 8):
    from typing import Final
else:
    from typing_extensions import Final

davep added 5 commits October 20, 2022 14:04
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 Textualize#963 (comment)
See Textualize#963 (comment)

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.
@willmcgugan willmcgugan merged commit d7cf152 into Textualize:css Oct 20, 2022
@davep davep deleted the 5x5 branch October 20, 2022 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants