neingeist
/
smstool
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

82 lines
2.3 KiB
Python

20 years ago
from wxPython.wx import *
20 years ago
from os import system
SMSLEN = 160
20 years ago
20 years ago
#class FloatValidator(wxValidator):
# def Clone (self):
# return self.__class__()
# def Validate(self, window):
# ctrl =wxPyTypeCast(self.GetWindow(), "wxTextCtrl")
# try:
# value = float( ctrl.GetValue())
# return true
# except ValueError:
# wx.MessageBox("A text object must contain some text!", "Error")
# return false
# def TransferToWindow(self):
# return true
# def TransferFromWindow(self):
# return true
20 years ago
class SmsToolFrame(wxFrame):
def __init__(self, parent, id, title):
wxFrame.__init__(self, parent, id, title,
wxPoint(100, 100), wxSize(450, 70))
panel = wxPanel(self, -1)
self.panel = panel
wxStaticText(panel, -1, "Text:",
wxDLG_PNT(panel, wxPoint(4, 4)), wxDefaultSize)
wxStaticText(panel, -1, "Nummer:",
wxDLG_PNT(panel, wxPoint(4, 20)), wxDefaultSize)
20 years ago
self.textCtrl = wxTextCtrl(panel, 20, "",
20 years ago
wxDLG_PNT(panel, wxPoint(30, 4)),
wxDLG_SZE(panel, wxSize(160, -1)))
20 years ago
self.textCtrl.SetMaxLength(SMSLEN);
20 years ago
self.nrCtrl = wxTextCtrl(panel, -1, "",
wxDLG_PNT(panel, wxPoint(30, 20)),
20 years ago
wxDLG_SZE(panel, wxSize(30, -1)),
# validator = FloatValidator())
)
20 years ago
self.fooCtrl = wxButton(panel, 10, "Senden",
wxDLG_PNT(panel, wxPoint(70, 20)),
wxDLG_SZE(panel, wxSize(30, -1)))
EVT_BUTTON(self, 10, self.OnFooClick)
20 years ago
self.zaehler = wxStaticText(panel, -1, str(SMSLEN),
wxDLG_PNT(panel, wxPoint(110, 20)), wxDefaultSize)
EVT_TEXT(self, 20, self.OnChange)
20 years ago
def OnCloseWindow(self, event):
self.Destroy()
def OnFooClick(self, event):
20 years ago
text = self.textCtrl.GetValue()
nr = self.nrCtrl.GetValue()
foo = system("echo '" + text + "' | cat")
self.foodialog = wxMessageDialog(self.panel,
text + str(foo) + nr,
"foo", wxOK, wxPoint(100, 100))
self.foodialog.Show(true)
def OnChange(self, event):
self.zaehler.SetLabel(str(SMSLEN-len(self.textCtrl.GetValue())))
20 years ago
class SmsTool(wxApp):
def OnInit(self):
frame = SmsToolFrame(NULL, -1, "SmsTool")
frame.Show(true)
self.SetTopWindow(frame)
return true
smstool=SmsTool(0)
smstool.MainLoop()