Skip to content

Commit

Permalink
Work around two time-handling bugs
Browse files Browse the repository at this point in the history
Unit detection was not considering localization in two places.

Fix the simple issue in find_errors_in_progress() by translating units
to compare against.

The second error is more complex, details are in thinkle#931.  Disable broken
parsing of number words for now.

Signed-off-by: Martin Pohlack <[email protected]>
  • Loading branch information
Martin Pohlack committed Jun 20, 2020
1 parent ee332a7 commit d5d77fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gourmet/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ def integerp (num, approx=0.01):
lambda x,y: ((len(y)>len(x) and 1) or (len(x)>len(y) and -1) or 0)
)

NUMBER_WORD_REGEXP = '|'.join(all_number_words).replace(' ','\s+')
#NUMBER_WORD_REGEXP = '|'.join(all_number_words).replace(' ','\s+')
NUMBER_WORD_REGEXP = None
FRACTION_WORD_REGEXP = '|'.join(filter(lambda n: NUMBER_WORDS[n]<1.0,
all_number_words)
).replace(' ','\s+')
Expand Down
2 changes: 1 addition & 1 deletion gourmet/gtk_extras/timeEntry.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def find_errors_in_progress (self, txt):
return None
else:
partial_unit = words[-1]
for u in self.conv.unit_to_seconds.keys():
for u in _(self.conv.unit_to_seconds.keys()):
if u.lower().find(partial_unit.lower())==0:
return None
#self._hide_warning_slowly()
Expand Down

0 comments on commit d5d77fc

Please sign in to comment.