pySIMsms.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:SIMreader 作者: stoic1979 项目源码 文件源码
def __init__(self, parent, sms):
        wxskinDialog.__init__(self, parent, -1, "SMS edit")
        self.SetAutoLayout(False)
        self.sms = sms

        # Main window resizer object
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer = wx.FlexGridSizer(4,1)

        self.smsLabel = wx.StaticText(self, -1, "Message Text (%d / 160)" % len(sms.message))
        sizer.Add(self.smsLabel, 1, wx.ALIGN_CENTER | wx.ALL, 5)
        smsTextId = wx.NewId()
        self.smsText = wx.TextCtrl(self, smsTextId, sms.message, size=(300,100), style=wx.TE_MULTILINE | wx.TE_LINEWRAP, validator = pySIMvalidator(None, None, 160))
        sizer.Add(self.smsText, 1, wx.ALIGN_CENTER | wx.ALL, 5)

        hsizer = wx.FlexGridSizer(2,3)
        label = wx.StaticText(self, -1, "Date: ")
        hsizer.Add(label, 1, wx.ALL, 5)
        label = wx.StaticText(self, -1, "From: ")
        hsizer.Add(label, 1, wx.ALL, 5)
        label = wx.StaticText(self, -1, "Status: ")
        hsizer.Add(label, 1, wx.ALL, 5)

        text = wx.TextCtrl(self, -1, self.sms.timestamp, style=wx.TE_READONLY)
        hsizer.Add(text, 1, wx.ALL, 5)
        self.numberCtrl = wx.TextCtrl(self, -1, self.sms.number, validator = pySIMvalidator("+*#pw0123456789", None, 20))
        hsizer.Add(self.numberCtrl, 1, wx.ALL, 5)

        choiceList = ['Read', 'Unread', 'Deleted']
        self.ch = wx.Choice(self, -1, (80, 50), choices = choiceList)
        for i in range(len(choiceList)):
            if sms.status == choiceList[i]:
                self.ch.SetSelection(i)
                break

        hsizer.Add(self.ch, 1, wx.ALL, 5)
        sizer.Add(hsizer, 1, wx.ALL, 5)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_OK, "Save"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        sizer.Add(buttons, 1, wx.ALIGN_CENTER | wx.ALL, 5)

        wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK)
        wx.EVT_TEXT(self.smsText, smsTextId, self.smsTextChange)

        self.SetAutoLayout(1);
        self.SetSizer(sizer)
        sizer.Fit(self)
        self.Layout()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号