def run(self): self.shutdown = False while not self.shutdown: state = xbmcgui.getMouseAction() rawAction = xbmcgui.getMouseRawAction() pos = xbmcgui.getMousePosition() #tempLabel.setLabel(str(state) + " " + str(rawAction)) pos_string = "x:%i y:%i" % (pos / 10000, pos % 10000) x_string = "x" if rawAction == 5: x_string = "xdotool mousemove %i %i mousedown 1&" % ( pos / 10000, pos % 10000) if rawAction == 6: x_string = "xdotool mousemove %i %i mouseup 1&" % (pos / 10000, pos % 10000) os.system(x_string) #self.mouse_pos.setLabel(pos_string) # Don't kill the CPU time.sleep(2)
def getControl(self): self.window.addControl(self.image) self.imgId = self.image.getId() self.control = self.window.getControl(self.imgId) self.control.setVisibleCondition('Window.IsActive(Pointer.xml)') self.setAnimation(xbmcgui.getMousePosition() ) #, (640,360) )#self.control.getPosition() )
def onControl(self, controlID): if controlID == self.button_click: pos = xbmcgui.getMousePosition() #x_string = "xdotool mousemove %i %i mousedown 1&" % (pos/10000, pos%10000) #x_string = "xdotool mousemove %i %i mouseup 1&" % (pos/10000, pos%10000) pos_string ="x:%i y:%i" % (pos/10000, pos%10000) x_string = "DISPLAY=:0 xdotool mousemove %i %i click 1&" % (pos/10000, pos%10000) #self.mouse_pos.setLabel(pos_string) os.system(x_string) self.setFocus(self.buttonfocus) os.system("DISPLAY=:0 xdotool mousemove 2000 2000&") if controlID == self.button_back: self.removeControl(self.button_back) #self.removeControl(self.button_navit1) self.removeControl(self.backImage) os.system("DISPLAY=:0 xdotool mousemove 200 200 click 1&") os.system("DISPLAY=:0 xdotool mousemove 2000 2000&") strWndFnc = "XBMC.ActivateWindow(%i)" % self.prevWindowId xbmc.executebuiltin(strWndFnc) self.setFocus(self.buttonfocus) # stop the temp thread #self.clickHandlerThread.shutdown = True #self.clickHandlerThread.join() self.close()
def onControl(self, controlID): if controlID == self.button_click: pos = xbmcgui.getMousePosition() #x_string = "xdotool mousemove %i %i mousedown 1&" % (pos/10000, pos%10000) #x_string = "xdotool mousemove %i %i mouseup 1&" % (pos/10000, pos%10000) pos_string = "x:%i y:%i" % (pos / 10000, pos % 10000) x_string = "DISPLAY=:0 xdotool mousemove %i %i click 1&" % ( pos / 10000, pos % 10000) #self.mouse_pos.setLabel(pos_string) os.system(x_string) self.setFocus(self.buttonfocus) os.system("DISPLAY=:0 xdotool mousemove 2000 2000&") if controlID == self.button_back: self.removeControl(self.button_back) #self.removeControl(self.button_navit1) self.removeControl(self.backImage) os.system("DISPLAY=:0 xdotool mousemove 200 200 click 1&") os.system("DISPLAY=:0 xdotool mousemove 2000 2000&") strWndFnc = "XBMC.ActivateWindow(%i)" % self.prevWindowId xbmc.executebuiltin(strWndFnc) self.setFocus(self.buttonfocus) # stop the temp thread #self.clickHandlerThread.shutdown = True #self.clickHandlerThread.join() self.close()
def setFocusColor(self): try: if self.getFocusId() == 301: x, y = xbmcgui.getMousePosition(self) self.getControl(303).setPosition(x, y) self.getControl(304).setPosition((x - self.fixe_rule_offset_304), self.fixe_rule_304) self.getControl(305).setPosition(self.fixe_rule_305, (y - self.fixe_rule_offset_305)) self.setProperty("MousePosX", str(x)) self.setProperty("MousePosY", str(y)) self.setProperty("MouseCoords", "Pipette: (%i,%i)" % self.getOffSet(x, y)) try: if self.imageGradient is not None: color = self.imageGradient.getPixel(*self.getOffSet(x, y)) else: color = self.image.getPixel(*self.getOffSet(x, y)) currentfocuscolor = argb_to_hex(color) self.setProperty("CurrentFocusColor", currentfocuscolor) except IndexError: pass if DEBUG: label = "[COLOR=%s]X: %i[CR]Y: %i[/COLOR]" % (currentfocuscolor, x, y) self.getControl(302).setLabel(label) self.getControl(302).setPosition(x, y) except: print_exc()
def onControl(self, controlID): os.system("DISPLAY=:0 xdotool key q") os.system("killall -9 mplayer") if controlID == self.button_click: pos = xbmcgui.getMousePosition() print(pos) pos_string = "x:%i y:%i" % (pos / 10000, pos % 10000) print(pos_string) x_string = "DISPLAY=:0 xdotool mousemove %i %i click 1&" % ( pos / 10000, pos % 10000) print(x_string) os.system(x_string) self.setFocus(self.buttonfocus) os.system("DISPLAY=:0 xdotool mousemove 2000 2000&") print("clicked") if controlID == self.button_back: self.removeControl(self.button_back) self.removeControl(self.backImage) os.system("DISPLAY=:0 xdotool mousemove 200 200 click 1&") os.system("DISPLAY=:0 xdotool mousemove 2000 2000&") strWndFnc = "XBMC.ActivateWindow(%i)" % self.prevWindowId print(strWndFnc) xbmc.executebuiltin(strWndFnc) print("done") self.setFocus(self.buttonfocus) print("set focus") # stop the temp thread #self.clickHandlerThread.shutdown = True #self.clickHandlerThread.join() self.close() print("closed")
def setFocusColor( self ): try: if self.getFocusId() == 301: x, y = xbmcgui.getMousePosition( self ) self.getControl( 303 ).setPosition( x, y ) self.getControl( 304 ).setPosition( ( x - self.fixe_rule_offset_304 ), self.fixe_rule_304 ) self.getControl( 305 ).setPosition( self.fixe_rule_305, ( y - self.fixe_rule_offset_305 ) ) self.setProperty( "MousePosX", str( x ) ) self.setProperty( "MousePosY", str( y ) ) self.setProperty( "MouseCoords", "Pipette: (%i,%i)" % self.getOffSet( x, y ) ) try: if self.imageGradient is not None: color = self.imageGradient.getPixel( *self.getOffSet( x, y ) ) else: color = self.image.getPixel( *self.getOffSet( x, y ) ) currentfocuscolor = argb_to_hex( color ) self.setProperty( "CurrentFocusColor", currentfocuscolor ) except IndexError: pass if DEBUG: label = "[COLOR=%s]X: %i[CR]Y: %i[/COLOR]" % ( currentfocuscolor, x, y ) self.getControl( 302 ).setLabel( label ) self.getControl( 302 ).setPosition( x, y ) except: print_exc()
def run(self): try: play_sfx = False # NB: xbmc.abortRequested not work correctly with threading.Thread while not xbmc.abortRequested: try: self.getWindow() if self.sprite != self.addon.getSetting("sprite"): self.getMedias() if not xbmc.getCondVisibility( 'Window.IsActive(Pointer.xml)'): time.sleep(.3) continue pos = xbmcgui.getMousePosition() if ((pos[0] - self.offsetx) == self.current_pos[0]) and ( pos[1] == self.current_pos[1]): self.control.setImage(self.sprites["wait"]) if play_sfx: if self.sprites["sfx"] and self.addon.getSetting( "playsfx") == "true": xbmc.playSFX(self.sprites["sfx"]) play_sfx = False else: play_sfx = True if pos[0] < self.current_pos[0]: self.control.setImage(self.sprites["left"]) else: self.control.setImage(self.sprites["right"]) #start = "%i,%i" % self.current_pos #end = "%i,%i" % ( pos[ 0 ]-self.offsetx, pos[ 1 ] ) ##self.speed = str( self.current_pos[ 0 ] - pos[ 0 ] ).strip( "-" ) #self.control.setAnimations( [ ( 'conditional', 'condition=true effect=slide start=%s end=%s time=%s' % ( start, end, self.speed ) ) ] ) self.setAnimation(pos) self.current_pos = (pos[0] - self.offsetx, pos[1]) #self.control.setPosition( *self.current_pos ) if xbmc.getCondVisibility( "Window.IsActive(addonsettings)"): self.reload_addon = True elif self.reload_addon: self.addon = Addon("script.mouse.tracker.service") self.speed = self.addon.getSetting("speed").split( ".")[0] self.reload_addon = False except SystemExit: break except: print_exc() time.sleep(float(int(self.speed)) * 0.001) except SystemExit: pass except: print_exc()
def onClick(self, controlID): try: if controlID == 1301: x, y = xbmcgui.getMousePosition(self) self.colorPicked = self.image.getPixel(*self.getOffSet(x, y)) except: self.colorPicked = None print_exc() self._close_dialog()
def onClick( self, controlID ): try: if controlID == 1301: x, y = xbmcgui.getMousePosition( self ) self.colorPicked = self.image.getPixel( *self.getOffSet( x, y ) ) except: self.colorPicked = None print_exc() self._close_dialog()
def run(self): try: play_sfx = False # NB: xbmc.abortRequested not work correctly with threading.Thread while not xbmc.abortRequested: try: self.getWindow() if self.sprite != self.addon.getSetting("sprite"): self.getMedias() if not xbmc.getCondVisibility("Window.IsActive(Pointer.xml)"): time.sleep(0.3) continue pos = xbmcgui.getMousePosition() if ((pos[0] - self.offsetx) == self.current_pos[0]) and (pos[1] == self.current_pos[1]): self.control.setImage(self.sprites["wait"]) if play_sfx: if self.sprites["sfx"] and self.addon.getSetting("playsfx") == "true": xbmc.playSFX(self.sprites["sfx"]) play_sfx = False else: play_sfx = True if pos[0] < self.current_pos[0]: self.control.setImage(self.sprites["left"]) else: self.control.setImage(self.sprites["right"]) # start = "%i,%i" % self.current_pos # end = "%i,%i" % ( pos[ 0 ]-self.offsetx, pos[ 1 ] ) ##self.speed = str( self.current_pos[ 0 ] - pos[ 0 ] ).strip( "-" ) # self.control.setAnimations( [ ( 'conditional', 'condition=true effect=slide start=%s end=%s time=%s' % ( start, end, self.speed ) ) ] ) self.setAnimation(pos) self.current_pos = (pos[0] - self.offsetx, pos[1]) # self.control.setPosition( *self.current_pos ) if xbmc.getCondVisibility("Window.IsActive(addonsettings)"): self.reload_addon = True elif self.reload_addon: self.addon = Addon("script.mouse.tracker.service") self.speed = self.addon.getSetting("speed").split(".")[0] self.reload_addon = False except SystemExit: break except: print_exc() time.sleep(float(int(self.speed)) * 0.001) except SystemExit: pass except: print_exc()
def setFocusColor(self): try: x, y = xbmcgui.getMousePosition(self) if self.image: color = self.image.getPixel(*self.getOffSet(x, y)) currentfocuscolor = argb_to_hex(color) self.setProperty("CurrentFocusColor", currentfocuscolor) self.setProperty("MousePosX", str(x)) self.setProperty("MousePosY", str(y)) self.setProperty("MouseCoords", "Pipette: (%i,%i)" % (x, y)) self.getControl(1303).setPosition(x, y) except: print_exc()
def setFocusColor( self ): try: x, y = xbmcgui.getMousePosition( self ) if self.image: color = self.image.getPixel( *self.getOffSet( x, y ) ) currentfocuscolor = argb_to_hex( color ) self.setProperty( "CurrentFocusColor", currentfocuscolor ) self.setProperty( "MousePosX", str( x ) ) self.setProperty( "MousePosY", str( y ) ) self.setProperty( "MouseCoords", "Pipette: (%i,%i)" % ( x, y ) ) self.getControl( 1303 ).setPosition( x, y ) except: print_exc()
def run(self): self.shutdown = False while not self.shutdown: state = xbmcgui.getMouseAction() rawAction = xbmcgui.getMouseRawAction() pos = xbmcgui.getMousePosition() #tempLabel.setLabel(str(state) + " " + str(rawAction)) pos_string ="x:%i y:%i" % (pos/10000, pos%10000) x_string = "x" if rawAction == 5: x_string = "xdotool mousemove %i %i mousedown 1&" % (pos/10000, pos%10000) if rawAction == 6: x_string = "xdotool mousemove %i %i mouseup 1&" % (pos/10000, pos%10000) os.system(x_string) #self.mouse_pos.setLabel(pos_string) # Don't kill the CPU time.sleep(2)
def getControl(self): self.window.addControl(self.image) self.imgId = self.image.getId() self.control = self.window.getControl(self.imgId) self.control.setVisibleCondition("Window.IsActive(Pointer.xml)") self.setAnimation(xbmcgui.getMousePosition()) # , (640,360) )#self.control.getPosition() )
def onClick(self, controlID): colorPicked = None set_input_text = True set_slider_percent = True try: if controlID != 301: self.resetGradient() if controlID == 301: # get pixel clicked x, y = xbmcgui.getMousePosition(self) if self.imageGradient is not None: colorPicked = self.imageGradient.getPixel(*self.getOffSet(x, y)) else: colorPicked = self.image.getPixel(*self.getOffSet(x, y)) elif controlID == 141: # get value of input text value = self.getControl(141).getText() self.setProperty("CurrentPickerColor", "") if value: argb = None # first check for name ( blue, red, pink ... ) try: argb = name_to_argb(value) except: # ValueError for check name last chance check hex try: argb = hex_to_argb(value) except: pass if argb is not None: color = argb_to_hex(argb) if color: colorPicked = argb set_input_text = False elif controlID in [24, 25]: # change image to pick color default = (self.filename, "")[controlID - 24] if default and (PALETTES_PATH not in default): default = os.path.join(PALETTES_PATH, "color-wheel.png") # PALETTES_PATH + os.sep new_img = get_browse_dialog(default, xbmc.getInfoLabel("System.CurrentControl")) if new_img and new_img != self.filename: self.filename = new_img self.loadImage(self.filename) self.image.resize((self.getControl(300).getWidth(), self.getControl(300).getHeight())) self.setProperty("ImageColor", self.filename) ADDON.setSetting("palette", self.filename) elif controlID == 20: # add current color to user fav color # hmmm! xbmc.getInfoLabel broken on xbmc Built on Oct 3 2011 Git:20111003-fc543cb color = xbmc.getInfoLabel("Container(50).Property(CurrentPickerColor)") color = color or xbmc.getInfoLabel("Control.GetLabel(142)") color = color or self.getControl(142).getLabel() savedcolors = ADDON.getSetting("savedcolors").split("|") if color and color not in savedcolors: ADDON.setSetting("savedcolors", "|".join([color] + savedcolors)) self.addSavedColors(True) elif controlID == 9001: # get color in saved colors colorPicked = eval(self.getControl(controlID).getSelectedItem().getLabel2()) elif controlID == 21: # get color on fullscreen colorPicked = pickColorOnScreen() elif controlID == 22: # user accept color # color = self.getProperty( "CurrentPickerColor" ) # return empty !! # hmmm! xbmc.getInfoLabel broken on xbmc Built on Oct 3 2011 Git:20111003-fc543cb color = xbmc.getInfoLabel("Container(50).Property(CurrentPickerColor)") color = color or xbmc.getInfoLabel("Control.GetLabel(142)") color = color or self.getControl(142).getLabel() if color: self.color_picked = color ADDON.setSetting("previouscolor", color) self._close_dialog() elif controlID == 142: # ajust CurrentPickerColor with gradient # hmmm! xbmc.getInfoLabel broken on xbmc Built on Oct 3 2011 Git:20111003-fc543cb hexcolor = xbmc.getInfoLabel("Container(50).Property(CurrentPickerColor)") hexcolor = hexcolor or xbmc.getInfoLabel("Control.GetLabel(142)") hexcolor = hexcolor or self.getControl(142).getLabel() img = createGradient(hex_to_argb(hexcolor), GRADIENT, PIXELS_PATH) # test self.imageGradient = IMAGE(img) self.imageGradient.resize((self.getControl(300).getWidth(), self.getControl(300).getHeight())) self.setProperty("ImageColor", img) elif controlID == 143: # get previous color # hmmm! xbmc.getInfoLabel broken on xbmc Built on Oct 3 2011 Git:20111003-fc543cb hexcolor = xbmc.getInfoLabel("Container(50).Property(PreviousPickerColor)") hexcolor = hexcolor or xbmc.getInfoLabel("Control.GetLabel(143)") hexcolor = hexcolor or self.getControl(143).getLabel() colorPicked = hex_to_argb(hexcolor) elif controlID in [101, 111, 121, 131]: # ajust color with moved slider # NOTE: ON MULTIPLE CLICK/SCROLLING XBMC FREEZE !!!! AH ok is getInfoLabel :) p1 = self.slider_percent[0].strip( "%" ) # xbmc.getInfoLabel( "Container(50).Property(alpha_percent)" ).strip( "%" ) or "0" p2 = self.slider_percent[1].strip( "%" ) # xbmc.getInfoLabel( "Container(50).Property(red_percent)" ).strip( "%" ) or "0" p3 = self.slider_percent[2].strip( "%" ) # xbmc.getInfoLabel( "Container(50).Property(green_percent)" ).strip( "%" ) or "0" p4 = self.slider_percent[3].strip( "%" ) # xbmc.getInfoLabel( "Container(50).Property(blue_percent)" ).strip( "%" ) or "0" percent = self.getControl(controlID).getPercent() # percent = int( xbmc.getInfoLabel( "Control.GetLabel(%i)" % controlID ).strip( "%" ) ) if controlID == 131: if 0 < percent < 100: percent += float("." + str(float(p1)).split(".")[-1]) p1 = percent elif controlID == 101: if 0 < percent < 100: percent += float("." + str(float(p2)).split(".")[-1]) p2 = percent elif controlID == 111: if 0 < percent < 100: percent += float("." + str(float(p3)).split(".")[-1]) p3 = percent elif controlID == 121: if 0 < percent < 100: percent += float("." + str(float(p4)).split(".")[-1]) p4 = percent colorPicked = argb_percent_to_argb((float(p1), float(p2), float(p3), float(p4))) set_slider_percent = False elif controlID == 3001: # set color from pickcoloronscreen is startup window colorPicked = self.color_picked self.color_picked = None if colorPicked is not None: # now if colorPicked setup vars alpha, red, green, blue = colorPicked currentpickercolor = argb_to_hex((alpha, red, green, blue)) # print 'Color: %s' % argb_to_hex( color ) if self.executeBuiltIn: # print self.builtin % currentpickercolor xbmc.executebuiltin(self.builtin % currentpickercolor) self.setProperty("CurrentPickerColor", currentpickercolor) if set_input_text: self.getControl(141).setText(currentpickercolor) self.slider_percent = argb_to_argb_percent((alpha, red, green, blue)) p1, p2, p3, p4 = self.slider_percent # set real info labels self.setProperty("alpha_percent", p1) self.setProperty("red_percent", p2) self.setProperty("green_percent", p3) self.setProperty("blue_percent", p4) if set_slider_percent: self.getControl(131).setPercent(float(p1.strip("%"))) self.getControl(101).setPercent(float(p2.strip("%"))) self.getControl(111).setPercent(float(p3.strip("%"))) self.getControl(121).setPercent(float(p4.strip("%"))) self.resetGradient() except: print_exc()
def onClick( self, controlID ): colorPicked = None set_input_text = True set_slider_percent = True try: if controlID != 301: self.resetGradient() if controlID == 301: # get pixel clicked x, y = xbmcgui.getMousePosition( self ) if self.imageGradient is not None: colorPicked = self.imageGradient.getPixel( *self.getOffSet( x, y ) ) else: colorPicked = self.image.getPixel( *self.getOffSet( x, y ) ) elif controlID == 141: # get value of input text value = self.getControl( 141 ).getText() self.setProperty( "CurrentPickerColor", "" ) if value: argb = None # first check for name ( blue, red, pink ... ) try: argb = name_to_argb( value ) except: # ValueError for check name last chance check hex try: argb = hex_to_argb( value ) except: pass if argb is not None: color = argb_to_hex( argb ) if color: colorPicked = argb set_input_text = False elif controlID in [ 24, 25 ]: # change image to pick color default = ( self.filename, "" )[ controlID - 24 ] if default and ( PALETTES_PATH not in default ): default = os.path.join( PALETTES_PATH, "color-wheel.png" )#PALETTES_PATH + os.sep new_img = get_browse_dialog( default, xbmc.getInfoLabel( "System.CurrentControl" ) ) if new_img and new_img != self.filename: self.filename = new_img self.loadImage( self.filename ) self.image.resize( ( self.getControl( 300 ).getWidth(), self.getControl( 300 ).getHeight() ) ) self.setProperty( "ImageColor", self.filename ) ADDON.setSetting( "palette", self.filename ) elif controlID == 20: # add current color to user fav color # hmmm! xbmc.getInfoLabel broken on xbmc Built on Oct 3 2011 Git:20111003-fc543cb color = xbmc.getInfoLabel( "Container(50).Property(CurrentPickerColor)" ) color = color or xbmc.getInfoLabel( "Control.GetLabel(142)" ) color = color or self.getControl( 142 ).getLabel() savedcolors = ADDON.getSetting( "savedcolors" ).split( "|" ) if color and color not in savedcolors: ADDON.setSetting( "savedcolors", "|".join( [ color ] + savedcolors ) ) self.addSavedColors( True ) elif controlID == 9001: #get color in saved colors colorPicked = eval( self.getControl( controlID ).getSelectedItem().getLabel2() ) elif controlID == 21: #get color on fullscreen colorPicked = pickColorOnScreen() elif controlID == 22: # user accept color #color = self.getProperty( "CurrentPickerColor" ) # return empty !! # hmmm! xbmc.getInfoLabel broken on xbmc Built on Oct 3 2011 Git:20111003-fc543cb color = xbmc.getInfoLabel( "Container(50).Property(CurrentPickerColor)" ) color = color or xbmc.getInfoLabel( "Control.GetLabel(142)" ) color = color or self.getControl( 142 ).getLabel() if color: self.color_picked = color ADDON.setSetting( "previouscolor", color ) self._close_dialog() elif controlID == 142: # ajust CurrentPickerColor with gradient # hmmm! xbmc.getInfoLabel broken on xbmc Built on Oct 3 2011 Git:20111003-fc543cb hexcolor = xbmc.getInfoLabel( "Container(50).Property(CurrentPickerColor)" ) hexcolor = hexcolor or xbmc.getInfoLabel( "Control.GetLabel(142)" ) hexcolor = hexcolor or self.getControl( 142 ).getLabel() img = createGradient( hex_to_argb( hexcolor ), GRADIENT, PIXELS_PATH ) # test self.imageGradient = IMAGE( img ) self.imageGradient.resize( ( self.getControl( 300 ).getWidth(), self.getControl( 300 ).getHeight() ) ) self.setProperty( "ImageColor", img ) elif controlID == 143: # get previous color # hmmm! xbmc.getInfoLabel broken on xbmc Built on Oct 3 2011 Git:20111003-fc543cb hexcolor = xbmc.getInfoLabel( "Container(50).Property(PreviousPickerColor)" ) hexcolor = hexcolor or xbmc.getInfoLabel( "Control.GetLabel(143)" ) hexcolor = hexcolor or self.getControl( 143 ).getLabel() colorPicked = hex_to_argb( hexcolor ) elif controlID in [ 101, 111, 121, 131 ]: # ajust color with moved slider # NOTE: ON MULTIPLE CLICK/SCROLLING XBMC FREEZE !!!! AH ok is getInfoLabel :) p1 = self.slider_percent[ 0 ].strip( "%" ) #xbmc.getInfoLabel( "Container(50).Property(alpha_percent)" ).strip( "%" ) or "0" p2 = self.slider_percent[ 1 ].strip( "%" ) #xbmc.getInfoLabel( "Container(50).Property(red_percent)" ).strip( "%" ) or "0" p3 = self.slider_percent[ 2 ].strip( "%" ) #xbmc.getInfoLabel( "Container(50).Property(green_percent)" ).strip( "%" ) or "0" p4 = self.slider_percent[ 3 ].strip( "%" ) #xbmc.getInfoLabel( "Container(50).Property(blue_percent)" ).strip( "%" ) or "0" percent = self.getControl( controlID ).getPercent() #percent = int( xbmc.getInfoLabel( "Control.GetLabel(%i)" % controlID ).strip( "%" ) ) if controlID == 131: if 0 < percent < 100: percent += float( "." + str( float( p1 ) ).split( "." )[ -1 ] ) p1 = percent elif controlID == 101: if 0 < percent < 100: percent += float( "." + str( float( p2 ) ).split( "." )[ -1 ] ) p2 = percent elif controlID == 111: if 0 < percent < 100: percent += float( "." + str( float( p3 ) ).split( "." )[ -1 ] ) p3 = percent elif controlID == 121: if 0 < percent < 100: percent += float( "." + str( float( p4 ) ).split( "." )[ -1 ] ) p4 = percent colorPicked = argb_percent_to_argb( ( float( p1 ), float( p2 ), float( p3 ), float( p4 ) ) ) set_slider_percent = False elif controlID == 3001: # set color from pickcoloronscreen is startup window colorPicked = self.color_picked self.color_picked = None if colorPicked is not None: # now if colorPicked setup vars alpha, red, green, blue = colorPicked currentpickercolor = argb_to_hex( ( alpha, red, green, blue ) ) #print 'Color: %s' % argb_to_hex( color ) if self.executeBuiltIn: #print self.builtin % currentpickercolor xbmc.executebuiltin( self.builtin % currentpickercolor ) self.setProperty( "CurrentPickerColor", currentpickercolor ) if set_input_text: self.getControl( 141 ).setText( currentpickercolor ) self.slider_percent = argb_to_argb_percent( ( alpha, red, green, blue ) ) p1, p2, p3, p4 = self.slider_percent # set real info labels self.setProperty( "alpha_percent", p1 ) self.setProperty( "red_percent", p2 ) self.setProperty( "green_percent", p3 ) self.setProperty( "blue_percent", p4 ) if set_slider_percent: self.getControl( 131 ).setPercent( float( p1.strip( "%" ) ) ) self.getControl( 101 ).setPercent( float( p2.strip( "%" ) ) ) self.getControl( 111 ).setPercent( float( p3.strip( "%" ) ) ) self.getControl( 121 ).setPercent( float( p4.strip( "%" ) ) ) self.resetGradient() except: print_exc()