Commit Graph

1098 Commits

Author SHA1 Message Date
Isaiah Odhner
d77a785a64 Update commands now that it must be run as a module 2023-06-08 23:47:53 -04:00
Isaiah Odhner
3364e11b5d Convert to relative imports
It no longer runs except with `python -m src.textual_paint.paint`
2023-06-07 22:38:09 -04:00
Isaiah Odhner
c4c1572dac Add meta data to inspector module 2023-06-07 16:12:26 -04:00
Isaiah Odhner
c17e1a905d Ignore more stack frames for framework style setter shortcuts
This lets it jump directly to `my_widget.display = False`, rather than
the `display` setter method in dom.py, for example.
2023-06-07 16:01:26 -04:00
Isaiah Odhner
3dfc1985b1 This is done (basically) 2023-06-07 15:38:26 -04:00
Isaiah Odhner
e414e46400 Fix inline styles left by inspector after resetting highlight
`widget.styles.tint` will return a default transparent (#00000000)
value, rather than None, when not set.

`border` doesn't work the same as the others here, but I'm not using it,
so I can just disable the styles I'm not using.
2023-06-07 15:31:22 -04:00
Isaiah Odhner
789f1776cb Fix linking to code that set inline styles for hyphenated/shorthand properties 2023-06-07 15:01:06 -04:00
Isaiah Odhner
2a8395581a Improve source code link formatting 2023-06-07 03:26:35 -04:00
Isaiah Odhner
ddcff5c955 DRY source code location info formatting 2023-06-07 03:05:30 -04:00
Isaiah Odhner
d10d5d33ba Fix opening file without a known line number 2023-06-07 02:55:44 -04:00
Isaiah Odhner
9f84b6206c Link to source code for CSS rule sets 2023-06-07 02:55:44 -04:00
Isaiah Odhner
3409992ae6 Link to source code that set inline styles
Impossible? No! Just add a little instrumentation magic... 🪄
2023-06-07 01:27:40 -04:00
Isaiah Odhner
10491e3d16 Show actual CSS rule sets in the inspector, not just a style dump 2023-06-06 22:28:43 -04:00
Isaiah Odhner
79ff919e14 Fix aborting picking when closing inspector with F12 2023-06-06 18:46:49 -04:00
Isaiah Odhner
b1e1a5ea4d Make resize handles subtle (invisible until hover)
I surveyed `def render_line` in the Textual codebase to find the right
property to get the `color` CSS property working for ResizeHandle:

- `self.styles`: wrong type
- `self.get_component_rich_style()`: would overcomplicate things
- `self.text_style`: wrong
- `self.rich_style`: right

Now I can use `:hover` styles, and restore some of the elegance of the
look of the inspector by hiding the resize handles until mouse over.
2023-06-06 18:33:27 -04:00
Isaiah Odhner
5e6bdbf323 Add internal resize handle to inspector 2023-06-06 18:16:44 -04:00
Isaiah Odhner
1620f3b5d3 Fix tab underline in inspector
It was an overly general CSS rule, confusingly applying to Tab,
because it's a *subclass* of Static.

Inspector features that would make this easier to understand would be:
- Showing what rules apply to a given widget, instead of just a CSS dump
- Showing better why exactly it was invisible
2023-06-06 17:40:08 -04:00
Isaiah Odhner
5ddb5c22a8 Found another good candidate for crosshair symbol 2023-06-05 15:58:23 -04:00
Isaiah Odhner
ce1b26543d Add resize handle to inspector panel 2023-06-04 20:04:51 -04:00
Isaiah Odhner
3071a34b0e Focus DOM tree after picking an element 2023-06-04 18:20:52 -04:00
Isaiah Odhner
636b3f6869 Add emoji for visual clarity (like bullet points)
and replacing "Listener on DOM node:" which was verbose for something repeated potentially many times.
2023-06-04 16:58:57 -04:00
Isaiah Odhner
a735443acc Color file paths for visual clarity
This helps a LOT, but putting it in a tooltip might still be better.
2023-06-04 16:20:14 -04:00
Isaiah Odhner
f727a3c08d Refactor: prefer Text.styled() in most cases 2023-06-04 16:17:52 -04:00
Isaiah Odhner
c525ff3e26 Link to source code for the message class 2023-06-04 15:50:38 -04:00
Isaiah Odhner
89dadbf4b1 Refactor to use Text.styled instead of Text.from_markup and escape
This is much more readable, and presumably more performant.
2023-06-04 15:47:20 -04:00
Isaiah Odhner
cfe4104b6f Only look upwards for handlers if the event bubbles 2023-06-04 15:34:05 -04:00
Isaiah Odhner
38dcdde2b9 Fix event handler method names checked for
Updating to Textual 0.27.0 broke this code, but it looks like they
made it way easier! It's now available statically on the class.
2023-06-04 15:28:14 -04:00
Isaiah Odhner
55c2ab1e4d Fix message: list both method names checked 2023-06-04 15:28:14 -04:00
Isaiah Odhner
a8bb2b253e Update Textual to 0.27.0
(Gonna use some tooltips!)
2023-06-04 15:28:14 -04:00
Isaiah Odhner
605a048fc7 Launch code editor from inspector panel
Disable stdout which crashes when run in Textual due to StdoutRedirector
2023-06-04 15:28:13 -04:00
Isaiah Odhner
99b4dfc10f Rename env var for explicit editor config
This is a little bit weird, since it sounds like it's the opposite of "VISUAL", but it's the name of the TUI framework.
2023-06-04 13:46:18 -04:00
Isaiah Odhner
d3c060a2f3 Accept spellings 2023-06-04 13:36:05 -04:00
Isaiah Odhner
bae5eceb51 Narrow exception catching 2023-06-04 13:36:05 -04:00
Isaiah Odhner
ef107b0da3 Add types, and workaround list[str | None] return type 2023-06-04 13:36:05 -04:00
Isaiah Odhner
bbb7550763 Fix the ported editor launching code 2023-06-04 13:22:50 -04:00
Isaiah Odhner
e9494ddf4b Port launchEditor.js (from CRA) to Python with ChatGPT 2023-06-04 02:54:53 -04:00
Isaiah Odhner
f5074d836f Link to nodes in DOMTree from NodeInfo panel 2023-06-04 02:28:42 -04:00
Isaiah Odhner
0c05e17223 Move expansion of nested nodes to method of DOMTree 2023-06-04 02:28:42 -04:00
Isaiah Odhner
e7d0d7280a Clean up 2023-06-04 01:06:44 -04:00
Isaiah Odhner
1c1fb8994e Hide inspector highlight when closing the inspector 2023-06-03 23:38:23 -04:00
Isaiah Odhner
fc279f0574 Fix type checker errors and ignore one 2023-06-03 20:08:27 -04:00
Isaiah Odhner
62fb218a1a Remove obsolete visibility reset
I made sure to leave a comment here because I thought I might leave this in by accident.
I changed how it works in 79ae7e1b7b.
2023-06-03 19:50:57 -04:00
Isaiah Odhner
336414d786 Prevent highlights from overlapping the inspector panel 2023-06-03 19:30:27 -04:00
Isaiah Odhner
545642f5d5 Prevent lingering highlight after picking with Inspect Element 2023-06-03 18:57:55 -04:00
Isaiah Odhner
8e930030c2 Make DOM tree hovering behavior more robust
Regarding "it seems to be reset anyways": I believe it was simply
highlighting an incorrect node, often, by chance, an invisible one.
`self._get_node(-1)` doesn't return None.
2023-06-03 18:00:22 -04:00
Isaiah Odhner
8acc079faa Clean up empty lists of highlight boxes 2023-06-03 16:14:06 -04:00
Isaiah Odhner
c2ddf4b88e Fix removing old highlight boxes
It was clearning (replacing) the dictionary, and thus losing track
of old highlights that should be removed.
2023-06-03 16:14:06 -04:00
Isaiah Odhner
79ae7e1b7b Fix ignoring of inspector highlight boxes when picking 2023-06-03 15:49:53 -04:00
Isaiah Odhner
89ff582c3d Remove highlight boxes associated with an old DOM node 2023-06-03 15:32:10 -04:00
Isaiah Odhner
377a883d3b Handle NoWidget
Why did this get dom_node = Container(classes={'inspector_highlight'}, pseudo_classes={'enabled'})?
2023-06-03 15:24:57 -04:00