added Command.__str__(), setting the_time with relative time offset

This commit is contained in:
Josh Holtrop 2010-12-29 00:02:05 -05:00
parent 2982469274
commit cc54eb8883
2 changed files with 11 additions and 0 deletions

View File

@ -6,8 +6,13 @@ class Command:
def __init__(self, timenow, cmdline):
self.time = timenow
self.command = 'start'
self.argstr = ''
self.parseCommandLine(cmdline)
def __str__(self):
return "{'time' => %s, 'command' => %s, 'argstr' => %s}" % \
(self.time, self.command, self.argstr)
def parseCommandLine(self, cmdline):
COMMANDS = {
'out' : 1,
@ -65,3 +70,8 @@ class Command:
seconds = m.group(2)
else: # hours
seconds = m.group(2) * 60 * 60
delta = datetime.timedelta(seconds = seconds)
if plus_minus == '-':
the_time -= delta
else:
the_time += delta

1
dwtt
View File

@ -42,6 +42,7 @@ def main(argv):
cmdline = doCmdWindow()
cmd = Command(timenow, cmdline)
print "Command:", cmd
def doCmdWindow():
c = CmdWindow()