X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1f780e48af479e7bf9a07eaaa1ab6b41f1ffb17b..b81383bbd984f1b0aad8db92d7be069f2a23fa74:/wxPython/samples/ide/activegrid/tool/CodeEditor.py diff --git a/wxPython/samples/ide/activegrid/tool/CodeEditor.py b/wxPython/samples/ide/activegrid/tool/CodeEditor.py index 09a96abf53..d8a158a0ee 100644 --- a/wxPython/samples/ide/activegrid/tool/CodeEditor.py +++ b/wxPython/samples/ide/activegrid/tool/CodeEditor.py @@ -117,7 +117,6 @@ class CodeView(STCTextEditor.TextView): def ProcessUpdateUIEvent(self, event): if not self.GetCtrl(): return False - hasText = self.GetCtrl().GetTextLength() > 0 id = event.GetId() if id == EXPAND_TEXT_ID: event.Enable(self.GetCtrl().CanLineExpand(self.GetCtrl().GetCurrentLine())) @@ -125,49 +124,29 @@ class CodeView(STCTextEditor.TextView): elif id == COLLAPSE_TEXT_ID: event.Enable(self.GetCtrl().CanLineCollapse(self.GetCtrl().GetCurrentLine())) return True - elif id == EXPAND_TOP_ID: - event.Enable(hasText) - return True - elif id == COLLAPSE_TOP_ID: - event.Enable(hasText) - return True - elif id == EXPAND_ALL_ID: - event.Enable(hasText) - return True - elif id == COLLAPSE_ALL_ID: - event.Enable(hasText) + elif (id == EXPAND_TOP_ID + or id == COLLAPSE_TOP_ID + or id == EXPAND_ALL_ID + or id == COLLAPSE_ALL_ID + or id == AUTO_COMPLETE_ID + or id == CLEAN_WHITESPACE + or id == INDENT_LINES_ID + or id == DEDENT_LINES_ID + or id == COMMENT_LINES_ID + or id == UNCOMMENT_LINES_ID): + event.Enable(self.GetCtrl().GetTextLength() > 0) return True elif id == CHECK_CODE_ID: event.Enable(False) return True - elif id == AUTO_COMPLETE_ID: - event.Enable(hasText) - return True - elif id == CLEAN_WHITESPACE: - event.Enable(hasText) - return True - elif id == SET_INDENT_WIDTH_ID: + elif (id == SET_INDENT_WIDTH_ID + or id == FOLDING_ID): event.Enable(True) return True elif id == USE_TABS_ID: event.Enable(True) event.Check(self.GetCtrl().GetUseTabs()) return True - elif id == INDENT_LINES_ID: - event.Enable(hasText) - return True - elif id == DEDENT_LINES_ID: - event.Enable(hasText) - return True - elif id == COMMENT_LINES_ID: - event.Enable(hasText) - return True - elif id == UNCOMMENT_LINES_ID: - event.Enable(hasText) - return True - elif id == FOLDING_ID: - event.Enable(True) - return True else: return STCTextEditor.TextView.ProcessUpdateUIEvent(self, event) @@ -324,7 +303,7 @@ class CodeView(STCTextEditor.TextView): self.GetCtrl().SetSelection(pos, pos) self._GetParentFrame().SetStatusText(_("Syntax Error: %s") % message) except: - self._GetParentFrame().SetStatusText(sys.exc_info()[0]) + self._GetParentFrame().SetStatusText("%s: %s" % (sys.exc_info()[0], sys.exc_info()[1])) def OnAutoComplete(self): @@ -625,52 +604,22 @@ class CodeService(STCTextEditor.TextService): def ProcessUpdateUIEvent(self, event): id = event.GetId() - if id == EXPAND_TEXT_ID: - event.Enable(False) - return True - elif id == COLLAPSE_TEXT_ID: - event.Enable(False) - return True - elif id == EXPAND_TOP_ID: - event.Enable(False) - return True - elif id == COLLAPSE_TOP_ID: - event.Enable(False) - return True - elif id == EXPAND_ALL_ID: - event.Enable(False) - return True - elif id == COLLAPSE_ALL_ID: - event.Enable(False) - return True - elif id == CHECK_CODE_ID: - event.Enable(False) - return True - elif id == AUTO_COMPLETE_ID: - event.Enable(False) - return True - elif id == CLEAN_WHITESPACE: - event.Enable(False) - return True - elif id == SET_INDENT_WIDTH_ID: - event.Enable(False) - return True - elif id == USE_TABS_ID: - event.Enable(False) - return True - elif id == INDENT_LINES_ID: - event.Enable(False) - return True - elif id == DEDENT_LINES_ID: - event.Enable(False) - return True - elif id == COMMENT_LINES_ID: - event.Enable(False) - return True - elif id == UNCOMMENT_LINES_ID: - event.Enable(False) - return True - elif id == FOLDING_ID: + if (id == EXPAND_TEXT_ID + or id == COLLAPSE_TEXT_ID + or id == EXPAND_TOP_ID + or id == COLLAPSE_TOP_ID + or id == EXPAND_ALL_ID + or id == COLLAPSE_ALL_ID + or id == CHECK_CODE_ID + or id == AUTO_COMPLETE_ID + or id == CLEAN_WHITESPACE + or id == SET_INDENT_WIDTH_ID + or id == USE_TABS_ID + or id == INDENT_LINES_ID + or id == DEDENT_LINES_ID + or id == COMMENT_LINES_ID + or id == UNCOMMENT_LINES_ID + or id == FOLDING_ID): event.Enable(False) return True else: