Skip to content

Commit

Permalink
Merge branch 'Developer' into Python3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Ev0-BH committed Oct 7, 2023
2 parents ed34130 + 35c018d commit ecb254b
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 72 deletions.
18 changes: 9 additions & 9 deletions lib/python/Screens/LocationBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,15 @@ def MovieLocationBox(session, text, dir, minFree=None):
class TimeshiftLocationBox(LocationBox):
def __init__(self, session):
LocationBox.__init__(
self,
session,
text=_("Where to save temporary timeshift recordings?"),
currDir=config.usage.timeshift_path.value,
bookmarks=config.usage.allowed_timeshift_paths,
autoAdd=True,
editDir=True,
inhibitDirs=defaultInhibitDirs,
minFree=1024 # the same requirement is hardcoded in servicedvb.cpp
self,
session,
text=_("Where to save temporary timeshift recordings?"),
currDir=config.usage.timeshift_path.value,
bookmarks=config.usage.allowed_timeshift_paths,
autoAdd=True,
editDir=True,
inhibitDirs=defaultInhibitDirs,
minFree=1024 # the same requirement is hardcoded in servicedvb.cpp
)
self.skinName = "LocationBox"

Expand Down
14 changes: 7 additions & 7 deletions lib/python/Screens/LogManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,13 @@ def __init__(self, session, logpath=None):

self["actions"] = ActionMap(["ChannelSelectBaseActions", "WizardActions", "DirectionActions", "MenuActions", "NumberActions", "ColorActions"],
{
"ok": self.ok,
"back": self.exit,
"up": self.goUp,
"down": self.goDown,
"left": self.goLeft,
"right": self.goRight,
"0": self.doRefresh,
"ok": self.ok,
"back": self.exit,
"up": self.goUp,
"down": self.goDown,
"left": self.goLeft,
"right": self.goRight,
"0": self.doRefresh,
}, -1)
self.onLayoutFinish.append(self.mainlist)

Expand Down
20 changes: 10 additions & 10 deletions lib/python/Screens/MessageBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ def autoResize(self):
self.instance.move(ePoint((getDesktop(0).size().width() - wsizex) // 2, (getDesktop(0).size().height() - wsizey) // 2))

def cancel(self):
for l in self["list"].list:
# print "[MessageBox] DEBUG: (cancel) '%s' -> '%s'" % (str(l[0]), str(l[1]))
for x in self["list"].list:
# print "[MessageBox] DEBUG: (cancel) '%s' -> '%s'" % (str(x[0]), str(x[1]))
# Should we be looking at the second element to get the boolean value rather than the word?
if l[0].lower() == _('no') or l[0].lower() == _('false'):
if len(l) > 2:
l[2](None)
if x[0].lower() == _('no') or x[0].lower() == _('false'):
if len(x) > 2:
x[2](None)
break
# Don't close again if the MessageBox was closed in the loop
if hasattr(self, "execing"):
Expand All @@ -256,12 +256,12 @@ def goEntry(self, entry=None):

def alwaysOK(self):
if self["list"].list:
for l in self["list"].list:
# print "[MessageBox] DEBUG: (cancel) '%s' -> '%s'" % (str(l[0]), str(l[1]))
for x in self["list"].list:
# print "[MessageBox] DEBUG: (cancel) '%s' -> '%s'" % (str(x[0]), str(x[1]))
# Should we be looking at the second element to get the boolean value rather than the word?
if l[0].lower() == _('yes') or l[0].lower() == _('true'):
if len(l) > 2:
self.goEntry(l)
if x[0].lower() == _('yes') or x[0].lower() == _('true'):
if len(x) > 2:
self.goEntry(x)
else:
self.close(True)
break
Expand Down
3 changes: 1 addition & 2 deletions lib/python/Screens/VideoWizard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from boxbranding import getBoxType, getMachineName, getHaveRCA, getHaveDVI, getHaveSCART, getHaveAVJACK
from Screens.Wizard import WizardSummary
from Screens.WizardLanguage import WizardLanguage
from Screens.Rc import Rc
Expand All @@ -9,7 +8,7 @@
from Components.SystemInfo import SystemInfo

from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_CURRENT_SKIN
from Tools.HardwareInfo import HardwareInfo
# from Tools.HardwareInfo import HardwareInfo

config.misc.showtestcard = ConfigBoolean(default=False)

Expand Down
3 changes: 0 additions & 3 deletions lib/python/Tools/General.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from enigma import iServiceInformation, eServiceReference, eServiceCenter


def isIPTV(service):
path = service and service.getPath()
return path and not path.startswith("/") and service.type in [0x1, 0x1001, 0x138A, 0x1389]
26 changes: 13 additions & 13 deletions lib/python/Tools/GetEcmInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@ def getText(self):
source = info.get('source', None)
if source:
# wicardd - type 2 / mgcamd
caid = info.get('caid', None)
if caid:
info['caid'] = info['caid'][2:]
info['pid'] = info['pid'][2:]
info['provid'] = info['prov'][2:]
time = ""
for line in ecm:
if 'msec' in line:
line = line.split(' ')
if line[0]:
time = " (%ss)" % (float(line[0]) / 1000)
continue
self.textvalue = source + time
caid = info.get('caid', None)
if caid:
info['caid'] = info['caid'][2:]
info['pid'] = info['pid'][2:]
info['provid'] = info['prov'][2:]
time = ""
for line in ecm:
if 'msec' in line:
line = line.split(' ')
if line[0]:
time = " (%ss)" % (float(line[0]) / 1000)
continue
self.textvalue = source + time
else:
reader = info.get('reader', '')
if reader:
Expand Down
28 changes: 10 additions & 18 deletions lib/python/e2reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Twisted imports
from twisted.python import log, failure
from twisted.internet import main, posixbase, error
#from twisted.internet.pollreactor import PollReactor, poller
# from twisted.internet.pollreactor import PollReactor, poller

from enigma import getApplication
import six
Expand Down Expand Up @@ -139,32 +139,24 @@ def removeAll(self, reads=reads, writes=writes, selectables=selectables):
self.addReader(self.waker)
return result

def doPoll(self, timeout,
reads=reads,
writes=writes,
selectables=selectables,
select=select,
log=log,
POLLIN=select.POLLIN,
POLLOUT=select.POLLOUT):
def doPoll(self, timeout, reads=reads, writes=writes, selectables=selectables, select=select, log=log, POLLIN=select.POLLIN, POLLOUT=select.POLLOUT):
"""Poll the poller for new events."""

if timeout is not None:
timeout = int(timeout * 1000) # convert seconds to milliseconds

try:
l = poller.poll(timeout)
if l is None:
x = poller.poll(timeout)
if x is None:
if self.running:
self.stop()
l = []
x = []
except select.error as e:
if e[0] == errno.EINTR:
return
else:
raise
raise
_drdw = self._doReadOrWrite
for fd, event in l:
for fd, event in x:
try:
selectable = selectables[fd]
except KeyError:
Expand All @@ -178,9 +170,9 @@ def doPoll(self, timeout,
def _doReadOrWrite(self, selectable, fd, event, POLLIN, POLLOUT, log, faildict=None):
if not faildict:
faildict = {
error.ConnectionDone: failure.Failure(error.ConnectionDone()),
error.ConnectionLost: failure.Failure(error.ConnectionLost())
}
error.ConnectionDone: failure.Failure(error.ConnectionDone()),
error.ConnectionLost: failure.Failure(error.ConnectionLost())
}
why = None
inRead = False
if event & POLL_DISCONNECTED and not (event & POLLIN):
Expand Down
4 changes: 2 additions & 2 deletions lib/python/keymapparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def parseKeys(context, filename, actionmap, device, keys):
id = get_attr("id")
flags = get_attr("flags")

flag_ascii_to_id = lambda x: {'m': 1, 'b': 2, 'r': 4, 'l': 8}[x]
flag_ascii_to_id = lambda x: {'m': 1, 'b': 2, 'r': 4, 'l': 8}[x] # noqa: E731

flags = sum(map(flag_ascii_to_id, flags))

Expand All @@ -51,7 +51,7 @@ def parseKeys(context, filename, actionmap, device, keys):
assert flags, "[keymapparser] %s: must specify at least one flag in context %s, id '%s'" % (filename, context, id)

keyid = getKeyId(id)
# print("[keymapparser] " + context + "::" + mapto + " -> " + device + "." + hex(keyid))
# print("[keymapparser] " + context + "::" + mapto + " -> " + device + "." + hex(keyid))
actionmap.bindKey(filename, device, keyid, flags, context, mapto)
addKeyBinding(filename, keyid, context, mapto, flags)

Expand Down
15 changes: 7 additions & 8 deletions lib/python/skin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import errno
from xml.etree.cElementTree import Element, ElementTree, fromstring

from enigma import addFont, eLabel, ePixmap, ePoint, eRect, eSize, eWindow, eWindowStyleManager, eWindowStyleSkinned, getDesktop, gFont, getFontFaces, gMainDC, gRGB, BT_ALPHATEST, BT_ALPHABLEND, BT_HALIGN_CENTER, BT_HALIGN_LEFT, BT_HALIGN_RIGHT, BT_KEEP_ASPECT_RATIO, BT_SCALE, BT_VALIGN_BOTTOM, BT_VALIGN_CENTER, BT_VALIGN_TOP
from os.path import basename, dirname, isfile, join
from os.path import basename, dirname, isfile

from Components.config import ConfigSubsection, ConfigText, config
from Components.Sources.Source import ObsoleteSource
Expand Down Expand Up @@ -235,19 +234,19 @@ def parseCoordinate(s, e, size=0, font=None):
return 0
# No test on "e" because it's already a variable
if "center" in s:
center = (e - size) / 2.0
center = (e - size) / 2.0 # noqa: F841
if "c" in s:
c = e / 2.0
if "w" in s:
s = s.replace("w", "*w")
w = float(font in fonts and fonts[font][3] or 0)
w = float(font in fonts and fonts[font][3] or 0) # noqa: F841
if "h" in s:
s = s.replace("h", "*h")
h = float(font in fonts and fonts[font][2] or 0)
h = float(font in fonts and fonts[font][2] or 0) # noqa: F841
if "%" in s:
s = s.replace("%", "*e / 100.0")
s = s.replace("%", "*e / 100.0") # noqa: F841
if "f" in s:
f = getSkinFactor()
f = getSkinFactor() # noqa: F841
# Don't bother trying an int() conversion,
# because at this point that's almost certainly
# going to throw an exception.
Expand Down Expand Up @@ -571,7 +570,7 @@ def scaleFlags(self, value):
"moveRightBottom": BT_HALIGN_RIGHT | BT_VALIGN_BOTTOM
}[value])
except KeyError:
raise AttribValueError("'none', 'scale', 'scaleKeepAspect', 'scaleLeftTop', 'scaleLeftCenter', 'scaleLeftBotton', 'scaleCenterTop', 'scaleCenter', 'scaleCenterBotton', 'scaleRightTop', 'scaleRightCenter', 'scaleRightBottom', 'moveLeftTop', 'moveLeftCenter', 'moveLeftBotton', 'moveCenterTop', 'moveCenter', 'moveCenterBotton', 'moveRightTop', 'moveRightCenter', 'moveRightBottom' ('Center'/'Centre'/'Middle' are equivalent)")
print("[Skin] Error: Invalid scale '%s'! Must be one of 'none', 'scale', 'scaleKeepAspect', 'scaleLeftTop', 'scaleLeftCenter', 'scaleLeftBotton', 'scaleCenterTop', 'scaleCenter', 'scaleCenterBotton', 'scaleRightTop', 'scaleRightCenter', 'scaleRightBottom', 'moveLeftTop', 'moveLeftCenter', 'moveLeftBotton', 'moveCenterTop', 'moveCenter', 'moveCenterBottom', 'moveRightTop', 'moveRightCenter', 'moveRightBottom' ('Center'/'Centre'/'Middle' are equivalent)." % value)

def orientation(self, value): # Used by eSlider and eListBox.
try:
Expand Down

0 comments on commit ecb254b

Please sign in to comment.