SwatPhonLab / UltraTrace

A Free/Open-Source tool for manual annotation of Ultrasound Tongue Imaging data.
GNU General Public License v3.0
10 stars 5 forks source link

Dysfunctional word zoom #141

Closed covetedfish closed 4 years ago

covetedfish commented 4 years ago

Screen Shot 2020-10-05 at 4 13 29 PM

mr-martian commented 4 years ago

One day I will finally succeed in replacing all the floats with decimal.Decimals and then I will finally be happy and not have to keep dealing with this bug.

jonorthwash commented 4 years ago

I'm now getting this when I do ctrl+n:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.8/tkinter/__init__.py", line 1883, in __call__
    return self.func(*args)
  File "/home/jwashin1/Documents/UltraTrace/ultratrace/modules/textgrid.py", line 542, in getBounds
    self.fillCanvases()
  File "/home/jwashin1/Documents/UltraTrace/ultratrace/modules/textgrid.py", line 591, in fillCanvases
    length = time - strtime
TypeError: unsupported operand type(s) for -: 'float' and 'decimal.Decimal'
mr-martian commented 4 years ago

d414e6f should fix the issue on that particular line.

I also added a __setattr__ method that will hopefully catch some portion of future type errors of this sort.

jonorthwash commented 4 years ago

More today:

ERROR:  unsupported operand type(s) for -: 'decimal.Decimal' and 'float'
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/jwashin1/Documents/UltraTrace/ultratrace/__main__.py", line 615, in <module>
    app = App()
  File "/home/jwashin1/Documents/UltraTrace/ultratrace/__main__.py", line 93, in __init__
    self.filesUpdate()
  File "/home/jwashin1/Documents/UltraTrace/ultratrace/__main__.py", line 512, in filesUpdate
    self.framesUpdate()
  File "/home/jwashin1/Documents/UltraTrace/ultratrace/__main__.py", line 554, in framesUpdate
    self.TextGrid.update()
  File "/home/jwashin1/Documents/UltraTrace/ultratrace/modules/textgrid.py", line 885, in update
    self.start = new_time - (duration/2)
TypeError: unsupported operand type(s) for -: 'float' and 'decimal.Decimal'
mr-martian commented 4 years ago

A few options for dealing with this:

  1. someone (probably me) tracks down every place in the code where a timestamp is manipulated and makes sure they're all decimal.Decimal
  2. we eliminate decimal.Decimal and use float everywhere
  3. we bundle the textgrid library and I do the same __setattr__ trick to ensure type consistency
jonorthwash commented 4 years ago

Isn't there a reason we're using decimal.Decimal?

I don't understand what the __setattr__ trick is.

jonorthwash commented 4 years ago
(18:24:29) popcorndude: so between TextGrid 1.4 and 1.5 they completely removed decimal.Decimal
(18:24:46) popcorndude: which explains why we've been getting different errors
jonorthwash commented 4 years ago

Fixed.