Port UI to GTK 4 (close #85)

This commit is contained in:
coderkun 2023-01-08 18:20:30 +01:00
parent 6ba8bc550f
commit 75b99e5820
36 changed files with 1848 additions and 3403 deletions

View file

@ -143,8 +143,6 @@ class Client(Base):
SIGNAL_LOAD_OUTPUT_DEVICES = 'load-output-devices'
# Signal: load albumart
SIGNAL_LOAD_ALBUMART = 'albumart'
# Signal: custom (dummy) event to trigger callback
SIGNAL_CUSTOM = 'custom'
# Signal: error
SIGNAL_ERROR = 'error'
# Buffer size for reading from socket
@ -319,11 +317,6 @@ class Client(Base):
return albumart
def get_custom(self, name):
self._logger.info("get custom \"%s\"", name)
self._add_action_signal(Client.SIGNAL_CUSTOM, self._get_custom, name)
# Private methods
def _connect(self, host, port, password):
@ -671,10 +664,6 @@ class Client(Base):
return (album, None)
def _get_custom(self, name):
return (name, )
def _start_worker(self):
"""Start the worker thread which waits for action to be performed."""
self._logger.debug("start worker")
@ -1121,7 +1110,7 @@ class MCGAlbum:
return True
def compare(album1, album2, criterion=None):
def compare(album1, album2, criterion=None, reverse=False):
if criterion == None:
criterion = SortOrder.TITLE
if criterion == SortOrder.ARTIST:
@ -1133,20 +1122,22 @@ class MCGAlbum:
elif criterion == SortOrder.MODIFIED:
value_function = "get_last_modified"
reverseMultiplier = -1 if reverse else 1
value1 = getattr(album1, value_function)()
value2 = getattr(album2, value_function)()
if value1 is None and value2 is None:
return 0
elif value1 is None:
return -1
return -1 * reverseMultiplier
elif value2 is None:
return 1
return 1 * reverseMultiplier
if value1 < value2:
return -1
return -1 * reverseMultiplier
elif value1 == value2:
return 0
else:
return 1
return 1 * reverseMultiplier