dialogs/DurationEditorDialog.py
changeset 2437 105c20fdeb19
parent 2301 5b8a7dd43f9f
child 2439 f0a040f1de1b
equal deleted inserted replaced
2436:82bfc75bcd9d 2437:105c20fdeb19
    23 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    25 
    25 
    26 
    26 
    27 from __future__ import absolute_import
    27 from __future__ import absolute_import
       
    28 from __future__ import division
    28 import re
    29 import re
    29 
    30 
    30 import wx
    31 import wx
    31 
    32 
    32 # -------------------------------------------------------------------------------
    33 # -------------------------------------------------------------------------------
   137 
   138 
   138             milliseconds += float(control.GetValue()) * factor
   139             milliseconds += float(control.GetValue()) * factor
   139 
   140 
   140         not_null = False
   141         not_null = False
   141         duration = "T#"
   142         duration = "T#"
   142         for value, format in [((int(milliseconds) / DAY),             "%dd"),
   143         for value, format in [((int(milliseconds) // DAY),             "%dd"),
   143                               ((int(milliseconds) % DAY) / HOUR,      "%dh"),
   144                               ((int(milliseconds) % DAY) // HOUR,      "%dh"),
   144                               ((int(milliseconds) % HOUR) / MINUTE,   "%dm"),
   145                               ((int(milliseconds) % HOUR) // MINUTE,   "%dm"),
   145                               ((int(milliseconds) % MINUTE) / SECOND, "%ds")]:
   146                               ((int(milliseconds) % MINUTE) // SECOND, "%ds")]:
   146 
   147 
   147             if value > 0 or not_null:
   148             if value > 0 or not_null:
   148                 duration += format % value
   149                 duration += format % value
   149                 not_null = True
   150                 not_null = True
   150 
   151