From 43081977bf409556202f3f3a1d4c2fc4c8c8122e Mon Sep 17 00:00:00 2001 From: ysard Date: Wed, 10 Nov 2021 01:59:37 +0100 Subject: [PATCH] Fix typos as mentioned in #221 review --- resources/lib/modules/pulseaudio.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/resources/lib/modules/pulseaudio.py b/resources/lib/modules/pulseaudio.py index a75649018..4cd72f484 100644 --- a/resources/lib/modules/pulseaudio.py +++ b/resources/lib/modules/pulseaudio.py @@ -143,11 +143,10 @@ def menu_connections(self, focusItem=None): rebuildList = 0 self.dbusDevices = self.get_sinks() - for dbusDevice in self.dbusDevices: + if self.dbusDevices: rebuildList = 1 oe.winOeMain.getControl(int(oe.listObject['palist'])).reset() self.clear_list() - break fallbackSink = dbus_pulseaudio.core_get_property('FallbackSink') @@ -177,7 +176,7 @@ def menu_connections(self, focusItem=None): sinkName = bytearray(self.dbusDevices[dbusDevice]['PropertyList']['device.description']).decode().strip('\x00') # fallback to the ugly name - if sinkName == '': + if not sinkName: sinkName = self.dbusDevices[dbusDevice]['Name'] for prop in properties: @@ -196,7 +195,7 @@ def menu_connections(self, focusItem=None): if rebuildList == 1: self.listItems[dbusDevice] = oe.winOeMain.addConfigItem(sinkName, dictProperties, oe.listObject['palist']) else: - if self.listItems[dbusDevice] != None: + if self.listItems[dbusDevice] is not None: self.listItems[dbusDevice].setLabel(sinkName) for dictProperty in dictProperties: self.listItems[dbusDevice].setProperty(dictProperty, dictProperties[dictProperty]) @@ -206,7 +205,7 @@ def open_context_menu(self, listItem): values = {} if listItem is None: listItem = oe.winOeMain.getControl(oe.listObject['palist']).getSelectedItem() - if listItem.getProperty('ActiveProfileName') != '': + if listItem.getProperty('ActiveProfileName'): values[1] = { 'text': oe._(32505), 'action': 'change_profile', @@ -218,9 +217,9 @@ def open_context_menu(self, listItem): } items = [] actions = [] - for key in list(values.keys()): - items.append(values[key]['text']) - actions.append(values[key]['action']) + for key, value in values.items(): + items.append(value['text']) + actions.append(value['action']) select_window = xbmcgui.Dialog() title = oe._(32012) result = select_window.select(title, items)