From 8dbdb1208c21bed47ab6c1b479b91d9533ccecc0 Mon Sep 17 00:00:00 2001 From: jbleyel Date: Mon, 26 Aug 2024 11:53:18 +0200 Subject: [PATCH] [VuBluetoothSetup/GigaBlueBluetoothSetup] * cleanup imports --- GigaBlueBluetoothSetup/src/OTAUpdate.py | 10 +------ GigaBlueBluetoothSetup/src/bt.py | 36 +++++++----------------- GigaBlueBluetoothSetup/src/bt_config.py | 2 +- GigaBlueBluetoothSetup/src/bt_scan.py | 2 +- GigaBlueBluetoothSetup/src/bt_setup.py | 5 +--- GigaBlueBluetoothSetup/src/plugin.py | 3 -- VuBluetoothSetup/src/OTAUpdate.py | 9 +----- VuBluetoothSetup/src/bt.py | 37 +++++++------------------ VuBluetoothSetup/src/bt_config.py | 2 +- VuBluetoothSetup/src/bt_setup.py | 3 -- VuBluetoothSetup/src/plugin.py | 3 -- 11 files changed, 26 insertions(+), 86 deletions(-) diff --git a/GigaBlueBluetoothSetup/src/OTAUpdate.py b/GigaBlueBluetoothSetup/src/OTAUpdate.py index 15d03dbfe..f42460a95 100644 --- a/GigaBlueBluetoothSetup/src/OTAUpdate.py +++ b/GigaBlueBluetoothSetup/src/OTAUpdate.py @@ -1,28 +1,20 @@ from __future__ import absolute_import # GUI (Screens) from Screens.Screen import Screen -from Screens.MessageBox import MessageBox -from Screens.InputBox import InputBox from Screens.HelpMenu import HelpableScreen -from Screens.ChoiceBox import ChoiceBox # Generic -from Tools.BoundFunction import boundFunction from Tools.Directories import * -from Components.config import config -import os # GUI (Components) -from Components.ActionMap import ActionMap, HelpableActionMap +from Components.ActionMap import ActionMap from Components.Label import Label -from Components.Button import Button from Components.ProgressBar import ProgressBar # Timer from enigma import eTimer from . import bt_types -from .bt_types import getEventDesc from .bt_task import BluetoothTask OTA_ERROR_SERVICE_DISCOVERY = 0 diff --git a/GigaBlueBluetoothSetup/src/bt.py b/GigaBlueBluetoothSetup/src/bt.py index ebb51c1b7..2f64dec80 100644 --- a/GigaBlueBluetoothSetup/src/bt.py +++ b/GigaBlueBluetoothSetup/src/bt.py @@ -1,39 +1,19 @@ from __future__ import print_function from __future__ import absolute_import -from Plugins.Plugin import PluginDescriptor from Screens.MessageBox import MessageBox -from Screens.Screen import Screen -from Screens.VirtualKeyBoard import VirtualKeyBoard -from Screens.InputBox import InputBox from Screens.ChoiceBox import ChoiceBox -from Components.Label import Label -from Components.ActionMap import ActionMap -from Components.config import config, ConfigSelection, getConfigListEntry, ConfigSubsection, ConfigYesNo, ConfigText, ConfigSelectionNumber, ConfigNumber -from Components.ConfigList import ConfigListScreen -from Components.Console import Console -from Components.GUIComponent import GUIComponent -from Components.MenuList import MenuList -from Components.Pixmap import Pixmap, MultiPixmap -from Components.Sources.List import List -from Components.Sources.StaticText import StaticText -from Components.VolumeControl import VolumeControl - -from Tools.BoundFunction import boundFunction +from Components.config import config, ConfigSelection, ConfigSubsection, ConfigYesNo, ConfigText, ConfigSelectionNumber, ConfigNumber from Tools.Notifications import AddNotification, AddNotificationWithCallback, AddPopup -from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR -from skin import loadSkin from enigma import eTimer, eServiceReference from enigma import eDVBVolumecontrol -import os -import re import time from . import gbbt -from .bt_types import getEventDesc, isAudioProfile, getIcon +from .bt_types import isAudioProfile from . import bt_types from .bt_task import BluetoothTask @@ -221,11 +201,15 @@ def __init__(self): self.initVolumeTimer.start(500, True) def InitVolume(self): - try: - vol = config.audio.volume.value + if hasattr(config, "volumeControl"): + vol = config.volumeControl.volume.value self.setVolume(vol) - except: - self.initVolumeTimer.start(100, True) + else: + try: + vol = config.audio.volume.value + self.setVolume(vol) + except: + self.initVolumeTimer.start(100, True) def setVolume(self, vol): self.gbbt.setVolume(int(vol)) diff --git a/GigaBlueBluetoothSetup/src/bt_config.py b/GigaBlueBluetoothSetup/src/bt_config.py index 076a1f3d2..c3e166ded 100644 --- a/GigaBlueBluetoothSetup/src/bt_config.py +++ b/GigaBlueBluetoothSetup/src/bt_config.py @@ -1,6 +1,6 @@ from Screens.Screen import Screen from Components.ActionMap import ActionMap -from Components.config import config, ConfigSelection, getConfigListEntry, ConfigSubsection, ConfigYesNo, ConfigText, ConfigSelectionNumber +from Components.config import config, getConfigListEntry, ConfigYesNo from Components.ConfigList import ConfigListScreen from Components.Sources.StaticText import StaticText diff --git a/GigaBlueBluetoothSetup/src/bt_scan.py b/GigaBlueBluetoothSetup/src/bt_scan.py index 7e7acc4a5..c4487c88b 100644 --- a/GigaBlueBluetoothSetup/src/bt_scan.py +++ b/GigaBlueBluetoothSetup/src/bt_scan.py @@ -6,7 +6,7 @@ from Components.Sources.List import List from Components.Sources.StaticText import StaticText from enigma import eTimer -from .bt_types import getEventDesc, isAudioProfile, getIcon +from .bt_types import isAudioProfile, getIcon from .bt import pybluetooth_instance from .bt_config import BluetoothSetupConfig from . import bt_types diff --git a/GigaBlueBluetoothSetup/src/bt_setup.py b/GigaBlueBluetoothSetup/src/bt_setup.py index 49cfa1698..adbaaefe9 100644 --- a/GigaBlueBluetoothSetup/src/bt_setup.py +++ b/GigaBlueBluetoothSetup/src/bt_setup.py @@ -2,21 +2,18 @@ from __future__ import absolute_import from Screens.Screen import Screen from Screens.HelpMenu import HelpableScreen -from Screens.MessageBox import MessageBox -from Tools.Notifications import AddNotification from Components.Label import Label from Components.ActionMap import HelpableActionMap from Components.config import config from Components.Sources.List import List from Components.Sources.StaticText import StaticText from enigma import eTimer -from .bt_types import getEventDesc, isAudioProfile, getIcon +from .bt_types import isAudioProfile, getIcon from .bt import pybluetooth_instance from .bt_config import BluetoothSetupConfig from .bt_scan import BluetoothDiscoveryScreen, BluetoothRCUSetup from .bt_task import BluetoothTask from . import bt_types -from .OTAUpdate import GbRcuOtaUpdate class BluetoothSetup(BluetoothTask): diff --git a/GigaBlueBluetoothSetup/src/plugin.py b/GigaBlueBluetoothSetup/src/plugin.py index 5c978bee9..ccd5fdc2c 100644 --- a/GigaBlueBluetoothSetup/src/plugin.py +++ b/GigaBlueBluetoothSetup/src/plugin.py @@ -2,10 +2,7 @@ from Plugins.Plugin import PluginDescriptor from .bt_setup import BluetoothSetupScreen from .bt import pybluetooth_instance -from Components.config import config, ConfigBoolean from enigma import eActionMap, eDVBVolumecontrol -from Tools.HardwareInfo import HardwareInfo -import os g_BTVolumeControlHandle = None diff --git a/VuBluetoothSetup/src/OTAUpdate.py b/VuBluetoothSetup/src/OTAUpdate.py index ecd3764ed..fde4f6441 100644 --- a/VuBluetoothSetup/src/OTAUpdate.py +++ b/VuBluetoothSetup/src/OTAUpdate.py @@ -1,20 +1,13 @@ # GUI (Screens) from Screens.Screen import Screen -from Screens.MessageBox import MessageBox -from Screens.InputBox import InputBox from Screens.HelpMenu import HelpableScreen -from Screens.ChoiceBox import ChoiceBox # Generic -from Tools.BoundFunction import boundFunction from Tools.Directories import * -from Components.config import config -import os # GUI (Components) -from Components.ActionMap import ActionMap, HelpableActionMap +from Components.ActionMap import ActionMap from Components.Label import Label -from Components.Button import Button from Components.ProgressBar import ProgressBar # Timer diff --git a/VuBluetoothSetup/src/bt.py b/VuBluetoothSetup/src/bt.py index b070535f7..8b4d3deba 100644 --- a/VuBluetoothSetup/src/bt.py +++ b/VuBluetoothSetup/src/bt.py @@ -1,37 +1,16 @@ -from Plugins.Plugin import PluginDescriptor - from Screens.MessageBox import MessageBox -from Screens.Screen import Screen -from Screens.VirtualKeyBoard import VirtualKeyBoard -from Screens.InputBox import InputBox from Screens.ChoiceBox import ChoiceBox -from Components.Label import Label -from Components.ActionMap import ActionMap -from Components.config import config, ConfigSelection, getConfigListEntry, ConfigSubsection, ConfigYesNo, ConfigText, ConfigSelectionNumber, ConfigNumber -from Components.ConfigList import ConfigListScreen -from Components.Console import Console -from Components.GUIComponent import GUIComponent -from Components.MenuList import MenuList -from Components.Pixmap import Pixmap, MultiPixmap -from Components.Sources.List import List -from Components.Sources.StaticText import StaticText -from Components.VolumeControl import VolumeControl - -from Tools.BoundFunction import boundFunction +from Components.config import config, ConfigSelection, ConfigSubsection, ConfigYesNo, ConfigText, ConfigSelectionNumber, ConfigNumber from Tools.Notifications import AddNotification, AddNotificationWithCallback, AddPopup -from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR -from skin import loadSkin from enigma import eTimer, eServiceReference from enigma import eDVBVolumecontrol -import os -import re import time from . import vubt -from .bt_types import getEventDesc, isAudioProfile, getIcon +from .bt_types import isAudioProfile from . import bt_types from .OTAUpdate import VuRcuOtaUpdate @@ -239,11 +218,15 @@ def __init__(self): self.initVolumeTimer.start(500, True) def InitVolume(self): - try: - vol = config.audio.volume.value + if hasattr(config, "volumeControl"): + vol = config.volumeControl.volume.value self.setVolume(vol) - except: - self.initVolumeTimer.start(100, True) + else: + try: + vol = config.audio.volume.value + self.setVolume(vol) + except: + self.initVolumeTimer.start(100, True) def setVolume(self, vol): self.vubt.setVolume(int(vol)) diff --git a/VuBluetoothSetup/src/bt_config.py b/VuBluetoothSetup/src/bt_config.py index b13806134..0519f3a7e 100644 --- a/VuBluetoothSetup/src/bt_config.py +++ b/VuBluetoothSetup/src/bt_config.py @@ -1,6 +1,6 @@ from Screens.Screen import Screen from Components.ActionMap import ActionMap -from Components.config import config, ConfigSelection, getConfigListEntry, ConfigSubsection, ConfigYesNo, ConfigText, ConfigSelectionNumber +from Components.config import config, getConfigListEntry, ConfigYesNo from Components.ConfigList import ConfigListScreen from Components.Sources.StaticText import StaticText diff --git a/VuBluetoothSetup/src/bt_setup.py b/VuBluetoothSetup/src/bt_setup.py index 933e416e4..a62e1af21 100644 --- a/VuBluetoothSetup/src/bt_setup.py +++ b/VuBluetoothSetup/src/bt_setup.py @@ -1,7 +1,5 @@ from Screens.Screen import Screen from Screens.HelpMenu import HelpableScreen -from Screens.MessageBox import MessageBox -from Tools.Notifications import AddNotification from Components.Label import Label from Components.ActionMap import HelpableActionMap from Components.config import config @@ -14,7 +12,6 @@ from .bt_scan import BluetoothDiscoveryScreen, BluetoothRCUSetup from .bt_task import BluetoothTask from . import bt_types -from .OTAUpdate import VuRcuOtaUpdate class BluetoothSetup(BluetoothTask): diff --git a/VuBluetoothSetup/src/plugin.py b/VuBluetoothSetup/src/plugin.py index a7989c3fc..ca1f89c21 100644 --- a/VuBluetoothSetup/src/plugin.py +++ b/VuBluetoothSetup/src/plugin.py @@ -2,10 +2,7 @@ from Plugins.Plugin import PluginDescriptor from .bt_setup import BluetoothSetupScreen from .bt import pybluetooth_instance -from Components.config import config, ConfigBoolean from enigma import eActionMap, eDVBVolumecontrol -from Tools.HardwareInfo import HardwareInfo -import os g_BTVolumeControlHandle = None