Example #1
0
    def callTipCheck(self):
        pos, lnNo, lnStPs, line, piv = self.getCurrLineInfo()

        bracket = methodparse.matchbracket(line[:piv + 1], '(')
        if bracket == -1 and self.CallTipActive():
            self.CallTipCancel()
            return

        cursBrktOffset = piv - bracket

        start, length = idWord(line, bracket - 1, lnStPs, object_delim,
                               object_delim)
        startLine = start - lnStPs
        word = line[startLine:startLine + length]
        if word:
            tip = self.getTipValue(word, lnNo)
            if tip:
                # Minus offset of 1st bracket in the tip
                tipBrkt = tip.find('(')
                if tipBrkt != -1:
                    pos = pos - tipBrkt - 1
                else:
                    tipBrkt = 0

                # get the current parameter from source
                paramNo = len(methodparse.safesplitfields(\
                      line[bracket+1:piv+1]+'X', ','))
                if paramNo:
                    paramNo = paramNo - 1

                # get hilight & corresponding parameter from tip
                tipBrktEnd = tip.rfind(')')
                tip_param_str = tip[tipBrkt + 1:tipBrktEnd]
                tip_params = methodparse.safesplitfields(\
                    tip_param_str, ',', ('(', '{'), (')', '}') )
                try:
                    hiliteStart = tipBrkt + 1 + tip_param_str.find(
                        tip_params[paramNo])
                except IndexError:
                    hilite = (0, 0)
                else:
                    hilite = (hiliteStart,
                              hiliteStart + len(tip_params[paramNo]))

                # don't update if active and unchanged
                if self.CallTipActive() and tip == self.lastCallTip and \
                      hilite == self.lastTipHilite:
                    return

                # close if active and changed
                if self.CallTipActive() and (tip != self.lastCallTip or \
                      hilite != self.lastTipHilite):
                    self.CallTipCancel()

                self.CallTipShow(pos - cursBrktOffset, tip)

                self.CallTipSetHighlight(hilite[0], hilite[1])
                self.lastCallTip = tip
                self.lastTipHilite = hilite
    def callTipCheck(self):
        pos, lnNo, lnStPs, line, piv = self.getCurrLineInfo()

        bracket = methodparse.matchbracket(line[:piv+1], '(')
        if bracket == -1 and self.CallTipActive():
            self.CallTipCancel()
            return

        cursBrktOffset = piv - bracket

        start, length = idWord(line, bracket-1, lnStPs, object_delim, object_delim)
        startLine = start-lnStPs
        word = line[startLine:startLine+length]
        if word:
            tip = self.getTipValue(word, lnNo)
            if tip:
                # Minus offset of 1st bracket in the tip
                tipBrkt = tip.find('(')
                if tipBrkt != -1:
                    pos = pos - tipBrkt - 1
                else:
                    tipBrkt = 0

                # get the current parameter from source
                paramNo = len(methodparse.safesplitfields(\
                      line[bracket+1:piv+1]+'X', ','))
                if paramNo:
                    paramNo = paramNo - 1

                # get hilight & corresponding parameter from tip
                tipBrktEnd = tip.rfind(')')
                tip_param_str = tip[tipBrkt+1:tipBrktEnd]
                tip_params = methodparse.safesplitfields(\
                    tip_param_str, ',', ('(', '{'), (')', '}') )
                try:
                    hiliteStart = tipBrkt+1 + tip_param_str.find(tip_params[paramNo])
                except IndexError:
                    hilite = (0, 0)
                else:
                    hilite = (hiliteStart,
                              hiliteStart+len(tip_params[paramNo]))

                # don't update if active and unchanged
                if self.CallTipActive() and tip == self.lastCallTip and \
                      hilite == self.lastTipHilite:
                    return

                # close if active and changed
                if self.CallTipActive() and (tip != self.lastCallTip or \
                      hilite != self.lastTipHilite):
                    self.CallTipCancel()

                self.CallTipShow(pos - cursBrktOffset, tip)

                self.CallTipSetHighlight(hilite[0], hilite[1])
                self.lastCallTip = tip
                self.lastTipHilite = hilite
Example #3
0
 def parseInstanceListToTypeLst(self, instLstStr):
     instLstStr = instLstStr[1:-1]
     instLst = methodparse.safesplitfields(instLstStr, ',')
     tpeLst = []
     for inst in instLst:
         key, val = inst[1:-1].split(', ')
         val = val[1:].split(' ')[0]
         tpeLst.append( (key, val) )
     return tpeLst
Example #4
0
 def parseInstanceListToTypeLst(self, instLstStr):
     instLstStr = instLstStr[1:-1]
     instLst = methodparse.safesplitfields(instLstStr, ',')
     tpeLst = []
     for inst in instLst:
         key, val = inst[1:-1].split(', ')
         val = val[1:].split(' ')[0]
         tpeLst.append((key, val))
     return tpeLst
Example #5
0
 def getPropNames(self, name):
     for prop in self.propItems:
         if prop[0] == name:
             strOpts = prop[4]
             if strOpts and strOpts[:2] != '##':
                 return methodparse.safesplitfields(strOpts, ',')
             else: return ()
     else:
         return ()
 def getPropNames(self, name):
     for prop in self.propItems:
         if prop[0] == name:
             strOpts = prop[4]
             if strOpts and strOpts[:2] != '##':
                 return methodparse.safesplitfields(strOpts, ',')
             else:
                 return ()
     else:
         return ()
 def __init__(self, parent, bitmapsSrc, companion):
     self._init_ctrls(parent)
     
     self.selection = -1
     self.parent = parent
     self.companion = companion
     self.bitmapsSrc = bitmapsSrc
     self.imageList = None
     self.bitmapsSrcEntries = methodparse.safesplitfields(bitmapsSrc[1:-1], ',')
     self.bitmaps = self.companion.eval(bitmapsSrc)
     self.width, self.height = -1, -1
     self.initImageListCtrl()
Example #8
0
    def __init__(self, parent, bitmapsSrc, companion):
        self._init_ctrls(parent)

        self.selection = -1
        self.parent = parent
        self.companion = companion
        self.bitmapsSrc = bitmapsSrc
        self.imageList = None
        self.bitmapsSrcEntries = methodparse.safesplitfields(
            bitmapsSrc[1:-1], ',')
        self.bitmaps = self.companion.eval(bitmapsSrc)
        self.width, self.height = -1, -1
        self.initImageListCtrl()
    def OnDebugApp(self, event=None, debugModel=None):
        model = self.getModel()
        if self.checkUnsaved(model): return
        if debugModel is None:
            if model.app:
                debugModel = model.app
            else:
                debugModel = model

        if debugModel.lastRunParams:
            params = methodparse.safesplitfields(debugModel.lastRunParams, ' ')
        else:
            params = None
        debugModel.debug(params, cont_if_running=1)
 def OnSetRunParams(self, event):
     model = self.getModel()
     dlg = wx.TextEntryDialog(self.editor, _('Parameters:'),
       _('Command-line parameters'), model.lastRunParams)
     try:
         if dlg.ShowModal() == wx.ID_OK:
             model.lastRunParams = dlg.GetValue()
             # update running debuggers debugging this module
             debugger = self.editor.debugger
             if debugger and debugger.filename == model.localFilename():
                 if model.lastRunParams:
                     params = methodparse.safesplitfields(model.lastRunParams, ' ')
                 else:
                     params = []
                 self.editor.debugger.setParams(params)
     finally:
         dlg.Destroy()