[SE|PY-CVS] SF.net SVN: sepy: [6]
Brought to you by:
sephiroth_tmm
From: <sep...@us...> - 2006-03-31 09:59:47
|
Revision: 6 Author: sephiroth_tmm Date: 2006-03-31 01:59:30 -0800 (Fri, 31 Mar 2006) ViewCVS: http://svn.sourceforge.net/sepy/?rev=6&view=rev Log Message: ----------- Modified Paths: -------------- SEPY.py core/documents/compare.py core/documents/editor.py core/documents/flex.py core/documents/swfmill.py core/documents/xhtml.py core/threads/Threads.py Modified: SEPY.py =================================================================== --- SEPY.py 2006-03-30 23:46:20 UTC (rev 5) +++ SEPY.py 2006-03-31 09:59:30 UTC (rev 6) @@ -39,6 +39,10 @@ else: from core.io.FileDropTarget import FileDropTarget + +import FrmStdoutStderr + + class main_window(wx.Frame): """ Main SEPY Window """ def __init__(self, *args, **kwds): @@ -2157,7 +2161,7 @@ try: import core.documents documentClass = getattr(core.documents, kwds.get('documentClass')) - view = documentClass.Document(panel, id, doc_name, self, text, **kwds) + view = documentClass.Editor(panel, id, doc_name, self, text, **kwds) except: self.notebook.Thaw() panel.Destroy() @@ -2687,8 +2691,6 @@ if doc.IsModifyed == 1: try: q_string = "%s %s ?" % (_("Do you want to save"), doc.filename) - except UnicodeDecodeError: - q_string = _("Do you want to save first?") except: q_string = _("Do you want to save first?") result = wx.MessageDialog(self, q_string, core.ui.dialogs.about.title, wx.YES_NO|wx.CANCEL|wx.ICON_EXCLAMATION).ShowModal() @@ -2704,10 +2706,10 @@ def ClearDocument(self, document, documentID, selection): """ clear document and send event to everyone """ - self.SendEvent("CLOSE", documentID) - document.isdying = True + document.Deleted = True document.Disconnect(-1, -1, stc.EVT_STC_PAINTED.evtType[0]) document.Disconnect(-1, -1, stc.EVT_STC_DWELLSTART.evtType[0]) + self.SendEvent("CLOSE", documentID) if document.MainThread: if document.MainThread.isAlive(): document.MainThread.stop() @@ -5336,6 +5338,7 @@ def OpenFrame(self): global frame frame = main_window(parent=None, id=wx.NewId(), title=core.ui.dialogs.about.title, dialog = None) + FrmStdoutStderr.FrameStdoutStderr(frame, -1, (400, 0), (500, 300)) def exc_hook(a,b,traceback): Modified: core/documents/compare.py =================================================================== --- core/documents/compare.py 2006-03-30 23:46:20 UTC (rev 5) +++ core/documents/compare.py 2006-03-31 09:59:30 UTC (rev 6) @@ -11,13 +11,14 @@ import editor from core.system.id import * -class Document(editor.Editor): +class Editor(editor.Editor): + def __init__(self, parent, id, filename, super_parent, text = '', **kwds): stc.StyledTextCtrl.__init__(self, parent ,id, wx.DefaultPosition, wx.DefaultSize, wx.TE_NOHIDESEL|wx.NO_FULL_REPAINT_ON_RESIZE, 'styledTextCtrl') self.log = super_parent.log self.custom = None self.MainThread = None - self.isdying = False + self.Deleted = False classpaths = None stat = kwds.get('stat', None) self.todolist = [] Modified: core/documents/editor.py =================================================================== --- core/documents/editor.py 2006-03-30 23:46:20 UTC (rev 5) +++ core/documents/editor.py 2006-03-31 09:59:30 UTC (rev 6) @@ -169,7 +169,7 @@ self.log = super_parent.log self.custom = CustomManager() self.MainThread = None - self.isdying = False + self.Deleted = False classpaths = kwds.get('classpaths', None) newlines = kwds.get('newlines', None) stat = kwds.get('stat', None) @@ -687,37 +687,45 @@ def onDwellStart(self, event): """ mouse stop moving for 2 seconds """ - if self.IsBeingDeleted(): return - event.Skip() + if Editor.IsDeleted(self): return + #event.Skip() if self.MainThread == None or not self.MainThread.isAlive(): del self.MainThread self.MainThread = core.threads.Threads.EditorParserThread(win=self) self.MainThread.start() + #wx.CallAfter(self.super_parent.OnCloseDocument, None) + @staticmethod + def IsDeleted(instance): + try: + if instance.Deleted: return True + return instance.IsBeingDeleted() + except wx.PyDeadObjectError: + return True + + def updateDocumentState(self,*args,**kwds): """ Update functions and variables """ - if self.isdying or not self.IsASFile(): return True + if Editor.IsDeleted(self): return True try: self.updateFunctionList() - if self.isdying: return True + if Editor.IsDeleted(self): return True self.updateVarsList() except: pass try: + if Editor.IsDeleted(self): return True self.super_parent.todoParser.CheckFile(self.GetId(),doc=self) - except wx.PyDeadObjectError: + except: pass - except AttributeError: - """ we should never have an Attribute Error here! """ - pass return True # execute thread def __execute__(self, fname, *args): try: - if not self.IsBeingDeleted(): + if not Editor.IsDeleted(self): return eval('self.%s' % fname)(*args) except TypeError: pass @@ -1785,6 +1793,7 @@ if not self.IsASFile(): return "",[] self.userFunctions = [] + if Editor.IsDeleted(self): return True self.initDB() self.updateKeywords() try: @@ -1792,15 +1801,17 @@ except: functionList = [] return "",[] + if Editor.IsDeleted(self): return True imported_class = re.finditer(core.system.patterns.i_pattern, self.GetText(), re.IGNORECASE|re.UNICODE|re.MULTILINE) if imported_class: while 1: + if Editor.IsDeleted(self): return True try: g = imported_class.next() functionList.append([g, g.end(), ""]) except StopIteration: break - if self.isdying: return True + if Editor.IsDeleted(self): return True self.super_parent.SendEvent('UPDFN', [self.GetId(), functionList]) self._matchProperties(self.GetText()) @@ -1851,7 +1862,7 @@ return h = self.varsPattern.finditer( word ) while 1: - if self.isdying: return True + if Editor.IsDeleted(self): return True try: g = h.next() except: @@ -1902,12 +1913,13 @@ Get the corresponding brace Used in GetFunctions """ + if Editor.IsDeleted(self): return -1 return self.BraceMatch(text.find("{", pos)) def GetFunctions(self, *args): """ Get file methods """ - if not self.IsASFile(): return [] + if not self.IsASFile() or Editor.IsDeleted(self): return [] try: text = self.GetTextRaw() except: @@ -1922,16 +1934,20 @@ comment = self.GetJavaDocCommentAt(class_g.start()) fn.append([class_g, nextPos, comment]) # matching all methods + if Editor.IsDeleted(self): return [] self.__calltips = {} met_g = self.m_pattern.finditer(text) while 1: - if self.isdying: return True + if Editor.IsDeleted(self): return True try: g = met_g.next() except: break + if Editor.IsDeleted(self): return True if not self._isInvalidStyleAt(g.end()): + if Editor.IsDeleted(self): return True nextPos = self.GetBracePosition(text,g.end()) + if Editor.IsDeleted(self): return True comment = self.GetJavaDocCommentAt(g.start()) # add the current function declaration to the calltip list @@ -1948,8 +1964,8 @@ full_name = gd.get('name3') ret_type = gd.get('return_type3') param_list = gd.get('param_list3') + if Editor.IsDeleted(self): return True self.__calltips[full_name] = "%s(%s) %s" % (full_name, param_list, ret_type) - fn.append([g, nextPos, comment]) return fn @@ -1960,7 +1976,7 @@ # ****************************** def GetJavaDocCommentAt(self, position): pos_start = position - if position < 2: + if position < 2 or Editor.IsDeleted(self): return "" #comment_end_pos = pos_start pos_start = comment_end_pos = self.PositionFromLine(self.LineFromPosition(pos_start)) @@ -1971,6 +1987,7 @@ stc.STC_C_COMMENT, \ stc.STC_C_COMMENTDOCKEYWORDERROR, \ stc.STC_C_DEFAULT]: + if Editor.IsDeleted(self): return True pos_start -= 1 if pos_start < 0: break @@ -1985,7 +2002,7 @@ # ************************************ def updateVarsList(self): for line in xrange(self.GetLineCount()): - if self.isdying: return True + if Editor.IsDeleted(self): return True currentLine = self.GetLine(line) try: self._matchVars(currentLine) @@ -2131,7 +2148,7 @@ """Scintilla has just painted""" evt.Skip() try: - if not self.IsBeingDeleted(): + if not Editor.IsDeleted(self): wx.CallAfter(self.UpdateBorder, False) except TypeError: pass @@ -2623,7 +2640,7 @@ def UpdateBorder(self, forceRefresh=False): """ call the border panel instance refresh """ try: - if not self.IsBeingDeleted(): + if not Editor.IsDeleted(self): self.border_panel.UpdateBorder(force=forceRefresh) except wx.PyDeadObjectError: pass Modified: core/documents/flex.py =================================================================== --- core/documents/flex.py 2006-03-30 23:46:20 UTC (rev 5) +++ core/documents/flex.py 2006-03-31 09:59:30 UTC (rev 6) @@ -131,12 +131,11 @@ def __init__(self, parent, id, filename, super_parent, text = '', **kwds): stc.StyledTextCtrl.__init__(self, parent ,id, wx.DefaultPosition, wx.DefaultSize, wx.TE_NOHIDESEL|wx.NO_FULL_REPAINT_ON_RESIZE, 'styledTextCtrl') self.log = super_parent.log - global log log = self.log self.custom = FlexManager(os.path.join(super_parent.base_path, "data", "flex.sqlite")) self.parser = FlexParser() self.MainThread = None - self.isdying = False + self.Deleted = False classpaths = kwds.get('classpaths', None) newlines = kwds.get('newlines', None) stat = kwds.get('stat', None) @@ -515,7 +514,6 @@ self.log.error(str(why)) functionList = [] return "",[] - if self.isdying: return True def GetFunctions(self, *args): Modified: core/documents/swfmill.py =================================================================== --- core/documents/swfmill.py 2006-03-30 23:46:20 UTC (rev 5) +++ core/documents/swfmill.py 2006-03-31 09:59:30 UTC (rev 6) @@ -174,12 +174,11 @@ def __init__(self, parent, id, filename, super_parent, text = '', **kwds): stc.StyledTextCtrl.__init__(self, parent ,id, wx.DefaultPosition, wx.DefaultSize, wx.TE_NOHIDESEL|wx.NO_FULL_REPAINT_ON_RESIZE, 'styledTextCtrl') self.log = super_parent.log - global log log = self.log self.custom = SwfmlManager(os.path.join(super_parent.base_path, "data", "swfmill.sqlite")) self.parser = SWFMLParser() self.MainThread = None - self.isdying = False + self.Deleted = False classpaths = kwds.get('classpaths', None) newlines = kwds.get('newlines', None) stat = kwds.get('stat', None) @@ -337,7 +336,7 @@ def __execute__(self, fname, *args): """ execute thread """ - if not self.IsBeingDeleted(): + if not Editor.IsDeleted(self): return eval('self.%s' % fname)(*args) @@ -576,7 +575,6 @@ except Exception, why: functionList = [] return "",[] - if self.isdying: return True def GetFunctions(self, *args): Modified: core/documents/xhtml.py =================================================================== --- core/documents/xhtml.py 2006-03-30 23:46:20 UTC (rev 5) +++ core/documents/xhtml.py 2006-03-31 09:59:30 UTC (rev 6) @@ -139,17 +139,16 @@ class Editor(swfmill.Editor): """ - Flex Editor Class + XHTML Editor Class """ def __init__(self, parent, id, filename, super_parent, text = '', **kwds): stc.StyledTextCtrl.__init__(self, parent ,id, wx.DefaultPosition, wx.DefaultSize, wx.TE_NOHIDESEL|wx.NO_FULL_REPAINT_ON_RESIZE, 'styledTextCtrl') self.log = super_parent.log - global log log = self.log self.custom = XMLManager(os.path.join(super_parent.base_path, "data", "xhtml.sqlite")) self.parser = XmlParser() self.MainThread = None - self.isdying = False + self.Deleted = False classpaths = kwds.get('classpaths', None) newlines = kwds.get('newlines', None) stat = kwds.get('stat', None) @@ -506,8 +505,6 @@ self.log.error(str(why)) functionList = [] return "",[] - if self.isdying: return True - #self.super_parent.SendEvent('UPDFN', [self.GetId(), functionList]) def GetFunctions(self, *args): self.parser.RefreshTokens(self.GetText()) Modified: core/threads/Threads.py =================================================================== --- core/threads/Threads.py 2006-03-30 23:46:20 UTC (rev 5) +++ core/threads/Threads.py 2006-03-31 09:59:30 UTC (rev 6) @@ -2,8 +2,10 @@ # -*- coding: utf-8 -*- # @version $Id: Threads.py,v 1.1 2006/03/26 12:59:24 sephiroth_tmm Exp $ +import sys import threading import wx +import core.documents.editor # ************************* # Thread class @@ -28,10 +30,11 @@ sem.acquire() try: if self.win and not isinstance(self.win, wx.PyDeadObjectError): - if not self.win.IsBeingDeleted(): + if not core.documents.editor.Editor.IsDeleted(self.win): self.win.updateDocumentState() finally: sem.release() def stop(self): + self.win.Deleted = True self.win = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |