- Timestamp:
- 10/01/05 17:02:06 (3 years ago)
- Files:
-
- nbshell/trunk/ChangeLog (modified) (1 diff)
- nbshell/trunk/nbshell/FigurePlugin.py (modified) (1 diff)
- nbshell/trunk/nbshell/PlainTextPlugin.py (modified) (1 diff)
- nbshell/trunk/nbshell/PythonPlugin.py (modified) (1 diff)
- nbshell/trunk/nbshell/Sheet.py (modified) (4 diffs)
- nbshell/trunk/nbshell/testtools.py (added)
- nbshell/trunk/nbshell/textplugin.py (modified) (1 diff)
- nbshell/trunk/nbshell/utils.py (modified) (1 diff)
- nbshell/trunk/old_tutorial.pybk (copied) (copied from nbshell/trunk/tutorial.pybk)
- nbshell/trunk/tutorial.pybk (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
nbshell/trunk/ChangeLog
r860 r910 1 2005-10-02 Tzanko Matev <tsanko@gmail.com> 2 3 * testtools.py: Added some tools for automatic testing of 4 functions. See the documentation of testtools.reverse_verifier for 5 more info and Sheet.InsertCell for an example of how to use them. 6 Also fixed a small bug in the xxxNotebookViewPlugin.Close() 7 methods of all plugins which was found when I added the 8 verification to InsertCell 9 10 * tutorial.pybk: Changed the tutorial to an ordinary notebook and 11 added some more text. The old tutorial is in old_tutorial.pybk. I 12 did this because the old tutorial was too confusing for novice 13 users (as Robert pointed out). 14 1 15 2005-09-19 Robert Kern <robert.kern@gmail.com> 2 16 nbshell/trunk/nbshell/FigurePlugin.py
r850 r910 201 201 pass 202 202 203 def Close(self, update=True): 204 """ This method is called when the document cell is 205 destroyed. It must close all windows. If update is false, do 206 not update the view""" 207 index = self.view.GetIndex(self.id) 208 self.view.DeleteCell(index, update) 209 203 def Close(self, update = True): 204 if self.window is not None: 205 index = self.view.GetIndex(self.id) 206 self.view.DeleteCell(index, update) 207 210 208 position = property(fget = lambda :0, fset = lambda x:None) 211 209 nbshell/trunk/nbshell/PlainTextPlugin.py
r852 r910 308 308 309 309 def Close(self, update = True): 310 index = self.view.GetIndex(self.id) 311 self.view.DeleteCell(index, update) 310 if self.window is not None: 311 index = self.view.GetIndex(self.id) 312 self.view.DeleteCell(index, update) 312 313 313 314 def InsertCode(self): nbshell/trunk/nbshell/PythonPlugin.py
r850 r910 822 822 823 823 def Close(self, update = True): 824 index = self.view.GetIndex(self.id) 825 self.view.DeleteCell(index, update) 824 if self.window is not None: 825 index = self.view.GetIndex(self.id) 826 self.view.DeleteCell(index, update) 826 827 827 828 def Copy(self): nbshell/trunk/nbshell/Sheet.py
r852 r910 23 23 from nbshell.utils import * 24 24 from nbshell import SimpleXMLWriter 25 26 from nbshell import testtools 25 27 26 28 … … 72 74 cell.view.SetFocus() 73 75 currentcell = property(fget = __get_current_cell, fset = __set_current_cell) 76 77 def DeleteCell(self, cell, update = True): 78 """Deletes a given element in celllist""" 79 #Change the current cell if necessary 80 if self.currentcell == cell: 81 if cell.index < len(self.celllist) -1: 82 self.currentcell = self.celllist[cell.index+1] 83 elif cell.index>0: 84 self.currentcell = self.celllist[cell.index-1] 85 else: 86 self.currentcell = None 87 88 89 cell.view.Close(update = False) 90 index = cell.index 91 self.__del_cell(cell.index) 92 self.Update(update = False, dicts = True) 93 94 #Concatenate the prevoius and the next cells if they are of the same 95 #type 96 if index > 0 and index < len(self.celllist) and\ 97 self.celllist[index-1].type == self.celllist[index].type: 98 if self.celllist[index-1].Concat(self.celllist[index]): 99 self.DeleteCell(self.celllist[index], update =False) 100 101 self.Update(update) 74 102 103 @testtools.verify 104 @testtools.reverse_decorator(DeleteCell, "[x.type for x in self.celllist]", 105 "{'self':self, 'cell':self.celllist[pos], 'update':update}", 106 "[x.type for x in self.celllist]") 75 107 def InsertCell(self, type, pos=-1, update = True, **kwds): 76 108 """Inserts a cell of the given type with the given data at the given … … 93 125 return cell 94 126 95 def DeleteCell(self, cell, update = True):96 """Deletes a given element in celllist"""97 #Change the current cell if necessary98 if self.currentcell == cell:99 if cell.index < len(self.celllist) -1:100 self.currentcell = self.celllist[cell.index+1]101 elif cell.index>0:102 self.currentcell = self.celllist[cell.index-1]103 else:104 self.currentcell = None105 106 107 cell.view.Close(update = False)108 index = cell.index109 self.__del_cell(cell.index)110 self.Update(update = False, dicts = True)111 112 #Concatenate the prevoius and the next cells if they are of the same113 #type114 if index > 0 and index < len(self.celllist) and\115 self.celllist[index-1].type == self.celllist[index].type:116 if self.celllist[index-1].Concat(self.celllist[index]):117 self.DeleteCell(self.celllist[index], update =False)118 119 self.Update(update)120 121 def __del_text_cell(self,cell,update = False):122 """Deletes the given text cell. Does not check if this is the first or123 last text cell"""124 #TODO: write this125 return126 127 def __del_code_cell(self,cell,update = False):128 #TODO: write this129 return130 131 127 def Update(self, update = True, celllist = False, dicts = False, output = False): 132 128 … … 311 307 #This is a simple match, create the block, giving the 312 308 #element as a parameter 309 print dir(self) 313 310 self.InsertCell(plugin_string, update=False, element = child) 314 311 #get the next element nbshell/trunk/nbshell/textplugin.py
r850 r910 306 306 return False 307 307 modified = property(fget = IsModified) 308 308 309 309 def Close(self, update = True): 310 index = self.view.GetIndex(self.id) 311 self.view.DeleteCell(index, update) 312 310 if self.window is not None: 311 index = self.view.GetIndex(self.id) 312 self.view.DeleteCell(index, update) 313 313 314 def InsertCode(self): 314 315 #self.doc.text = self.window.GetText() nbshell/trunk/nbshell/utils.py
r823 r910 138 138 global oldtime 139 139 t0 = 0 140
