From 4eb3260cca4e17e024e473092ae95baeb39b8efd Mon Sep 17 00:00:00 2001 From: persianpros Date: Tue, 13 Apr 2021 23:10:29 +0430 Subject: [PATCH 1/5] PEP8 double aggressive E251 and E252 --- plugin/plugin.py | 4 ++-- plugin/ui.py | 20 ++++++++++---------- setup.py | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/plugin/plugin.py b/plugin/plugin.py index 0bc7cb2..64dc8d0 100644 --- a/plugin/plugin.py +++ b/plugin/plugin.py @@ -23,7 +23,7 @@ from Components.config import config, ConfigSubsection, ConfigYesNo config.plugins.ModifyPLiFullHD = ConfigSubsection() -config.plugins.ModifyPLiFullHD.enabled = ConfigYesNo(default = False) +config.plugins.ModifyPLiFullHD.enabled = ConfigYesNo(default=False) def autostart(reason, **kwargs): @@ -44,6 +44,6 @@ def Plugins(path, **kwargs): name = _("Modify PLi-FullHD") descr = _("Change regular font and colors in PLi FullHD/FullNightHD/HD1 skins") return [ - PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_PLUGINMENU, icon = 'plugin.png', fnc=main), + PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_PLUGINMENU, icon='plugin.png', fnc=main), PluginDescriptor(name=name, description=descr, where=[PluginDescriptor.WHERE_SESSIONSTART], fnc=autostart), ] diff --git a/plugin/ui.py b/plugin/ui.py index 677044b..d83f39b 100644 --- a/plugin/ui.py +++ b/plugin/ui.py @@ -39,7 +39,7 @@ from plugin import plugin_path cfg = config.plugins.ModifyPLiFullHD -cfg.skin = NoSave(ConfigSelection(default = "PLi-FullHD", choices = [("PLi-FullHD","PLi-FullHD"),("PLi-FullNightHD","PLi-FullNightHD"),("PLi-HD1","PLi-HD1")])) +cfg.skin = NoSave(ConfigSelection(default="PLi-FullHD", choices=[("PLi-FullHD","PLi-FullHD"),("PLi-FullNightHD","PLi-FullNightHD"),("PLi-HD1","PLi-HD1")])) cfg.toptemplatecolor = NoSave(ConfigIP(default=[0,0,0,48])) cfg.basictemplatecolor = NoSave(ConfigIP(default=[0,0,0,32])) cfg.selectorcolor = NoSave(ConfigIP(default=[0,0,0,48])) @@ -55,9 +55,9 @@ cfg.blackcolor = NoSave(ConfigIP(default=[0,0,0,0])) cfg.fallbackcolor = NoSave(ConfigIP(default=[0,176,176,192])) cfg.notavailablecolor = NoSave(ConfigIP(default=[0,94,94,94])) -cfg.selector_vertical = ConfigSelection(default = "both", choices = [("both",_("both")),("left",_("left only")),("right",_("right only")),("no",_("none"))]) -cfg.oopera_scale = ConfigSelection(default = "standard", choices = [("fullhd",_("FullHD")),("standard",_("Standard"))]) -cfg.altwin = ConfigYesNo(default = False) +cfg.selector_vertical = ConfigSelection(default="both", choices=[("both",_("both")),("left",_("left only")),("right",_("right only")),("no",_("none"))]) +cfg.oopera_scale = ConfigSelection(default="standard", choices=[("fullhd",_("FullHD")),("standard",_("Standard"))]) +cfg.altwin = ConfigYesNo(default=False) XML_NAME = "PLi-FullHD_Pars.xml" XML_FILE = resolveFilename(SCOPE_CONFIG, XML_NAME) @@ -84,19 +84,19 @@ class ModifyPLiFullHD(Screen, ConfigListScreen): """ - def __init__(self, session, selected = None, show_apply = False): + def __init__(self, session, selected=None, show_apply=False): Screen.__init__(self, session) self.session = session self.menuSelectedIndex = selected self.withApply = show_apply choicelist = self.readFonts() - cfg.font = NoSave(ConfigSelection(default = "LiberationSans-Regular.ttf", choices = choicelist)) + cfg.font = NoSave(ConfigSelection(default="LiberationSans-Regular.ttf", choices=choicelist)) self.list = [] self.onChangedEntry = [] - ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry ) + ConfigListScreen.__init__(self, self.list, session=session, on_change=self.changedEntry ) self["actions"] = ActionMap(["SetupActions", "ColorActions"], { @@ -780,7 +780,7 @@ def showFileOptions(self): menu.append((_("Create new \"%s\" file") % "Blue Classic" , 10, "")) menu.append((_("Font sizes table") , 20, "")) - self.session.openWithCallback(self.fileOptionsCallback, ChoiceBox, title=_("Operations with configuration file"), list=menu, selection = self.selectionChoiceBox) + self.session.openWithCallback(self.fileOptionsCallback, ChoiceBox, title=_("Operations with configuration file"), list=menu, selection=self.selectionChoiceBox) def fileOptionsCallback(self, choice): if choice is None: @@ -886,14 +886,14 @@ def __init__(self, session, ): config.plugins.ModifyPLiFullHD = ConfigSubsection() choicelist = self.readFonts() - config.plugins.ModifyPLiFullHD.fonts = NoSave(ConfigSelection(default = choicelist[0], choices = choicelist)) + config.plugins.ModifyPLiFullHD.fonts = NoSave(ConfigSelection(default=choicelist[0], choices=choicelist)) self["info"] = Label(_("Font size / line height (px)")) self["fontsinfo"] = Label() self.FontInfoCfg = [getConfigListEntry(_("Select font"), config.plugins.ModifyPLiFullHD.fonts )] - ConfigListScreen.__init__(self, self.FontInfoCfg, session = session, on_change = self.displayValues) + ConfigListScreen.__init__(self, self.FontInfoCfg, session=session, on_change=self.displayValues) self["actions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"], { diff --git a/setup.py b/setup.py index c8fb350..c9d56e0 100644 --- a/setup.py +++ b/setup.py @@ -2,11 +2,11 @@ import setup_translate pkg = 'Extensions.ModifyPLiFullHD' -setup (name = 'enigma2-plugin-extensions-modifyplifullhd', - version = '1.47', - description = 'modify font and colors for PLi-FullHD and PLi-HD1 skins', - packages = [pkg], - package_dir = {pkg: 'plugin'}, - package_data = {pkg: ['win2k/*.png','png/*.png', 'locale/*.pot', 'locale/*/LC_MESSAGES/*.mo']}, - cmdclass = setup_translate.cmdclass, # for translation +setup (name='enigma2-plugin-extensions-modifyplifullhd', + version='1.47', + description='modify font and colors for PLi-FullHD and PLi-HD1 skins', + packages=[pkg], + package_dir={pkg: 'plugin'}, + package_data={pkg: ['win2k/*.png','png/*.png', 'locale/*.pot', 'locale/*/LC_MESSAGES/*.mo']}, + cmdclass=setup_translate.cmdclass, # for translation ) From 175d07f2bce6ab642207f88917489396fd4ac7b0 Mon Sep 17 00:00:00 2001 From: persianpros Date: Tue, 13 Apr 2021 23:10:29 +0430 Subject: [PATCH 2/5] PEP8 double aggressive E20 and E211 --- plugin/ui.py | 144 +++++++++++++++++++++++++-------------------------- setup.py | 2 +- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/plugin/ui.py b/plugin/ui.py index d83f39b..1910961 100644 --- a/plugin/ui.py +++ b/plugin/ui.py @@ -96,7 +96,7 @@ def __init__(self, session, selected=None, show_apply=False): self.list = [] self.onChangedEntry = [] - ConfigListScreen.__init__(self, self.list, session=session, on_change=self.changedEntry ) + ConfigListScreen.__init__(self, self.list, session=session, on_change=self.changedEntry) self["actions"] = ActionMap(["SetupActions", "ColorActions"], { @@ -170,10 +170,10 @@ def loadMenu(self): def loadConfig(self): self.list = [] - self.list.append(getConfigListEntry(self.skin_enabled ,cfg.enabled)) + self.list.append(getConfigListEntry(self.skin_enabled,cfg.enabled)) if cfg.enabled.value: e = "\c%s" % hex2strColor(int(skin.parseColor("foreground").argb())) - self.list.append(getConfigListEntry(self.skin_name, cfg.skin )) + self.list.append(getConfigListEntry(self.skin_name, cfg.skin)) self.list.append(getConfigListEntry(_("Regular font"), cfg.font)) self.list.append(getConfigListEntry(_("Top color (a,r,g,b)"), cfg.toptemplatecolor)) self.list.append(getConfigListEntry(_("Selector color (a,r,g,b)"), cfg.selectorcolor)) @@ -301,21 +301,21 @@ def addMark(value): for pixmap in borderset.findall("pixmap"): if borderset.attrib.get("name", None) == "bsWindow": if pixmap.attrib.get("pos") == "bpTopLeft": - pixmap.set('filename', "%s/top_left_corner.png" % alt if cfg.altwin.value else "window/top_left_corner.png" ) + pixmap.set('filename', "%s/top_left_corner.png" % alt if cfg.altwin.value else "window/top_left_corner.png") if pixmap.attrib.get("pos") == "bpTop": - pixmap.set('filename', "%s/top_edge.png" % alt if cfg.altwin.value else "window/top_edge.png" ) + pixmap.set('filename', "%s/top_edge.png" % alt if cfg.altwin.value else "window/top_edge.png") if pixmap.attrib.get("pos") == "bpTopRight": - pixmap.set('filename', "%s/top_right_corner.png" % alt if cfg.altwin.value else "window/top_right_corner.png" ) + pixmap.set('filename', "%s/top_right_corner.png" % alt if cfg.altwin.value else "window/top_right_corner.png") if pixmap.attrib.get("pos") == "bpLeft": - pixmap.set('filename', "%s/left_edge.png" % alt if cfg.altwin.value else "window/left_edge.png" ) + pixmap.set('filename', "%s/left_edge.png" % alt if cfg.altwin.value else "window/left_edge.png") if pixmap.attrib.get("pos") == "bpRight": - pixmap.set('filename', "%s/right_edge.png" % alt if cfg.altwin.value else "window/right_edge.png" ) + pixmap.set('filename', "%s/right_edge.png" % alt if cfg.altwin.value else "window/right_edge.png") if pixmap.attrib.get("pos") == "bpBottomLeft": - pixmap.set('filename', "%s/bottom_left_corner.png" % alt if cfg.altwin.value else "window/bottom_left_corner.png" ) + pixmap.set('filename', "%s/bottom_left_corner.png" % alt if cfg.altwin.value else "window/bottom_left_corner.png") if pixmap.attrib.get("pos") == "bpBottom": - pixmap.set('filename', "%s/bottom_edge.png" % alt if cfg.altwin.value else "window/bottom_edge.png" ) + pixmap.set('filename', "%s/bottom_edge.png" % alt if cfg.altwin.value else "window/bottom_edge.png") if pixmap.attrib.get("pos") == "bpBottomRight": - pixmap.set('filename', "%s/bottom_right_corner.png" % alt if cfg.altwin.value else "window/bottom_right_corner.png" ) + pixmap.set('filename', "%s/bottom_right_corner.png" % alt if cfg.altwin.value else "window/bottom_right_corner.png") for borderset in windowstyle.findall("borderset"): for pixmap in borderset.findall("pixmap"): if borderset.attrib.get("name", None) == "bsListboxEntry": @@ -484,14 +484,14 @@ def applyChanges(self, recurse=True): def oopera_scale(self): status = self.get_opera_scale() if status: - if "fullhd" in cfg.oopera_scale.value and status == "standard" : + if "fullhd" in cfg.oopera_scale.value and status == "standard": os.system("sed -i 's/Scale=100/Scale=150/' %s" % OPERA_INI_PATH) elif "standard" in cfg.oopera_scale.value and status == "fullhd": os.system("sed -i 's/Scale=150/Scale=100/' %s" % OPERA_INI_PATH) def get_opera_scale(self): try: - fi = open(OPERA_INI_PATH ,"r") + fi = open(OPERA_INI_PATH,"r") for line in fi.readlines(): if "Scale" in line: if line[-4:-1] == "100": @@ -701,39 +701,39 @@ def indent(elem, level=0): root = ET.Element('skin') fonts = ET.SubElement(root, 'fonts') - ET.SubElement( fonts, 'font', filename="%s" % cfg.font.value, name="Regular", scale="100") + ET.SubElement(fonts, 'font', filename="%s" % cfg.font.value, name="Regular", scale="100") colors = ET.SubElement(root, 'colors') - ET.SubElement( colors, 'color', name="toptemplatecolor", value="%s" % toptemplatecolor) - ET.SubElement( colors, 'color', name="basictemplatecolor", value="%s" % basictemplatecolor) - ET.SubElement( colors, 'color', name="selectorcolor", value="%s" % selectorcolor) - ET.SubElement( colors, 'color', name="transponderinfo", value="%s" % transponderinfo) - ET.SubElement( colors, 'color', name="selectedFG", value="%s" % selectedFG) - ET.SubElement( colors, 'color', name="yellow", value="%s" % yellow) - ET.SubElement( colors, 'color', name="yellowsoft", value="%s" % yellowsoft) - ET.SubElement( colors, 'color', name="red", value="%s" % red) - ET.SubElement( colors, 'color', name="grey", value="%s" % grey) - ET.SubElement( colors, 'color', name="darkgrey", value="%s" % darkgrey) - ET.SubElement( colors, 'color', name="secondFG", value="%s" % secondFG) - ET.SubElement( colors, 'color', name="fallback", value="%s" % fallback) - ET.SubElement( colors, 'color', name="notavailable", value="%s" % notavailable) - ET.SubElement( colors, 'color', name="background", value="%s" % background) - ET.SubElement( colors, 'color', name="black", value="%s" % black) + ET.SubElement(colors, 'color', name="toptemplatecolor", value="%s" % toptemplatecolor) + ET.SubElement(colors, 'color', name="basictemplatecolor", value="%s" % basictemplatecolor) + ET.SubElement(colors, 'color', name="selectorcolor", value="%s" % selectorcolor) + ET.SubElement(colors, 'color', name="transponderinfo", value="%s" % transponderinfo) + ET.SubElement(colors, 'color', name="selectedFG", value="%s" % selectedFG) + ET.SubElement(colors, 'color', name="yellow", value="%s" % yellow) + ET.SubElement(colors, 'color', name="yellowsoft", value="%s" % yellowsoft) + ET.SubElement(colors, 'color', name="red", value="%s" % red) + ET.SubElement(colors, 'color', name="grey", value="%s" % grey) + ET.SubElement(colors, 'color', name="darkgrey", value="%s" % darkgrey) + ET.SubElement(colors, 'color', name="secondFG", value="%s" % secondFG) + ET.SubElement(colors, 'color', name="fallback", value="%s" % fallback) + ET.SubElement(colors, 'color', name="notavailable", value="%s" % notavailable) + ET.SubElement(colors, 'color', name="background", value="%s" % background) + ET.SubElement(colors, 'color', name="black", value="%s" % black) windowstyle = ET.SubElement(root, 'windowstyle', id="0", type="skinned") - ET.SubElement( windowstyle, 'title', offset="20,6", font="Regular;26") - ET.SubElement( windowstyle, 'color', name="Background", color="background") - ET.SubElement( windowstyle, 'color', name="LabelForeground", color="foreground") - ET.SubElement( windowstyle, 'color', name="ListboxBackground", color="background") - ET.SubElement( windowstyle, 'color', name="ListboxForeground", color="foreground") - ET.SubElement( windowstyle, 'color', name="ListboxSelectedBackground", color="selectorcolor") - ET.SubElement( windowstyle, 'color', name="ListboxSelectedForeground", color="selectedFG") - ET.SubElement( windowstyle, 'color', name="ListboxMarkedBackground", color="un40a0aa0") - ET.SubElement( windowstyle, 'color', name="ListboxMarkedForeground", color="red") - ET.SubElement( windowstyle, 'color', name="ListboxMarkedAndSelectedBackground", color="un4a00a0a") - ET.SubElement( windowstyle, 'color', name="ListboxMarkedAndSelectedForeground", color="red") - ET.SubElement( windowstyle, 'color', name="WindowTitleForeground", color="foreground") - ET.SubElement( windowstyle, 'color', name="WindowTitleBackground", color="background") + ET.SubElement(windowstyle, 'title', offset="20,6", font="Regular;26") + ET.SubElement(windowstyle, 'color', name="Background", color="background") + ET.SubElement(windowstyle, 'color', name="LabelForeground", color="foreground") + ET.SubElement(windowstyle, 'color', name="ListboxBackground", color="background") + ET.SubElement(windowstyle, 'color', name="ListboxForeground", color="foreground") + ET.SubElement(windowstyle, 'color', name="ListboxSelectedBackground", color="selectorcolor") + ET.SubElement(windowstyle, 'color', name="ListboxSelectedForeground", color="selectedFG") + ET.SubElement(windowstyle, 'color', name="ListboxMarkedBackground", color="un40a0aa0") + ET.SubElement(windowstyle, 'color', name="ListboxMarkedForeground", color="red") + ET.SubElement(windowstyle, 'color', name="ListboxMarkedAndSelectedBackground", color="un4a00a0a") + ET.SubElement(windowstyle, 'color', name="ListboxMarkedAndSelectedForeground", color="red") + ET.SubElement(windowstyle, 'color', name="WindowTitleForeground", color="foreground") + ET.SubElement(windowstyle, 'color', name="WindowTitleBackground", color="background") bsWinPath = "window" if self.current_skin == "PLi-HD1": # HD1 using HD bswindow pictures @@ -741,21 +741,21 @@ def indent(elem, level=0): elif cfg.altwin.value: # alternate window borders for FullHD skins bsWinPath = plugin_path + "/win2k/" - bswindow = ET.SubElement( windowstyle, 'borderset', name="bsWindow") - ET.SubElement( bswindow, 'pixmap', filename="%s/top_left_corner.png" % bsWinPath, pos="bpTopLeft") - ET.SubElement( bswindow, 'pixmap', filename="%s/top_edge.png" % bsWinPath, pos="bpTop") - ET.SubElement( bswindow, 'pixmap', filename="%s/top_right_corner.png" % bsWinPath, pos="bpTopRight") - ET.SubElement( bswindow, 'pixmap', filename="%s/left_edge.png" % bsWinPath, pos="bpLeft") - ET.SubElement( bswindow, 'pixmap', filename="%s/right_edge.png" % bsWinPath, pos="bpRight") - ET.SubElement( bswindow, 'pixmap', filename="%s/bottom_left_corner.png" % bsWinPath, pos="bpBottomLeft") - ET.SubElement( bswindow, 'pixmap', filename="%s/bottom_edge.png" % bsWinPath, pos="bpBottom") - ET.SubElement( bswindow, 'pixmap', filename="%s/bottom_right_corner.png" % bsWinPath, pos="bpBottomRight") - - bslistboxentry = ET.SubElement( windowstyle, 'borderset', name="bsListboxEntry") - ET.SubElement( bslistboxentry, 'pixmap', filename=self.line("line"), pos="bpTop") - ET.SubElement( bslistboxentry, 'pixmap', filename=self.line("line"), pos="bpBottom") - ET.SubElement( bslistboxentry, 'pixmap', filename=self.line("vline"), pos="bpLeft") - ET.SubElement( bslistboxentry, 'pixmap', filename=self.line("vline"), pos="bpRight") + bswindow = ET.SubElement(windowstyle, 'borderset', name="bsWindow") + ET.SubElement(bswindow, 'pixmap', filename="%s/top_left_corner.png" % bsWinPath, pos="bpTopLeft") + ET.SubElement(bswindow, 'pixmap', filename="%s/top_edge.png" % bsWinPath, pos="bpTop") + ET.SubElement(bswindow, 'pixmap', filename="%s/top_right_corner.png" % bsWinPath, pos="bpTopRight") + ET.SubElement(bswindow, 'pixmap', filename="%s/left_edge.png" % bsWinPath, pos="bpLeft") + ET.SubElement(bswindow, 'pixmap', filename="%s/right_edge.png" % bsWinPath, pos="bpRight") + ET.SubElement(bswindow, 'pixmap', filename="%s/bottom_left_corner.png" % bsWinPath, pos="bpBottomLeft") + ET.SubElement(bswindow, 'pixmap', filename="%s/bottom_edge.png" % bsWinPath, pos="bpBottom") + ET.SubElement(bswindow, 'pixmap', filename="%s/bottom_right_corner.png" % bsWinPath, pos="bpBottomRight") + + bslistboxentry = ET.SubElement(windowstyle, 'borderset', name="bsListboxEntry") + ET.SubElement(bslistboxentry, 'pixmap', filename=self.line("line"), pos="bpTop") + ET.SubElement(bslistboxentry, 'pixmap', filename=self.line("line"), pos="bpBottom") + ET.SubElement(bslistboxentry, 'pixmap', filename=self.line("vline"), pos="bpLeft") + ET.SubElement(bslistboxentry, 'pixmap', filename=self.line("vline"), pos="bpRight") indent(root) et = ET.ElementTree(root) @@ -766,20 +766,20 @@ def indent(elem, level=0): def showFileOptions(self): menu = [] if cfg.skin.value in ("PLi-HD1", "PLi-FullHD"): - menu.append((_("Create new file with default values") , 100, "")) + menu.append((_("Create new file with default values"), 100, "")) elif cfg.skin.value == "PLi-FullNightHD": - menu.append((_("Create new file with default values") , 200, "")) + menu.append((_("Create new file with default values"), 200, "")) menu.append((_("Save current parameters"), 1)) menu.append((_("Delete file with parameters and close plugin"), 2, "")) if cfg.skin.value in ("PLi-HD1", "PLi-FullHD", "PLi-FullNightHD"): - menu.append((_("Create new \"%s\" file") % "F&H" , 3, "")) - menu.append((_("Create new \"%s\" file") % "Purple" , 4, "")) - menu.append((_("Create new \"%s\" file") % "Grey" , 5, "")) - menu.append((_("Create new \"%s\" file") % "Grey 2" , 6, "")) - menu.append((_("Create new \"%s\" file") % "Violet" , 7, "")) - menu.append((_("Create new \"%s\" file") % "Blue Classic" , 10, "")) - - menu.append((_("Font sizes table") , 20, "")) + menu.append((_("Create new \"%s\" file") % "F&H", 3, "")) + menu.append((_("Create new \"%s\" file") % "Purple", 4, "")) + menu.append((_("Create new \"%s\" file") % "Grey", 5, "")) + menu.append((_("Create new \"%s\" file") % "Grey 2", 6, "")) + menu.append((_("Create new \"%s\" file") % "Violet", 7, "")) + menu.append((_("Create new \"%s\" file") % "Blue Classic", 10, "")) + + menu.append((_("Font sizes table"), 20, "")) self.session.openWithCallback(self.fileOptionsCallback, ChoiceBox, title=_("Operations with configuration file"), list=menu, selection=self.selectionChoiceBox) def fileOptionsCallback(self, choice): @@ -891,7 +891,7 @@ def __init__(self, session, ): self["info"] = Label(_("Font size / line height (px)")) self["fontsinfo"] = Label() - self.FontInfoCfg = [getConfigListEntry(_("Select font"), config.plugins.ModifyPLiFullHD.fonts )] + self.FontInfoCfg = [getConfigListEntry(_("Select font"), config.plugins.ModifyPLiFullHD.fonts)] ConfigListScreen.__init__(self, self.FontInfoCfg, session=session, on_change=self.displayValues) @@ -910,10 +910,10 @@ def displayValues(self): self["tmp"].setText("W") info = "" for h in range(1,21): - info += ("%02d / %02d\t") % ( h, self.lineHeight(h, family)) - info += ("%02d / %02d\t") % ( h+20, self.lineHeight(h+20, family)) - info += ("%02d / %02d\t") % ( h+40, self.lineHeight(h+40, family)) - info += ("%02d / %02d") % ( h+60, self.lineHeight(h+60, family)) + info += ("%02d / %02d\t") % (h, self.lineHeight(h, family)) + info += ("%02d / %02d\t") % (h+20, self.lineHeight(h+20, family)) + info += ("%02d / %02d\t") % (h+40, self.lineHeight(h+40, family)) + info += ("%02d / %02d") % (h+60, self.lineHeight(h+60, family)) info += ("\n") self["fontsinfo"].setText(info) diff --git a/setup.py b/setup.py index c9d56e0..4ae332d 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import setup_translate pkg = 'Extensions.ModifyPLiFullHD' -setup (name='enigma2-plugin-extensions-modifyplifullhd', +setup(name='enigma2-plugin-extensions-modifyplifullhd', version='1.47', description='modify font and colors for PLi-FullHD and PLi-HD1 skins', packages=[pkg], From f17149e487b6c469a2cb2ceb5328692cb2edbf88 Mon Sep 17 00:00:00 2001 From: persianpros Date: Tue, 13 Apr 2021 23:10:30 +0430 Subject: [PATCH 3/5] PEP8 double aggressive E22, E224, E241, E242 and E27 --- plugin/ui.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugin/ui.py b/plugin/ui.py index 1910961..6dd32a0 100644 --- a/plugin/ui.py +++ b/plugin/ui.py @@ -69,7 +69,7 @@ def hex2strColor(argb): out = "" for i in range(28,-1,-4): - out += "%s" % chr(0x30 + (argb>>i & 0xf)) + out += "%s" % chr(0x30 + (argb >> i & 0xf)) return out class ModifyPLiFullHD(Screen, ConfigListScreen): @@ -111,7 +111,7 @@ def __init__(self, session, selected=None, show_apply=False): self["key_red"] = Label(_("Cancel")) self["key_yellow"] = Label(_("Apply")) self["key_blue"] = Label(_("Options")) - self["info"]= Label() + self["info"] = Label() self.wrong_xml = False self.selectionChoiceBox = 0 @@ -446,7 +446,7 @@ def deleteParseFile(self, name): os.unlink(name) def backupParseFile(self, name): if self.testFile(BACKUP): - if not self.withApply: + if not self.withApply: os.unlink(BACKUP) shutil.copyfile(name, BACKUP) return True @@ -570,7 +570,7 @@ def reloadSkin(self): if pixmap.attrib.get("pos") == "bpLeft": if cfg.selector_vertical.value in ("no", "right"): borderset.remove(pixmap) - if pixmap.attrib.get("pos") == "bpRight": + if pixmap.attrib.get("pos") == "bpRight": if cfg.selector_vertical.value in ("no", "left"): borderset.remove(pixmap) # call reload skin @@ -684,14 +684,14 @@ def createDefaultCfgFile(self, typ=""): def writeToFile(self, toptemplatecolor, basictemplatecolor, selectorcolor, transponderinfo, selectedFG, yellow, yellowsoft, red, grey, darkgrey, secondFG, fallback, notavailable, background, black): def indent(elem, level=0): - i = "\n" + level*" " + i = "\n" + level * " " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " if not elem.tail or not elem.tail.strip(): elem.tail = i for elem in elem: - indent(elem, level+1) + indent(elem, level + 1) if not elem.tail or not elem.tail.strip(): elem.tail = i else: @@ -911,9 +911,9 @@ def displayValues(self): info = "" for h in range(1,21): info += ("%02d / %02d\t") % (h, self.lineHeight(h, family)) - info += ("%02d / %02d\t") % (h+20, self.lineHeight(h+20, family)) - info += ("%02d / %02d\t") % (h+40, self.lineHeight(h+40, family)) - info += ("%02d / %02d") % (h+60, self.lineHeight(h+60, family)) + info += ("%02d / %02d\t") % (h + 20, self.lineHeight(h + 20, family)) + info += ("%02d / %02d\t") % (h + 40, self.lineHeight(h + 40, family)) + info += ("%02d / %02d") % (h + 60, self.lineHeight(h + 60, family)) info += ("\n") self["fontsinfo"].setText(info) From 60ecf71e710d228c69dc865f00a4bce715612f86 Mon Sep 17 00:00:00 2001 From: persianpros Date: Tue, 13 Apr 2021 23:10:31 +0430 Subject: [PATCH 4/5] PEP8 double aggressive E225 ~ E228 and E231 --- plugin/plugin.py | 4 ++-- plugin/ui.py | 50 ++++++++++++++++++++++++------------------------ setup.py | 2 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/plugin/plugin.py b/plugin/plugin.py index 64dc8d0..f6c7d04 100644 --- a/plugin/plugin.py +++ b/plugin/plugin.py @@ -28,10 +28,10 @@ def autostart(reason, **kwargs): import ui - if reason == 0 and config.plugins.ModifyPLiFullHD.enabled.value and config.skin.primary_skin.value.split('/')[0] in ("PLi-FullHD","PLi-FullNightHD","PLi-HD1") and ui.reload_skin_on_start: + if reason == 0 and config.plugins.ModifyPLiFullHD.enabled.value and config.skin.primary_skin.value.split('/')[0] in ("PLi-FullHD", "PLi-FullNightHD", "PLi-HD1") and ui.reload_skin_on_start: ui.modifyskin.applyAutorun() -def main(session,**kwargs): +def main(session, **kwargs): import ui def recursive(answer=False): if answer: diff --git a/plugin/ui.py b/plugin/ui.py index 6dd32a0..e153f84 100644 --- a/plugin/ui.py +++ b/plugin/ui.py @@ -39,24 +39,24 @@ from plugin import plugin_path cfg = config.plugins.ModifyPLiFullHD -cfg.skin = NoSave(ConfigSelection(default="PLi-FullHD", choices=[("PLi-FullHD","PLi-FullHD"),("PLi-FullNightHD","PLi-FullNightHD"),("PLi-HD1","PLi-HD1")])) -cfg.toptemplatecolor = NoSave(ConfigIP(default=[0,0,0,48])) -cfg.basictemplatecolor = NoSave(ConfigIP(default=[0,0,0,32])) -cfg.selectorcolor = NoSave(ConfigIP(default=[0,0,0,48])) -cfg.transponderinfocolor = NoSave(ConfigIP(default=[0,0,144,240])) -cfg.selectedfgcolor = NoSave(ConfigIP(default=[0,252,192,0])) -cfg.yellowcolor = NoSave(ConfigIP(default=[0,255,192,0])) -cfg.yellowsoftcolor = NoSave(ConfigIP(default=[0,204,172,104])) -cfg.redcolor = NoSave(ConfigIP(default=[0,250,64,16])) -cfg.secondfgcolor = NoSave(ConfigIP(default=[0,252,192,0])) -cfg.greycolor = NoSave(ConfigIP(default=[0,170,170,170])) -cfg.darkgreycolor = NoSave(ConfigIP(default=[0,85,85,85])) -cfg.backgroundcolor = NoSave(ConfigIP(default=[0,0,0,0])) -cfg.blackcolor = NoSave(ConfigIP(default=[0,0,0,0])) -cfg.fallbackcolor = NoSave(ConfigIP(default=[0,176,176,192])) -cfg.notavailablecolor = NoSave(ConfigIP(default=[0,94,94,94])) -cfg.selector_vertical = ConfigSelection(default="both", choices=[("both",_("both")),("left",_("left only")),("right",_("right only")),("no",_("none"))]) -cfg.oopera_scale = ConfigSelection(default="standard", choices=[("fullhd",_("FullHD")),("standard",_("Standard"))]) +cfg.skin = NoSave(ConfigSelection(default="PLi-FullHD", choices=[("PLi-FullHD", "PLi-FullHD"), ("PLi-FullNightHD", "PLi-FullNightHD"), ("PLi-HD1", "PLi-HD1")])) +cfg.toptemplatecolor = NoSave(ConfigIP(default=[0, 0, 0, 48])) +cfg.basictemplatecolor = NoSave(ConfigIP(default=[0, 0, 0, 32])) +cfg.selectorcolor = NoSave(ConfigIP(default=[0, 0, 0, 48])) +cfg.transponderinfocolor = NoSave(ConfigIP(default=[0, 0, 144, 240])) +cfg.selectedfgcolor = NoSave(ConfigIP(default=[0, 252, 192, 0])) +cfg.yellowcolor = NoSave(ConfigIP(default=[0, 255, 192, 0])) +cfg.yellowsoftcolor = NoSave(ConfigIP(default=[0, 204, 172, 104])) +cfg.redcolor = NoSave(ConfigIP(default=[0, 250, 64, 16])) +cfg.secondfgcolor = NoSave(ConfigIP(default=[0, 252, 192, 0])) +cfg.greycolor = NoSave(ConfigIP(default=[0, 170, 170, 170])) +cfg.darkgreycolor = NoSave(ConfigIP(default=[0, 85, 85, 85])) +cfg.backgroundcolor = NoSave(ConfigIP(default=[0, 0, 0, 0])) +cfg.blackcolor = NoSave(ConfigIP(default=[0, 0, 0, 0])) +cfg.fallbackcolor = NoSave(ConfigIP(default=[0, 176, 176, 192])) +cfg.notavailablecolor = NoSave(ConfigIP(default=[0, 94, 94, 94])) +cfg.selector_vertical = ConfigSelection(default="both", choices=[("both", _("both")), ("left", _("left only")), ("right", _("right only")), ("no", _("none"))]) +cfg.oopera_scale = ConfigSelection(default="standard", choices=[("fullhd", _("FullHD")), ("standard", _("Standard"))]) cfg.altwin = ConfigYesNo(default=False) XML_NAME = "PLi-FullHD_Pars.xml" @@ -68,7 +68,7 @@ def hex2strColor(argb): out = "" - for i in range(28,-1,-4): + for i in range(28, -1, -4): out += "%s" % chr(0x30 + (argb >> i & 0xf)) return out @@ -170,7 +170,7 @@ def loadMenu(self): def loadConfig(self): self.list = [] - self.list.append(getConfigListEntry(self.skin_enabled,cfg.enabled)) + self.list.append(getConfigListEntry(self.skin_enabled, cfg.enabled)) if cfg.enabled.value: e = "\c%s" % hex2strColor(int(skin.parseColor("foreground").argb())) self.list.append(getConfigListEntry(self.skin_name, cfg.skin)) @@ -381,7 +381,7 @@ def parseColors(self): cfg.blackcolor.value = self.map(value) def map(self, colorstring): - return [int(colorstring[0:2],16),int(colorstring[2:4],16),int(colorstring[4:6],16),int(colorstring[6:8],16)] + return [int(colorstring[0:2], 16), int(colorstring[2:4], 16), int(colorstring[4:6], 16), int(colorstring[6:8], 16)] def getColorsFromCfg(self): toptemplate = self.l2h(cfg.toptemplatecolor.value) @@ -403,7 +403,7 @@ def getColorsFromCfg(self): return toptemplate, basictemplate, selector, transponderinfo, selectedfg, yellow, yellowsoft, red, grey, darkgrey, secondfg, fallback, notavailable, background, black def l2h(self, l): - return "%02x%02x%02x%02x" % (l[0],l[1],l[2],l[3]) + return "%02x%02x%02x%02x" % (l[0], l[1], l[2], l[3]) def keySave(self): self.setSkinPath() @@ -476,7 +476,7 @@ def applyChanges(self, recurse=True): self.reloadSkin() self.reloadChanellSelection() if recurse: - self.close((self["config"].getCurrentIndex(),True)) + self.close((self["config"].getCurrentIndex(), True)) else: self.deleteParseFile(BACKUP) self.close() @@ -491,7 +491,7 @@ def oopera_scale(self): def get_opera_scale(self): try: - fi = open(OPERA_INI_PATH,"r") + fi = open(OPERA_INI_PATH, "r") for line in fi.readlines(): if "Scale" in line: if line[-4:-1] == "100": @@ -909,7 +909,7 @@ def displayValues(self): self["tmp"].instance.setNoWrap(1) self["tmp"].setText("W") info = "" - for h in range(1,21): + for h in range(1, 21): info += ("%02d / %02d\t") % (h, self.lineHeight(h, family)) info += ("%02d / %02d\t") % (h + 20, self.lineHeight(h + 20, family)) info += ("%02d / %02d\t") % (h + 40, self.lineHeight(h + 40, family)) diff --git a/setup.py b/setup.py index 4ae332d..6bdb419 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,6 @@ description='modify font and colors for PLi-FullHD and PLi-HD1 skins', packages=[pkg], package_dir={pkg: 'plugin'}, - package_data={pkg: ['win2k/*.png','png/*.png', 'locale/*.pot', 'locale/*/LC_MESSAGES/*.mo']}, + package_data={pkg: ['win2k/*.png', 'png/*.png', 'locale/*.pot', 'locale/*/LC_MESSAGES/*.mo']}, cmdclass=setup_translate.cmdclass, # for translation ) From 79f210359af06156aa4f5fbed0a17e1bcbad5e6b Mon Sep 17 00:00:00 2001 From: persianpros Date: Tue, 13 Apr 2021 23:10:32 +0430 Subject: [PATCH 5/5] PEP8 double aggressive E301 ~ E306 --- plugin/__init__.py | 5 ++++- plugin/plugin.py | 3 +++ plugin/ui.py | 6 ++++++ setup_translate.py | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/plugin/__init__.py b/plugin/__init__.py index a305838..825b878 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -4,11 +4,13 @@ from os import environ as os_environ import gettext + def localeInit(): lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" os_environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it! gettext.bindtextdomain("ModifyPLiFullHD", resolveFilename(SCOPE_PLUGINS, "Extensions/ModifyPLiFullHD/locale")) + def _(txt): t = gettext.dgettext("ModifyPLiFullHD", txt) if t == txt: @@ -16,5 +18,6 @@ def _(txt): t = gettext.gettext(txt) return t + localeInit() -language.addCallback(localeInit) \ No newline at end of file +language.addCallback(localeInit) diff --git a/plugin/plugin.py b/plugin/plugin.py index f6c7d04..cf71d98 100644 --- a/plugin/plugin.py +++ b/plugin/plugin.py @@ -31,13 +31,16 @@ def autostart(reason, **kwargs): if reason == 0 and config.plugins.ModifyPLiFullHD.enabled.value and config.skin.primary_skin.value.split('/')[0] in ("PLi-FullHD", "PLi-FullNightHD", "PLi-HD1") and ui.reload_skin_on_start: ui.modifyskin.applyAutorun() + def main(session, **kwargs): import ui + def recursive(answer=False): if answer: session.openWithCallback(recursive, ui.ModifyPLiFullHD, answer[0], answer[1]) session.openWithCallback(recursive, ui.ModifyPLiFullHD) + def Plugins(path, **kwargs): global plugin_path plugin_path = path diff --git a/plugin/ui.py b/plugin/ui.py index e153f84..985296b 100644 --- a/plugin/ui.py +++ b/plugin/ui.py @@ -66,12 +66,14 @@ reload_skin_on_start = True + def hex2strColor(argb): out = "" for i in range(28, -1, -4): out += "%s" % chr(0x30 + (argb >> i & 0xf)) return out + class ModifyPLiFullHD(Screen, ConfigListScreen): skin = """ @@ -444,6 +446,7 @@ def cancelCallback(self, answer): def deleteParseFile(self, name): if self.testFile(name): os.unlink(name) + def backupParseFile(self, name): if self.testFile(BACKUP): if not self.withApply: @@ -453,6 +456,7 @@ def backupParseFile(self, name): return False shutil.copyfile(name, BACKUP) return True + def useBackupFile(self): if self.testFile(BACKUP): shutil.move(BACKUP, XML_FILE) @@ -859,8 +863,10 @@ def changeColorsOnline(self): skin.colorNames[n] = skin.parseColor("#%s" % self.newColors[n]) ### + modifyskin = ModifyPLiFullHD(Screen) + class ModifyPLiFullHDFontInfo(Screen, ConfigListScreen): skin = """ diff --git a/setup_translate.py b/setup_translate.py index 29e8221..9d6993d 100644 --- a/setup_translate.py +++ b/setup_translate.py @@ -4,8 +4,10 @@ from distutils.command.build import build as _build import os + class build_trans(cmd.Command): description = 'Compile .po files into .mo files' + def initialize_options(self): pass @@ -25,11 +27,14 @@ def run(self): if os.system("msgfmt '%s' -o '%s'" % (src, dest)) != 0: raise Exception, "Failed to compile: " + src + class build(_build): sub_commands = _build.sub_commands + [('build_trans', None)] + def run(self): _build.run(self) + cmdclass = { 'build': build, 'build_trans': build_trans,