Volume is saved in settings

This commit is contained in:
Manuel Cortez 2018-10-10 11:46:35 -05:00
parent 9816cecf56
commit febc63c547
2 changed files with 5 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import logging
import widgetUtils import widgetUtils
import utils import utils
import application import application
import config
from pubsub import pub from pubsub import pub
from wxUI import mainWindow, menus from wxUI import mainWindow, menus
from update import updater from update import updater
@ -206,6 +207,7 @@ class Controller(object):
log.debug("Exiting...") log.debug("Exiting...")
self.timer.Stop() self.timer.Stop()
pub.unsubscribe(self.on_download_finished, "download_finished") pub.unsubscribe(self.on_download_finished, "download_finished")
config.app.write()
event.Skip() event.Skip()
widgetUtils.exit_application() widgetUtils.exit_application()

View File

@ -4,6 +4,7 @@ import os
import random import random
import vlc import vlc
import logging import logging
import config
from pubsub import pub from pubsub import pub
from utils import call_threaded from utils import call_threaded
@ -19,7 +20,7 @@ class audioPlayer(object):
def __init__(self): def __init__(self):
self.is_playing = False self.is_playing = False
self.vol = 50 self.vol = config.app["main"]["volume"]
self.is_working = False self.is_working = False
self.queue = [] self.queue = []
self.stopped = True self.stopped = True
@ -94,6 +95,7 @@ class audioPlayer(object):
@volume.setter @volume.setter
def volume(self, vol): def volume(self, vol):
if vol <= 100 and vol >= 0: if vol <= 100 and vol >= 0:
config.app["main"]["volume"] = vol
self.vol = vol self.vol = vol
self.player.audio_set_volume(self.vol) self.player.audio_set_volume(self.vol)