dialogs/DurationEditorDialog.py
changeset 1702 bbb2c38969ca
parent 1696 8043f32de7b8
child 1730 64d8f52bc8c8
equal deleted inserted replaced
1701:8337f6c169d0 1702:bbb2c38969ca
   120             except ValueError, e:
   120             except ValueError, e:
   121                 message = wx.MessageDialog(self, _("Invalid value!\nYou must fill a numeric value."), _("Error"), wx.OK|wx.ICON_ERROR)
   121                 message = wx.MessageDialog(self, _("Invalid value!\nYou must fill a numeric value."), _("Error"), wx.OK|wx.ICON_ERROR)
   122                 message.ShowModal()
   122                 message.ShowModal()
   123                 message.Destroy()
   123                 message.Destroy()
   124             event.Skip()
   124             event.Skip()
       
   125             self.OnCloseDialog()
   125         return OnValueChanged
   126         return OnValueChanged
   126 
   127 
   127     def GetDuration(self):
   128     def GetDuration(self):
   128         milliseconds = 0
   129         milliseconds = 0
   129         for control, factor in [(self.Days, DAY), (self.Hours, HOUR),
   130         for control, factor in [(self.Days, DAY), (self.Hours, HOUR),
   145         
   146         
   146         duration += "%gms" % (milliseconds % SECOND)
   147         duration += "%gms" % (milliseconds % SECOND)
   147         return duration
   148         return duration
   148     
   149     
   149     def OnOK(self, event):
   150     def OnOK(self, event):
       
   151         self.OnCloseDialog()
       
   152 
       
   153     def OnCloseDialog(self):
   150         errors = []
   154         errors = []
   151         for control, name in [(self.Days, _("days")), (self.Hours, _("hours")), 
   155         for control, name in [(self.Days, _("days")), (self.Hours, _("hours")), 
   152                               (self.Minutes, _("minutes")), (self.Seconds, _("seconds")),
   156                               (self.Minutes, _("minutes")), (self.Seconds, _("seconds")),
   153                               (self.Milliseconds, _("milliseconds"))]:
   157                               (self.Milliseconds, _("milliseconds"))]:
   154             try:
   158             try: