printrun-src/printrun/gui/log.py

changeset 46
cce0af6351f0
parent 15
0bbb006204fc
--- a/printrun-src/printrun/gui/log.py	Tue Jan 19 20:45:09 2021 +0100
+++ b/printrun-src/printrun/gui/log.py	Wed Jan 20 10:15:13 2021 +0100
@@ -30,9 +30,17 @@
         lbrs = wx.BoxSizer(wx.HORIZONTAL)
         root.commandbox = wx.TextCtrl(bottom_panel, style = wx.TE_PROCESS_ENTER)
         root.commandbox.SetToolTip(wx.ToolTip(_("Send commands to printer\n(Type 'help' for simple\nhelp function)")))
+        root.commandbox.Hint = 'Command to [S]end'
         root.commandbox.Bind(wx.EVT_TEXT_ENTER, root.sendline)
         root.commandbox.Bind(wx.EVT_CHAR, root.cbkey)
-        root.commandbox.history = [u""]
+        def deselect(ev):
+            # In Ubuntu 19.10, when focused, all text is selected
+            lp = root.commandbox.LastPosition
+            # print(f"SetSelection({lp}, {lp})")
+            wx.CallAfter(root.commandbox.SetSelection, lp, lp)
+            ev.Skip()
+        root.commandbox.Bind(wx.EVT_SET_FOCUS, deselect)
+        root.commandbox.history = [""]
         root.commandbox.histindex = 1
         lbrs.Add(root.commandbox, 1)
         root.sendbtn = make_button(bottom_panel, _("Send"), root.sendline, _("Send Command to Printer"), style = wx.BU_EXACTFIT, container = lbrs)

mercurial