Commit Graph

340 Commits

Author SHA1 Message Date
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
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
Isaiah Odhner
3cbcc1002f Implement Custom Colors 2023-05-24 23:59:32 -04:00
Isaiah Odhner
c01167c84f Fill in inputs when editing a custom color 2023-05-24 23:23:39 -04:00
Isaiah Odhner
13485b4f79 Sync color grid with HSL state 2023-05-24 23:12:35 -04:00
Isaiah Odhner
4f00b95d1a Use current HSL state when submitting Edit Colors 2023-05-24 23:03:48 -04:00
Isaiah Odhner
7e32bf68c1 Initialize color field and luminosity ramp with starting color 2023-05-24 22:54:47 -04:00
Isaiah Odhner
c636ae0d1b Refactor _set_color_from_rgb to match _get_current_color
I might want to make this a @property; I've never used getters/setters
in Python before, but this seems like a good use case.
2023-05-24 22:39:43 -04:00
Isaiah Odhner
9b03ec2f34 Flip luminosity ramp 2023-05-24 22:25:33 -04:00
Isaiah Odhner
0a96a19c33 Preview hue and saturation on the luminosity ramp 2023-05-24 22:23:25 -04:00