Commit Graph

886 Commits

Author SHA1 Message Date
Isaiah Odhner
03020d767a Include private method event listeners 2023-05-29 15:50:13 -04:00
Isaiah Odhner
fb4ff044ea Fix broken (escaped) markup, and add more styling
- Fix accidentally escaped `[link]` markup
  (broken in 1dbf02e941)
- Using Text type will help avoid this problem in the future.
  Don't just make it work, make it so it must work!
  Make it strongly typed, not stringly typed.
- Use `css_identifier_styled` instead of `css_identifier`
- Add colors to exceptional case handling
2023-05-29 15:48:05 -04:00
Isaiah Odhner
75c15b97b5 Fix order of CSS path shown for event listener nodes
I just came across this `css_path_nodes` property and realized my path
was probably in the wrong order.

Also, this gives a clear option for naming the variable,
although I feel I should point out it's not a different type of node.
2023-05-29 15:48:05 -04:00
Isaiah Odhner
1dbf02e941 Use inspect.getdoc, which handles indentation, rather than raw __doc__
This inspect module sure is coming in handy for this inspector, who knew!
2023-05-29 14:18:08 -04:00
Isaiah Odhner
3bcc7eeb70 Rename index to count since some indices may be skipped 2023-05-29 13:43:57 -04:00
Isaiah Odhner
5d3383d960 Use a unique sentinel value instead of Ellipsis for the ellipsis node
This fixes the expansion logic applying to ellipsis objects in arbitrary places.
2023-05-29 13:40:40 -04:00
Isaiah Odhner
b52c1b93e9 Fix frozenset expansion 2023-05-29 03:00:18 -04:00
Isaiah Odhner
dc2714f9ff Fix dict expansion 2023-05-29 03:00:18 -04:00
Isaiah Odhner
840d6a53d5 DEAL WITH IT 😎 2023-05-29 03:00:18 -04:00
Isaiah Odhner
7d71484102 Unify "Nothing selected" message for properties tab (don't use Tree) 2023-05-29 02:03:16 -04:00
Isaiah Odhner
9b4a5ed1a2 Unify property display in inspector
- Include bytes as one of the basic types.
- Use ReprHighlighter everywhere repr is used.
- Show length for sets and tuples as well as lists.
- Show repr for lists.
- Bold key and show "=" for lists/dicts and other objects.
- Allow expanding tuples and sets.
- Remove "{}" and "[]" markers for easier scanning.
2023-05-29 02:03:16 -04:00
Isaiah Odhner
8f4703f79c Remove falsy name case 2023-05-29 01:24:44 -04:00
Isaiah Odhner
fe443f4c07 Refactor to one isinstance() call 2023-05-29 00:58:41 -04:00
Isaiah Odhner
fab2791fc6 Also highlight None with ReprHighlighter 2023-05-29 00:58:07 -04:00
Isaiah Odhner
f6983ea5f7 Fix and ignore type checking errors in inspector module
Also, object | None is redundant.
2023-05-29 00:08:50 -04:00
Isaiah Odhner
40b725f06b Mark as generic to all objects
(I briefly used `root.css_identifier` instead of taking a `label` param)
2023-05-28 23:36:34 -04:00
Isaiah Odhner
4d87e8913c Escape property name in Rich markup 2023-05-28 23:15:41 -04:00
Isaiah Odhner
177cae974c DRY and improve error handling for getters
- DRY adding nodes with enumerate() vs dir()
- Don't show the error message as a quoted string value
  (This was super simple, but ambiguous and potentially confusing.)
- Make the error handling look nice with colors
2023-05-28 23:12:16 -04:00
Isaiah Odhner
ffbe362fe4 Show picking state with accent color on Inspect Element button 2023-05-28 21:51:41 -04:00
Isaiah Odhner
92788eaeba Load more items when clicking ellipsis in properties tree 2023-05-28 21:11:48 -04:00
Isaiah Odhner
6a0187a709 Fix cut off bottom of scrolling panes in inspector 2023-05-28 20:40:08 -04:00
Isaiah Odhner
559da0ca12 DRY adding nodes with enumerate() vs dir()
Could go further, with the key_filter/self._already_loaded bits...
2023-05-28 20:25:35 -04:00
Isaiah Odhner
32c334ff62 Fix list handling in properties tree
Also, show length, and for misc. types, show type.
2023-05-28 20:25:35 -04:00
Isaiah Odhner
cbbe87295c Tweak inspector layout 2023-05-28 19:22:29 -04:00
Isaiah Odhner
055753b53a Dynamically load properties when expanding
- Make the Tree into a subclass, PropertiesTree.
- Populate nodes when expanding a node instead of all at once.
- Remove the max_depth limit, since you now expand nodes manually.
- Remove cyclic reference detection, for now at least.
- Track already-loaded nodes/keys, like in the DOMTree, but with a data
  structure. It's a little more complicated since unlike DOM nodes, a
  value could appear multiple times in a list. But this should also
  be more efficient.
2023-05-28 18:31:37 -04:00
Isaiah Odhner
f0ce14189c Show more properties 2023-05-28 18:30:21 -04:00
Isaiah Odhner
3a447b4e70 Enable inspecting inspector
Layout is hard, but at least I have this nifty new tool...
2023-05-28 18:30:21 -04:00
Isaiah Odhner
e1d5739ec8 Use tabs for inspector details views
TODO: fix bottom of contents cut off when scrolled to bottom in TabPanes
2023-05-28 18:30:21 -04:00
Isaiah Odhner
c0f088dd4d Hide "Expand All Visible" button since it's confusing
- I wanted it to expand all, not just one level
  (but named it according to how it ended up functioning.)
- It's not that helpful since the Inspect Element feature works great.
- It's especially confusing now that there's multiple tree views.
  It doesn't affect the Properties view, but it's not visually tied to
  the DOM tree view except by proximity.
- I'd rather make the DOM tree default to (mostly) expanded, rather than
  have a button you have to click, anyways.
2023-05-28 02:35:18 -04:00
Isaiah Odhner
b85fba8f15 Show actual DOM path, not just the css_identifier for the one node 2023-05-28 02:19:18 -04:00
Isaiah Odhner
0f9f394d26 Show info about event listeners, linking to source code 2023-05-28 01:33:23 -04:00
Isaiah Odhner
dba6721164 Inspect properties of DOM nodes 2023-05-28 00:08:12 -04:00
Isaiah Odhner
6b97dfc165 Optimize: don't reset highlight for nodes that should stay highlighted 2023-05-26 13:27:51 -04:00
Isaiah Odhner
2101092dbc Refactor original styles storage to use a dictionary
This was only meant to be preparation for an optimization, but this
actually greatly improved performance!
2023-05-26 13:14:31 -04:00
Isaiah Odhner
d64054c197 Go ahead and handle NoWidget 2023-05-26 13:07:07 -04:00
Isaiah Odhner
dd4b96e624 Tint descendants since tint isn't inherited 2023-05-26 13:04:55 -04:00
Isaiah Odhner
bab23a3df7 Hide inspector by default 2023-05-26 13:04:55 -04:00
Isaiah Odhner
759991e902 Add DOM inspector panel 2023-05-26 13:04:55 -04:00
Isaiah Odhner
91bf2f1701 VS Code: configure indentation
I'm tired of creating new files and ending up with mixed indentation.
2023-05-25 22:52:46 -04:00
Isaiah Odhner
0fb8cce026 Improve layout of Edit Colors dialog 2023-05-25 22:43:36 -04:00
Isaiah Odhner
4ed14057f6 Allow only one selected color across both grids (Basic and Custom) 2023-05-25 17:08:10 -04:00
Isaiah Odhner
0372a99d27 Constrain window to screen so titlebar is always accessible
Otherwise a window that's too big to fit can't be closed!
2023-05-25 03:01:48 -04:00
Isaiah Odhner
f00c332c0c Pick slot for new custom color by clicking in Custom Colors grid 2023-05-25 02:01:45 -04:00
Isaiah Odhner
33781fa53f Fix color not updating when applying min/max constraints
self.last_valid_int needs to be set in these cases.
2023-05-25 01:42:53 -04:00
Isaiah Odhner
c94430feb5 Reset to last valid int on blur, not just 0, and don't update when empty 2023-05-25 01:34:36 -04:00
Isaiah Odhner
6f1476be8f Handle min/max in IntegerInput, and fix flicker and invisible cursor
- Handle validation in one place.
- This fixes a flicker when typing an invalid character.
- This fixes the cursor becoming invisible after typing an invalid character, when the cursor was at the end, and thus the length of the text shrinks to where the cursor further to the right than the end of the text. (I'm guessing that the cursor position may not be updated in some way.)
2023-05-25 01:23:56 -04:00
Isaiah Odhner
3507d4267a Reset color value inputs to 0 on blur 2023-05-25 01:08:29 -04:00
Isaiah Odhner
c19a3a2741 Cleanup unused imports 2023-05-25 00:32:56 -04:00
Isaiah Odhner
724fe814d1 Make @property _current_color 2023-05-25 00:27:49 -04:00
Isaiah Odhner
9eb5f87f22 Prevent changing focus ring when adding a custom color 2023-05-25 00:23:50 -04:00