diff --git a/smstool.py b/smstool.py index 4176d0e..e1a16b2 100644 --- a/smstool.py +++ b/smstool.py @@ -8,6 +8,8 @@ SMSLEN = 160 class SimserFrame(wxFrame): def __init__(self, parent, id, title): + + # Create GUI wxFrame.__init__(self, parent, id, title, wxPoint(100, 100), wxSize(450, 70)) @@ -29,10 +31,10 @@ class SimserFrame(wxFrame): wxDLG_PNT(panel, wxPoint(30, 20)), wxDLG_SZE(panel, wxSize(60, -1))) - self.fooCtrl = wxButton(panel, 10, "Senden", + self.sendCtrl = wxButton(panel, 10, "Senden", wxDLG_PNT(panel, wxPoint(100, 20)), wxDLG_SZE(panel, wxSize(30, -1))) - EVT_BUTTON(self, 10, self.OnFooClick) + EVT_BUTTON(self, 10, self.OnSendClick) self.zaehler = wxStaticText(panel, -1, str(SMSLEN), wxDLG_PNT(panel, wxPoint(150, 20)), wxDefaultSize) @@ -42,7 +44,7 @@ class SimserFrame(wxFrame): def OnCloseWindow(self, event): self.Destroy() - def OnFooClick(self, event): + def OnSendClick(self, event): text = self.textCtrl.GetValue() nr = self.nrCtrl.GetValue() @@ -50,6 +52,7 @@ class SimserFrame(wxFrame): text = sub("'", "''", text) nr = sub("'", "''", nr) + # Send SMS and report back rc = system("echo '" + text + "' | gsmsendsms '" + nr + "'") if(rc == 0): self.foodialog = wxMessageDialog(self.panel, @@ -59,8 +62,6 @@ class SimserFrame(wxFrame): self.foodialog = wxMessageDialog(self.panel, "gsmsendsms returned error code: " + str(rc >> 8), "Error", wxOK, wxPoint(100, 100)) - - self.foodialog.Show(true)