Exception when pasting no rows #263

Closed
opened 2024-11-15 13:08:14 +00:00 by kae · 0 comments
Owner

^C with no rows selected followed by a ^V gives an exception:

 "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/line_profiler/line_profiler.py", line 150, in wrapper
    146  @functools.wraps(func)
    147  def wrapper(*args, **kwds):
    148      self.enable_by_count()
    149      try:
--> 150          result = func(*args, **kwds)
    151      finally:
    ..................................................
     functools.wraps = <function 'wraps' functools.py:65>
     func = <function 'Window.paste_rows' musicmuster.py:1072>
     args = (<__main__.Window object at 0x7efdc91816c0>, False, )
     kwds = {}
    ..................................................

File "/home/kae/mm/./app/musicmuster.py", line 1094, in paste_rows
    1073  def paste_rows(self, dummy_for_profiling=None) -> None:
 (...)
    1090          == self.move_source_model.source_model.playlist_id
    1091      ):
    1092          self.move_source_model.move_rows(self.move_source_rows, destination_row)
    1093      else:
--> 1094          self.move_source_model.move_rows_between_playlists(
    1095              self.move_source_rows, destination_row, to_playlist_model.playlist_id
    ..................................................
     self = <__main__.Window object at 0x7efdc91816c0>
     dummy_for_profiling = False
     self.move_source_model.source_model.playlist_id = 8
     self.move_source_model.move_rows = <method 'PlaylistProxyModel.move_rows' of <PlaylistProxyMode
                                         l: source_model=<PlaylistModel: playlist_id=8, 1123 rows>> p
                                         laylistmodel.py:1617>
     self.move_source_rows = []
     destination_row = 37
     self.move_source_model.move_rows_between_playlists = <method 'PlaylistProxyModel.move_rows_between_playlists' of 
                                                           <PlaylistProxyModel: source_model=<PlaylistModel: playlist_i
                                                           d=8, 1123 rows>> playlistmodel.py:1620>
     to_playlist_model.playlist_id = 163
    ..................................................

File "/home/kae/mm/app/playlistmodel.py", line 1623, in move_rows_between_playlists
    1620  def move_rows_between_playlists(
    1621      self, from_rows: list[int], to_row_number: int, to_playlist_id: int
    1622  ) -> None:
--> 1623      return self.source_model.move_rows_between_playlists(
    1624          from_rows, to_row_number, to_playlist_id
    ..................................................
     self = <PlaylistProxyModel: source_model=<PlaylistModel: playlist_i
             d=8, 1123 rows>>
     from_rows = []
     to_row_number = 37
     to_playlist_id = 163
     self.source_model.move_rows_between_playlists = <method 'PlaylistModel.move_rows_between_playlists' of <Play
                                                      listModel: playlist_id=8, 1123 rows> playlistmodel.py:818>
    ..................................................

File "/home/kae/mm/app/playlistmodel.py", line 833, in move_rows_between_playlists
    818  def move_rows_between_playlists(
    819      self, from_rows: list[int], to_row_number: int, to_playlist_id: int
    820  ) -> None:
 (...)
    829  
    830      # Row removal must be wrapped in beginRemoveRows ..
    831      # endRemoveRows and the row range must be contiguous. Process
    832      # the highest rows first so the lower row numbers are unchanged
--> 833      row_groups = self._reversed_contiguous_row_groups(from_rows)
    834      next_to_row = to_row_number
    ..................................................
     self = <PlaylistModel: playlist_id=8, 1123 rows>
     from_rows = []
     to_row_number = 37
     to_playlist_id = 163
     self._reversed_contiguous_row_groups = <method 'PlaylistModel._reversed_contiguous_row_groups' of <
                                             PlaylistModel: playlist_id=8, 1123 rows> playlistmodel.py:10
                                             66>
    ..................................................

File "/home/kae/mm/app/playlistmodel.py", line 1082, in _reversed_contiguous_row_groups
    1066  def _reversed_contiguous_row_groups(
    1067      self, row_numbers: list[int]
    1068  ) -> list[list[int]]:
 (...)
    1078      log.debug(f"{self}: _reversed_contiguous_row_groups({row_numbers=} called")
    1079  
    1080      result: list[list[int]] = []
    1081      temp: list[int] = []
--> 1082      last_value = row_numbers[0] - 1
    1083  
    ..................................................
     self = <PlaylistModel: playlist_id=8, 1123 rows>
     row_numbers = []
     log.debug = <method 'Logger.debug' of <Logger musicmuster (DEBUG)> __ini
                  t__.py:1467>
     result = []
     temp = []
    ..................................................

---- (full traceback above) ----
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/line_profiler/line_profiler.py", line 150, in wrapper
    result = func(*args, **kwds)
File "/home/kae/mm/./app/musicmuster.py", line 1094, in paste_rows
    self.move_source_model.move_rows_between_playlists(
File "/home/kae/mm/app/playlistmodel.py", line 1623, in move_rows_between_playlists
    return self.source_model.move_rows_between_playlists(
File "/home/kae/mm/app/playlistmodel.py", line 833, in move_rows_between_playlists
    row_groups = self._reversed_contiguous_row_groups(from_rows)
File "/home/kae/mm/app/playlistmodel.py", line 1082, in _reversed_contiguous_row_groups
    last_value = row_numbers[0] - 1

IndexError: list index out of range
^C with no rows selected followed by a ^V gives an exception: ``` "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/line_profiler/line_profiler.py", line 150, in wrapper 146 @functools.wraps(func) 147 def wrapper(*args, **kwds): 148 self.enable_by_count() 149 try: --> 150 result = func(*args, **kwds) 151 finally: .................................................. functools.wraps = <function 'wraps' functools.py:65> func = <function 'Window.paste_rows' musicmuster.py:1072> args = (<__main__.Window object at 0x7efdc91816c0>, False, ) kwds = {} .................................................. File "/home/kae/mm/./app/musicmuster.py", line 1094, in paste_rows 1073 def paste_rows(self, dummy_for_profiling=None) -> None: (...) 1090 == self.move_source_model.source_model.playlist_id 1091 ): 1092 self.move_source_model.move_rows(self.move_source_rows, destination_row) 1093 else: --> 1094 self.move_source_model.move_rows_between_playlists( 1095 self.move_source_rows, destination_row, to_playlist_model.playlist_id .................................................. self = <__main__.Window object at 0x7efdc91816c0> dummy_for_profiling = False self.move_source_model.source_model.playlist_id = 8 self.move_source_model.move_rows = <method 'PlaylistProxyModel.move_rows' of <PlaylistProxyMode l: source_model=<PlaylistModel: playlist_id=8, 1123 rows>> p laylistmodel.py:1617> self.move_source_rows = [] destination_row = 37 self.move_source_model.move_rows_between_playlists = <method 'PlaylistProxyModel.move_rows_between_playlists' of <PlaylistProxyModel: source_model=<PlaylistModel: playlist_i d=8, 1123 rows>> playlistmodel.py:1620> to_playlist_model.playlist_id = 163 .................................................. File "/home/kae/mm/app/playlistmodel.py", line 1623, in move_rows_between_playlists 1620 def move_rows_between_playlists( 1621 self, from_rows: list[int], to_row_number: int, to_playlist_id: int 1622 ) -> None: --> 1623 return self.source_model.move_rows_between_playlists( 1624 from_rows, to_row_number, to_playlist_id .................................................. self = <PlaylistProxyModel: source_model=<PlaylistModel: playlist_i d=8, 1123 rows>> from_rows = [] to_row_number = 37 to_playlist_id = 163 self.source_model.move_rows_between_playlists = <method 'PlaylistModel.move_rows_between_playlists' of <Play listModel: playlist_id=8, 1123 rows> playlistmodel.py:818> .................................................. File "/home/kae/mm/app/playlistmodel.py", line 833, in move_rows_between_playlists 818 def move_rows_between_playlists( 819 self, from_rows: list[int], to_row_number: int, to_playlist_id: int 820 ) -> None: (...) 829 830 # Row removal must be wrapped in beginRemoveRows .. 831 # endRemoveRows and the row range must be contiguous. Process 832 # the highest rows first so the lower row numbers are unchanged --> 833 row_groups = self._reversed_contiguous_row_groups(from_rows) 834 next_to_row = to_row_number .................................................. self = <PlaylistModel: playlist_id=8, 1123 rows> from_rows = [] to_row_number = 37 to_playlist_id = 163 self._reversed_contiguous_row_groups = <method 'PlaylistModel._reversed_contiguous_row_groups' of < PlaylistModel: playlist_id=8, 1123 rows> playlistmodel.py:10 66> .................................................. File "/home/kae/mm/app/playlistmodel.py", line 1082, in _reversed_contiguous_row_groups 1066 def _reversed_contiguous_row_groups( 1067 self, row_numbers: list[int] 1068 ) -> list[list[int]]: (...) 1078 log.debug(f"{self}: _reversed_contiguous_row_groups({row_numbers=} called") 1079 1080 result: list[list[int]] = [] 1081 temp: list[int] = [] --> 1082 last_value = row_numbers[0] - 1 1083 .................................................. self = <PlaylistModel: playlist_id=8, 1123 rows> row_numbers = [] log.debug = <method 'Logger.debug' of <Logger musicmuster (DEBUG)> __ini t__.py:1467> result = [] temp = [] .................................................. ---- (full traceback above) ---- File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/line_profiler/line_profiler.py", line 150, in wrapper result = func(*args, **kwds) File "/home/kae/mm/./app/musicmuster.py", line 1094, in paste_rows self.move_source_model.move_rows_between_playlists( File "/home/kae/mm/app/playlistmodel.py", line 1623, in move_rows_between_playlists return self.source_model.move_rows_between_playlists( File "/home/kae/mm/app/playlistmodel.py", line 833, in move_rows_between_playlists row_groups = self._reversed_contiguous_row_groups(from_rows) File "/home/kae/mm/app/playlistmodel.py", line 1082, in _reversed_contiguous_row_groups last_value = row_numbers[0] - 1 IndexError: list index out of range ```
kae added the
bug
label 2024-11-15 13:08:14 +00:00
kae closed this issue 2024-11-15 21:38:38 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: kae/musicmuster#263
No description provided.