Automatically update empty server list if updates are enabled
This commit is contained in:
parent
2983dbc69a
commit
558e7e69bf
@ -208,9 +208,7 @@ class ConfigDialog(QtGui.QDialog):
|
|||||||
def loadSavedPublicServerList(self):
|
def loadSavedPublicServerList(self):
|
||||||
settings = QSettings("Syncplay", "Interface")
|
settings = QSettings("Syncplay", "Interface")
|
||||||
settings.beginGroup("PublicServerList")
|
settings.beginGroup("PublicServerList")
|
||||||
self.publicServers = settings.value("publicServers", constants.FALLBACK_PUBLIC_SYNCPLAY_SERVERS)
|
self.publicServers = settings.value("publicServers", None)
|
||||||
if self.publicServers is None:
|
|
||||||
self.publicServers = constants.FALLBACK_PUBLIC_SYNCPLAY_SERVERS
|
|
||||||
|
|
||||||
def loadMediaBrowseSettings(self):
|
def loadMediaBrowseSettings(self):
|
||||||
settings = QSettings("Syncplay", "MediaBrowseDialog")
|
settings = QSettings("Syncplay", "MediaBrowseDialog")
|
||||||
@ -240,7 +238,6 @@ class ConfigDialog(QtGui.QDialog):
|
|||||||
settings.setValue("ShowMoreSettings", morestate)
|
settings.setValue("ShowMoreSettings", morestate)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
|
|
||||||
def updateServerList(self):
|
def updateServerList(self):
|
||||||
try:
|
try:
|
||||||
servers = utils.getListOfPublicServers()
|
servers = utils.getListOfPublicServers()
|
||||||
@ -910,7 +907,21 @@ class ConfigDialog(QtGui.QDialog):
|
|||||||
settings = QSettings("Syncplay", "MoreSettings")
|
settings = QSettings("Syncplay", "MoreSettings")
|
||||||
settings.clear()
|
settings.clear()
|
||||||
self.datacleared = True
|
self.datacleared = True
|
||||||
|
|
||||||
|
def populateEmptyServerList(self):
|
||||||
|
if self.publicServers is None:
|
||||||
|
if self.config["checkForUpdatesAutomatically"] == True:
|
||||||
|
self.updateServerList()
|
||||||
|
else:
|
||||||
|
currentServer = self.hostCombobox.currentText()
|
||||||
|
self.publicServers = constants.FALLBACK_PUBLIC_SYNCPLAY_SERVERS
|
||||||
|
i = 0
|
||||||
|
for server in self.publicServers:
|
||||||
|
self.hostCombobox.addItem(server[1])
|
||||||
|
self.hostCombobox.setItemData(i, server[0], Qt.ToolTipRole)
|
||||||
|
i += 1
|
||||||
|
self.hostCombobox.setEditText(currentServer)
|
||||||
|
|
||||||
def __init__(self, config, playerpaths, error, defaultConfig):
|
def __init__(self, config, playerpaths, error, defaultConfig):
|
||||||
|
|
||||||
self.config = config
|
self.config = config
|
||||||
@ -983,4 +994,5 @@ class ConfigDialog(QtGui.QDialog):
|
|||||||
if constants.SHOW_TOOLTIPS:
|
if constants.SHOW_TOOLTIPS:
|
||||||
self.processWidget(self, lambda w: self.loadTooltips(w))
|
self.processWidget(self, lambda w: self.loadTooltips(w))
|
||||||
self.processWidget(self, lambda w: self.loadValues(w))
|
self.processWidget(self, lambda w: self.loadValues(w))
|
||||||
self.processWidget(self, lambda w: self.connectChildren(w))
|
self.processWidget(self, lambda w: self.connectChildren(w))
|
||||||
|
self.populateEmptyServerList()
|
||||||
Loading…
x
Reference in New Issue
Block a user