|
|
@ -1,5 +1,8 @@
|
|
|
|
|
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
|
|
|
|
from wxPython.wx import *
|
|
|
|
from wxPython.wx import *
|
|
|
|
from os import system
|
|
|
|
from os import system
|
|
|
|
|
|
|
|
from re import sub
|
|
|
|
|
|
|
|
|
|
|
|
SMSLEN = 160
|
|
|
|
SMSLEN = 160
|
|
|
|
|
|
|
|
|
|
|
@ -36,20 +39,19 @@ class SmsToolFrame(wxFrame):
|
|
|
|
wxDLG_PNT(panel, wxPoint(30, 4)),
|
|
|
|
wxDLG_PNT(panel, wxPoint(30, 4)),
|
|
|
|
wxDLG_SZE(panel, wxSize(160, -1)))
|
|
|
|
wxDLG_SZE(panel, wxSize(160, -1)))
|
|
|
|
self.textCtrl.SetMaxLength(SMSLEN);
|
|
|
|
self.textCtrl.SetMaxLength(SMSLEN);
|
|
|
|
|
|
|
|
self.textCtrl.SetFocus()
|
|
|
|
|
|
|
|
|
|
|
|
self.nrCtrl = wxTextCtrl(panel, -1, "",
|
|
|
|
self.nrCtrl = wxTextCtrl(panel, -1, "",
|
|
|
|
wxDLG_PNT(panel, wxPoint(30, 20)),
|
|
|
|
wxDLG_PNT(panel, wxPoint(30, 20)),
|
|
|
|
wxDLG_SZE(panel, wxSize(30, -1)),
|
|
|
|
wxDLG_SZE(panel, wxSize(60, -1)))
|
|
|
|
# validator = FloatValidator())
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.fooCtrl = wxButton(panel, 10, "Senden",
|
|
|
|
self.fooCtrl = wxButton(panel, 10, "Senden",
|
|
|
|
wxDLG_PNT(panel, wxPoint(70, 20)),
|
|
|
|
wxDLG_PNT(panel, wxPoint(100, 20)),
|
|
|
|
wxDLG_SZE(panel, wxSize(30, -1)))
|
|
|
|
wxDLG_SZE(panel, wxSize(30, -1)))
|
|
|
|
EVT_BUTTON(self, 10, self.OnFooClick)
|
|
|
|
EVT_BUTTON(self, 10, self.OnFooClick)
|
|
|
|
|
|
|
|
|
|
|
|
self.zaehler = wxStaticText(panel, -1, str(SMSLEN),
|
|
|
|
self.zaehler = wxStaticText(panel, -1, str(SMSLEN),
|
|
|
|
wxDLG_PNT(panel, wxPoint(110, 20)), wxDefaultSize)
|
|
|
|
wxDLG_PNT(panel, wxPoint(150, 20)), wxDefaultSize)
|
|
|
|
|
|
|
|
|
|
|
|
EVT_TEXT(self, 20, self.OnChange)
|
|
|
|
EVT_TEXT(self, 20, self.OnChange)
|
|
|
|
|
|
|
|
|
|
|
@ -60,11 +62,22 @@ class SmsToolFrame(wxFrame):
|
|
|
|
text = self.textCtrl.GetValue()
|
|
|
|
text = self.textCtrl.GetValue()
|
|
|
|
nr = self.nrCtrl.GetValue()
|
|
|
|
nr = self.nrCtrl.GetValue()
|
|
|
|
|
|
|
|
|
|
|
|
foo = system("echo '" + text + "' | cat")
|
|
|
|
# Quote text
|
|
|
|
|
|
|
|
text = sub("'", "''", text)
|
|
|
|
|
|
|
|
nr = sub("'", "''", nr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rc = system("echo '" + text + "' | gsmsendsms '" + nr + "'")
|
|
|
|
|
|
|
|
if(rc == 0):
|
|
|
|
|
|
|
|
self.foodialog = wxMessageDialog(self.panel,
|
|
|
|
|
|
|
|
"Message sent",
|
|
|
|
|
|
|
|
"Success", wxOK, wxPoint(100, 100))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.foodialog = wxMessageDialog(self.panel,
|
|
|
|
|
|
|
|
"gsmsendsms returned error code: " + str(rc >> 8),
|
|
|
|
|
|
|
|
"Error", wxOK, wxPoint(100, 100))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.foodialog = wxMessageDialog(self.panel,
|
|
|
|
|
|
|
|
text + str(foo) + nr,
|
|
|
|
|
|
|
|
"foo", wxOK, wxPoint(100, 100))
|
|
|
|
|
|
|
|
self.foodialog.Show(true)
|
|
|
|
self.foodialog.Show(true)
|
|
|
|
|
|
|
|
|
|
|
|
def OnChange(self, event):
|
|
|
|
def OnChange(self, event):
|
|
|
|