📄 pybridge.py
字号:
return config.set(prefs.STARTUP_TASKS_DONE, value)
@asUrgent
def handleCommandLine(self, commandLine):
singleclick.parseCommandLineArgs(getArgumentList(commandLine))
def pageLoadFinished(self, area, url):
eventloop.addUrgentCall(HTMLDisplay.runPageFinishCallback,
"%s finish callback" % area, args=(area, url))
@asUrgent
def openFile(self, path):
singleclick.openFile(getLongPathName(path))
@asUrgent
def setVolume(self, volume):
volume = float(volume)
config.set(prefs.VOLUME_LEVEL, volume)
app.controller.videoDisplay.setVolume(volume)
@asUrgent
def quit(self):
app.controller.quit()
@asUrgent
def removeCurrentChannel(self):
app.controller.removeCurrentFeed()
@asUrgent
def updateCurrentChannel(self):
app.controller.updateCurrentFeed()
@asUrgent
def updateChannels(self):
app.controller.updateAllFeeds()
@asUrgent
def showHelp(self):
self.delegate.openExternalURL(config.get(prefs.HELP_URL))
@asUrgent
def copyChannelLink(self):
app.controller.copyCurrentFeedURL()
@asUrgent
def handleContextMenu(self, index):
self.delegate.handleContextMenu(index)
@asUrgent
def handleSimpleDialog(self, id, buttonIndex):
self.delegate.handleDialog(id, buttonIndex)
@asUrgent
def handleHTTPAuthDialog(self, id, buttonIndex, username, password):
self.delegate.handleDialog(id, buttonIndex, username=username,
password=password)
@asUrgent
def handleTextEntryDialog(self, id, buttonIndex, text):
self.delegate.handleDialog(id, buttonIndex, value=text)
@asUrgent
def handleSearchChannelDialog(self, id, buttonIndex, term, style, loc):
self.delegate.handleDialog(id, buttonIndex, term=term, style=style, loc=loc)
@asUrgent
def addChannel(self, url):
app.controller.addAndSelectFeed(url)
@asUrgent
def openURL(self, url):
self.delegate.openExternalURL(url)
@asUrgent
def playPause(self):
app.controller.playbackController.playPause()
@asUrgent
def stop(self):
app.controller.playbackController.stop()
@asUrgent
def skip(self, step):
app.controller.playbackController.skip(step)
@asUrgent
def skipPrevious(self):
app.controller.playbackController.skip(-1, allowMovieReset=False)
@asUrgent
def onMovieFinished(self):
app.controller.playbackController.onMovieFinished()
@asUrgent
def loadURLInBrowser(self, browserId, url):
try:
display = app.controller.frame.selectedDisplays[browserId]
except KeyError:
print "No HTMLDisplay for %s in loadURLInBrowser: "% browserId
else:
display.onURLLoad(url)
@asUrgent
def performSearch(self, engine, query):
app.controller.performSearch(engine, query)
# Returns a list of search engine titles and names
# Should we just keep a map of engines to names?
def getSearchEngineNames(self):
out = []
for engine in views.searchEngines:
out.append(engine.name)
return out
def getSearchEngineTitles(self):
out = []
for engine in views.searchEngines:
out.append(engine.title)
return out
def showCursor(self, display):
# ShowCursor has an amazing API. From Microsoft:
#
# This function sets an internal display counter that determines
# whether the cursor should be displayed. The cursor is displayed
# only if the display count is greater than or equal to 0. If a
# mouse is installed, the initial display count is 0. If no mouse
# is installed, the display count is -1
#
# How do we get the initial display count? There's no method. We
# assume it's 0 and the mouse is plugged in.
if ((display and self.cursorDisplayCount >= 0) or
(not display and self.cursorDisplayCount < 0)):
return
if display:
arg = 1
else:
arg = 0
self.cursorDisplayCount = ctypes.windll.user32.ShowCursor(arg)
@asUrgent
def createNewPlaylist(self):
playlist.createNewPlaylist()
@asUrgent
def createNewPlaylistFolder(self):
folder.createNewPlaylistFolder()
@asUrgent
def createNewSearchChannel(self):
app.controller.addSearchFeed()
@asUrgent
def createNewChannelFolder(self):
folder.createNewChannelFolder()
@asUrgent
def handleDrop(self, dropData, dropType, sourceData):
app.controller.handleDrop(dropData, dropType, sourceData)
@asUrgent
def removeCurrentSelection(self):
app.controller.removeCurrentSelection()
@asUrgent
def checkForUpdates(self):
autoupdate.checkForUpdates()
@asUrgent
def removeCurrentItems(self):
app.controller.removeCurrentItems()
@asUrgent
def copyCurrentItemURL(self):
app.controller.copyCurrentItemURL()
@asUrgent
def selectAllItems(self):
app.controller.selectAllItems()
@asUrgent
def createNewChannelFolder(self):
folder.createNewChannelFolder()
@asUrgent
def createNewChannelGuide(self):
app.controller.addAndSelectGuide()
@asUrgent
def addChannel(self):
app.controller.addAndSelectFeed()
@asUrgent
def renameCurrentChannel(self):
app.controller.renameCurrentChannel()
@asUrgent
def recommendCurrentChannel(self):
print "WARNING: recommendCurrentChannel not supported"
@asUrgent
def renameCurrentPlaylist(self):
app.controller.renameCurrentPlaylist()
@asUrgent
def removeCurrentPlaylist(self):
app.controller.removeCurrentPlaylist()
@asUrgent
def openDonatePage(self):
self.delegate.openExternalURL(config.get(prefs.DONATE_URL))
@asUrgent
def saveVideoFile(self, path):
if frontend.currentVideoPath is None:
return
print "saving video %s to %s" % (frontend.currentVideoPath, path)
shutil.copyfile(frontend.currentVideoPath, path)
def startupDoSearch(self, path):
if path.endswith(":"):
path = path + "\\" # convert C: to C:\
frontend.startup.doSearch(path)
def startupCancelSearch(self):
frontend.startup.cancelSearch()
def getSpecialFolder(self, name):
return platformcfg.getSpecialFolder(name)
def createProxyObjects(self):
createProxyObjects()
@asUrgent
def initializeSearchEngines(self):
# Send the search engine info to jsbridge. This is a little tricky
# because we need to access views.searchEngines from the main thread.
names = []
titles = []
for engine in views.searchEngines:
names.append(engine.name)
titles.append(engine.title)
frontend.jsBridge.setSearchEngineInfo(names, titles)
frontend.jsBridge.setSearchEngine(searchengines.getLastEngine())
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -