printrun-src/printrun/gui/log.py

changeset 46
cce0af6351f0
parent 15
0bbb006204fc
equal deleted inserted replaced
45:c82943fb205f 46:cce0af6351f0
28 self.Add(root.logbox, 1, wx.EXPAND) 28 self.Add(root.logbox, 1, wx.EXPAND)
29 bottom_panel = root.newPanel(parentpanel) 29 bottom_panel = root.newPanel(parentpanel)
30 lbrs = wx.BoxSizer(wx.HORIZONTAL) 30 lbrs = wx.BoxSizer(wx.HORIZONTAL)
31 root.commandbox = wx.TextCtrl(bottom_panel, style = wx.TE_PROCESS_ENTER) 31 root.commandbox = wx.TextCtrl(bottom_panel, style = wx.TE_PROCESS_ENTER)
32 root.commandbox.SetToolTip(wx.ToolTip(_("Send commands to printer\n(Type 'help' for simple\nhelp function)"))) 32 root.commandbox.SetToolTip(wx.ToolTip(_("Send commands to printer\n(Type 'help' for simple\nhelp function)")))
33 root.commandbox.Hint = 'Command to [S]end'
33 root.commandbox.Bind(wx.EVT_TEXT_ENTER, root.sendline) 34 root.commandbox.Bind(wx.EVT_TEXT_ENTER, root.sendline)
34 root.commandbox.Bind(wx.EVT_CHAR, root.cbkey) 35 root.commandbox.Bind(wx.EVT_CHAR, root.cbkey)
35 root.commandbox.history = [u""] 36 def deselect(ev):
37 # In Ubuntu 19.10, when focused, all text is selected
38 lp = root.commandbox.LastPosition
39 # print(f"SetSelection({lp}, {lp})")
40 wx.CallAfter(root.commandbox.SetSelection, lp, lp)
41 ev.Skip()
42 root.commandbox.Bind(wx.EVT_SET_FOCUS, deselect)
43 root.commandbox.history = [""]
36 root.commandbox.histindex = 1 44 root.commandbox.histindex = 1
37 lbrs.Add(root.commandbox, 1) 45 lbrs.Add(root.commandbox, 1)
38 root.sendbtn = make_button(bottom_panel, _("Send"), root.sendline, _("Send Command to Printer"), style = wx.BU_EXACTFIT, container = lbrs) 46 root.sendbtn = make_button(bottom_panel, _("Send"), root.sendline, _("Send Command to Printer"), style = wx.BU_EXACTFIT, container = lbrs)
39 bottom_panel.SetSizer(lbrs) 47 bottom_panel.SetSizer(lbrs)
40 self.Add(bottom_panel, 0, wx.EXPAND) 48 self.Add(bottom_panel, 0, wx.EXPAND)

mercurial