Commit Graph

576 Commits

Author SHA1 Message Date
Isaiah Odhner
3e29d2a75e Split action_paste and paste 2023-05-04 14:35:14 -04:00
Isaiah Odhner
c2ee9ef2df Simplify: don't need a Task!
This still handles errors, unlike a million things I tried before,
and can still work and exit successfully.
2023-05-04 14:29:12 -04:00
Isaiah Odhner
cf39357641 Clean up 2023-05-04 14:23:32 -04:00
Isaiah Odhner
1656c64ea2 Make --recode-samples handle exceptions, in an insanely complicated way 2023-05-04 13:40:08 -04:00
Isaiah Odhner
c9c58f12c6 Extract Open and Save As dialogs to a file_dialogs module 2023-05-04 13:15:06 -04:00
Isaiah Odhner
3ae8af3ad7 Use default colors instead last, when padding rows from an ANSI file
I'm not sure whether it should continue the color at the end of a row,
or if it should use the default color, but before, it used the last
color set in the entire file, even for earlier rows,
so this is at least better than that.
2023-05-03 20:29:24 -04:00
Isaiah Odhner
426354e986 Add notes to development section of readme 2023-05-03 20:20:49 -04:00
Isaiah Odhner
943151afe9 Set up diffing ANSI files with cat --show-all
I can only set up half of this directly, for the other half,
you have to run the command I mention here.
2023-05-03 19:50:37 -04:00
Isaiah Odhner
1d26df938d Add 2x2.ans sample file (containing a border square) 2023-05-03 19:04:26 -04:00
Isaiah Odhner
fcfe1d354e Add 1x1.ans sample file (containing a smiley face) 2023-05-03 19:04:26 -04:00
Isaiah Odhner
b80f15bfde Find samples folder relative to the Python script, and DRY 2023-05-03 19:04:26 -04:00
Isaiah Odhner
03ce16e100 Allow creating new file via the command line, if file doesn't exist 2023-05-03 17:22:50 -04:00
Isaiah Odhner
cf81a4236a Convert line endings to CRLF in sample ANSI files
I used:
    cd samples && sed -i 's/$/\r/' *

A git diff across branches suggests that this command gives the same results:
    src/textual_paint/paint.py --recode-samples

And --recode-samples is now idempotent, for the current set of sample files.
2023-05-03 16:09:31 -04:00
Isaiah Odhner
1eccb1b98a Disable line ending normalization for ANSI files 2023-05-03 16:00:31 -04:00
Isaiah Odhner
799ec9944a Fix color values being rounded when loading an ANSI file 2023-05-03 13:49:52 -04:00
Isaiah Odhner
91e228a239 Use inline styles when exporting HTML
I'd rather it be copy-pastable and larger, than smaller but potentially disappointing or frustrating.
2023-05-03 12:35:40 -04:00
Isaiah Odhner
4f4a65c6fe Fix gaps between lines in HTML export in Chrome/Firefox on Ubuntu
This is dependent on the font.
In both Chrome/Firefox, monospace uses "DejaVu Sans Mono" on my system,
but if I specify "DejaVu Sans Mono" explicitly, it uses a larger
font size (16px, as compared to 12px in Firefox or 13px in Chrome), and
slight gaps are visible.

This fixes a regression when switching over to the Rich API's built-in
HTML exporting — from where I'm sitting — but it may look totally
different on someone else's computer.
2023-05-03 12:30:29 -04:00
Isaiah Odhner
b4af4032f7 Copy HTML template from rich/_export_format.py 2023-05-03 12:05:54 -04:00
Isaiah Odhner
0bed615e74 Exit after --recode-samples
Otherwise it may leave the app in a weird state where
app.image != app.canvas.image (I presume), and you can't draw, at least
not visibly, and it can prompt you to save changes to the document
that isn't visibly open, except in the titlebar (Header).
2023-05-03 11:56:14 -04:00
Isaiah Odhner
0282eb3785 Clarify formatter_class strategy (hack) 2023-05-03 11:39:04 -04:00
Isaiah Odhner
1cdad17fe9 Set a fixed width when updating CLI help on readme
By default it uses the terminal width, which caused the help text to change spuriously.
2023-05-03 11:39:00 -04:00
Isaiah Odhner
77fa6cb444 Fix error after resizing the document if there was an action preview
If you confirmed the dialog with Enter after hovering over the canvas,
previously it got:

    IndexError: list index out of range

when canceling the preview after it became outdated in regard to the
canvas size.
2023-05-03 11:38:56 -04:00
Isaiah Odhner
cbbaf18945 Rename methods dealing with plain text 2023-05-03 11:38:34 -04:00
Isaiah Odhner
eaa64c992e Add --recode-samples for testing 2023-05-03 11:37:40 -04:00
Isaiah Odhner
8463f2069f Automatically update the readme CLI help 2023-05-03 11:37:33 -04:00
Isaiah Odhner
62d0f5043d Use Textual's Color.parse during ANSI export 2023-05-02 14:00:09 -04:00
Isaiah Odhner
afcedccba6 Use Rich API for HTML export
This should handle escaping.
2023-05-02 13:43:53 -04:00
Isaiah Odhner
7f35b96c40 Construct Rich renderable without encoding to ANSI first 2023-05-02 13:33:00 -04:00
Isaiah Odhner
fec1b45a40 Gesture towards a Rich API based ANSI file loading solution 2023-05-02 12:53:18 -04:00
Isaiah Odhner
dd5557c803 Accept spellings 2023-05-02 12:33:48 -04:00
Isaiah Odhner
815a279784 Clean up new SVG code 2023-05-02 01:19:06 -04:00
Isaiah Odhner
e0ec86dce0 Clean up old SVG code 2023-05-02 01:19:06 -04:00
Isaiah Odhner
3ac9ad0ff8 Update readme in regard to progress on Set As Wallpaper 2023-05-02 01:00:22 -04:00
Isaiah Odhner
1fc878d352 Customize SVG template, removing window chrome 2023-05-01 21:34:33 -04:00
Isaiah Odhner
fa63020929 Copy SVG template from rich/_export_format.py 2023-05-01 21:28:32 -04:00
Isaiah Odhner
6d2529bdf2 WIP: use Rich API for saving SVG 2023-05-01 21:28:32 -04:00
Isaiah Odhner
c17ff44562 Tweak attributes window layout further
- Reduce gratuitous padding
- Align inputs
2023-05-01 18:51:33 -04:00
Isaiah Odhner
e9cad1ae80 Make attributes window layout nicer 2023-05-01 18:47:25 -04:00
Isaiah Odhner
cfc17fafef Place buttons in a row, in Save As and Open dialogs
This also enables arrow keys to switch between the buttons,
but that's not very important.
2023-05-01 18:23:33 -04:00
Isaiah Odhner
d5cc0332b9 Show current zoom level in Custom Zoom dialog 2023-05-01 18:23:18 -04:00
Isaiah Odhner
3145fb7f11 Tweak formatting 2023-05-01 18:23:18 -04:00
Isaiah Odhner
bbc023eb59 Use pipe instead of Union[] 2023-05-01 18:23:18 -04:00
Isaiah Odhner
c67174d4c5 Partially format one file using black
Trying it out, I liked some of it's suggestions, but not others...
I don't think I can commit to formatting the codebase at this point.
2023-05-01 18:23:18 -04:00
Isaiah Odhner
4ff90fa8ec Add ignore comment for error Pylance gives even though pyright doesn't
With Pyright's strict mode disabled, I got zero issues from the CLI,
but got a Problem underline in VS Code from Pylance:
- "Gio" is unknown import symbol Pylance(reportGeneralTypeIssues)

This also silences, on the same line:
- Type of "Gio" is unknown Pylance(reportUnknownVariableType)

gi.repository uses DynamicImporter, which I assume is all the reason
the type checker "needs" to be confused, so I'm not worried about this.
2023-05-01 17:13:05 -04:00
Isaiah Odhner
d8d0871729 Catch any errors getting the clipboard data
I haven't run into this, but since we've got a nice localized string for it...
2023-05-01 16:56:43 -04:00
Isaiah Odhner
a20f2c05d7 Tweak help window title, and add icon 2023-05-01 16:44:09 -04:00
Isaiah Odhner
6367315c2a Clean up / refactor 2023-05-01 16:11:26 -04:00
Isaiah Odhner
873f0f2096 Tweak for technical correctness
This theoretically should behave better in more styling scenarios.
2023-05-01 16:08:55 -04:00
Isaiah Odhner
bec4fb680b Get border dynamically 2023-05-01 16:06:54 -04:00
Isaiah Odhner
6c61830143 Fix minimize behavior 2023-05-01 16:03:15 -04:00