Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/Developer' into python3
Browse files Browse the repository at this point in the history
  • Loading branch information
norhap committed Oct 24, 2023
2 parents 65533d4 + 0d35994 commit b868fc4
Show file tree
Hide file tree
Showing 114 changed files with 1,515 additions and 1,261 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/enigma2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
echo "checking locale format..."
find . -type f -name "*.po" -exec msgfmt {} -o {}.mo \;
echo "checking PEP8 validation..."
flake8 --builtins="_,ngettext,pgettext" --ignore=W191,W503,W504,E128,E501,E722 . --exit-zero
flake8 --builtins="_,ngettext,pgettext" --ignore=W191,W503,W504,E123,E126,E128,E501,E722 . --exit-zero
echo "check format PEP8 completed!"
# PEP8 :- IGNORE CODES
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
echo "installing libsigc++-3"
pushd .
cd /tmp
git clone --depth 1 https://github.com/dbus-cxx/libsigc--3.0.git
git clone --depth 1 https://github.com/TwolDE2/libsigc--3.0.git
cd libsigc--3.0
autoreconf -i
./configure
Expand Down
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -1177,3 +1177,13 @@ openvix: developer 6.4.008.003
openvix: developer 6.4.008.004
openvix: developer 6.4.008.005
openvix: developer 6.4.008.006
openvix: developer 6.4.008.007
openvix: developer 6.4.008.008
openvix: developer 6.4.008.009
openvix: developer 6.4.008.010
openvix: developer 6.4.008.011
openvix: developer 6.4.008.012
openvix: developer 6.4.008.013
openvix: developer 6.4.009.001
openvix: developer 6.4.009.002
openvix: developer 6.4.009.003
4 changes: 3 additions & 1 deletion data/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<item level="2" text="Include ECM in http streams" description="ECM data will be included in the stream. This enables a client receiver to decode it.">config.streaming.stream_ecm</item>
<item level="2" text="Descramble sending http streams" description="When enabled, http streams are descrambled on the server side. The (remote) client receiver does not have to do descrambling.">config.streaming.descramble</item>
<item level="2" text="Descramble receiving http streams" description="When enabled, always descramble receiving http streams. This takes up more resources (descrambling demuxers), only enable if necessary. Individual streams are always descrambled if 0x100 is added to the service type, regardless of this setting.">config.streaming.descramble_client</item>
<item level="2" text="Streamrelay url" description="The IP address of the streamrelay server that is used to descramble services that can only be decrypted via streamrelay">config.misc.softcam_streamrelay_url</item>
<item level="2" text="Streamrelay port" description="The port of the streamrelay server that is used to descramble services that can only be decrypted via streamrelay">config.misc.softcam_streamrelay_port</item>
<item level="2" text="Require authentication for http streams" description="When enabled, authentication is required to watch http streams.">config.streaming.authentication</item>
<item level="2" text="Http(s) stream start delay" description="Define additional delay in milliseconds before start of http(s) streams, e.g. to connect a remote tuner, you use a complex system of DiSEqC.">config.usage.http_startdelay</item>
<item level="2" text="Wake On LAN" description="When enabled the set top box is able to wakeup on LAN" requires="WakeOnLAN">config.usage.wakeOnLAN</item>
Expand Down Expand Up @@ -324,7 +326,7 @@
</if>
<item level="0" text="Automatically update Client/Server View" description="Automatically update Client/Server View">config.oscaminfo.autoupdate</item>
<item level="0" text="Update interval (in seconds)" description="Update interval (in seconds)" conditional="config.oscaminfo.autoupdate.value">config.oscaminfo.intervall</item>
</setup>
</setup>
<setup key="softcamscriptsetup" title="">
<item level="0" text="SoftcamScript select camscript" description="Select a softcam script from the available list.">config.misc.softcams</item>
<item level="0" text="SoftcamScript enable/disable cam restart" description="Allow reinitialisation of selected cam script.">config.misc.softcamrestarts</item>
Expand Down
5 changes: 3 additions & 2 deletions lib/base/ebase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void eTimer::changeInterval(long msek)
else
bActive=true; // then activate Timer

interval = msek; // set new Interval
interval = msek; // set new Interval
nextActivation += interval; // calc nextActivation

context.addTimer(this); // add Timer to context TimerList
Expand Down Expand Up @@ -272,7 +272,8 @@ int eMainloop::processOneEvent(long user_timeout, PyObject **res, ePyObject addi
m_inActivate = 0;
}
if (pfd[i].revents & (POLLERR|POLLHUP|POLLNVAL))
eTrace("[eMainloop::processOneEvent] unhandled POLLERR/HUP/NVAL for fd %d(%d)", pfd[i].fd, pfd[i].revents);
return_reason = 1;
/* eTrace("[eMainloop::processOneEvent] unhandled POLLERR/HUP/NVAL for fd %d(%d)", pfd[i].fd, pfd[i].revents); */
}
}
for (; i < fdcount; ++i)
Expand Down
6 changes: 2 additions & 4 deletions lib/gdi/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void eDBoxLCD::dumpLCD2PNG(void)
int lcd_width = res.width();
int lcd_hight = res.height();
ePtr<gPixmap> pixmap32;
pixmap32 = new gPixmap(eSize(lcd_width, lcd_hight), 32, gPixmap::accelAuto);
pixmap32 = new gPixmap(eSize(lcd_width, lcd_hight), 32, gPixmap::accelNever);
const uint8_t *srcptr = (uint8_t*)_buffer;
uint8_t *dstptr=(uint8_t*)pixmap32->surface->data;

Expand Down Expand Up @@ -326,11 +326,9 @@ void eDBoxLCD::dumpLCD2PNG(void)
break;
case 32:
{
srcptr += _stride/4;
dstptr += pixmap32->surface->stride/4;
for (int y = lcd_hight; y != 0; --y)
{
memcpy(dstptr, srcptr, lcd_width*bpp);
memcpy(dstptr, srcptr, lcd_width*pixmap32->surface->bypp);
srcptr += _stride;
dstptr += pixmap32->surface->stride;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/gui/elistbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class iListboxContent: public iObject
virtual int getItemHeight()=0;
virtual int getItemWidth() { return -1; }
virtual int getOrientation() { return 1; }
virtual int getMaxItemTextWidth() { return 1; }

eListbox *m_listbox;
#endif
Expand Down Expand Up @@ -184,6 +185,7 @@ class eListbox: public eWidget

int getScrollbarWidth() { return m_scrollbar_width; }
int getScrollbarHeight() { return m_scrollbar_height; }
int getMaxItemTextWidth() { return m_content->getMaxItemTextWidth(); }

#ifndef SWIG
struct eListboxStyle *getLocalStyle(void);
Expand Down
153 changes: 150 additions & 3 deletions lib/gui/elistboxcontent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int iListboxContent::currentCursorSelectable()
DEFINE_REF(eListboxPythonStringContent);

eListboxPythonStringContent::eListboxPythonStringContent()
:m_cursor(0), m_saved_cursor(0), m_itemheight(25), m_itemwidth(25), m_orientation(1)
:m_cursor(0), m_saved_cursor(0), m_itemheight(25), m_itemwidth(25), m_max_text_width(0), m_orientation(1)
{
}

Expand Down Expand Up @@ -138,6 +138,43 @@ void eListboxPythonStringContent::setSize(const eSize &size)
m_itemsize = size;
}

int eListboxPythonStringContent::getMaxItemTextWidth()
{
ePtr<gFont> fnt;
eListboxStyle *local_style = 0;
int m_text_offset = 1;
if (m_listbox)
local_style = m_listbox->getLocalStyle();
if (local_style) {
fnt = local_style->m_font;
m_text_offset = local_style->m_text_offset.x();
}
if (!fnt) fnt = new gFont("Regular", 20);

for (int i = 0; i < size(); i++)
{
ePyObject item = PyList_GET_ITEM(m_list, i);
if (PyTuple_Check(item))
{
item = PyTuple_GET_ITEM(item, 0);
}
if (item != Py_None) {
const char *string = PyUnicode_Check(item) ? PyUnicode_AsUTF8(item) : "<not-a-string>";
eRect textRect = eRect(0,0, 8000, 100);

ePtr<eTextPara> para = new eTextPara(textRect);
para->setFont(fnt);
para->renderString(string);
int textWidth = para->getBoundBox().width();
if (textWidth > m_max_text_width) {
m_max_text_width = textWidth;
}
}
}

return m_max_text_width + (m_text_offset*2);
}

void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
ePtr<gFont> fnt;
Expand Down Expand Up @@ -275,8 +312,7 @@ void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style,
flags |= gPainter::RT_HALIGN_BLOCK;
}

painter.renderText(eRect(text_offset, m_itemsize),
string, flags, border_color, border_size);
painter.renderText(eRect(text_offset, m_itemsize), string, flags, border_color, border_size);
}
}

Expand Down Expand Up @@ -848,6 +884,117 @@ static ePyObject lookupColor(ePyObject color, ePyObject data)
return color;
}

int eListboxPythonMultiContent::getMaxItemTextWidth()
{
ePtr<gFont> fnt;
eListboxStyle *local_style = 0;
int m_text_offset = 1;
if (m_listbox)
local_style = m_listbox->getLocalStyle();
if (local_style) {
fnt = local_style->m_font;
m_text_offset = local_style->m_text_offset.x();
}
if (!fnt) fnt = new gFont("Regular", 20);

ePyObject items, buildfunc_ret;
if (m_list) {
for (int k = 0; k < size(); k++)
{
items = PyList_GET_ITEM(m_list, k); // borrowed reference!

if (m_buildFunc)
{
if (PyCallable_Check(m_buildFunc)) // when we have a buildFunc then call it
{
if (PyTuple_Check(items))
buildfunc_ret = items = PyObject_CallObject(m_buildFunc, items);
else
eDebug("[eListboxPythonMultiContent] items is not a tuple");
}
else
eDebug("[eListboxPythonMultiContent] buildfunc is not callable");
}

ePyObject data;

/* if we have a template, use the template for the actual formatting.
we will later detect that "data" is present, and refer to that, instead
of the immediate value. */
int start = 1;
if (m_template)
{
data = items;
items = m_template;
start = 0;
}

int items_size = PyList_Size(items);
for (int i = start; i < items_size; ++i) {
ePyObject item = PyList_GET_ITEM(items, i); // borrowed reference!

if (!item)
{
eDebug("[eListboxPythonMultiContent] no items[%d] ?", i);
continue;
}

if (!PyTuple_Check(item))
{
eDebug("[eListboxPythonMultiContent] items[%d] is not a tuple.", i);
continue;
}

int size = PyTuple_Size(item);

if (!size)
{
eDebug("[eListboxPythonMultiContent] items[%d] is an empty tuple.", i);
continue;
}

int type = PyLong_AsLong(PyTuple_GET_ITEM(item, 0));

switch (type)
{
case TYPE_TEXT: // text
{
ePyObject px = PyTuple_GET_ITEM(item, 1), pfnt = PyTuple_GET_ITEM(item, 5), pstring = PyTuple_GET_ITEM(item, 7);

if (PyLong_Check(pstring) && data) /* if the string is in fact a number, it refers to the 'data' list. */
pstring = PyTuple_GetItem(data, PyLong_AsLong(pstring));

if (pfnt) {
int fnt_i = PyLong_AsLong(pfnt);
if (m_font.find(fnt_i) != m_font.end()) fnt = m_font[fnt_i];
}

/* don't do anything if we have 'None' as string */
if (pstring == Py_None)
continue;

const char *string = (PyUnicode_Check(pstring)) ? PyUnicode_AsUTF8(pstring) : "<not-a-string>";
eRect textRect = eRect(0,0, 9999, 100);

ePtr<eTextPara> para = new eTextPara(textRect);
para->setFont(fnt);
para->renderString(string);
int textWidth = para->getBoundBox().width() + PyLong_AsLong(px);
if (textWidth > m_max_text_width) {
m_max_text_width = textWidth;
}
break;
}
}

}
}

}

return m_max_text_width + (m_text_offset*2);
}

void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
gRegion itemregion(eRect(offset, m_itemsize));
Expand Down
3 changes: 3 additions & 0 deletions lib/gui/elistboxcontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class eListboxPythonStringContent: public virtual iListboxContent
void invalidateEntry(int index);
void invalidate();
eSize getItemSize() { return m_itemsize; }
int getMaxItemTextWidth();
#ifndef SWIG
protected:
void cursorHome();
Expand Down Expand Up @@ -53,6 +54,7 @@ class eListboxPythonStringContent: public virtual iListboxContent
ePtr<gFont> m_font;
int m_itemheight;
int m_itemwidth;
int m_max_text_width;
int m_orientation;
#endif
};
Expand Down Expand Up @@ -93,6 +95,7 @@ class eListboxPythonMultiContent: public eListboxPythonStringContent
void resetClip();
void entryRemoved(int idx);
void setTemplate(SWIG_PYOBJECT(ePyObject) tmplate);
int getMaxItemTextWidth();
private:
std::map<int, ePtr<gFont> > m_font;
};
Expand Down
7 changes: 4 additions & 3 deletions lib/python/Components/Addons/Pager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from skin import parseScale, applySkinFactor

from Components.MultiContent import MultiContentEntryPixmapAlphaBlend
from Components.Sources.List import List

from Tools.Directories import resolveFilename, SCOPE_GUISKIN
from Tools.LoadPixmap import LoadPixmap
Expand Down Expand Up @@ -89,7 +90,7 @@ def postWidgetCreate(self, instance):
instance.allowNativeKeys(False)

def getSourceOrientation(self):
if self.source.__class__.__name__ == "List": # Components.Sources.List, used by MainMenu
if isinstance(self.source, List): # Components.Sources.List
orig_source = self.source.master.master
else:
orig_source = self.source
Expand All @@ -103,7 +104,7 @@ def getCurrentIndex(self):
return self.source.l.getCurrentSelectionIndex()

def getSourceSize(self):
if self.source.__class__.__name__ == "List": # Components.Sources.List, used by MainMenu
if isinstance(self.source, List): # Components.Sources.List
return self.source.master.master.instance.size()
return self.source.instance.size()

Expand All @@ -115,7 +116,7 @@ def getListCount(self):
return 0

def getListItemSize(self):
if self.source.__class__.__name__ == "List": # Components.Sources.List, used by MainMenu
if isinstance(self.source, List): # Components.Sources.List
orig_source = self.source.master.master
else:
orig_source = self.source
Expand Down
27 changes: 22 additions & 5 deletions lib/python/Components/ChoiceList.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont
from enigma import RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, gFont
from Components.MenuList import MenuList
from Components.MultiContent import MultiContentEntryText
from Tools.Directories import fileExists, SCOPE_CURRENT_SKIN, resolveFilename
from Tools.LoadPixmap import LoadPixmap
from skin import applySkinFactor, fonts, parameters
Expand All @@ -15,12 +16,27 @@ def ChoiceEntryComponent(key=None, text=None):
text = ["--"]
res = [text]
if text[0] == "--":
x, y, w, h = parameters.get("ChoicelistDash", applySkinFactor(0, 2, 800, 25))
res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, "-" * 200))
# Do we want graphical separator (solid line with color) or dashed line
isUseGraphicalSeparator = parameters.get("ChoicelistUseGraphicalSeparator", 0)
x, y, w, h = parameters.get("ChoicelistDash", applySkinFactor(0, 2, 1280, 25))
if isUseGraphicalSeparator:
bk_color = parameters.get("ChoicelistSeparatorColor", "0x00555556")
res.append(
MultiContentEntryText(
pos=(x, y + 20),
size=(w, 2),
font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
text="",
color=None, color_sel=None,
backcolor=bk_color, backcolor_sel=bk_color))
else:
res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, "-" * 200))
else:
x, y, w, h = parameters.get("ChoicelistName", applySkinFactor(45, 2, 800, 25))
x, y, w, h = parameters.get("ChoicelistName", applySkinFactor(45, 2, 1280, 25))
res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, text[0]))
if key:
# separate the sizes definition for keybutton is=cons and the rest so there to be possibility to use different size images for different type icons
iconKeyConfigName = "ChoicelistIcon"
if key == "expandable":
pngfile = resolveFilename(SCOPE_CURRENT_SKIN, "icons/expandable.png")
elif key == "expanded":
Expand All @@ -30,10 +46,11 @@ def ChoiceEntryComponent(key=None, text=None):
elif key == "bullet":
pngfile = resolveFilename(SCOPE_CURRENT_SKIN, "icons/bullet.png")
else:
iconKeyConfigName = "ChoicelistButtonIcon"
pngfile = resolveFilename(SCOPE_CURRENT_SKIN, "buttons/key_%s.png" % key)
if fileExists(pngfile):
png = LoadPixmap(pngfile)
x, y, w, h = parameters.get("ChoicelistIcon", (applySkinFactor(5), applySkinFactor(0), png.size().width(), png.size().height()))
x, y, w, h = parameters.get(iconKeyConfigName, (applySkinFactor(5), applySkinFactor(0), png.size().width(), png.size().height()))
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, png))
return res

Expand Down
Loading

0 comments on commit b868fc4

Please sign in to comment.