From 4d3fead262f59d5e75717cd0dc356b2840765f17 Mon Sep 17 00:00:00 2001 From: dpeddi Date: Tue, 14 Jan 2020 00:28:33 +0100 Subject: [PATCH] add more activty elements --- .../activity/circularCaloriesElement.py | 13 ++++++++ .../elements/activity/pulseMeterElement.py | 8 ++--- .../elements/activity/unknown17Element.py | 30 +++++++++++++++++++ .../models/elements/activityElement.py | 6 +++- watchFaceParser/models/elements/watchFace.py | 6 ---- 5 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 watchFaceParser/models/elements/activity/circularCaloriesElement.py create mode 100644 watchFaceParser/models/elements/activity/unknown17Element.py diff --git a/watchFaceParser/models/elements/activity/circularCaloriesElement.py b/watchFaceParser/models/elements/activity/circularCaloriesElement.py new file mode 100644 index 0000000..ec21103 --- /dev/null +++ b/watchFaceParser/models/elements/activity/circularCaloriesElement.py @@ -0,0 +1,13 @@ +import logging + +from watchFaceParser.models.elements.common.circularProgressElement import CircularProgressElement + + +class CircularCaloriesElement(CircularProgressElement): + def __init__(self, parameter, parent, name = None): + super(CircularCaloriesElement, self).__init__(parameter = parameter, parent = parent, name = name) + + + def draw3(self, drawer, resources, state): + assert(type(resources) == list) + super(CircularCaloriesElement, self).draw4(drawer, resources, state.getCalories(), 800) diff --git a/watchFaceParser/models/elements/activity/pulseMeterElement.py b/watchFaceParser/models/elements/activity/pulseMeterElement.py index 37854d6..2efaaf1 100644 --- a/watchFaceParser/models/elements/activity/pulseMeterElement.py +++ b/watchFaceParser/models/elements/activity/pulseMeterElement.py @@ -1,10 +1,10 @@ -from watchFaceParser.models.elements.common.numberElement import NumberElement +from watchFaceParser.models.elements.common.circularProgressElement import CircularProgressElement -class PulseMeterElement(NumberElement): +class PulseMeterElement(CircularProgressElement): def __init__(self, parameter, parent, name = 'None'): super(PulseMeterElement, self).__init__(parameter, parent, name) def draw3(self, drawer, resources, state): assert(type(resources) == list) - #if state.getGoal2(): - # self.draw4(drawer, resources, state.getGoal2()) \ No newline at end of file + if state.getPulse(): + self.draw4(drawer, resources, state.getPulse(), 150) \ No newline at end of file diff --git a/watchFaceParser/models/elements/activity/unknown17Element.py b/watchFaceParser/models/elements/activity/unknown17Element.py new file mode 100644 index 0000000..c35cc27 --- /dev/null +++ b/watchFaceParser/models/elements/activity/unknown17Element.py @@ -0,0 +1,30 @@ +import logging + +from watchFaceParser.models.elements.basic.compositeElement import CompositeElement + +class Unknown17Element(CompositeElement): + def __init__(self, parameter, parent, name = None): + self._step = None + self._circularCalories = None + super(Unknown17Element, self).__init__(parameters = None, parameter = parameter, parent = parent, name = name) + + def getStep(self): + return self._step + + def getCircularCalories(self): + return self._circularCalories + + def draw3(self, drawer, resources, state): + + if self.getCircularCalories(): + self.getCircularCalories().draw3(drawer, resources, state) + + + def createChildForParameter(self, parameter): + parameterId = parameter.getId() + + if parameterId == 1: + from watchFaceParser.models.elements.activity.circularCaloriesElement import CircularCaloriesElement + self._circularCalories = CircularCaloriesElement(parameter = parameter, parent = self, name = '_circularCalories') + else: + super(Unknown17Element, self).createChildForParameter(parameter) diff --git a/watchFaceParser/models/elements/activityElement.py b/watchFaceParser/models/elements/activityElement.py index 8b5f702..68b8eb2 100644 --- a/watchFaceParser/models/elements/activityElement.py +++ b/watchFaceParser/models/elements/activityElement.py @@ -13,6 +13,7 @@ def __init__(self, parameter, parent = None, name = None): self._calories = None self._starImage = None self._circleRange = None + self._unknown17 = None super(ActivityElement, self).__init__(parameters = None, parameter = parameter, parent = parent, name = name) @@ -80,7 +81,10 @@ def createChildForParameter(self, parameter): from watchFaceParser.models.elements.activity.pulseMeterElement import PulseMeterElement self._pulseMeter = PulseMeterElement(parameter = parameter, parent = self, name = '?PulseMeter?') return self._pulseMeter + elif parameterId == 17: + from watchFaceParser.models.elements.activity.unknown17Element import Unknown17Element + self._unknown17 = Unknown17Element(parameter = parameter, parent = self, name = '?Unknown17?') + return self._unknown17 else: - #print ("unsupported parameterid",parameterId) return super(ActivityElement, self).createChildForParameter(parameter) diff --git a/watchFaceParser/models/elements/watchFace.py b/watchFaceParser/models/elements/watchFace.py index 038e4f3..afee59b 100644 --- a/watchFaceParser/models/elements/watchFace.py +++ b/watchFaceParser/models/elements/watchFace.py @@ -57,12 +57,6 @@ def getBattery(self): def getAnalogDial(self): return self._analogDial - - #def getWeather(self): - # print ("GETWEATHER") - # return self._weather - - def createChildForParameter(self, parameter): parameterId = parameter.getId() if parameterId == 2: