Sat, 04 Jun 2016 09:22:51 +0200
Code cleanup
15 | 1 | # This file is part of the Printrun suite. |
2 | # | |
3 | # Printrun is free software: you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation, either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # Printrun is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with Printrun. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | import wx | |
17 | ||
18 | from .utils import make_button | |
19 | ||
20 | class LogPane(wx.BoxSizer): | |
21 | ||
22 | def __init__(self, root, parentpanel = None): | |
23 | super(LogPane, self).__init__(wx.VERTICAL) | |
24 | if not parentpanel: parentpanel = root.panel | |
25 | root.logbox = wx.TextCtrl(parentpanel, style = wx.TE_MULTILINE, size = (350, -1)) | |
26 | root.logbox.SetMinSize((100, -1)) | |
27 | root.logbox.SetEditable(0) | |
28 | self.Add(root.logbox, 1, wx.EXPAND) | |
29 | bottom_panel = root.newPanel(parentpanel) | |
30 | lbrs = wx.BoxSizer(wx.HORIZONTAL) | |
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)"))) | |
33 | root.commandbox.Bind(wx.EVT_TEXT_ENTER, root.sendline) | |
34 | root.commandbox.Bind(wx.EVT_CHAR, root.cbkey) | |
35 | root.commandbox.history = [u""] | |
36 | root.commandbox.histindex = 1 | |
37 | 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) | |
39 | bottom_panel.SetSizer(lbrs) | |
40 | self.Add(bottom_panel, 0, wx.EXPAND) |