printrun-src/printrun/gui/toolbar.py

changeset 46
cce0af6351f0
parent 15
0bbb006204fc
equal deleted inserted replaced
45:c82943fb205f 46:cce0af6351f0
25 root.locker.SetToolTip(wx.ToolTip(_("Lock graphical interface"))) 25 root.locker.SetToolTip(wx.ToolTip(_("Lock graphical interface")))
26 glob = wx.BoxSizer(wx.HORIZONTAL) 26 glob = wx.BoxSizer(wx.HORIZONTAL)
27 parentpanel = root.newPanel(parentpanel) 27 parentpanel = root.newPanel(parentpanel)
28 glob.Add(parentpanel, 1, flag = wx.EXPAND) 28 glob.Add(parentpanel, 1, flag = wx.EXPAND)
29 glob.Add(root.locker, 0, flag = wx.ALIGN_CENTER) 29 glob.Add(root.locker, 0, flag = wx.ALIGN_CENTER)
30 ToolbarSizer = wx.WrapSizer if use_wrapsizer and wx.VERSION > (2, 9) else wx.BoxSizer 30 ToolbarSizer = wx.WrapSizer if use_wrapsizer else wx.BoxSizer
31 self = ToolbarSizer(wx.HORIZONTAL) 31 self = ToolbarSizer(wx.HORIZONTAL)
32 root.rescanbtn = make_autosize_button(parentpanel, _("Port"), root.rescanports, _("Communication Settings\nClick to rescan ports")) 32 root.rescanbtn = make_autosize_button(parentpanel, _("Port"), root.rescanports, _("Communication Settings\nClick to rescan ports"))
33 self.Add(root.rescanbtn, 0, wx.TOP | wx.LEFT, 0) 33 self.Add(root.rescanbtn, 0, wx.TOP | wx.LEFT, 0)
34 34
35 root.serialport = wx.ComboBox(parentpanel, -1, choices = root.scanserial(), 35 root.serialport = wx.ComboBox(parentpanel, -1, choices = root.scanserial(),
40 40
41 self.Add(wx.StaticText(parentpanel, -1, "@"), 0, wx.RIGHT | wx.ALIGN_CENTER, 0) 41 self.Add(wx.StaticText(parentpanel, -1, "@"), 0, wx.RIGHT | wx.ALIGN_CENTER, 0)
42 root.baud = wx.ComboBox(parentpanel, -1, 42 root.baud = wx.ComboBox(parentpanel, -1,
43 choices = ["2400", "9600", "19200", "38400", 43 choices = ["2400", "9600", "19200", "38400",
44 "57600", "115200", "250000"], 44 "57600", "115200", "250000"],
45 style = wx.CB_DROPDOWN, size = (100, -1)) 45 style = wx.CB_DROPDOWN, size = (110, -1))
46 root.baud.SetToolTip(wx.ToolTip(_("Select Baud rate for printer communication"))) 46 root.baud.SetToolTip(wx.ToolTip(_("Select Baud rate for printer communication")))
47 try: 47 try:
48 root.baud.SetValue("115200") 48 root.baud.SetValue("115200")
49 root.baud.SetValue(str(root.settings.baudrate)) 49 root.baud.SetValue(str(root.settings.baudrate))
50 except: 50 except:
51 pass 51 pass
52 self.Add(root.baud) 52 self.Add(root.baud)
53 53
54 if not hasattr(root, "connectbtn"): 54 if not hasattr(root, "connectbtn"):
55 root.connectbtn = make_autosize_button(parentpanel, _("Connect"), root.connect, _("Connect to the printer")) 55 root.connectbtn_cb_var = root.connect
56 root.connectbtn = make_autosize_button(parentpanel, _("&Connect"), root.connectbtn_cb, _("Connect to the printer"))
56 root.statefulControls.append(root.connectbtn) 57 root.statefulControls.append(root.connectbtn)
57 else: 58 else:
58 root.connectbtn.Reparent(parentpanel) 59 root.connectbtn.Reparent(parentpanel)
59 self.Add(root.connectbtn) 60 self.Add(root.connectbtn)
60 if not hasattr(root, "resetbtn"): 61 if not hasattr(root, "resetbtn"):

mercurial