Beispiel #1
0
 def __init_devices_sizer(self):
     sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"设备"),
                               wx.VERTICAL)
     choices = Utility.get_devices()
     self.lb_devices = wx.ListBox(sizer.GetStaticBox(), wx.ID_ANY,
                                  wx.DefaultPosition, wx.DefaultSize,
                                  choices, 0)
     button = wx.Button(sizer.GetStaticBox(), wx.ID_ANY, u"刷新",
                        wx.DefaultPosition, wx.DefaultSize, 0)
     button.Bind(wx.EVT_BUTTON, self.on_refresh)
     sizer.Add(self.lb_devices, 1, wx.EXPAND | wx.ALL, 0)
     sizer.Add(button, 0, wx.EXPAND | wx.ALL, 0)
     return sizer
Beispiel #2
0
 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
Beispiel #3
0
 def __refresh_devices(self):
     devices = Utility.get_devices()
     self.lb_devices.Set(devices)
     if len(devices) == 1:
         self.lb_devices.SetSelection(0)
Beispiel #4
0
 def __refresh(self):
     self.lb_devices.Set(Utility.get_devices())
     self.lb_fastboot.Set(Utility.get_fastboots())
    def __init__(self, parent):
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=wx.Size(500, 300),
                          style=wx.TAB_TRAVERSAL)
        MainSizer = wx.BoxSizer(wx.VERTICAL)
        DeviceSizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Device"), wx.HORIZONTAL)
        AndroidSizer = wx.BoxSizer(wx.VERTICAL)
        DeviceListBoxChoices = Utility.get_devices()
        self.DeviceListBox = wx.ListBox(DeviceSizer.GetStaticBox(), wx.ID_ANY,
                                        wx.DefaultPosition, wx.DefaultSize,
                                        DeviceListBoxChoices, 0)
        self.DeviceListBox.Bind(wx.EVT_LISTBOX, self.on_select_item)
        self.RefreshButton = wx.Button(DeviceSizer.GetStaticBox(), wx.ID_ANY,
                                       u"Refresh", wx.DefaultPosition,
                                       wx.DefaultSize, 0)
        self.RefreshButton.Bind(wx.EVT_BUTTON, self.on_refresh)
        ArtosynSizer = wx.StaticBoxSizer(
            wx.StaticBox(DeviceSizer.GetStaticBox(), wx.ID_ANY,
                         u"Artosyn8020"), wx.VERTICAL)
        self.ST_Artosyn = wx.StaticText(ArtosynSizer.GetStaticBox(), wx.ID_ANY,
                                        u"请先选择Andrid设备", wx.DefaultPosition,
                                        wx.DefaultSize, 0)
        self.ST_Artosyn.Wrap(-1)

        ButtonSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.open_button = wx.Button(ArtosynSizer.GetStaticBox(), wx.ID_ANY,
                                     u"Open", wx.DefaultPosition,
                                     wx.DefaultSize, 0)
        self.close_button = wx.Button(ArtosynSizer.GetStaticBox(), wx.ID_ANY,
                                      u"Close", wx.DefaultPosition,
                                      wx.DefaultSize, 0)
        self.root_button = wx.Button(ArtosynSizer.GetStaticBox(), wx.ID_ANY,
                                     u"Root", wx.DefaultPosition,
                                     wx.DefaultSize, 0)
        self.wakeup_button = wx.Button(ArtosynSizer.GetStaticBox(), wx.ID_ANY,
                                       u"WakeUp", wx.DefaultPosition,
                                       wx.DefaultSize, 0)
        self.open_button.Bind(wx.EVT_BUTTON, self.on_open)
        self.close_button.Bind(wx.EVT_BUTTON, self.on_close)
        self.root_button.Bind(wx.EVT_BUTTON, self.on_root)
        self.wakeup_button.Bind(wx.EVT_BUTTON, self.on_wakeup)
        ButtonSizer.Add(self.open_button, 0, wx.ALL, 0)
        ButtonSizer.Add(self.close_button, 0, wx.ALL, 0)
        ButtonSizer.Add(self.root_button, 0, wx.ALL, 0)
        ButtonSizer.Add(self.wakeup_button, 0, wx.ALL, 0)

        UpgradeSizer = wx.StaticBoxSizer(
            wx.StaticBox(ArtosynSizer.GetStaticBox(), wx.ID_ANY, u"Upgrade"),
            wx.VERTICAL)

        Up_St_Sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.upgarde_gauge = wx.Gauge(UpgradeSizer.GetStaticBox(), wx.ID_ANY,
                                      1000, wx.DefaultPosition, wx.DefaultSize,
                                      wx.GA_HORIZONTAL)
        self.upgarde_gauge.SetValue(0)
        Up_St_Sizer.Add(self.upgarde_gauge, 1,
                        wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)

        self.upgrade_button = wx.Button(UpgradeSizer.GetStaticBox(), wx.ID_ANY,
                                        u"Start", wx.DefaultPosition,
                                        wx.DefaultSize, 0)
        self.upgrade_button.Bind(wx.EVT_BUTTON, self.on_upgrade)
        Up_St_Sizer.Add(self.upgrade_button, 0, wx.LEFT, 5)
        self.FilePicker = wx.FilePickerCtrl(UpgradeSizer.GetStaticBox(),
                                            wx.ID_ANY, wx.EmptyString,
                                            u"Select a file", u"*.bin",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            wx.FLP_DEFAULT_STYLE)
        UpgradeSizer.Add(Up_St_Sizer, 1, wx.EXPAND, 5)
        UpgradeSizer.Add(self.FilePicker, 0, wx.EXPAND | wx.ALL, 0)

        AndroidSizer.Add(self.DeviceListBox, 1, wx.EXPAND | wx.ALL, 0)
        AndroidSizer.Add(self.RefreshButton, 0, wx.EXPAND | wx.ALL, 0)
        ArtosynSizer.Add(self.ST_Artosyn, 0, wx.ALL, 0)
        ArtosynSizer.Add(ButtonSizer, 1, wx.EXPAND, 0)
        ArtosynSizer.Add(UpgradeSizer, 0, wx.EXPAND, 0)
        DeviceSizer.Add(AndroidSizer, 1, wx.EXPAND, 5)
        DeviceSizer.Add(ArtosynSizer, 2, wx.EXPAND | wx.LEFT, 5)

        MessageSizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Message"), wx.VERTICAL)

        self.TC_message = wx.TextCtrl(MessageSizer.GetStaticBox(), wx.ID_ANY,
                                      wx.EmptyString, wx.DefaultPosition,
                                      wx.DefaultSize, 0)
        MessageSizer.Add(self.TC_message, 1, wx.ALL | wx.EXPAND, 0)

        MainSizer.Add(DeviceSizer, 1, wx.EXPAND | wx.ALL, 5)
        MainSizer.Add(MessageSizer, 5, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)

        self.SetSizer(MainSizer)
        self.Layout()
 def refresh():
     self.DeviceListBox.Set(Utility.get_devices())
Beispiel #7
0
 def __refresh_devices(self):
     devices = Utility.get_devices()
     self.lb_devices.Set(devices)
     if len(devices) == 1:
         self.lb_devices.SetSelection(0)
         self.__update_8020_state()