예제 #1
0
	def __init__(self, **kwargs):
		super(WidgetBubble, self).__init__(**kwargs)
		
		self.pos = [0.0,0.0]
		self.orgSize = [512.0, 160.0]
		self.size = [self.orgSize[0],self.orgSize[1]]
		self.scale = 1.0
		self.rotation = 0.0 
		self.iLevelBg = KImage("icons/ico_level_bg_512_512.png")
		self.iLevelBubble = KImage("icons/ico_level_bubble_256_256.png")
		self.drawIt()
		self.myValue = None
		self.stat = {
            'skip': 0,
            'update': 0
            }
		self.wvfh = WidgetValFunctionHandler()
예제 #2
0
    def __init__(self, **kwargs):

        self.updateCount = 0

        self.screen = 0
        self.size = [200, 200]
        self.pos = [0, 0]
        self.scale = 1.0
        self.rotation = 0.0
        self.x = 0
        self.y = 0

        self.myValue = None
        self.stat = {'skip': 0, 'update': 0}
        self.subPix = 1.25

        self.mtitle = ""
        self.mcallback = None
        self.mvalk = ""
        self.munit = 1
        self.mround = 1
        self.maxnum = 4
        self.valueToDisplay = 0.0

        self.smSettings = {
            'title': '',
            'min': -175,
            'max': 175,
            'unit': '',
            'round': 1
        }

        self.sm = CircularProgressBar()
        self.sm.size_hint = [None, None]
        self.sm.width = self.size[0]
        self.sm.height = self.size[1]
        self.sm.size = self.size
        self.sm.max = self.smSettings['max']
        self.sm.min = self.smSettings['min']
        self.sm.set_value(0.0, '', '')

        self.wvfh = WidgetValFunctionHandler()
예제 #3
0
    def __init__(self, **kwargs):
        super(Widget_cn, self).__init__(**kwargs)

        self.drawItC = 0

        self.screen = 0
        self.pos = [0, 0]
        self.size = [0, 0]
        self.scale = 1.0
        self.rotation = 0.0

        self.myValue = None
        self.stat = {'skip': 0, 'update': 0}
        self.subPix = 1.25

        self.mtitle = ""
        self.mcallback = None
        self.mvalk = ""
        self.munit = 1
        self.mround = 1
        self.maxnum = 4
        self.wvfh = WidgetValFunctionHandler()
예제 #4
0
class Widget_cn(WidgetProto, WidgetHelper):

    pos = ObjectProperty(None)
    size = ObjectProperty(None)
    scale = ObjectProperty(None)
    rotation = ObjectProperty(None)
    size_hint = None, None

    def __init__(self, **kwargs):
        super(Widget_cn, self).__init__(**kwargs)

        self.drawItC = 0

        self.screen = 0
        self.pos = [0, 0]
        self.size = [0, 0]
        self.scale = 1.0
        self.rotation = 0.0

        self.myValue = None
        self.stat = {'skip': 0, 'update': 0}
        self.subPix = 1.25

        self.mtitle = ""
        self.mcallback = None
        self.mvalk = ""
        self.munit = 1
        self.mround = 1
        self.maxnum = 4
        self.wvfh = WidgetValFunctionHandler()

    def setValues(self, screen, title, unit, round_, maxnum):
        self.screen = screen
        self.mtitle = title
        self.munit = unit
        self.mround = round_
        self.maxnum = maxnum

    def settingsNeedIt(self):
        return True

    def settingsDoneStore(self):
        pass

    def setValuesFromDic(self, dic):
        self.setValues(screen=dic['screen'],
                       title=dic['title'],
                       unit=dic['unit'],
                       round_=dic['round'],
                       maxnum=dic['maxnum'])
        self.wvfh.setParametersFromDict(dic['valHandler'])

    def getAttrFromDialog(self):
        atr = {
            'title': str(self.tiTitle.text),
            'round': int(self.tiRound.text),
            'unit': self.tiUnit.text,
            'maxnum': int(self.tiMaxnum.text)
        }
        return atr

    def addSettingsDialogPart(self, bl, wConf=None):
        bl, self.tiTitle = self.addDialogRow(
            bl, "Title", "" if wConf == None else wConf['atr']['title'])
        bl, self.tiRound = self.addDialogRow(
            bl, "Round to", "1" if wConf == None else wConf['atr']['round'])
        bl, self.tiUnit = self.addDialogRow(
            bl, "Unit", "kts" if wConf == None else wConf['atr']['unit'])
        bl, self.tiMaxnum = self.addDialogRow(
            bl, "Max characters",
            "4" if wConf == None else wConf['atr']['maxnum'])

        return bl

    def getWidget(self):
        print("getWidget () o ", self.mtitle, "pos:", int(self.pos[0]), "x",
              int(self.pos[1]), "size:", int(self.size[0]), "x",
              int(self.size[1]))

        return self

    def updateIt(self, fromWho='', vals=''):
        self.update(fromWho, vals)

    def update(self, fromWho, vals):
        if self.gui.rl.current[:7] != 'Widgets':
            return 0

        if 0:
            print('''update from widget_n[{}] 
                from:{}  
                gotvals:{}'''.format(self.mtitle, fromWho, vals))

        v = self.wvfh.updateVal(fromWho, vals)
        if v != None:
            vAsInt = True
            try:
                vi = int(v)
            except:
                vAsInt = False

            if vAsInt:
                v = str(round(v, self.mround) if self.mround > 0 else int(v))
            else:
                v = str(v)

            if self.myValue == None or self.myValue != v:
                self.myValue = v

                self.l.text = str("%s%s" % (v, self.munit))
                self.l.refresh()
                self.recL.texture = self.l.texture

                #print("recl size",self.l.texture.size)
                self.recL.size = [
                    self.l.texture.size[0] * self.subPix,
                    self.l.texture.size[1] * self.subPix
                ]
                #off = self.msize[0]*.55-(self.l.texture.size[0]*self.subPix)
                #self.posL.x = off

                if 0:
                    print("o ", self.mtitle, "pos:", int(self.pos[0]), "x",
                          int(self.pos[1]), "size:", int(self.size[0]), "x",
                          int(self.size[1]))
                self.stat['update'] += 1
            else:
                self.stat['skip'] += 1
                if (self.stat['skip'] % 50) == 0:
                    print("widget stat", self.mtitle, " -> ", self.stat)

            if self.drawItC == 1:
                self.drawItC += 1

    def setGui(self, gui):
        self.gui = gui

        lsize = 2.0

        self.msize = [(self.maxnum + len(self.munit)) * self.gui.lineH * lsize,
                      self.gui.lineH * lsize]

        self.title = textLabel(
            text=self.mtitle,
            font_size=(self.gui.lineH * 1.2) / self.subPix,
            font_name='Segment7-4Gml.otf',
            #bold = "bold"
        )
        self.title.refresh()

        self.valEmpty = ""
        for v in range(self.maxnum):
            self.valEmpty += "0"

        self.l = textLabel(
            text="%s%s" % (self.valEmpty, self.munit),
            font_size=(self.gui.lineH * lsize) / self.subPix,
            font_name='Segment7-4Gml.otf',
        )
        self.l.refresh()

        self.size = [
            self.l.texture.size[0] * self.subPix,
            self.l.texture.size[1] * self.subPix
        ]
        print("pos ", [self.x, self.y], ' size ', self.size)
        self.pos = [self.x, self.y]

        print("from widget pos:", self.pos, " size:", self.size)
        self.drawIt()
        #sys.exit(9)

    def getSize(self):
        return self.size

    def setColor(self, t):
        if t == "w":
            Color(1, 1, 1, 1)
        elif t == "title":
            Color(.6, .6, .6, .5)
        elif t == "b":
            Color(1, 1, 1, 1)
        elif t == "cog":
            Color(0, 1, 0, 1)
        elif t == "hdg":
            Color(1, 0, 0, 1)
        elif t == 'bg':
            Color(.3, 0, 0, .1)

    def drawIt(self):
        self.drawItC += 1

        with self.canvas:
            PushMatrix()
            self.centPos = Translate(0.0, 0.0, 0.0)

            PushMatrix()
            self.setColor("title")
            Translate(0, self.size[1] * .7, 0)
            Rotate(0, 0, 0, 1)
            Rectangle(size=[
                self.title.texture.size[0] * .5 * self.subPix,
                self.title.texture.size[1] * .5 * self.subPix
            ],
                      pos=(0, 0),
                      texture=self.title.texture)
            PopMatrix()

            self.setColor('w')
            self.posL = Translate(0, self.size[1] * -0.2, 0)
            self.recL = Rectangle(size=[self.size[0], self.size[1]],
                                  pos=(0, 0),
                                  texture=self.l.texture)

            PopMatrix()
예제 #5
0
    def __init__(self, **kwargs):

        self.updateCount = 0

        self.screen = 0
        self.size = [200, 200]
        self.pos = [0, 0]
        self.scale = 1.0
        self.rotation = 0.0
        self.x = 0
        self.y = 0

        self.myValue = None
        self.stat = {'skip': 0, 'update': 0}
        self.subPix = 1.25

        self.mtitle = ""
        self.mcallback = None
        self.mvalk = ""
        self.munit = 1
        self.mround = 1
        self.maxnum = 4
        self.valueToDisplay = 0.0

        self.smSettings = {
            'title': '',
            'name': '-170 to 170',
            'thumb': 'widget_niddle_170_170.png',
            'min': -175,
            'max': 175,
            'tick': 25,
            'subtick': 6,
            'start_angle': -170,
            'end_angle': 170,
            'value_font_size': 23,
            'label_font_size': 50,
        }

        self.sm = MySpeedMeter()
        self.sm.size_hint = [None, None]
        self.sm.size = self.size
        self.sm.pos = self.pos

        self.defSettings = [
            {
                'name': '-170 to 170',
                'title': '',
                'thumb': 'widget_niddle_170_170.png',
                'min': -175,
                'max': 175,
                'tick': 25,
                'subtick': 6,
                'start_angle': -170,
                'end_angle': 170,
                'value_font_size': 23,
                'label_font_size': 50,
            },
            {
                'name': '-170 to 170 small numbers',
                'title': '',
                'thumb': 'widget_niddle_170_170.png',
                'min': -3,
                'max': 3,
                'tick': 1,
                'subtick': 11,
                'start_angle': -170,
                'end_angle': 170,
                'value_font_size': 23,
                'label_font_size': 50,
            },
            {
                'name': '-90 to 90 ',
                'thumb': 'widget_niddle_90_90.png',
                'min': -175,
                'max': 175,
                'tick': 50,
                'subtick': 3,
                'start_angle': -85,
                'end_angle': 85,
                'value_font_size': 14,
                'label_font_size': 50,
            },
            {
                'name': '-90 to 90 small numbers',
                'title': '',
                'thumb': 'widget_niddle_90_90.png',
                'min': -3,
                'max': 3,
                'tick': 1,
                'subtick': 11,
                'start_angle': -85,
                'end_angle': 85,
                'value_font_size': 14,
                'label_font_size': 50,
            },
            {
                'name': '0 to 90 small numbers',
                'title': '',
                'thumb': 'widget_niddle_corner.png',
                'min': 0,
                'max': 5,
                'tick': 1,
                'subtick': 6,
                'start_angle': 90,
                'end_angle': 0,
                'value_font_size': 14,
                'label_font_size': 35,
            },
        ]

        self.wvfh = WidgetValFunctionHandler()
        self.wvfh.setParameters()
예제 #6
0
class Widget_niddle(WidgetHelper):
    def __init__(self, **kwargs):

        self.updateCount = 0

        self.screen = 0
        self.size = [200, 200]
        self.pos = [0, 0]
        self.scale = 1.0
        self.rotation = 0.0
        self.x = 0
        self.y = 0

        self.myValue = None
        self.stat = {'skip': 0, 'update': 0}
        self.subPix = 1.25

        self.mtitle = ""
        self.mcallback = None
        self.mvalk = ""
        self.munit = 1
        self.mround = 1
        self.maxnum = 4
        self.valueToDisplay = 0.0

        self.smSettings = {
            'title': '',
            'name': '-170 to 170',
            'thumb': 'widget_niddle_170_170.png',
            'min': -175,
            'max': 175,
            'tick': 25,
            'subtick': 6,
            'start_angle': -170,
            'end_angle': 170,
            'value_font_size': 23,
            'label_font_size': 50,
        }

        self.sm = MySpeedMeter()
        self.sm.size_hint = [None, None]
        self.sm.size = self.size
        self.sm.pos = self.pos

        self.defSettings = [
            {
                'name': '-170 to 170',
                'title': '',
                'thumb': 'widget_niddle_170_170.png',
                'min': -175,
                'max': 175,
                'tick': 25,
                'subtick': 6,
                'start_angle': -170,
                'end_angle': 170,
                'value_font_size': 23,
                'label_font_size': 50,
            },
            {
                'name': '-170 to 170 small numbers',
                'title': '',
                'thumb': 'widget_niddle_170_170.png',
                'min': -3,
                'max': 3,
                'tick': 1,
                'subtick': 11,
                'start_angle': -170,
                'end_angle': 170,
                'value_font_size': 23,
                'label_font_size': 50,
            },
            {
                'name': '-90 to 90 ',
                'thumb': 'widget_niddle_90_90.png',
                'min': -175,
                'max': 175,
                'tick': 50,
                'subtick': 3,
                'start_angle': -85,
                'end_angle': 85,
                'value_font_size': 14,
                'label_font_size': 50,
            },
            {
                'name': '-90 to 90 small numbers',
                'title': '',
                'thumb': 'widget_niddle_90_90.png',
                'min': -3,
                'max': 3,
                'tick': 1,
                'subtick': 11,
                'start_angle': -85,
                'end_angle': 85,
                'value_font_size': 14,
                'label_font_size': 50,
            },
            {
                'name': '0 to 90 small numbers',
                'title': '',
                'thumb': 'widget_niddle_corner.png',
                'min': 0,
                'max': 5,
                'tick': 1,
                'subtick': 6,
                'start_angle': 90,
                'end_angle': 0,
                'value_font_size': 14,
                'label_font_size': 35,
            },
        ]

        self.wvfh = WidgetValFunctionHandler()
        self.wvfh.setParameters()

    def setValues(self, screen, title, unit, round_, maxnum):
        self.screen = str(screen)
        self.mtitle = title
        self.munit = unit
        self.mround = round_
        self.maxnum = maxnum

    def settingsDoneStore(self):
        pass

    def settingsNeedIt(self):
        return True

    def setValuesFromDic(self, dic):
        print("setValuesFromDic", dic)
        self.wvfh.setParametersFromDict(dic['valHandler'])
        self.screen = str(dic['screen'])
        for k in self.smSettings.keys():
            #print("key ",k," in dic is ",dic[k])
            try:

                try:
                    self.smSettings[k] = int(dic[k])
                except:
                    self.smSettings[k] = str(dic[k])
                #print("set self.sm")
                exec("self.sm.{0} = {1}".format(k, self.smSettings[k]))
                #print("    sm set")

            except:
                pass
                #print(" pass ???")

        #print("so niddle pos",self.pos," size",self.size)

    def getAttrFromDialog(self):
        self.updateSmSettings()
        return self.smSettings

    def addSettingsDialogPart(self, bl, inWConf=None):

        presetVals = []
        for s in self.defSettings:
            presetVals.append(s['name'])
        presetDef = presetVals[0]

        #bl = BoxLayout(orientation="vertical")
        bh = self.getDialogRow()
        bh.add_widget(MyLabel(text="Preset:"))
        self.spPreset = Spinner(text=presetDef,
                                values=presetVals,
                                height=cm(1))
        bh.add_widget(self.spPreset)
        bl.add_widget(bh)
        self.spPreset.bind(text=self.on_presetChange)

        if inWConf:
            self.spPreset.text = inWConf['atr']['name']

        bl, self.ti_title = self.addDialogRow(
            bl, "Title", "" if inWConf == None else inWConf['atr']['title'])
        bl, self.ti_min = self.addDialogRow(
            bl, "Min value",
            -175 if inWConf == None else str(inWConf['atr']['min']))
        bl, self.ti_max = self.addDialogRow(
            bl, "Max value",
            175 if inWConf == None else str(inWConf['atr']['max']))
        bl, self.ti_tick = self.addDialogRow(
            bl, "Tick", 25 if inWConf == None else str(inWConf['atr']['tick']))
        bl, self.ti_subtick = self.addDialogRow(
            bl, "Sub ticks",
            6 if inWConf == None else str(inWConf['atr']['subtick']))
        bl, self.ti_start_angle = self.addDialogRow(
            bl, "Start angle",
            -170 if inWConf == None else str(inWConf['atr']['start_angle']))
        bl, self.ti_end_angle = self.addDialogRow(
            bl, "End angle",
            170 if inWConf == None else str(inWConf['atr']['end_angle']))
        bl, self.ti_value_font_size = self.addDialogRow(
            bl, "Value size",
            23 if inWConf == None else str(inWConf['atr']['value_font_size']))
        bl, self.ti_label_font_size = self.addDialogRow(
            bl, "Labels size",
            50 if inWConf == None else str(inWConf['atr']['label_font_size']))

        return bl

    def updateSmSettings(self):
        print("updateSmSettings")
        for k in self.smSettings.keys():
            #print("value ",k)
            try:
                exec(
                    "self.smSettings['{0}'] = str(self.ti_{0}.text)".format(k))
                #print(" -> ",self.smSettings[k])
            except:
                print(" not pressent")
                pass

    def on_presetChange(self, a='', b=''):
        print("on_presetChange")
        sp = self.spPreset.text
        for s in self.defSettings:
            if s['name'] == sp:
                spO = s
                break

        for k in spO.keys():
            print("setting to gui", k)
            try:
                exec("self.ti_%s.text = str(%s)" % (k, spO[k]))
                #print("set")
            except:
                #print('skipp')
                pass
            try:
                self.smSettings[k] = spO[k]
            except:
                pass
        print("affter change smSettings is ", self.smSettings)

    def getWidget(self):
        '''print("getWidget () o ",self.mtitle,
                  "pos:",int(self.pos[0]),"x",int(self.pos[1]),
                  "size:",int(self.size[0]),"x",int(self.size[1]))
        '''
        return self.sm

    def updateIt(self, fromWho='', vals=''):
        self.update(fromWho, vals)
        self.setPos(self.pos)
        self.setScale(self.scale)
        self.setRot(self.rotation)

    def update(self, fromWho, vals):
        if (self.gui.rl.current[:7] != 'Widgets'
                or self.screen != self.gui.rl.current[7:]):
            return 0

        if 0:
            print('''update from widget_n[{}] 
                from:{}  
                gotvals:{}'''.format(self.mtitle, fromWho, vals))

        v = self.wvfh.updateVal(fromWho, vals)
        if v != None:

            vAsInt = True
            try:
                vi = int(v)
            except:
                vAsInt = False

            if vAsInt:
                self.valueToDisplay = round(
                    v, self.mround) if self.mround > 0 else int(v)
            else:
                self.valueToDisplay = v

            if self.smSettings['title'] != '':
                self.sm.label = "{}\n{}".format(self.smSettings['title'],
                                                self.valueToDisplay)
            else:
                self.sm.label = str(self.valueToDisplay)

            if self.valueToDisplay > self.smSettings['max']:
                self.valueToDisplay = self.smSettings['max']
            if self.valueToDisplay < self.smSettings['min']:
                self.valueToDisplay = self.smSettings['min']

            if self.gui.animation:
                Animation.cancel_all(self.sm, 'angle')
                anim = Animation(value=self.valueToDisplay, t='out_quad')
                anim.start(self.sm)

            else:
                self.sm.value = self.valueToDisplay

    def setGui(self, gui):
        self.gui = gui

        self.size = [200, 200]
        self.pos = [self.x, self.y]

    def getSize(self):
        return [self.size[0], self.size[1], 0.5, -1.0]
예제 #7
0
class Widget_circularProgress(WidgetHelper):
    def __init__(self, **kwargs):

        self.updateCount = 0

        self.screen = 0
        self.size = [200, 200]
        self.pos = [0, 0]
        self.scale = 1.0
        self.rotation = 0.0
        self.x = 0
        self.y = 0

        self.myValue = None
        self.stat = {'skip': 0, 'update': 0}
        self.subPix = 1.25

        self.mtitle = ""
        self.mcallback = None
        self.mvalk = ""
        self.munit = 1
        self.mround = 1
        self.maxnum = 4
        self.valueToDisplay = 0.0

        self.smSettings = {
            'title': '',
            'min': -175,
            'max': 175,
            'unit': '',
            'round': 1
        }

        self.sm = CircularProgressBar()
        self.sm.size_hint = [None, None]
        self.sm.width = self.size[0]
        self.sm.height = self.size[1]
        self.sm.size = self.size
        self.sm.max = self.smSettings['max']
        self.sm.min = self.smSettings['min']
        self.sm.set_value(0.0, '', '')

        self.wvfh = WidgetValFunctionHandler()
        #self.wvfh.setParameters()

    def setValues(self, screen, title, unit, round_, maxnum):
        self.screen = screen
        self.mtitle = title
        self.munit = unit
        self.mround = round_
        self.maxnum = maxnum

    def settingsDoneStore(self):
        pass

    def settingsNeedIt(self):
        return True

    def setValuesFromDic(self, dic):
        print("Widget_circularProgress.setValuesFromDic", dic)
        self.ImOnScreen = str(dic['screen'])
        self.smSettings['title'] = dic['title']
        self.smSettings['min'] = int(dic['min'])
        self.smSettings['max'] = int(dic['max'])
        self.smSettings['unit'] = dic['unit']
        self.smSettings['round'] = int(dic['round'])
        self.wvfh.setParametersFromDict(dic['valHandler'])

        self.sm.min = self.smSettings['min']
        self.sm.max = self.smSettings['max']

        print("so circular progress pos", self.pos, " size", self.size)
        #sys.exit(0)

    def getAttrFromDialog(self):
        self.smSettings['title'] = self.ti_title.text
        self.smSettings['min'] = self.ti_min.text
        self.smSettings['max'] = self.ti_max.text
        self.smSettings['unit'] = self.ti_unit.text
        self.smSettings['round'] = self.ti_round.text

        return self.smSettings

    def addSettingsDialogPart(self, bl, inWConf=None):

        bl, self.ti_title = self.addDialogRow(
            bl, "Title", "" if inWConf == None else inWConf['atr']['title'])
        bl, self.ti_min = self.addDialogRow(
            bl, "Min value",
            -175 if inWConf == None else str(inWConf['atr']['min']))
        bl, self.ti_max = self.addDialogRow(
            bl, "Max value",
            175 if inWConf == None else str(inWConf['atr']['max']))
        bl, self.ti_round = self.addDialogRow(
            bl, "Round to",
            "1" if inWConf == None else inWConf['atr']['round'])
        bl, self.ti_unit = self.addDialogRow(
            bl, "Unit", "%" if inWConf == None else inWConf['atr']['unit'])

        return bl

    def getWidget(self):
        '''print("getWidget () o ",self.mtitle,
                  "pos:",int(self.pos[0]),"x",int(self.pos[1]),
                  "size:",int(self.size[0]),"x",int(self.size[1]))
        '''
        return self.sm

    def updateIt(self, fromWho='', vals=''):
        self.update(fromWho, vals)
        self.setPos(self.pos)
        self.setScale(self.scale)
        self.setRot(self.rotation)

    def update(self, fromWho, vals):
        if (self.gui.rl.current[:7] != 'Widgets'
                or self.ImOnScreen != self.gui.rl.current[7:]):
            #print("skip")
            return 0

        if 0:
            print('''
            
update from widget_circularProgress[{}] 
                from:{}  
                gotvals:{}'''.format(self.mtitle, fromWho, vals))

        v = self.wvfh.updateVal(fromWho, vals)
        if v != None:
            self.valueToDisplay = round(
                v, self.smSettings['round']
            ) if self.smSettings['round'] > 0 else int(v)
            self.sm.set_value(self.valueToDisplay, self.smSettings['title'],
                              self.smSettings['unit'])

    def setGui(self, gui):
        self.gui = gui

        self.size = [200, 200]
        self.pos = [self.x, self.y]

    def getSize(self):
        return [self.size[0], self.size[1], 0.25, -1.0]
예제 #8
0
class WidgetBubble(Widget):
	
	
	def __init__(self, **kwargs):
		super(WidgetBubble, self).__init__(**kwargs)
		
		self.pos = [0.0,0.0]
		self.orgSize = [512.0, 160.0]
		self.size = [self.orgSize[0],self.orgSize[1]]
		self.scale = 1.0
		self.rotation = 0.0 
		self.iLevelBg = KImage("icons/ico_level_bg_512_512.png")
		self.iLevelBubble = KImage("icons/ico_level_bubble_256_256.png")
		self.drawIt()
		self.myValue = None
		self.stat = {
            'skip': 0,
            'update': 0
            }
		self.wvfh = WidgetValFunctionHandler()
		#self.wvfh.setParameters()

	def setValuesFromDic(self,dic):
		print("setValuesFromDic",dic)
		self.ImOnScreen = str(dic['screen'])
		self.wvfh.setParametersFromDict(dic['valHandler'])

	def settingsNeedIt(self):
		return True
	
	def getAttrFromDialog(self):
		return {}
	
	def addSettingsDialogPart(self,bl,inWConf=None):
		return bl
		
	def setLevel(self,level):
		#print("setLevel",level)
		if self.gui.animation:
			Animation.cancel_all(self.bubRot,'angle')
			anim = Animation(angle=-level,t='out_quad' )
			anim.start( self.bubRot )
			
		else:
			self.bubRot.angle = -level
		
	def getSize(self):
		return [self.orgSize[0],self.orgSize[1], 1.0, -1.0 ]
		#return self.orgSize
		
	def setGui(self, gui):
		self.gui = gui
		
	def getWidget(self):
		return self
		
	def setColor(self,t):
		if t == "w":
			Color(1,1,1,1)
		elif t == "b":
			Color(1,1,1,1)
		elif t == "cog":
			Color(0,1,0,1)
		elif t == "hdg":
			Color(1,0,0,1)
		
	def drawIt(self):
		print("drawIt")
		with self.canvas:
			self.setColor('w')
			
			PushMatrix()
			self.centPos = Translate(self.size[0]*.5, self.size[1]*.5,0)
			self.comScale = Scale(1,1,1)
			self.comRot = Rotate(0,0,0,1)
			self.r = Rotate(0,0,0,1)
			
			Translate(-self.orgSize[0]*.5,-110.0,0)
			
			
			Rectangle(
                pos = (0,0),
                texture = self.iLevelBg.texture,
                size = self.iLevelBg.texture.size,
                )
			
			PushMatrix()
			poi = 450.0
			Translate(self.orgSize[0]*.5,poi,0)
			self.bubRot = Rotate(0,0,0,-1)
			Translate(0,-poi+20,0)
			Rectangle(
                pos = (0,0),
                texture = self.iLevelBubble.texture,
                size = [self.iLevelBubble.texture.size[0]*.3,self.iLevelBubble.texture.size[1]*.3]
                )
			PopMatrix()
			
			PopMatrix()
			
			
			self.bind(pos = self.updateIt)
	
	def updateOfSize(self,a='',b=''):
		print("bubble.update of size",self.size,"\na",a,"\nb",b)
			
				
	def update(self, fromWho, vals):
		if( self.gui.rl.current[:7] != 'Widgets' or
			self.ImOnScreen != self.gui.rl.current[7:]
             ):
			return 0
		
		v = self.wvfh.updateVal(fromWho, vals)
		if v != None:
			if self.myValue == None or self.myValue != v:
				self.myValue = v
				self.setLevel( v )
				self.stat['update']+=1
			else:
				self.stat['skip']+=1
				if (self.stat['skip']%50)==0:
					print("widget stat bubble level -> ",self.stat)


	def updateIt(self, *args):
		#print("bubble.updateIt")
		try:
			aoeuobc = self.gui
		except:
			return 0
		
		if self.gui.rl.current[:7] in ["Widgets"]:
			pass
		else:
			return 0