diff --git a/README.md b/README.md index 6832c8e..0261bb4 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ This is a TUI (Text User Interface) image editor, inspired by MS Paint, built wi - [x] **Attributes** (resize canvas; in the future may change color/text modes, maybe text encoding) - [x] **Edit Colors** - [x] **Set As Wallpaper** (tiled or centered) - - Every command is implemented, other than **Print** and **Send** (as fax / email), and a few toggles: **Draw Opaque** (pending tool options), **Show Thumbnail** (pending [sixel support in Textual](https://textual.textualize.io/roadmap/#widgets)), and **Text Toolbar** (which could show FIGlet fonts, but that would complicate the text area implementation, and could show bold/italic/underline, but that would complicate the document model. Both interesting, but not for a first release!) + - Every command is implemented, other than printing options, and a few toggles: **Draw Opaque** (pending tool options), **Show Thumbnail** (pending [sixel support in Textual](https://textual.textualize.io/roadmap/#widgets)), and **Text Toolbar** (which could show FIGlet fonts, but that would complicate the text area implementation, and could show bold/italic/underline, but that would complicate the document model. Both interesting, but not for a first release!) - [x] Color palette - [x] Efficient screen updates and undo/redo history, by tracking regions affected by each action - You could totally use this program over SSH! Haha, this "what if" project could actually be useful. Of course, it should be mentioned that you can also run graphical programs over SSH, but this might be more responsive, or just fit your vibe better. diff --git a/src/textual_paint/paint.py b/src/textual_paint/paint.py index 7695e26..333e507 100755 --- a/src/textual_paint/paint.py +++ b/src/textual_paint/paint.py @@ -3631,9 +3631,19 @@ Columns: {len(palette) // 2} self.message_box(_("Paint"), "Not implemented.", "ok") def action_print(self) -> None: self.message_box(_("Paint"), "Not implemented.", "ok") + def action_send(self) -> None: - self.message_box(_("Paint"), "Not implemented.", "ok") - + """Send the image as an email attachment.""" + import subprocess + import tempfile + file_path = tempfile.mktemp(suffix=".svg") + svg = self.image.get_svg() + self.write_file_path(file_path, svg.encode("utf-8"), _("Send")) + body = _("Textual Paint image attached.") + subprocess.run(["xdg-email", "--utf8", "--attach", file_path, "--body", body, "Someone "]) + # Don't remove the file. + # Some e-mail applications require the file to remain present after xdg-email returns. + def action_set_as_wallpaper_tiled(self) -> None: """Tile the image as the wallpaper.""" self.set_as_wallpaper(tiled=True) @@ -4425,7 +4435,7 @@ Columns: {len(palette) // 2} MenuItem(_("Page Se&tup..."), self.action_page_setup, 57605, grayed=True, description=_("Changes the page layout.")), MenuItem(_("&Print...\tCtrl+P"), self.action_print, 57607, grayed=True, description=_("Prints the active document and sets printing options.")), Separator(), - MenuItem(_("S&end..."), self.action_send, 37662, grayed=True, description=_("Sends a picture by using mail or fax.")), + MenuItem(_("S&end..."), self.action_send, 37662, description=_("Sends a picture by using mail or fax.")), Separator(), MenuItem(_("Set As &Wallpaper (Tiled)"), self.action_set_as_wallpaper_tiled, 57677, description=_("Tiles this bitmap as the desktop wallpaper.")), MenuItem(_("Set As Wa&llpaper (Centered)"), self.action_set_as_wallpaper_centered, 57675, description=_("Centers this bitmap as the desktop wallpaper.")),