Files
twblue/src/wxUI/dialogs/mastodon/menus.py
Claude 977de1332a Implement post editing functionality for Mastodon
Add ability to edit posts in Mastodon with full support for:
- Editing post text and content warnings
- Re-uploading or keeping existing media attachments
- Editing poll options (for posts with polls)
- Modifying visibility and language settings
- All features available through web interface

Changes:
- Add edit_post() method in Mastodon session to handle API calls
- Create editPost dialog class that loads existing post data
- Add edit_status() method to buffer controllers
- Add Edit menu item to base and notification menus
- Register edit_post action in all keymaps (no default key assigned)
- Add edit_post() action handler in main controller

The edit option is only enabled for the user's own posts (not boosts).
Users can access the feature through the context menu or by assigning
a keyboard shortcut in the keymap editor.
2025-11-06 14:37:12 +00:00

61 lines
2.8 KiB
Python

# -*- coding: utf-8 -*-
import wx
class base(wx.Menu):
def __init__(self):
super(base, self).__init__()
self.boost = wx.MenuItem(self, wx.ID_ANY, _("&Boost"))
self.Append(self.boost)
self.reply = wx.MenuItem(self, wx.ID_ANY, _(u"Re&ply"))
self.Append(self.reply)
self.edit = wx.MenuItem(self, wx.ID_ANY, _(u"&Edit"))
self.Append(self.edit)
self.fav = wx.MenuItem(self, wx.ID_ANY, _(u"&Add to favorites"))
self.Append(self.fav)
self.unfav = wx.MenuItem(self, wx.ID_ANY, _(u"R&emove from favorites"))
self.Append(self.unfav)
self.openUrl = wx.MenuItem(self, wx.ID_ANY, _("&Open URL"))
self.Append(self.openUrl)
self.openInBrowser = wx.MenuItem(self, wx.ID_ANY, _(u"&Open in instance"))
self.Append(self.openInBrowser)
self.play = wx.MenuItem(self, wx.ID_ANY, _(u"&Play audio"))
self.Append(self.play)
self.view = wx.MenuItem(self, wx.ID_ANY, _(u"&Show post"))
self.Append(self.view)
self.copy = wx.MenuItem(self, wx.ID_ANY, _(u"&Copy to clipboard"))
self.Append(self.copy)
self.remove = wx.MenuItem(self, wx.ID_ANY, _(u"&Delete"))
self.Append(self.remove)
self.userActions = wx.MenuItem(self, wx.ID_ANY, _(u"&User actions..."))
self.Append(self.userActions)
class notification(wx.Menu):
def __init__(self, item="status"):
super(notification, self).__init__()
valid_types = ["status", "mention", "reblog", "favourite", "update", "poll"]
if item in valid_types:
self.boost = wx.MenuItem(self, wx.ID_ANY, _("&Boost"))
self.Append(self.boost)
self.reply = wx.MenuItem(self, wx.ID_ANY, _(u"Re&ply"))
self.Append(self.reply)
self.edit = wx.MenuItem(self, wx.ID_ANY, _(u"&Edit"))
self.Append(self.edit)
self.fav = wx.MenuItem(self, wx.ID_ANY, _(u"&Add to favorites"))
self.Append(self.fav)
self.unfav = wx.MenuItem(self, wx.ID_ANY, _(u"R&emove from favorites"))
self.Append(self.unfav)
self.openUrl = wx.MenuItem(self, wx.ID_ANY, _("&Open URL"))
self.Append(self.openUrl)
self.play = wx.MenuItem(self, wx.ID_ANY, _(u"&Play audio"))
self.Append(self.play)
self.openInBrowser = wx.MenuItem(self, wx.ID_ANY, _(u"&Open in instance"))
self.Append(self.openInBrowser)
self.view = wx.MenuItem(self, wx.ID_ANY, _(u"&Show post"))
self.Append(self.view)
self.copy = wx.MenuItem(self, wx.ID_ANY, _(u"&Copy to clipboard"))
self.Append(self.copy)
self.remove = wx.MenuItem(self, wx.ID_ANY, _(u"&Dismiss"))
self.Append(self.remove)
self.userActions = wx.MenuItem(self, wx.ID_ANY, _(u"&User actions..."))
self.Append(self.userActions)