def __init__(self, w=OVERLAY_WIDTH, h=OVERLAY_HEIGHT, *args, **kwargs): self.window = xbmcgui.Window(WINDOW_FULLSCREEN_VIDEO) viewport_w, viewport_h = self._get_skin_resolution() # Adjust size based on viewport, we are using 1080p coordinates w = int(w * viewport_w / VIEWPORT_WIDTH) h = int(h * viewport_h / VIEWPORT_HEIGHT) x = (viewport_w - w) / 2 y = (viewport_h - h) / 2 + int( ADDON.getSetting(id="overlay_status_offset")) self._shown = False self._text = "" self._label = xbmcgui.ControlLabel(x, y, w, h, self._text, alignment=XBFONT_CENTER_X | XBFONT_CENTER_Y, *args, **kwargs) self._shadow = xbmcgui.ControlLabel(x + 1, y + 1, w, h, self._text, textColor='0xD0000000', alignment=XBFONT_CENTER_X | XBFONT_CENTER_Y, *args, **kwargs) self._background = xbmcgui.ControlImage( x, y, w, h, os.path.join(ADDON_PATH, "resources", "img", "black.png").encode('utf-8')) self._background.setColorDiffuse("0xD0000000")
def showDialog(lines, timeout=0): win = xbmcgui.WindowDialog() background_img = os.path.join(Const.addon_path, 'resources', 'media', 'info_background.png') starty = 0 h = 75 + 25 * len(lines) win.addControl( xbmcgui.ControlImage(x=0, y=starty, width=1920, height=h, filename=background_img, colorDiffuse='0xEEEEEEEE')) y = starty for line in lines: y += 25 win.addControl( xbmcgui.ControlLabel(x=50, y=y, width=1820, height=25, label=line)) if timeout > 0: win.show() xbmc.sleep(5000) win.close() else: win.doModal() del win
def _setFrame(self, title): """ Set the image for for the fullscreen background. """ # Image for the fullscreen background. self.main_bg_img = skin.main_bg_img # Fullscreen background image control. self.main_bg = xbmcgui.ControlImage(1, 1, 1280, 720, self.main_bg_img) self.addControl(self.main_bg) super(AddonFullWindow, self)._setFrame(title)
def _setFrame(self, title): """ Set window frame Define paths to images for window background and title background textures, and set control position adjustment constants used in setGrid. This is a helper method not to be called directly. """ # Window background image self.background_img = skin.background_img # Background for a window header self.title_background_img = skin.title_background_img self.background = xbmcgui.ControlImage(-10, -10, 1, 1, self.background_img) self.addControl(self.background) self.setAnimation(self.background) self.title_background = xbmcgui.ControlImage(-10, -10, 1, 1, self.title_background_img) self.addControl(self.title_background) self.setAnimation(self.title_background) self.title_bar = xbmcgui.ControlLabel(-10, -10, 1, 1, title, alignment=skin.header_align, textColor=skin.header_text_color, font='font13_title') self.addControl(self.title_bar) self.setAnimation(self.title_bar) self.window_close_button = xbmcgui.ControlButton( -100, -100, skin.close_btn_width, skin.close_btn_height, '', focusTexture=skin.close_button_focus, noFocusTexture=skin.close_button_no_focus) self.addControl(self.window_close_button) self.setAnimation(self.window_close_button)
def _add_editcontrol(self, x, y, height, width, password=0): media = os.path.join( xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media') control = xbmcgui.ControlImage(0, 0, 0, 0, filename=os.path.join( media, "white.png"), aspectRatio=0, colorDiffuse="ff111111") control.setPosition(x, y) control.setHeight(height) control.setWidth(width) self.addControl(control) return control
def onInit(self): self.image = xbmcgui.ControlImage(100, 250, 125, 75, aspectRatio=2)
def __init__(self, *args, **kwargs): bg_image = os.path.join(__addon__.getAddonInfo('path'), 'Images/') + "background.png" check_image = os.path.join(__addon__.getAddonInfo('path'), 'Images/') + "trans_checked.png" uncheck_image = os.path.join(__addon__.getAddonInfo('path'), 'Images/') + "trans_unchecked1.png" self.ctrlBackgound = xbmcgui.ControlImage(0, 0, 1280, 720, bg_image) self.cancelled = False self.addControl(self.ctrlBackgound) self.msg = kwargs.get( 'msg' ) + '\nNormally there are 3-4 selections and 2 rounds of pictures' self.round = kwargs.get('round') self.strActionInfo = xbmcgui.ControlLabel(335, 120, 700, 300, self.msg, 'font13', '0xFFFF00FF') self.addControl(self.strActionInfo) self.strActionInfo = xbmcgui.ControlLabel( 335, 20, 724, 400, 'Captcha round %s' % (str(self.round)), 'font40', '0xFFFF00FF') self.addControl(self.strActionInfo) self.cptloc = kwargs.get('captcha') # self.img = xbmcgui.ControlImage(335,200,624,400,self.cptloc) imgw = 400 imgh = 300 imgX = 335 imgY = 200 pw = imgw / 3 ph = imgh / 3 self.img = xbmcgui.ControlImage(imgX, imgY, imgw, imgh, self.cptloc) self.addControl(self.img) self.chk = [0] * 9 self.chkbutton = [0] * 9 self.chkstate = [False] * 9 self.chk[0] = xbmcgui.ControlImage(imgX, imgY, pw, ph, check_image) self.chk[1] = xbmcgui.ControlImage(imgX + pw, imgY, pw, ph, check_image) self.chk[2] = xbmcgui.ControlImage(imgX + pw + pw, imgY, pw, ph, check_image) self.chk[3] = xbmcgui.ControlImage(imgX, imgY + ph, pw, ph, check_image) self.chk[4] = xbmcgui.ControlImage(imgX + pw, imgY + ph, pw, ph, check_image) self.chk[5] = xbmcgui.ControlImage(imgX + pw + pw, imgY + ph, pw, ph, check_image) self.chk[6] = xbmcgui.ControlImage(imgX, imgY + ph + ph, pw, ph, check_image) self.chk[7] = xbmcgui.ControlImage(imgX + pw, imgY + ph + ph, pw, ph, check_image) self.chk[8] = xbmcgui.ControlImage(imgX + pw + pw, imgY + ph + ph, pw, ph, check_image) self.chkbutton[0] = xbmcgui.ControlButton(imgX, imgY, pw, ph, '1', font='font1') self.chkbutton[1] = xbmcgui.ControlButton(imgX + pw, imgY, pw, ph, '2', font='font1') self.chkbutton[2] = xbmcgui.ControlButton(imgX + pw + pw, imgY, pw, ph, '3', font='font1') self.chkbutton[3] = xbmcgui.ControlButton(imgX, imgY + ph, pw, ph, '4', font='font1') self.chkbutton[4] = xbmcgui.ControlButton(imgX + pw, imgY + ph, pw, ph, '5', font='font1') self.chkbutton[5] = xbmcgui.ControlButton(imgX + pw + pw, imgY + ph, pw, ph, '6', font='font1') self.chkbutton[6] = xbmcgui.ControlButton(imgX, imgY + ph + ph, pw, ph, '7', font='font1') self.chkbutton[7] = xbmcgui.ControlButton(imgX + pw, imgY + ph + ph, pw, ph, '8', font='font1') self.chkbutton[8] = xbmcgui.ControlButton(imgX + pw + pw, imgY + ph + ph, pw, ph, '9', font='font1') for obj in self.chk: self.addControl(obj) obj.setVisible(False) for obj in self.chkbutton: self.addControl(obj) self.cancelbutton = xbmcgui.ControlButton(imgX + (imgw / 2) - 110, imgY + imgh + 10, 100, 40, 'Cancel', alignment=2) self.okbutton = xbmcgui.ControlButton(imgX + (imgw / 2) + 10, imgY + imgh + 10, 100, 40, 'OK', alignment=2) self.addControl(self.okbutton) self.addControl(self.cancelbutton) self.chkbutton[6].controlDown(self.cancelbutton) self.chkbutton[6].controlUp(self.chkbutton[3]) self.chkbutton[7].controlDown(self.cancelbutton) self.chkbutton[7].controlUp(self.chkbutton[4]) self.chkbutton[8].controlDown(self.okbutton) self.chkbutton[8].controlUp(self.chkbutton[5]) self.chkbutton[6].controlLeft(self.chkbutton[8]) self.chkbutton[6].controlRight(self.chkbutton[7]) self.chkbutton[7].controlLeft(self.chkbutton[6]) self.chkbutton[7].controlRight(self.chkbutton[8]) self.chkbutton[8].controlLeft(self.chkbutton[7]) self.chkbutton[8].controlRight(self.chkbutton[6]) self.chkbutton[3].controlDown(self.chkbutton[6]) self.chkbutton[3].controlUp(self.chkbutton[0]) self.chkbutton[4].controlDown(self.chkbutton[7]) self.chkbutton[4].controlUp(self.chkbutton[1]) self.chkbutton[5].controlDown(self.chkbutton[8]) self.chkbutton[5].controlUp(self.chkbutton[2]) self.chkbutton[3].controlLeft(self.chkbutton[5]) self.chkbutton[3].controlRight(self.chkbutton[4]) self.chkbutton[4].controlLeft(self.chkbutton[3]) self.chkbutton[4].controlRight(self.chkbutton[5]) self.chkbutton[5].controlLeft(self.chkbutton[4]) self.chkbutton[5].controlRight(self.chkbutton[3]) self.chkbutton[0].controlDown(self.chkbutton[3]) self.chkbutton[0].controlUp(self.cancelbutton) self.chkbutton[1].controlDown(self.chkbutton[4]) self.chkbutton[1].controlUp(self.cancelbutton) self.chkbutton[2].controlDown(self.chkbutton[5]) self.chkbutton[2].controlUp(self.okbutton) self.chkbutton[0].controlLeft(self.chkbutton[2]) self.chkbutton[0].controlRight(self.chkbutton[1]) self.chkbutton[1].controlLeft(self.chkbutton[0]) self.chkbutton[1].controlRight(self.chkbutton[2]) self.chkbutton[2].controlLeft(self.chkbutton[1]) self.chkbutton[2].controlRight(self.chkbutton[0]) self.cancelled = False self.setFocus(self.okbutton) self.okbutton.controlLeft(self.cancelbutton) self.okbutton.controlRight(self.cancelbutton) self.cancelbutton.controlLeft(self.okbutton) self.cancelbutton.controlRight(self.okbutton) self.okbutton.controlDown(self.chkbutton[2]) self.okbutton.controlUp(self.chkbutton[8]) self.cancelbutton.controlDown(self.chkbutton[0]) self.cancelbutton.controlUp(self.chkbutton[6])