Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kodi 17 backwards compat to #308 #311

Merged
merged 1 commit into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 17 additions & 8 deletions jellyfin_kodi/dialogs/loginmanual.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from helper import translate
from helper import LazyLogger
from helper import kodi_version

##################################################################################################

Expand Down Expand Up @@ -97,13 +98,20 @@ def onAction(self, action):

def _add_editcontrol(self, x, y, height, width, password=False):

control = xbmcgui.ControlEdit(0, 0, 0, 0,
label="User",
font="font13",
textColor="FF00A4DC",
disabledColor="FF888888",
focusTexture="-",
noFocusTexture="-")
kwargs = dict(
label="User",
font="font13",
textColor="FF00A4DC",
disabledColor="FF888888",
focusTexture="-",
noFocusTexture="-"
)

# TODO: Kodi 17 compat removal cleanup
if kodi_version() < 18:
kwargs['isPassword'] = password

control = xbmcgui.ControlEdit(0, 0, 0, 0, **kwargs)

control.setPosition(x, y)
control.setHeight(height)
Expand All @@ -112,7 +120,8 @@ def _add_editcontrol(self, x, y, height, width, password=False):
self.addControl(control)

# setType has no effect before the control is added to a window
if password:
# TODO: Kodi 17 compat removal cleanup
if password and not kodi_version() < 18:
control.setType(xbmcgui.INPUT_TYPE_PASSWORD, "Please enter password")

return control
Expand Down
2 changes: 1 addition & 1 deletion jellyfin_kodi/helper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def addon_id():


def kodi_version():
return xbmc.getInfoLabel('System.BuildVersion')[:2]
return int(xbmc.getInfoLabel('System.BuildVersion').split('.')[0])


def window(key, value=None, clear=False, window_id=10000):
Expand Down