我正在尝试用Kodi解决一个相当基本的初学者问题但没有取得多大成功。我有一个皮肤脚本的开始,它打开一个窗口并创建一个控件,通过将鼠标指向它而无法看到它。
然而,我无法弄清楚如何制作它以便在脚本运行时立即显示此控制按钮而不必将鼠标移到它上面。如果您是初学者,Kodi的文档有点稀疏:
...这是我的default.py文件......
import xbmc, xbmcgui, os
class cGUI(xbmcgui.WindowXML):
def __init__(self, *args, **kwargs):
xbmcgui.WindowXML.__init__(self, *args, **kwargs)
self.strActionInfo = xbmcgui.ControlLabel(50, 50, 200, 200, '', 'font14', '0xFFBBBBFF')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('Push BACK to quit')
self.listing = kwargs.get("listing")
self.main_control_id = kwargs.get("id")
def onClick(self, controlID):
if controlID == self.main_control_id:
self.gui_button_SelectedPosition = self.gui_button.getSelectedPosition()
def setFocusId(self, 10):
pass
ui = cGUI('controltest.xml', 'special://home/addons/script.video.test2', id=10)
ui.doModal()
del ui
...这是我的皮肤XML文件......
<?xml version="1.0" encoding="UTF-8"?>
<window type="window">
<defaultcontrol always="true">10</defaultcontrol>
<menucontrol>9000</menucontrol>
<backgroundcolor>1A1817</backgroundcolor>
<views>50,51,509,510</views>
<visible>Window.IsActive(Home)</visible>
<animation effect="fade" time="100">WindowOpen</animation>
<animation effect="slide" end="0,576" time="100">WindowClose</animation>
<zorder>1</zorder>
<coordinates>
<left>0</left>
<top>0</top>
<origin x="0" y="0">Window.IsActive(Home)</origin>
</coordinates>
<controls>
<control type="button" id="10">
<description>My first button control</description>
<left>100</left>
<top>100</top>
<width>1100</width>
<height>550</height>
<visible>true</visible>
<colordiffuse>1A1817</colordiffuse>
<label>28</label>
<wrapmultiline>true</wrapmultiline>
<font>font12</font>
<textcolor>80FFFFFF</textcolor>
<focusedcolor>7fffffff</focusedcolor>
<disabledcolor>80FFFFFF</disabledcolor>
<shadowcolor>70FFFFFF</shadowcolor>
<invalidcolor>70FFFFFF</invalidcolor>
<align></align>
<aligny></aligny>
<textoffsetx></textoffsetx>
<textoffsety></textoffsety>
<pulseonselect></pulseonselect>
<onfocus>-</onfocus>
<onunfocus>-</onunfocus>
<onup>2</onup>
<ondown>3</ondown>
<onleft>1</onleft>
<onright>1</onright>
</control>
</controls>
</window>
任何人都可以让我知道我需要添加/更改以使其工作吗?
由于
答案 0 :(得分:1)
您应该为按钮控件定义texturefocus和texturenofocus。