TypesettingTools / Myaamori-Aegisub-Scripts

Overengineering is my middle name.
MIT License
37 stars 7 forks source link

fix issues when selection is entire section but filter function expects list #18

Open jpenney opened 2 years ago

jpenney commented 2 years ago

Fixes issue with both sort_field and sort_expression, which are using functionality specific to list (others filters might as well). Current version fails to sort without a selection:

$ /tmp/subdigest.py -i test.ass --sort-field layer ASC
Traceback (most recent call last):
  File "/tmp/subdigest.py", line 569, in <module>
    sys.exit(main())
  File "/tmp/subdigest.py", line 557, in main
    sub_obj = filt(*filter_args)
  File "/tmp/subdigest.py", line 408, in sort_field
    self._process_selection(_sort)
  File "/tmp/subdigest.py", line 134, in _process_selection
    f(self._get_section())
  File "/tmp/subdigest.py", line 407, in _sort
    events.sort(key=lambda line: getattr(line, field), reverse=order == "DESC")
AttributeError: 'EventsSection' object has no attribute 'sort'

Changes: