def OnUpdatePosIndicator(self, cmdui): editControl = scriptutils.GetActiveEditControl() value = " " * 5 if editControl is not None: try: startChar, endChar = editControl.GetSel() lineNo = editControl.LineFromChar(startChar) colNo = endChar - editControl.LineIndex(lineNo) if cmdui.m_nID == win32ui.ID_INDICATOR_LINENUM: value = "%0*d" % (5, lineNo + 1) else: value = "%0*d" % (3, colNo + 1) except win32ui.error: pass cmdui.SetText(value) cmdui.Enable()
def _GetControl(control=None): if control is None: control = scriptutils.GetActiveEditControl() return control