Commits

Anonymous committed 1cf8294

New debugger code. Keys now imported from Preferences.

  • Participants
  • Parent commits 8846928

Comments (0)

Files changed (1)

 from Views.DiffView import PythonSourceDiffView
 from Views.AppViews import AppCompareView
 from Views import ObjCollection
-from PrefsKeys import keyDefs
-from Debugger import Debugger
+from Preferences import keyDefs
 from Utils import AddToolButtonBmpIS
 import moduleparse, relpath
 from sourceconst import *
+from Preferences import Debugger
 
 # Special import for the profiler
 import wxPython
 
 true = 1;false = 0
 
+_vc_hook = None
+
 class EditorModel:
     defaultName = 'abstract'
     bitmap = 'None'
 
     def getDataAsLines(self):
         return string.split(self.data, '\012')
+
     def setDataFromLines(self, lines):
+        data = self.data
         self.data = string.join(lines, '\012')
+        self.modified = self.modified or self.data != data
 
 
     def notify(self):
             self.transport.save(self.filename, self.data, mode='w')
             self.modified = false
             self.saved = true
+            
+            for view in self.views.values():
+                view.saveNotification()
+            
+            if _vc_hook:
+                _vc_hook.save(self.filename, self.data, mode='w')
         else:
             raise 'No filename'
 
 
         blocks = Utils.split_seq(lines[start+1 : start+size], '=======')
         lines[start:start+size+1] = blocks[blockIdx]
-        self.data = self.setDataFromLines(lines)
+        self.setDataFromLines(lines)
 
         self.update()
         self.notify()
+        
+        self.editor.updateModulePage(self)
+        self.editor.updateTitle()
 
     def acceptConflictChange(self, conflict):
         self.applyChangeBlock(conflict, 1)
             wx.wxLogWarning('Save before running Cyclops')
             raise 'Not saved yet!'
 
-    def debug(self, params = None):
+    def debug(self, params=None, cont_if_running=0, cont_always=0,
+              temp_breakpoint=None):
         if self.savedAs:
-            if self.editor.debugger:
-                self.editor.debugger.Show(true)
-            else:
-                self.editor.debugger = Debugger.DebuggerFrame(self)
-                self.editor.debugger.Show(true)
-                if params is None: params = []
-                self.editor.debugger.debug_file(self.editor.debugger.filename, params)
-
+            debugger = self.editor.debugger
+            if Preferences.useDebugger == 'old':
+                if debugger:
+                    debugger.Show(true)
+                else:
+                    self.editor.debugger = Debugger.DebuggerFrame(self)
+                    debugger = self.editor.debugger
+                    debugger.Show(true)
+                    if params is None: params = []
+                    debugger.debug_file(debugger.filename, params)
+            elif Preferences.useDebugger == 'new':
+                if not debugger:
+                    if self.defaultName != 'App' and self.app:
+                        filename = self.app.filename
+                    else:
+                        filename = self.filename
+                    debugger = Debugger.DebuggerFrame(self.editor, filename)
+                    debugger.setDebugClient()
+                    self.editor.debugger = debugger
+                    debugger.setParams(params)
+                debugger.Show(true)
+                debugger.ensureRunning(cont_if_running, cont_always,
+                                       temp_breakpoint)
+    
     def profile(self):
         # XXX Should change to the profile file directory
         if self.savedAs:
         equivalents, e.g.
         _custom_classes = {'wxTreeCtrl': ['MyTreeCtrl', 'AdvancedTreeCtrl']}
         
-        These custom classes will then be available to the Designer
-        and will act as equivalent to the corresponding wxPython class,
-        but will generate source for the custom definition.
-
-        One implication is that you loose the constructor. Because Boa
-        will generate the creation code for the object the constructor
-        signature has to be the same as the wxPython class.
+        These custom classes will then be available to the Designer
+        and will act as equivalent to the corresponding wxPython class,
+        but will generate source for the custom definition.
+        
+        One implication is that you loose the constructor. Because Boa
+        will generate the creation code for the object, the constructor
+        signature has to be the same as the wxPython class.
         """
         res = {}
         if cls.class_attributes.has_key('_custom_classes'):
                 self.moduleModels[name], main = identifySource(
                     self.editor.modules[os.path.basename(absPath)\
                                        ].model.getModule().source)
-            else:
-                print 'could not find unsaved module', absPath, self.editor.modules
 
     def readModules(self):
         modS, modE = self.findModules()
                 return headerInfo
         else:
             return ModuleModel, ''
-