Commit Graph

564 Commits

Author SHA1 Message Date
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
Isaiah Odhner
f54de3f065 Fix help window layout when maximized, breaking minimize behavior
Maximization is more important, so this is still a win, but this does
make minimization stop working and look really stupid.
2023-05-01 15:57:22 -04:00
Isaiah Odhner
f0f9200292 Prevent dragging window if maximized 2023-05-01 15:46:10 -04:00
Isaiah Odhner
facfd6cfe3 Fix potential error if minimize but not maximize present, or visa versa 2023-05-01 15:42:49 -04:00
Isaiah Odhner
c8b042bae6 Add minimize/maximize/restore to help window 2023-05-01 15:34:44 -04:00
Isaiah Odhner
f630026811 Note about linting 2023-05-01 14:47:30 -04:00
Isaiah Odhner
974bff7d3d Note about path separators 2023-05-01 14:38:58 -04:00
Isaiah Odhner
a296502529 Update spell checker configuration and accept spellings
- Re-ignore moved localization folder
- Ignore textual_paint.egg-info folder
- Enable spell checking in VS Code for file types that are already
  checked via the cspell-cli
- Accept new words
2023-05-01 13:39:08 -04:00
Isaiah Odhner
0b6006325e Resolve all non-strict mode Pyright errors 2023-05-01 13:24:24 -04:00
Isaiah Odhner
2a35778cbd Add file drop support 2023-05-01 12:31:21 -04:00
Isaiah Odhner
b0c9d1562d Fix textbox being discarded with (only) pasted text in it 2023-05-01 11:44:47 -04:00
Isaiah Odhner
1a7b6561bd Simplify usage line in help 2023-05-01 10:51:33 -04:00
Isaiah Odhner
85449524bf Fix "[filename]" missing, interpreted as markup and ignored 2023-05-01 10:48:54 -04:00