From 56424cf0d1a32898d01fd50c776f0b7d5a5ecbcf Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 24 Jan 2019 16:07:02 -0600 Subject: [PATCH] Implemented Ctrl+A to select all in important edit boxes --- changelog.md | 1 + src/views/dialogs/postDisplay.py | 8 ++++++++ src/wxUI/tabs/home.py | 11 +++++++++++ 3 files changed, 20 insertions(+) diff --git a/changelog.md b/changelog.md index b03f7fc..c91db3b 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,7 @@ * control+Shift+P: Play all. * Fixed an error in the audio player that was skipping the first track if you were in the last song and pressed "play next" in the menu bar or via the keystroke. * Chats with unread messages will be placed at the top of the chats section. When a chat buffer receives a new message, socializer will move the buffer to the first position in the chats list. This should make easier for everyone to determine which chats contain unread items. ([#24,](https://code.manuelcortez.net/manuelcortez/socializer/issues/24)) +* In dialogs for displaying posts and comments, and also in the two edit boxes present in chat buffers, it is possible to select all by pressing Control+A. ## Changes in version 0.18 (21.01.2019) diff --git a/src/views/dialogs/postDisplay.py b/src/views/dialogs/postDisplay.py index b671c32..c6659df 100644 --- a/src/views/dialogs/postDisplay.py +++ b/src/views/dialogs/postDisplay.py @@ -16,11 +16,19 @@ class displayBasicPost(widgetUtils.BaseDialog): def create_post_view(self, label=_("Message")): lbl = wx.StaticText(self.panel, -1, label) self.post_view = wx.TextCtrl(self.panel, -1, size=(730, -1), style=wx.TE_READONLY|wx.TE_MULTILINE) + selectId = wx.NewId() + self.Bind(wx.EVT_MENU, self.onSelect, id=selectId) + self.accel_tbl = wx.AcceleratorTable([ + (wx.ACCEL_CTRL, ord('A'), selectId),]) + self.SetAcceleratorTable(self.accel_tbl) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(lbl, 0, wx.ALL, 5) box.Add(self.post_view, 0, wx.ALL, 5) return box + def onSelect(self, event): + self.post_view.SelectAll() + def create_views_control(self): lbl = wx.StaticText(self.panel, -1, _("Views")) self.views = wx.TextCtrl(self.panel, -1, style=wx.TE_READONLY|wx.TE_MULTILINE) diff --git a/src/wxUI/tabs/home.py b/src/wxUI/tabs/home.py index d2060fb..7c0d446 100644 --- a/src/wxUI/tabs/home.py +++ b/src/wxUI/tabs/home.py @@ -164,11 +164,22 @@ class chatTab(wx.Panel): def create_controls(self): lbl1 = wx.StaticText(self, wx.NewId(), _("History")) self.history = wx.TextCtrl(self, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE, size=(500, 300)) + selectId = wx.NewId() + self.Bind(wx.EVT_MENU, self.onSelect, id=selectId) + self.accel_tbl = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('A'), selectId)]) + self.SetAcceleratorTable(self.accel_tbl) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(lbl1, 0, wx.ALL, 5) box.Add(self.history, 0, wx.ALL, 5) return box + def onSelect(self, event, *args, **kwargs): + if self.history.HasFocus(): + self.history.SelectAll() + else: + self.text.SelectAll() + event.Skip() + def create_attachments(self): lbl = wx.StaticText(self, -1, _("Attachments")) self.attachments = widgetUtils.list(self, _("Type"), _("Title"), style=wx.LC_REPORT)