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: if anchor is not None: Application.sharedData[APP_DATA_KEY_ANCHOR] = anchor 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: self.LoadPage(href)
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
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
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
def _onLinkClicked(self, href): """ Клик по ссылке Возвращает False, если обрабатывать ссылку разрешить компоненту, в противном случае - True (если обрабатываем сами) href - ссылка """ modifier = self.getKeyCode() mouse_button = ID_MOUSE_LEFT source_href = href href = urllib.parse.unquote(href) href = self.decodeIDNA(href) logger.debug('_onLinkClicked. href_src={source_href}'.format( source_href=source_href)) (url, page, filename, anchor) = self._identifyUri(href) params = self.getClickParams(source_href, mouse_button, modifier, url, page, filename, anchor) Application.onLinkClick(self._currentPage, params) if params.process: return True if page is not None and anchor is not None: Application.sharedData[APP_DATA_KEY_ANCHOR] = anchor if url is not None: self.openUrl(url) elif page is not None and modifier == ID_KEY_CTRL: Application.mainWindow.tabsController.openInTab(page, True) elif page is not None: self._currentPage.root.selectedPage = page elif filename is not None: try: outwiker.core.system.getOS().startFile(filename) except OSError: text = _("Can't execute file '%s'") % filename outwiker.core.commands.showError(Application.mainWindow, text) elif anchor is not None: return False return True
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)