|
|
@ -8,6 +8,9 @@ from collections import namedtuple |
|
|
|
from datetime import datetime, timedelta |
|
|
|
from datetime import datetime, timedelta |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__version__ = '0.0.1' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# example time table for the TrapControl |
|
|
|
# example time table for the TrapControl |
|
|
|
example = ''' |
|
|
|
example = ''' |
|
|
|
00:00.0 close |
|
|
|
00:00.0 close |
|
|
@ -187,6 +190,7 @@ class TimedCommands(object): |
|
|
|
''' parses a time table and establishes a serial connection |
|
|
|
''' parses a time table and establishes a serial connection |
|
|
|
|
|
|
|
|
|
|
|
timetable: |
|
|
|
timetable: |
|
|
|
|
|
|
|
a file path to an excel file or |
|
|
|
a textual representaion of time and commands like |
|
|
|
a textual representaion of time and commands like |
|
|
|
|
|
|
|
|
|
|
|
00:12.0 close |
|
|
|
00:12.0 close |
|
|
@ -215,6 +219,9 @@ class TimedCommands(object): |
|
|
|
# make sure the available commands are a dictionary |
|
|
|
# make sure the available commands are a dictionary |
|
|
|
cmd_dict = self._ensure_command_dict(available_commands) |
|
|
|
cmd_dict = self._ensure_command_dict(available_commands) |
|
|
|
# parse the time table into something suitable |
|
|
|
# parse the time table into something suitable |
|
|
|
|
|
|
|
if '.xls' in timetable: |
|
|
|
|
|
|
|
self.commands = parse_excel_file(timetable, cmd_dict) |
|
|
|
|
|
|
|
else: |
|
|
|
self.commands = parse_time_table(timetable, cmd_dict) |
|
|
|
self.commands = parse_time_table(timetable, cmd_dict) |
|
|
|
|
|
|
|
|
|
|
|
# establish the serial connection |
|
|
|
# establish the serial connection |
|
|
@ -259,5 +266,3 @@ class TrapControl(TimedCommands): |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, timetable): |
|
|
|
def __init__(self, timetable): |
|
|
|
super().__init__(timetable, ['open', 'close']) |
|
|
|
super().__init__(timetable, ['open', 'close']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|