-
Notifications
You must be signed in to change notification settings - Fork 20
/
JChipImport.py
38 lines (31 loc) · 869 Bytes
/
JChipImport.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import wx
import Model
import JChip
from ChipImport import ChipImportDialog
def parseTagTime( line, lineNo, errors ):
try:
fields = line.split()
tag = fields[0][1:]
tStr = fields[1]
except IndexError:
errors.append( 'line {}: unrecognised input'.format(lineNo) )
return None, None
try:
day = int(fields[2][1:2])
except Exception:
day = 0
try:
t = JChip.parseTime(tStr, day)
except (IndexError, ValueError):
errors.append( 'line {}: invalid time: "{}"'.format(lineNo, tStr) )
return None, None
return tag, t
def JChipImportDialog( parent, id = wx.ID_ANY ):
return ChipImportDialog( 'JChip', parseTagTime, parent, id )
if __name__ == '__main__':
app = wx.App(False)
mainWin = wx.Frame(None,title="CrossMan", size=(600,400))
Model.setRace( Model.Race() )
mainWin.Show()
with JChipImportDialog(mainWin) as dlg:
dlg.ShowModal()