Fixed alignment issues with labels

This commit is contained in:
Sumner Evans
2019-08-23 23:35:30 -06:00
parent 0456514228
commit ad66686da2
5 changed files with 18 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import os import os
from os import environ
import math import math
import random import random
@@ -50,8 +51,9 @@ class LibremsonicApp(Gtk.Application):
config_file = config_file.get_bytestring().decode('utf-8') config_file = config_file.get_bytestring().decode('utf-8')
else: else:
# Default to ~/.config/libremsonic. # Default to ~/.config/libremsonic.
config_folder = (os.environ.get('XDG_CONFIG_HOME') config_folder = (environ.get('XDG_CONFIG_HOME')
or os.path.expanduser('~/.config')) or environ.get('APPDATA')
or os.path.join(environ.get('HOME'), '.config'))
config_folder = os.path.join(config_folder, 'libremsonic') config_folder = os.path.join(config_folder, 'libremsonic')
config_file = os.path.join(config_folder, 'config.json') config_file = os.path.join(config_folder, 'config.json')
@@ -376,10 +378,10 @@ class LibremsonicApp(Gtk.Application):
self.player.pause() self.player.pause()
self.chromecast_player.shutdown() self.chromecast_player.shutdown()
self.mpv_player.shutdown() self.mpv_player.shutdown()
CacheManager.should_exit = True
self.state.save() self.state.save()
self.save_play_queue() self.save_play_queue()
CacheManager.shutdown()
# ########## HELPER METHODS ########## # # ########## HELPER METHODS ########## #
def show_configure_servers_dialog(self): def show_configure_servers_dialog(self):

View File

@@ -71,6 +71,14 @@ class CacheManager(metaclass=Singleton):
executor: ThreadPoolExecutor = ThreadPoolExecutor(max_workers=50) executor: ThreadPoolExecutor = ThreadPoolExecutor(max_workers=50)
should_exit: bool = False should_exit: bool = False
@staticmethod
def shutdown():
# TODO fix this shutdown
CacheManager.should_exit = True
print('Shutdown start')
CacheManager.executor.shutdown()
print('Shutdown complete')
class CacheEncoder(json.JSONEncoder): class CacheEncoder(json.JSONEncoder):
def default(self, obj): def default(self, obj):
if type(obj) == datetime: if type(obj) == datetime:

View File

@@ -323,6 +323,7 @@ class ArtistDetailPanel(Gtk.Box):
label=text, label=text,
name=name, name=name,
halign=Gtk.Align.START, halign=Gtk.Align.START,
xalign=0,
**params, **params,
) )
@@ -531,7 +532,7 @@ class AlbumWithSongs(Gtk.Box):
allow_deselect = False allow_deselect = False
def on_download_state_change(song_id=None): def on_download_state_change(song_id=None):
GLib.idle_add(self.update_album_songs, self.album.id) self.update_album_songs(self.album.id)
# Use the new selection instead of the old one for calculating what # Use the new selection instead of the old one for calculating what
# to do the right click on. # to do the right click on.

View File

@@ -238,6 +238,7 @@ class PlayerControls(Gtk.ActionBar):
return Gtk.Label( return Gtk.Label(
name=name, name=name,
halign=Gtk.Align.START, halign=Gtk.Align.START,
xalign=0,
use_markup=True, use_markup=True,
ellipsize=Pango.EllipsizeMode.END, ellipsize=Pango.EllipsizeMode.END,
) )

View File

@@ -157,8 +157,8 @@ def show_song_popover(
# Determine if we should enable the download button. # Determine if we should enable the download button.
download_sensitive, remove_download_sensitive = False, False download_sensitive, remove_download_sensitive = False, False
for song_id in song_ids: for song_id in song_ids:
details = CacheManager.get_song_details(song_id) details = CacheManager.get_song_details(song_id).result()
status = CacheManager.get_cached_status(details.result()) status = CacheManager.get_cached_status(details)
if download_sensitive or status == SongCacheStatus.NOT_CACHED: if download_sensitive or status == SongCacheStatus.NOT_CACHED:
download_sensitive = True download_sensitive = True