Skip to content

Commit

Permalink
Fix imageasset __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rn3j committed Dec 31, 2024
1 parent ae2dce2 commit 16c9aba
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/tauon/t_modules/t_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def reload(self) -> None:
SDL_DestroyTexture(self.sdl_texture)
if self.scale_name:
self.path = str(self.scaled_asset_directory / self.scale_name)
self.__init__(self.path, reload=True, scale_name=self.scale_name)
self.__init__(scaled_asset_directory=scaled_asset_directory, path=self.path, reload=True, scale_name=self.scale_name)

def render(self, x: int, y: int, colour=None) -> None:
self.rect.x = round(x)
Expand Down Expand Up @@ -893,7 +893,7 @@ def reload(self) -> None:
SDL_DestroyTexture(self.sdl_texture)
if self.scale_name:
self.path = str(self.scaled_asset_directory / self.scale_name)
self.__init__(self.path, reload=True, scale_name=self.scale_name)
self.__init__(scaled_asset_directory=scaled_asset_directory, path=self.path, reload=True, scale_name=self.scale_name)

def render(self, x: int, y: int, colour) -> None:
if colour != self.colour:
Expand Down Expand Up @@ -1822,11 +1822,10 @@ def key(self, track_id: int) -> tuple[str, str, str]:
return track_object.artist, track_object.title, track_object.filename

def object_key(self, track: TrackClass) -> tuple[str, str, str]:

return track.artist, track.title, track.filename

# Increments the play time
def add(self, index: int, value):
"""Increments the play time"""
track_object = pctl.master_library[index]

if after_scan:
Expand All @@ -1842,22 +1841,22 @@ def add(self, index: int, value):
else:
self.db[key] = [value, "", 0, 0] # Playtime in s, flags, rating, love timestamp

# Returns the track play time
def get(self, index: int):
"""Returns the track play time"""
if index < 0:
return 0
return self.db.get(self.key(index), (0,))[0]

# Returns the track user rating
def get_rating(self, index: int):
"""Returns the track user rating"""
key = self.key(index)
if key in self.db:
# self.db[key]
return self.db[key][2]
return 0

# Sets the track user rating
def set_rating(self, index: int, value: int, write: bool = False) -> None:
"""Sets the track user rating"""
key = self.key(index)
if key not in self.db:
self.db[key] = self.new_object()
Expand Down

0 comments on commit 16c9aba

Please sign in to comment.