def __init__(self, parent): wx.Panel.__init__(self, parent) self.key = [0, 0, 0, 1, 0] self.SetBackgroundColour((207, 207, 207)) self.urgency = False sizer = wx.BoxSizer(wx.HORIZONTAL) start = Button(self, text=u"开始接驳", size=(120, 52), colour='green') pause = Button(self, u"暂停接驳", (120, 52), 'yellow') complete = Button(self, u"完成接驳", (120, 52), 'green') shoutdown = Button(self, u"关机", (120, 52), 'red') self.login_btn = Button(self, u"登录", (120, 52), 'white') sizer.Add(start, 0, wx.EXPAND) sizer.Add(pause, 0, wx.EXPAND | wx.LEFT, 50) sizer.Add(complete, 0, wx.EXPAND | wx.LEFT, 50) sizer.Add(shoutdown, 0, wx.EXPAND | wx.LEFT, 50) sizer.Add(self.login_btn, 0, wx.EXPAND | wx.LEFT, 50) self.Bind(wx.EVT_BUTTON, self.start, start) self.Bind(wx.EVT_BUTTON, self.pause, pause) self.Bind(wx.EVT_BUTTON, self.complete, complete) self.Bind(wx.EVT_BUTTON, self.shoutdown, shoutdown) self.Bind(wx.EVT_BUTTON, self.login, self.login_btn) watcher.attach(EVENT.EVT_URGENCY, self.urgency_event) watcher.attach(EVENT.CLEAR, self.urgency_event) self.SetSizer(sizer)
def __init__(self, parent): wx.Panel.__init__(self, parent, size=(476, 600)) self.SetBackgroundColour((207, 207, 207)) self.table = ListTable(self) self.table.SetSize((476, 700)) self.table.set_label(["id", u"运单号", u"手机号"]) self.index = 0 self.data = list() watcher.attach(EVENT.REG_PHONE, self.new_data) watcher.attach(EVENT.EVT_COMPLETE, self.clear)
def __init__(self): """ 初始化函数 :param port:端口 :param baudrate:波特率 :return None """ self.port = "COM5" self.baudrate = 115200 self.serial = None self.task = None watcher.attach(EVENT.SERIAL_CMD, self._send_command)
def __init__(self, parent): super(StatusPanel, self).__init__(parent) img_url = os.path.join(PRJ_PATH, "source/img/ready.jpg") image = wx.Image(img_url, wx.BITMAP_TYPE_JPEG).Scale(800, 350) self.static_img = wx.StaticBitmap( self, wx.ID_ANY, image.ConvertToBitmap(), size=(800, 350)) watcher.attach(EVENT.EVT_START, self.change_status) watcher.attach(EVENT.EVT_PAUSE, self.change_status) watcher.attach(EVENT.EVT_URGENCY, self.change_status) watcher.attach(EVENT.EVT_COMPLETE, self.change_status) self.ClearBackground()
def __init__(self, parent): super(InfoPanel, self).__init__(parent) self.img = None self.SetBackgroundColour((207, 207, 207)) self.express_img = wx.BitmapButton( self, wx.ID_ANY, wx.NullBitmap, size=(300, 246)) self.img = self.express_img labels = [u"快递公司", u"接驳批次", u"快件总数", u"接驳数", u"手机号识别数", u"异常件数"] self.table = LabelTable(self) self.table.SetSize((450, 246)) self.table.set_label(labels) watcher.table_update = self.table.set_data self.express_img.Bind(wx.EVT_BUTTON, self.img_explore) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.table, wx.ID_ANY, wx.EXPAND) sizer.Add(self.express_img, wx.ID_ANY, wx.EXPAND | wx.LEFT, 50) watcher.attach(EVENT.EVT_CAMERA, self.change_img) self.SetSizer(sizer)
def __init__(self): self.app = wx.App() self.frame = MainFrame(None) watcher.attach(EVENT.PROGRAM_ERROR, self.program_error)