Exemplo n.º 1
0
    def StatusTextChange(self, status):
        if self.visible:
            if self.drivingMoz:
                internaljumpPrefix = u"file://internaljump/wikipage/"
            else:
                internaljumpPrefix = u"http://internaljump/wikipage/"

            if status.startswith(internaljumpPrefix):
                # First check for an anchor. In URLs, anchors are always
                # separated by '#' regardless which character is used
                # in the wiki syntax (normally '!')
                try:
                    wikiWord, anchor = status[len(internaljumpPrefix):].split(
                            u"#", 1)
                    anchor = flexibleUrlUnquote(anchor)
                except ValueError:
                    wikiWord = status[len(internaljumpPrefix):]
                    anchor = None
                    
                wikiWord = flexibleUrlUnquote(wikiWord)

                wikiDocument = self.presenter.getWikiDocument()
                if wikiDocument is None:
                    return
                    
                wikiWord = wikiDocument.getWikiPageNameForLinkTerm(wikiWord)

                if wikiWord is not None:
                    status = _(u"Link to page: %s") % wikiWord

            self.presenter.getMainControl().statusBar.SetStatusText(
                    uniToGui(status), 0)
Exemplo n.º 2
0
    def StatusTextChange(self, status):
        if self.visible:
            if self.drivingMoz:
                internaljumpPrefix = u"file://internaljump/wikipage/"
            else:
                internaljumpPrefix = u"http://internaljump/wikipage/"

            if status.startswith(internaljumpPrefix):
                # First check for an anchor. In URLs, anchors are always
                # separated by '#' regardless which character is used
                # in the wiki syntax (normally '!')
                try:
                    wikiWord, anchor = status[len(internaljumpPrefix):].split(
                        u"#", 1)
                    anchor = flexibleUrlUnquote(anchor)
                except ValueError:
                    wikiWord = status[len(internaljumpPrefix):]
                    anchor = None

                wikiWord = flexibleUrlUnquote(wikiWord)

                wikiDocument = self.presenter.getWikiDocument()
                if wikiDocument is None:
                    return

                wikiWord = wikiDocument.getWikiPageNameForLinkTerm(wikiWord)

                if wikiWord is not None:
                    status = _(u"Link to page: %s") % wikiWord

            self.presenter.getMainControl().statusBar.SetStatusText(
                uniToGui(status), 0)
Exemplo n.º 3
0
    def OnMouseMotion(self, evt):
        evt.Skip()

        pos = self.CalcUnscrolledPosition(evt.GetPosition())
        irep = self.GetInternalRepresentation()
        if irep is None:
            cell = None
        else:
            cell = irep.FindCellByPos(pos.x, pos.y)
        callTip = u""
        status = u""

        if cell is not None:
            linkInfo = cell.GetLink()
            if linkInfo is not None:
                href = linkInfo.GetHref()
                if href.startswith(u"internaljump:wikipage/"):
                    # Jump to another wiki page

                    # First check for an anchor. In URLs, anchors are always
                    # separated by '#' regardless which character is used
                    # in the wiki syntax (normally '!')
                    try:
                        wikiWord, anchor = href[22:].split(u"#", 1)
                        anchor = flexibleUrlUnquote(anchor)
                    except ValueError:
                        wikiWord = href[22:]
                        anchor = None

                    wikiWord = flexibleUrlUnquote(wikiWord)

                    wikiDocument = self.presenter.getWikiDocument()
                    if wikiDocument is None:
                        return
                    wikiWord = wikiDocument.getWikiPageNameForLinkTerm(
                        wikiWord)

                    if wikiWord is not None:
                        propList = wikiDocument.getAttributeTriples(
                            wikiWord, u"short_hint", None)

                        if len(propList) > 0:
                            callTip = propList[-1][2]

                        status = _(u"Link to page: %s") % wikiWord
                else:
                    status = href

        self.presenter.getMainControl().statusBar.SetStatusText(
            uniToGui(status), 0)

        self.SetToolTipString(callTip)
Exemplo n.º 4
0
    def OnMouseMotion(self, evt):
        evt.Skip()

        pos = self.CalcUnscrolledPosition(evt.GetPosition())
        irep = self.GetInternalRepresentation()
        if irep is None:
            cell = None
        else:
            cell = irep.FindCellByPos(pos.x, pos.y)
        callTip = u""
        status = u""

        if cell is not None:
            linkInfo = cell.GetLink()
            if linkInfo is not None:
                href = linkInfo.GetHref()
                if href.startswith(u"internaljump:wikipage/"):
                    # Jump to another wiki page
                    
                    # First check for an anchor. In URLs, anchors are always
                    # separated by '#' regardless which character is used
                    # in the wiki syntax (normally '!')
                    try:
                        wikiWord, anchor = href[22:].split(u"#", 1)
                        anchor = flexibleUrlUnquote(anchor)
                    except ValueError:
                        wikiWord = href[22:]
                        anchor = None

                    wikiWord = flexibleUrlUnquote(wikiWord)
                    
                    wikiDocument = self.presenter.getWikiDocument()
                    if wikiDocument is None:
                        return
                    wikiWord = wikiDocument.getWikiPageNameForLinkTerm(wikiWord)

                    if wikiWord is not None:
                        propList = wikiDocument.getAttributeTriples(wikiWord,
                                u"short_hint", None)

                        if len(propList) > 0:
                            callTip = propList[-1][2]
                        
                        status = _(u"Link to page: %s") % wikiWord
                else:
                    status = href

        self.presenter.getMainControl().statusBar.SetStatusText(
                        uniToGui(status), 0)

        self.SetToolTipString(callTip)