[SE|PY-CVS] SF.net SVN: sepy: [7]
Brought to you by:
sephiroth_tmm
From: <sep...@us...> - 2006-03-31 11:34:59
|
Revision: 7 Author: sephiroth_tmm Date: 2006-03-31 03:34:47 -0800 (Fri, 31 Mar 2006) ViewCVS: http://svn.sourceforge.net/sepy/?rev=7&view=rev Log Message: ----------- Modified Paths: -------------- SEPY.py core/documents/editor.py core/ui/panels/workspace/__init__.py Modified: SEPY.py =================================================================== --- SEPY.py 2006-03-31 09:59:30 UTC (rev 6) +++ SEPY.py 2006-03-31 11:34:47 UTC (rev 7) @@ -40,9 +40,6 @@ from core.io.FileDropTarget import FileDropTarget -import FrmStdoutStderr - - class main_window(wx.Frame): """ Main SEPY Window """ def __init__(self, *args, **kwds): @@ -1140,6 +1137,16 @@ break + def GetSelectionById(self, id): + """ find the document instance from its id """ + for line in xrange(self.notebook.GetPageCount()): + doc = self.GetTextCtrl(sel=line) + if doc.GetId() == id: + return line + else: + return None + + def CheckFolderPathFromProject(self, item): """ check if selected folder exists in the filesystem path @@ -2687,7 +2694,6 @@ return doc = self.GetTextCtrl(self.notebook.GetPage(sel).GetId()) del_id = doc.GetId() - ''' save document to filemanager ''' if doc.IsModifyed == 1: try: q_string = "%s %s ?" % (_("Do you want to save"), doc.filename) @@ -2709,15 +2715,20 @@ 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(): + # Wait until the current tread die + document.MainThread.join() document.MainThread.stop() - del document.MainThread + document.MainThread = None + # Stop the closing operation if the + # document thread is running? + #return False try: document.SaveTimer.Stop() except: pass + self.SendEvent("CLOSE", documentID) self.sqlmanager.AddItem(document) self.notebook.DeletePage(selection) if self.notebook.GetPageCount() == 0: @@ -2727,9 +2738,19 @@ self.mainmenu.Enable(ID_SAVE, 0) self.mainmenu.Enable(ID_SAVA, 0) - # -- - # -- SESSION - # -- + + + def ClearDocumentById(self, document): + """ + execute the ClearDocument() method using the document id + to find the current notebook selection first + """ + sel = self.GetSelectionById(document.GetId()) + if sel != None: + self.ClearDocument(document, document.GetId(), sel) + + + def EnableSessionMenu(self, evt): if evt: self.menu.FindItemById(ID_SESS_SAVE).Enable(1) @@ -5338,9 +5359,12 @@ 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)) + # For testing threads using only one output window + # import FrmStdoutStderr + # FrmStdoutStderr.FrameStdoutStderr(frame, -1, (400, 0), (500, 300)) + def exc_hook(a,b,traceback): global frame """ Modified: core/documents/editor.py =================================================================== --- core/documents/editor.py 2006-03-31 09:59:30 UTC (rev 6) +++ core/documents/editor.py 2006-03-31 11:34:47 UTC (rev 7) @@ -686,14 +686,15 @@ wx.CallAfter(self.super_parent.DisableMenuIfNotModified, False ) def onDwellStart(self, event): - """ mouse stop moving for 2 seconds """ + """ mouse stop moving for n seconds """ if Editor.IsDeleted(self): return - #event.Skip() if self.MainThread == None or not self.MainThread.isAlive(): - del self.MainThread + self.MainThread = None self.MainThread = core.threads.Threads.EditorParserThread(win=self) self.MainThread.start() - #wx.CallAfter(self.super_parent.OnCloseDocument, None) + # Test the thread crash by closing the document itself + # just after thread has been invoked + # wx.CallAfter(self.super_parent.OnCloseDocument, None) @staticmethod Modified: core/ui/panels/workspace/__init__.py =================================================================== --- core/ui/panels/workspace/__init__.py 2006-03-31 09:59:30 UTC (rev 6) +++ core/ui/panels/workspace/__init__.py 2006-03-31 11:34:47 UTC (rev 7) @@ -36,7 +36,7 @@ from xml.parsers.expat import ExpatError -__version__ = "1.6.5" +__version__ = "1.6.6" wx.ID_FILE32, wx.ID_FILE33, wx.ID_FILE34, wx.ID_FILE35, wx.ID_FILE36, wx.ID_FILE37, wx.ID_FILE38, wx.ID_FILE39, wx.ID_FILE40, wx.ID_FILE41, wx.ID_FILE42 = [wx.NewId() for line in xrange(11)] @@ -2082,7 +2082,6 @@ except WindowsError, why: wx.LogWarning(str(why)) return - sc = prj.GetCommands().values() for line in ls: realname = os.path.join(path, line) if os.path.isdir(realname): @@ -2137,10 +2136,13 @@ nitem.SetData(data) newitem = self.tree.AppendItem(item, line, index, index, nitem) + sc = prj.GetCommands().values() for command in sc: if id == command.get('parent_id'): s_path = os.path.normpath(command.get('pathname')).split(os.path.sep) - if path.split(os.path.sep)[-len(s_path):] == s_path: + t_data = self.tree.GetPyData(item) + if (path.split(os.path.sep)[-len(s_path):] == s_path) \ + or (int(t_data.get('type', -1)) == PROJECT_LINKED_FOLDER and t_data.get('id') == command.get('parent_id')): data = dict(type=command.get("type"), name=command.get('name'), exp="", location=command.get('location'), pathname=command.get("pathname"), path=prj.GetProjectFile(), prj=prj, parent_id=command.get('parent_id'), id=command.get('id'), parsed=False) nitem = wx.TreeItemData() nitem.SetData(data) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |