Commit Graph

943 Commits

Author SHA1 Message Date
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
Isaiah Odhner
058d54643b Wire up luminosity ramp, color field, and color preview state 2023-05-24 22:18:44 -04:00
Isaiah Odhner
ddf40c5b81 Fix size for inputs in Edit Colors 2023-05-24 22:18:44 -04:00
Isaiah Odhner
fc1536fd8e Start wiring up numeric color value inputs to state 2023-05-24 22:18:44 -04:00
Isaiah Odhner
cf979114a9 Refactor: remove class LabeledInput so it's easy to get at the Inputs
Now that I'm creating the inputs dynamically, it doesn't help to have a class for labeled inputs.
And `self._inputs_by_letter[component_letter] = labeled_inputs[-1].query_one(Input)` failed, because it's not mounted yet.
2023-05-24 00:56:45 -04:00
Isaiah Odhner
0fdbce1f77 Refactor: create numeric inputs dynamically 2023-05-24 00:54:23 -04:00
Isaiah Odhner
eee0d17916 Add color preview 2023-05-24 00:54:23 -04:00
Isaiah Odhner
d2ac30615a Fix scaling of HSL ramps so that the cursor is visible at the maximums 2023-05-24 00:05:07 -04:00
Isaiah Odhner
8680c364dd Clamp values 2023-05-23 23:52:45 -04:00
Isaiah Odhner
edaf7fb17a Make ColorField and LuminosityRamp interactive 2023-05-23 23:52:45 -04:00
Isaiah Odhner
a515999937 Scaffold visual color inputs (Hue/Sat field and Lum slider) 2023-05-23 03:00:08 -04:00
Isaiah Odhner
272bcb3217 Scaffold numeric color value inputs 2023-05-23 03:00:08 -04:00
Isaiah Odhner
4c73395c0c Tweak border 2023-05-23 00:06:02 -04:00
Isaiah Odhner
4d676409c0 Separate focused and selected states in Edit Colors 2023-05-22 23:51:34 -04:00
Isaiah Odhner
9ada90e92d Fix behavior when navigating with arrows on duplicate color 2023-05-22 23:37:10 -04:00
Isaiah Odhner
2aea62bff5 Fix NoMatches crash if you tab to the color grid and then use arrows 2023-05-22 01:49:56 -04:00
Isaiah Odhner
d88885419c Make color grid focusable, keyboard navigable; require clicking OK button 2023-05-22 01:43:23 -04:00
Isaiah Odhner
7f28470f78 Note an issue 2023-05-22 00:23:44 -04:00
Isaiah Odhner
04d0ca80fd VS Code: Add launch task for --recode-samples 2023-05-22 00:22:36 -04:00
Isaiah Odhner
85ec3627cd Fix Path vs str type error
It didn't actually cause an error at runtime because
format_from_extension just uses os.path.splitext, which uses os.fspath
which converts Path objects to path strings.
2023-05-22 00:22:36 -04:00
Isaiah Odhner
0edd171233 Clean up imports
I had kept these around because several of these I'll want to use,
and the auto-import feature wasn't working, but I've since found a fix
for that (in 453111269e).
I'm also adding rich here to fix auto-imports from rich.
2023-05-22 00:22:36 -04:00
Isaiah Odhner
e9755637d6 Update Textual to 0.26.0
Both issues I opened have been fixed! :)
2023-05-21 22:00:39 -04:00
Isaiah Odhner
ab45f40e15 Use Iterator instead of Generator for consistency and conciseness 2023-05-21 20:18:06 -04:00
Isaiah Odhner
3f9d1a5c37 Prefer "| None" to Optional 2023-05-21 20:04:22 -04:00
Isaiah Odhner
0bf1841d0d Use tuple instead of Tuple from typing module 2023-05-21 20:04:22 -04:00
Isaiah Odhner
8a97c1394f Use dict instead of Dict from typing module 2023-05-21 19:50:09 -04:00
Isaiah Odhner
7b15a580ab Use list instead of List from typing module 2023-05-21 19:49:22 -04:00
Isaiah Odhner
9dab42f9c9 Add max_width param, syncing with ansi-art-thumbnailer 2023-05-21 19:43:40 -04:00
Isaiah Odhner
c3d6c24596 Optimize SVG opening: ignore most rects when measuring grid
This brings it down from around 20 seconds to less than a second,
for moderately sized documents (i.e. default size).
For larger documents, it can still be slow.
2023-05-20 02:05:02 -04:00
Isaiah Odhner
dae8e809c4 Update from_svg docstring 2023-05-20 00:49:01 -04:00
Isaiah Odhner
cd2498c151 Refactor: use size_attrib 2023-05-20 00:29:21 -04:00
Isaiah Odhner
445d29268f Fix type checker error 2023-05-20 00:23:37 -04:00
Isaiah Odhner
5392864552 Update readme regarding SVG loading
Not sure if some of this should go in Known Issues, maybe with a
"see Known Issues" reference, but I might just fix these things soon.
2023-05-20 00:21:49 -04:00
Isaiah Odhner
b88b5cdfa0 Mention new project: ansi-art-thumbnailer 2023-05-19 22:19:27 -04:00
Isaiah Odhner
322391544b Parse <style> tags when loading SVG 2023-05-19 15:48:42 -04:00
Isaiah Odhner
f2ac4dc98b Perf: Make rects_to_ignore into a set
Checking membership in a set is O(1), as compared to O(n) for a list.
2023-05-19 01:27:22 -04:00