def __init_devices_sizer(self): sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"设备"), wx.VERTICAL) device_choices = Utility.get_devices() fastboot_choices = Utility.get_fastboots() d_tilte = wx.StaticText(self, wx.ID_ANY, u"Android Devices", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTER) f_title = wx.StaticText(self, wx.ID_ANY, u"Fastboot Devices", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTER) self.lb_devices = wx.ListBox(sizer.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, device_choices, style=wx.LB_EXTENDED) self.lb_fastboot = wx.ListBox(sizer.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, fastboot_choices, style=wx.LB_EXTENDED) button = wx.Button(sizer.GetStaticBox(), wx.ID_ANY, u"刷新", wx.DefaultPosition, wx.DefaultSize, 0) button.Bind(wx.EVT_BUTTON, self.on_refresh) sizer.Add(d_tilte, 0, wx.EXPAND | wx.ALL, 0) sizer.Add(self.lb_devices, 1, wx.EXPAND | wx.ALL, 0) sizer.Add(f_title, 0, wx.EXPAND | wx.TOP, 5) sizer.Add(self.lb_fastboot, 1, wx.EXPAND | wx.ALL, 0) sizer.Add(button, 0, wx.EXPAND | wx.ALL, 0) return sizer
def __refresh(self): self.lb_devices.Set(Utility.get_devices()) self.lb_fastboot.Set(Utility.get_fastboots())