|
7 | 7 | from functools import partial |
8 | 8 |
|
9 | 9 | import serial.tools.list_ports as slp |
| 10 | +import serial |
10 | 11 |
|
11 | 12 | import wx |
12 | 13 | import wx.lib.newevent as NE |
13 | 14 |
|
14 | | -from i2cdriver import I2CDriver |
| 15 | +import i2cdriver |
15 | 16 |
|
16 | 17 | PingEvent, EVT_PING = NE.NewEvent() |
17 | 18 |
|
@@ -216,9 +217,11 @@ def addrbutton(s): |
216 | 217 | d1 = min(self.devs) |
217 | 218 | try: |
218 | 219 | self.connect(self.devs[d1]) |
219 | | - except serial.SerialException: |
| 220 | + except: |
220 | 221 | del self.devs[d1] |
221 | 222 | d1 = None |
| 223 | + cb.Set(sorted(self.devs.keys())) |
| 224 | + if d1 is not None: |
222 | 225 | cb.SetValue(d1) |
223 | 226 |
|
224 | 227 | t = threading.Thread(target=ping_thr, args=(self, )) |
@@ -275,7 +278,7 @@ def filter(d): |
275 | 278 | return dict([d for d in seldev if d]) |
276 | 279 |
|
277 | 280 | def connect(self, dev): |
278 | | - self.sd = I2CDriver(dev) |
| 281 | + self.sd = i2cdriver.I2CDriver(dev) |
279 | 282 | [w.Enable(True) for w in self.allw] |
280 | 283 | self.refresh(None) |
281 | 284 |
|
@@ -350,6 +353,6 @@ def hot(self, i, s): |
350 | 353 | except: |
351 | 354 | import sys, traceback |
352 | 355 | xc = traceback.format_exception(*sys.exc_info()) |
353 | | - dlg = wx.MessageDialog(None, "".join(xc), "i2cgui Error Trap", wx.OK | wx.ICON_WARNING) |
| 356 | + dlg = wx.MessageDialog(None, "".join(xc), "i2cgui Error Trap (%s)" % i2cdriver.__version__, wx.OK | wx.ICON_WARNING) |
354 | 357 | dlg.ShowModal() |
355 | 358 | dlg.Destroy() |
0 commit comments