diff --git a/fstimer/gui/timing.py b/fstimer/gui/timing.py index 07bc755..897930a 100644 --- a/fstimer/gui/timing.py +++ b/fstimer/gui/timing.py @@ -235,12 +235,14 @@ def update_racers_label(self): if self.numlaps > 1: s += ' (per lap)' s += ': ' + ' | '.join(str(n) for n in self.racers_in) + s += ', Times taken : %d ' % len(self.rawtimes['times']) self.racerslabel.set_markup(s) def check_for_newtime(self, jnk_unused): '''Handles entering of a new time''' if self.entrybox.get_text() == self.timebtn: self.new_blank_time() + self.update_racers_label() def scroll_times(self, jnk1_unused, jnk2_unused): '''handles scrolling of the time window''' @@ -632,7 +634,7 @@ def record_time(self, jnk_unused): and then mark the time.''' txt = self.entrybox.get_text() timemarks = txt.count(self.timebtn) - txt = txt.replace(self.timebtn, '') + txt = txt.replace(self.timebtn, '').lstrip('0') # it is actually a result. (or a pass, which we treat as a result) # prepend to raw self.rawtimes['ids'].insert(0, txt) diff --git a/fstimer/printer/printcsv.py b/fstimer/printer/printcsv.py index f5b14df..60991f1 100644 --- a/fstimer/printer/printcsv.py +++ b/fstimer/printer/printcsv.py @@ -42,6 +42,13 @@ def file_extension(self): containing data from this printer''' return 'csv' + def escape(self, word): + '''returns an escaped version of the value''' + if type(word) == str and word.find(',') >= 0: + return '"' + word.replace('"', '\\"') + '"' + else: + return word + def scratch_table_header(self): '''Returns the header of the printout for scratch results''' return 'Place,' + ','.join(self.fields) + '\n' diff --git a/fstimer/printer/printer.py b/fstimer/printer/printer.py index 27337a8..ae0ce25 100644 --- a/fstimer/printer/printer.py +++ b/fstimer/printer/printer.py @@ -73,9 +73,13 @@ def cat_table_footer(self, category): @type category: string @param category: name of the category handled by the table''' return '' - + + def escape(self, word): + '''returns an escaped version of the value, if needed''' + return word + def common_entry(self, row): - return self.row_delim.join(row) + return self.row_delim.join(map(self.escape, row)) def scratch_entry(self, row, category=None): '''Returns the printout of the entry of a given runner