Python xbmcgui.ControlButton() Examples

The following are 26 code examples of xbmcgui.ControlButton(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmcgui , or try the search function .
Example #1
Source File: get_auth.py    From xbmc-addons-chinese with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, cookie, tokens, vcodetype, codeString, vcode_path):
        self.cookie = cookie
        self.tokens = tokens
        self.vcodetype = vcodetype
        self.codeString = codeString
        self.vcode_path = vcode_path

        # windowItems
        self.image = xbmcgui.ControlImage(80, 100, 500, 200, self.vcode_path)
        self.buttonInput = xbmcgui.ControlButton(
            100, 330, 220, 50, label=u'输入验证码', alignment=6, font='font13', textColor='0xFFFFFFFF'
        )
        self.buttonRefresh = xbmcgui.ControlButton(
            290, 330, 220, 50, label=u'刷新验证码', alignment=6, font='font13', textColor='0xFFFFFFFF'
        )
        self.addControls([self.image, self.buttonInput, self.buttonRefresh])
        self.buttonInput.controlRight(self.buttonRefresh)
        self.buttonRefresh.controlLeft(self.buttonInput)
        self.setFocus(self.buttonInput) 
Example #2
Source File: get_auth.py    From plugin.video.bdyun with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, cookie, tokens, vcodetype, codeString, vcode_path):
        self.cookie = cookie
        self.tokens = tokens
        self.vcodetype = vcodetype
        self.codeString = codeString
        self.vcode_path = vcode_path

        # windowItems
        self.image = xbmcgui.ControlImage(80, 100, 500, 200, self.vcode_path)
        self.buttonInput = xbmcgui.ControlButton(
            100, 330, 220, 50, label=u'输入验证码', alignment=6, font='font13', textColor='0xFFFFFFFF'
        )
        self.buttonRefresh = xbmcgui.ControlButton(
            290, 330, 220, 50, label=u'刷新验证码', alignment=6, font='font13', textColor='0xFFFFFFFF'
        )
        self.addControls([self.image, self.buttonInput, self.buttonRefresh])
        self.buttonInput.controlRight(self.buttonRefresh)
        self.buttonRefresh.controlLeft(self.buttonInput)
        self.setFocus(self.buttonInput) 
Example #3
Source File: keyboard_ru.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def onInit(self):
		#xbmc.executebuiltin('ReplaceWindow(progressdialog)')
		#xbmc.executebuiltin('Dialog.Close(progressdialog)')
		#ctr=self.getControl(10101)
		#ctr.close()
		print 'lalalalal'
		st_x=250
		st_y=250
		y=1
		while (y<5):
			n=1
			while (n<15):
				self.label = xbmcgui.ControlButton(st_x+n*50, st_y+y*50, 50, 50, self.lns[y-1][n-1])
				if n==1: 
					self.label.setWidth(100)
					self.label.setPosition(st_x, st_y+y*50)
				if n==14: 
					self.label.setWidth(100)
					self.label.setPosition(st_x+n*50, st_y+y*50)
				self.label.setVisible(False)
				self.addControl(self.label)
				#print self.label.getId()
				n=n+1
			y=y+1
			
		id=3001
		y=1
		while (y<5):
			n=1
			while (n<15):
				self.label = self.getControl(3001+(n-1)+(y-1)*14)
				if n>1: self.label.controlLeft(self.getControl(3001+(n-1)+(y-1)*14-1))
				if y>1: self.label.controlUp(self.getControl(3001+(n-1)+(y-2)*14))
				if n<14: self.label.controlRight(self.getControl(3001+(n-1)+(y-1)*14+1))
				if y<4: self.label.controlDown(self.getControl(3001+(n-1)+(y)*14))
				#print self.label.getId()
				n=n+1
				self.label.setVisible(True)
			y=y+1
		pass
		# Put your List Populating code/ and GUI startup stuff here 
Example #4
Source File: camerasettings.py    From plugin.video.surveillanceroom with GNU General Public License v3.0 5 votes vote down vote up
def _place_window(self, width, height, title):
        """ Main window drawing """

        X_MARGIN = 5    # Horisontal adjustment for a header background if the main background has transparent edges. 
        Y_MARGIN = 5    # Vertical adjustment for a header background if the main background has transparent edges  
        Y_SHIFT = 4     # Header position adjustment if the main backround has visible borders.
        HEADER_HEIGHT = 35  # The height of a window header (for the title background and the title label).


        background_img = os.path.join(_images, 'AddonWindow', 'ContentPanel.png')
        background = xbmcgui.ControlImage(self.x, self.y, width, height, background_img)
        
        title_background_img = os.path.join(_images, 'AddonWindow', 'dialogheader.png')
        title_background = xbmcgui.ControlImage(self.x + X_MARGIN, self.y + Y_MARGIN, width - 2 * X_MARGIN, HEADER_HEIGHT, title_background_img)
        
        title_bar = xbmcgui.ControlLabel(self.x + X_MARGIN, self.y + Y_MARGIN + Y_SHIFT, width - 2 * X_MARGIN, HEADER_HEIGHT,
                                         title, alignment=ALIGN_CENTER, textColor='0xFFFFA500', font='font13_title')
        
        self.window_close_button = xbmcgui.ControlButton(self.x + width - 70, self.y + Y_MARGIN + Y_SHIFT, 60, 30, '',
                        focusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton-focus.png'),
                        noFocusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton.png'))
        
        self.addControl(background)
        self.addControl(title_background)
        self.addControl(title_bar)
        self.addControl(self.window_close_button) 
Example #5
Source File: xbmc_config_menu.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def setPosition(self, x, y):
        xbmcgui.ControlButton.setPosition(self, x, y)
        if xbmcgui.__version__ == "1.2":
          self.textControl.setPosition(x + self.getWidth(), y)
        else:
          self.textControl.setPosition(x + self.getWidth() / 2, y) 
Example #6
Source File: xbmc_config_menu.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def setHeight(self, w):
        xbmcgui.ControlButton.setHeight(self, w)
        self.textControl.setHeight(w) 
Example #7
Source File: xbmc_config_menu.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def setWidth(self, w):
        xbmcgui.ControlButton.setWidth(self, w)
        self.textControl.setWidth(w/2) 
Example #8
Source File: xbmc_config_menu.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def getY(self):
        return xbmcgui.ControlButton.getPosition(self)[1] 
Example #9
Source File: xbmc_config_menu.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def getX(self):
        return xbmcgui.ControlButton.getPosition(self)[0] 
Example #10
Source File: xbmc_config_menu.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def setLabel(self, val):
        self.label = val
        xbmcgui.ControlButton.setLabel(self, val) 
Example #11
Source File: xbmc_config_menu.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def __new__(cls, *args, **kwargs):
        del kwargs["isPassword"]
        del kwargs["window"]
        args = list(args)
        return xbmcgui.ControlButton.__new__(cls, *args, **kwargs) 
Example #12
Source File: xbmc_config_menu.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def add_control_list(self, c):
        control = xbmcgui.ControlButton(0, -100, self.controls_width, self.height_control,
                                        c["label"], os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'),
                                        os.path.join(self.mediapath, 'Controls','MenuItemNF.png'),
                                        0, textColor=c["color"], 
                                        font=self.font)

        label = xbmcgui.ControlLabel(0, -100, self.controls_width - 30, self.height_control,
                                     "", font=self.font, textColor=c["color"], alignment=4 | 1)

        upBtn = xbmcgui.ControlButton(0, -100, 20, 15, "",
                                      focusTexture=os.path.join(self.mediapath, 'Controls', 'spinUp-Focus.png'),
                                      noFocusTexture=os.path.join(self.mediapath, 'Controls', 'spinUp-noFocus.png'))

        downBtn = xbmcgui.ControlButton(0, -100 + 15, 20, 15, "",
                                        focusTexture=os.path.join(self.mediapath, 'Controls', 'spinDown-Focus.png'),
                                        noFocusTexture=os.path.join(self.mediapath, 'Controls', 'spinDown-noFocus.png'))


        self.addControl(control)
        self.addControl(label)
        self.addControl(upBtn)
        self.addControl(downBtn)

        control.setVisible(False)
        label.setVisible(False)
        upBtn.setVisible(False)
        downBtn.setVisible(False)
        label.setLabel(c["lvalues"][self.values[c["id"]]])

        c["control"] = control
        c["label"] = label
        c["downBtn"] = downBtn
        c["upBtn"] = upBtn 
Example #13
Source File: keyboardint.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def onInit(self):
		#xbmc.executebuiltin('ReplaceWindow(progressdialog)')
		#xbmc.executebuiltin('Dialog.Close(progressdialog)')
		#ctr=self.getControl(10101)
		#ctr.close()
		print 'lalalalal'
		st_x=250
		st_y=250
		y=1
		while (y<5):
			n=1
			while (n<15):
				self.label = xbmcgui.ControlButton(st_x+n*50, st_y+y*50, 50, 50, self.lns[y-1][n-1])
				if n==1: 
					self.label.setWidth(100)
					self.label.setPosition(st_x, st_y+y*50)
				if n==14: 
					self.label.setWidth(100)
					self.label.setPosition(st_x+n*50, st_y+y*50)
				self.label.setVisible(False)
				self.addControl(self.label)
				#print self.label.getId()
				n=n+1
			y=y+1
			
		id=3001
		y=1
		while (y<5):
			n=1
			while (n<15):
				self.label = self.getControl(3001+(n-1)+(y-1)*14)
				if n>1: self.label.controlLeft(self.getControl(3001+(n-1)+(y-1)*14-1))
				if y>1: self.label.controlUp(self.getControl(3001+(n-1)+(y-2)*14))
				if n<14: self.label.controlRight(self.getControl(3001+(n-1)+(y-1)*14+1))
				if y<4: self.label.controlDown(self.getControl(3001+(n-1)+(y)*14))
				#print self.label.getId()
				n=n+1
				self.label.setVisible(True)
			y=y+1
		pass
		# Put your List Populating code/ and GUI startup stuff here 
Example #14
Source File: xbmc_config_menu.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def add_control_list(self, c):
        control = xbmcgui.ControlButton(0, -100, self.controls_width, self.height_control,
                                        c["label"], os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'),
                                        os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'),
                                        0, textColor=c["color"],
                                        font=self.font)

        label = xbmcgui.ControlLabel(0, -100, self.controls_width - 30, self.height_control,
                                     "", font=self.font, textColor=c["color"], alignment=4 | 1)

        upBtn = xbmcgui.ControlButton(0, -100, 20, 15, "",
                                      focusTexture=os.path.join(self.mediapath, 'Controls', 'spinUp-Focus.png'),
                                      noFocusTexture=os.path.join(self.mediapath, 'Controls', 'spinUp-noFocus.png'))

        downBtn = xbmcgui.ControlButton(0, -100 + 15, 20, 15, "",
                                        focusTexture=os.path.join(self.mediapath, 'Controls', 'spinDown-Focus.png'),
                                        noFocusTexture=os.path.join(self.mediapath, 'Controls', 'spinDown-noFocus.png'))

        self.addControl(control)
        self.addControl(label)
        self.addControl(upBtn)
        self.addControl(downBtn)

        control.setVisible(False)
        label.setVisible(False)
        upBtn.setVisible(False)
        downBtn.setVisible(False)
        label.setLabel(c["lvalues"][self.values[c["id"]]])

        c["control"] = control
        c["label"] = label
        c["downBtn"] = downBtn
        c["upBtn"] = upBtn 
Example #15
Source File: addonwindow.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def setFrame(self, title):
        """
        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 = os.path.join(_images, 'AddonWindow', 'ContentPanel.png')
        # Background for a window header
        self.title_background_img = os.path.join(_images, 'AddonWindow', 'dialogheader.png')
        # Horisontal adjustment for a header background if the main background has transparent edges.
        self.X_MARGIN = 5
        # Vertical adjustment for a header background if the main background has transparent edges
        self.Y_MARGIN = 5
        # Header position adjustment if the main backround has visible borders.
        self.Y_SHIFT = 4
        # The height of a window header (for the title background and the title label).
        self.HEADER_HEIGHT = 35
        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=ALIGN_CENTER, textColor='0xFFFFA500',
                                                                        font='font13_title')
        self.addControl(self.title_bar)
        self.setAnimation(self.title_bar)
        self.window_close_button = xbmcgui.ControlButton(-100, -100, 60, 30, '',
                        focusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton-focus.png'),
                        noFocusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton.png'))
        self.addControl(self.window_close_button)
        self.setAnimation(self.window_close_button) 
Example #16
Source File: keyboardint.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def onInit(self):
		#xbmc.executebuiltin('ReplaceWindow(progressdialog)')
		#xbmc.executebuiltin('Dialog.Close(progressdialog)')
		#ctr=self.getControl(10101)
		#ctr.close()
		print 'lalalalal'
		st_x=250
		st_y=250
		y=1
		while (y<5):
			n=1
			while (n<15):
				self.label = xbmcgui.ControlButton(st_x+n*50, st_y+y*50, 50, 50, self.lns[y-1][n-1])
				if n==1: 
					self.label.setWidth(100)
					self.label.setPosition(st_x, st_y+y*50)
				if n==14: 
					self.label.setWidth(100)
					self.label.setPosition(st_x+n*50, st_y+y*50)
				self.label.setVisible(False)
				self.addControl(self.label)
				#print self.label.getId()
				n=n+1
			y=y+1
			
		id=3001
		y=1
		while (y<5):
			n=1
			while (n<15):
				self.label = self.getControl(3001+(n-1)+(y-1)*14)
				if n>1: self.label.controlLeft(self.getControl(3001+(n-1)+(y-1)*14-1))
				if y>1: self.label.controlUp(self.getControl(3001+(n-1)+(y-2)*14))
				if n<14: self.label.controlRight(self.getControl(3001+(n-1)+(y-1)*14+1))
				if y<4: self.label.controlDown(self.getControl(3001+(n-1)+(y)*14))
				#print self.label.getId()
				n=n+1
				self.label.setVisible(True)
			y=y+1
		pass
		# Put your List Populating code/ and GUI startup stuff here 
Example #17
Source File: keyboard_ru.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def onInit(self):
		#xbmc.executebuiltin('ReplaceWindow(progressdialog)')
		#xbmc.executebuiltin('Dialog.Close(progressdialog)')
		#ctr=self.getControl(10101)
		#ctr.close()
		print 'lalalalal'
		st_x=250
		st_y=250
		y=1
		while (y<5):
			n=1
			while (n<15):
				self.label = xbmcgui.ControlButton(st_x+n*50, st_y+y*50, 50, 50, self.lns[y-1][n-1])
				if n==1: 
					self.label.setWidth(100)
					self.label.setPosition(st_x, st_y+y*50)
				if n==14: 
					self.label.setWidth(100)
					self.label.setPosition(st_x+n*50, st_y+y*50)
				self.label.setVisible(False)
				self.addControl(self.label)
				#print self.label.getId()
				n=n+1
			y=y+1
			
		id=3001
		y=1
		while (y<5):
			n=1
			while (n<15):
				self.label = self.getControl(3001+(n-1)+(y-1)*14)
				if n>1: self.label.controlLeft(self.getControl(3001+(n-1)+(y-1)*14-1))
				if y>1: self.label.controlUp(self.getControl(3001+(n-1)+(y-2)*14))
				if n<14: self.label.controlRight(self.getControl(3001+(n-1)+(y-1)*14+1))
				if y<4: self.label.controlDown(self.getControl(3001+(n-1)+(y)*14))
				#print self.label.getId()
				n=n+1
				self.label.setVisible(True)
			y=y+1
		pass
		# Put your List Populating code/ and GUI startup stuff here 
Example #18
Source File: xbmc_config_menu.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def setPosition(self, x, y):
        xbmcgui.ControlButton.setPosition(self, x, y)
        if xbmcgui.__version__ == "1.2":
            self.textControl.setPosition(x + self.getWidth(), y)
        else:
            self.textControl.setPosition(x + old_div(self.getWidth(), 2), y) 
Example #19
Source File: xbmc_config_menu.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def setHeight(self, w):
        xbmcgui.ControlButton.setHeight(self, w)
        self.textControl.setHeight(w) 
Example #20
Source File: xbmc_config_menu.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def setWidth(self, w):
        xbmcgui.ControlButton.setWidth(self, w)
        self.textControl.setWidth(old_div(w, 2)) 
Example #21
Source File: xbmc_config_menu.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def getY(self):
        return xbmcgui.ControlButton.getPosition(self)[1] 
Example #22
Source File: xbmc_config_menu.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def getX(self):
        return xbmcgui.ControlButton.getPosition(self)[0] 
Example #23
Source File: xbmc_config_menu.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def setLabel(self, val):
        self.label = val
        xbmcgui.ControlButton.setLabel(self, val) 
Example #24
Source File: xbmc_config_menu.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def __new__(cls, *args, **kwargs):
        del kwargs["isPassword"]
        del kwargs["window"]
        args = list(args)
        return xbmcgui.ControlButton.__new__(cls, *args, **kwargs) 
Example #25
Source File: renumbertools.py    From addon with GNU General Public License v3.0 4 votes vote down vote up
def onAction(self, action):
            self.close()

            # TODO mirar retro-compatiblidad
            # class ControlEdit(xbmcgui.ControlButton):
            #     def __new__(self, *args, **kwargs):
            #         del kwargs["isPassword"]
            #         del kwargs["window"]
            #         args = list(args)
            #         return xbmcgui.ControlButton.__new__(self, *args, **kwargs)
            #
            #     def __init__(self, *args, **kwargs):
            #         self.isPassword = kwargs["isPassword"]
            #         self.window = kwargs["window"]
            #         self.label = ""
            #         self.text = ""
            #         self.textControl = xbmcgui.ControlLabel(self.getX(), self.getY(), self.getWidth(), self.getHeight(),
            #                                                 self.text,
            #                                                 font=kwargs["font"], textColor=kwargs["textColor"], alignment=4 | 1)
            #         self.window.addControl(self.textControl)
            #
            #     def setLabel(self, val):
            #         self.label = val
            #         xbmcgui.ControlButton.setLabel(self, val)
            #
            #     def getX(self):
            #         return xbmcgui.ControlButton.getPosition(self)[0]
            #
            #     def getY(self):
            #         return xbmcgui.ControlButton.getPosition(self)[1]
            #
            #     def setEnabled(self, e):
            #         xbmcgui.ControlButton.setEnabled(self, e)
            #         self.textControl.setEnabled(e)
            #
            #     def setWidth(self, w):
            #         xbmcgui.ControlButton.setWidth(self, w)
            #         self.textControl.setWidth(w / 2)
            #
            #     def setHeight(self, w):
            #         xbmcgui.ControlButton.setHeight(self, w)
            #         self.textControl.setHeight(w)
            #
            #     def setPosition(self, x, y):
            #         xbmcgui.ControlButton.setPosition(self, x, y)
            #         self.textControl.setPosition(x + self.getWidth() / 2, y)
            #
            #     def setText(self, text):
            #         self.text = text
            #         if self.isPassword:
            #             self.textControl.setLabel("*" * len(self.text))
            #         else:
            #             self.textControl.setLabel(self.text)
            #
            #     def getText(self):
            #         return self.text
            #
            #
            # if not hasattr(xbmcgui, "ControlEdit"):
            #     xbmcgui.ControlEdit = ControlEdit 
Example #26
Source File: renumbertools.py    From pelisalacarta-ce with GNU General Public License v3.0 4 votes vote down vote up
def onAction(self, action):
        self.close()

# TODO mirar retro-compatiblidad
# class ControlEdit(xbmcgui.ControlButton):
#     def __new__(self, *args, **kwargs):
#         del kwargs["isPassword"]
#         del kwargs["window"]
#         args = list(args)
#         return xbmcgui.ControlButton.__new__(self, *args, **kwargs)
#
#     def __init__(self, *args, **kwargs):
#         self.isPassword = kwargs["isPassword"]
#         self.window = kwargs["window"]
#         self.label = ""
#         self.text = ""
#         self.textControl = xbmcgui.ControlLabel(self.getX(), self.getY(), self.getWidth(), self.getHeight(),
#                                                 self.text,
#                                                 font=kwargs["font"], textColor=kwargs["textColor"], alignment=4 | 1)
#         self.window.addControl(self.textControl)
#
#     def setLabel(self, val):
#         self.label = val
#         xbmcgui.ControlButton.setLabel(self, val)
#
#     def getX(self):
#         return xbmcgui.ControlButton.getPosition(self)[0]
#
#     def getY(self):
#         return xbmcgui.ControlButton.getPosition(self)[1]
#
#     def setEnabled(self, e):
#         xbmcgui.ControlButton.setEnabled(self, e)
#         self.textControl.setEnabled(e)
#
#     def setWidth(self, w):
#         xbmcgui.ControlButton.setWidth(self, w)
#         self.textControl.setWidth(w / 2)
#
#     def setHeight(self, w):
#         xbmcgui.ControlButton.setHeight(self, w)
#         self.textControl.setHeight(w)
#
#     def setPosition(self, x, y):
#         xbmcgui.ControlButton.setPosition(self, x, y)
#         self.textControl.setPosition(x + self.getWidth() / 2, y)
#
#     def setText(self, text):
#         self.text = text
#         if self.isPassword:
#             self.textControl.setLabel("*" * len(self.text))
#         else:
#             self.textControl.setLabel(self.text)
#
#     def getText(self):
#         return self.text
#
#
# if not hasattr(xbmcgui, "ControlEdit"):
#     xbmcgui.ControlEdit = ControlEdit