本文整理汇总了Python中outwiker.core.application.Application.onLinkClick方法的典型用法代码示例。如果您正苦于以下问题:Python Application.onLinkClick方法的具体用法?Python Application.onLinkClick怎么用?Python Application.onLinkClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类outwiker.core.application.Application
的用法示例。
在下文中一共展示了Application.onLinkClick方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __onLinkClicked
# 需要导入模块: from outwiker.core.application import Application [as 别名]
# 或者: from outwiker.core.application.Application import onLinkClick [as 别名]
def __onLinkClicked(self, href, gtk_mouse_button, gtk_key_modifier):
"""
Клик по ссылке
Возвращает False, если обрабатывать ссылку разрешить компоненту,
в противном случае - True (если обрабатываем сами)
href - ссылка
gtk_mouse_button - кнопка мыши, с помощью которой кликнули по ссылке
(1 - левая, 2 - средняя, 3 - правая, -1 - не известно)
gtk_key_modifier - зажатые клавиши (1 - Shift, 4 - Ctrl)
"""
source_href = href
href = urllib.parse.unquote(href)
href = self._decodeIDNA(href)
logger.debug('__onLinkClicked. href_src={source_href}; href_process={href}'.format(
source_href=source_href, href=href)
)
(url, page, filename, anchor) = self.__identifyUri(href)
logger.debug('__onLinkClicked. url={url}, page={page}, filename={filename}, anchor={anchor}'.format(
url=url, page=page, filename=filename, anchor=anchor))
modifier = self.__gtk2OutWikerKeyCode(gtk_key_modifier)
mouse_button = self.__gtk2OutWikerMouseButtonCode(gtk_mouse_button)
params = self._getClickParams(source_href,
mouse_button,
modifier,
url,
page,
filename,
anchor)
Application.onLinkClick(self._currentPage, params)
if params.process:
return True
if url is not None:
self.openUrl(url)
elif (page is not None and
(mouse_button == ID_MOUSE_MIDDLE or modifier == ID_KEY_CTRL)):
Application.mainWindow.tabsController.openInTab(page, True)
elif page is not None:
if anchor is not None:
Application.sharedData[APP_DATA_KEY_ANCHOR] = anchor
self._currentPage.root.selectedPage = page
elif filename is not None:
try:
outwiker.core.system.getOS().startFile(filename)
except OSError:
text = _(u"Can't execute file '%s'") % filename
outwiker.core.commands.showError(Application.mainWindow, text)
elif anchor is not None:
return False
return True
示例2: __onLinkClicked
# 需要导入模块: from outwiker.core.application import Application [as 别名]
# 或者: from outwiker.core.application.Application import onLinkClick [as 别名]
def __onLinkClicked (self, href, gtk_mouse_button, gtk_key_modifier):
"""
Клик по ссылке
Возвращает False, если обрабатывать ссылку разрешить компоненту,
в противном случае - True (если обрабатываем сами)
href - ссылка
gtk_mouse_button - кнопка мыши, с помощью которой кликнули по ссылке (1 - левая, 2 - средняя, 3 - правая, -1 - не известно)
gtk_key_modifier - зажатые клавиши (1 - Shift, 4 - Ctrl)
"""
(url, page, filename, anchor) = self.__identifyUri (href)
modifier = self.__gtk2OutWikerKeyCode (gtk_key_modifier)
mouse_button = self.__gtk2OutWikerMouseButtonCode (gtk_mouse_button)
params = self._getClickParams (self._decodeIDNA (href),
mouse_button,
modifier,
url,
page,
filename,
anchor)
Application.onLinkClick (self._currentPage, params)
if params.process:
return True
if url is not None:
self.openUrl (url)
elif page is not None and (mouse_button == ID_MOUSE_MIDDLE or modifier == ID_KEY_CTRL):
Application.mainWindow.tabsController.openInTab (page, True)
elif page is not None:
Application.anchor = anchor
self._currentPage.root.selectedPage = page
elif filename is not None:
try:
outwiker.core.system.getOS().startFile (filename)
except OSError:
text = _(u"Can't execute file '%s'") % filename
outwiker.core.commands.MessageBox (text, _(u"Error"), wx.ICON_ERROR | wx.OK)
elif anchor is not None:
return False
return True
示例3: __onLinkClicked
# 需要导入模块: from outwiker.core.application import Application [as 别名]
# 或者: from outwiker.core.application.Application import onLinkClick [as 别名]
def __onLinkClicked (self, href):
"""
Клик по ссылке
"""
(url, page, filename, anchor) = self.__identifyUri (href)
button = ID_MOUSE_LEFT
modifier = self.__getKeyCode()
params = self._getClickParams (self._decodeIDNA (href),
button,
modifier,
url,
page,
filename,
anchor)
Application.onLinkClick (self._currentPage, params)
if params.process:
return
if url is not None:
self.openUrl (url)
elif page is not None and modifier == ID_KEY_CTRL:
Application.anchor = anchor
Application.mainWindow.tabsController.openInTab (page, True)
elif page is not None:
Application.anchor = anchor
self._currentPage.root.selectedPage = page
elif filename is not None:
try:
outwiker.core.system.getOS().startFile (filename)
except OSError:
text = _(u"Can't execute file '%s'") % filename
outwiker.core.commands.MessageBox (text, _(u"Error"), wx.ICON_ERROR | wx.OK)
elif anchor is not None:
self.LoadPage (href)