我正在处理我的python脚本,因为我在脚本中输入了键盘代码。
当我按下键盘上的按钮时,我可以使用向上,向下,向左,向右和ESC键代码工作,但当我按下退格键时,我无法使用ACTION_PARENT_DIR = 9
使退格键工作键盘上的按钮。
这是test.py:
import xbmc
import xbmcgui
#get actioncodes from keymap.xml
ACTION_MOVE_LEFT = 1
ACTION_MOVE_RIGHT = 2
ACTION_MOVE_UP = 3
ACTION_MOVE_DOWN = 4
ACTION_PARENT_DIR = 9
ACTION_PREVIOUS_MENU = 10
class MyClass(xbmcgui.WindowXML):
def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
if action == ACTION_PARENT_DIR:
self.close()
if action == ACTION_MOVE_LEFT:
self.strAction = xbmcgui.ControlLabel(300, 200, 600, 200, '', 'font14', '0xFF00FF00')
self.addControl(self.strAction)
self.strAction.setLabel('You have press on the left arrow button!')
if action == ACTION_MOVE_RIGHT:
self.removeControl(self.strAction)
self.strAction = xbmcgui.ControlLabel(300, 200, 600, 200, '', 'font14', '0xFF00FF00')
self.addControl(self.strAction)
self.strAction.setLabel('You have press on the right arrow button!')
if action == ACTION_MOVE_UP:
self.strAction = xbmcgui.ControlLabel(300, 200, 600, 200, '', 'font14', '0xFF00FF00')
self.addControl(self.strAction)
self.strAction.setLabel('You have press on the up arrow button!')
if action == ACTION_MOVE_DOWN:
self.strAction = xbmcgui.ControlLabel(300, 200, 600, 200, '', 'font14', '0xFF00FF00')
self.addControl(self.strAction)
self.strAction.setLabel('You have press on the down arrow button!')
这是keycode.xml
<keymap>
<global>
<keyboard>
<p>Play</p>
<q>Queue</q>
<f>FastForward</f>
<r>Rewind</r>
<left>Left</left>
<right>Right</right>
<up>Up</up>
<down>Down</down>
<left mod="ctrl">analogseekback</left>
<right mod="ctrl">analogseekforward</right>
<pageup>PageUp</pageup>
<pagedown>PageDown</pagedown>
<return>Select</return>
<enter>Select</enter>
<delete>Back</delete>
<backspace>Back</backspace>
<key id="65446">Back</key>
<m>ActivateWindow(PlayerControls)</m>
<s>ActivateWindow(shutdownmenu)</s>
<escape>PreviousMenu</escape>
<key id="61952">parentdir</key>
<i>Info</i>
<menu>ContextMenu</menu>
<c>ContextMenu</c>
<space>Pause</space>
<x>Stop</x>
<period>SkipNext</period>
<comma>SkipPrevious</comma>
<tab>FullScreen</tab>
<printscreen>Screenshot</printscreen>
<s mod="ctrl">Screenshot</s>
<minus>VolumeDown</minus>
<plus>VolumeUp</plus>
<equals>VolumeUp</equals>
<zero>Number0</zero>
<one>Number1</one>
<two>Number2</two>
<three>Number3</three>
<four>Number4</four>
<five>Number5</five>
<six>Number6</six>
<seven>Number7</seven>
<eight>Number8</eight>
<nine>Number9</nine>
<numpadminus>VolumeDown</numpadminus>
<numpadplus>VolumeUp</numpadplus>
<numpadzero>Number0</numpadzero>
<numpadone>Number1</numpadone>
<numpadtwo>Number2</numpadtwo>
<numpadthree>Number3</numpadthree>
<numpadfour>Number4</numpadfour>
<numpadfive>Number5</numpadfive>
<numpadsix>Number6</numpadsix>
<numpadseven>Number7</numpadseven>
<numpadeight>Number8</numpadeight>
<numpadnine>Number9</numpadnine>
<backslash>ToggleFullScreen</backslash>
<home>FirstPage</home>
<end>LastPage</end>
<!-- Multimedia keyboard keys -->
<browser_back>Back</browser_back>
<browser_forward></browser_forward>
<browser_refresh></browser_refresh>
<browser_stop></browser_stop>
<browser_search></browser_search>
<browser_favorites>ActivateWindow(Favourites)</browser_favorites>
<browser_home>XBMC.ActivateWindow(Home)</browser_home>
<volume_mute>Mute</volume_mute>
<volume_down>VolumeDown</volume_down>
<volume_up>VolumeUp</volume_up>
<next_track>SkipNext</next_track>
<prev_track>SkipPrevious</prev_track>
<stop>Stop</stop>
<play_pause>Pause</play_pause>
<launch_mail></launch_mail>
<launch_media_select>XBMC.ActivateWindow(MyMusic)</launch_media_select>
<launch_app1_pc_icon>ActivateWindow(MyPrograms)</launch_app1_pc_icon>
<launch_app2_pc_icon>ActivateWindow(MyPrograms)</launch_app2_pc_icon>
<launch_file_browser></launch_file_browser>
<launch_media_center></launch_media_center>
<!-- ****************************************************** -->
<!-- MS Media Center keyboard shortcuts sent by MCE remotes -->
<!-- See http://msdn.microsoft.com/en-us/library/bb189249.aspx -->
<p mod="ctrl,shift">Play</p>
<!-- Play -->
<s mod="ctrl,shift">Stop</s>
<!-- Stop -->
<p mod="ctrl">Pause</p>
<!-- Pause -->
<f mod="ctrl,shift">FastForward</f>
<!-- Fwd -->
<b mod="ctrl,shift">Rewind</b>
<!-- Rew -->
<f mod="ctrl">SkipNext</f>
<!-- Skip -->
<b mod="ctrl">SkipPrevious</b>
<!-- Replay -->
<d mod="ctrl">Info</d>
<!-- MCE Details -->
<f10>VolumeUp</f10>
<!-- MCE Vol up -->
<f9>VolumeDown</f9>
<!-- MCE Vol down -->
<f8>Mute</f8>
<!-- MCE mute -->
<g mod="ctrl">OSD</g>
<!-- MCE Guide -->
<m mod="ctrl">ActivateWindow(music)</m>
<!-- MCE My music -->
<i mod="ctrl">ActivateWindow(pictures)</i>
<!-- MCE My pictures -->
<e mod="ctrl">ActivateWindow(video)</e>
<!-- MCE videos -->
<m mod="ctrl,shift">PlayerControl(ShowVideoMenu)</m>
<!-- MCE DVD menu -->
<!-- MCE keypresses without an obvious use in XBMC -->
<o mod="ctrl">Notification(MCEKeypress, Recorded TV, 3)</o>
<t mod="ctrl">Notification(MCEKeypress, Live TV, 3)</t>
<t mod="ctrl,shift">Notification(MCEKeypress, My TV, 3)</t>
<a mod="ctrl">Notification(MCEKeypress, Radio, 3)</a>
<u mod="ctrl">Notification(MCEKeypress, DVD subtitle, 3)</u>
<a mod="ctrl,shift">Notification(MCEKeypress, DVD audio, 3)</a>
</keyboard>
</global>
<loginscreen>
<keyboard>
<end>XBMC.ShutDown()</end>
</keyboard>
</loginscreen>
<home>
<keyboard>
<i>info</i>
<end>XBMC.ShutDown()</end>
</keyboard>
</home>
<virtualkeyboard>
<keyboard>
<backspace>Backspace</backspace>
</keyboard>
</virtualkeyboard>
</keymap>
有谁知道我应该用什么密码来让退格在xbmc上运行?
当我按下键盘时,我需要退格键才能工作,因为当我按下键盘上的退格键时我想回到上一个主菜单。
答案 0 :(得分:1)
退格键的ID(映射到“后退”操作)为92
。
我写了一个小插件来获取给定操作的ID:https://github.com/dersphere/script.get_action_id
只需将此存储库克隆或下载到xbmc / addons / dir,您就可以在program-plugins下找到它。