Commits

Henning Schröder committed d3294ff

file save

  • Participants
  • Parent commits 419cc6e

Comments (0)

Files changed (7)

File codeaide/ide/api.py

     """
     """
 
+
 class Window(Interface):
     """
     """
     
     root_path = property()
     python_path = property()
+

File codeaide/ide/simple/base.py

         #self.connect(self, SIGNAL("lastWindowClosed()"), self._force_quit)
         self.settings = api.Settings(self)
         self._main_window = None
+        self._project = api.Project()
+        
+        
+    @property
+    def active_project(self):
+        return self._project
 
 
     @property
         CodeEditor.__init__(self)
 
 
+
+        
+class Project(object):
+    implements(api.Project)
+
+    @property
+    def root_path(self):
+        return os.getcwd()
+
+    

File codeaide/ide/simple/commands.py

 
 
     def execute(self):
-        filename = self.doc.filename
+        filename = self.doc.document().filename
         print "saving", repr(filename)
-        save(filename, unicode(self.doc.toPlainText()))
+        self.doc.save_buffer(filename)
+
 
 
 class FileSaveAsCommand(DocumentCommandBase):
             if not filename:
                 return False
             filename = unicode(filename)
-            self.doc.renameDoc(self.doc.filename, filename)
-
+            self.doc.rename(self.doc.document().filename, filename)
+            self.doc.save_buffer(filename)
 
 
 class FileCloseCommand(DocumentCommandBase):

File codeaide/ide/simple/help.py

 # -*- coding: utf-8 -*-
 from PyQt4.QtCore import Qt, QUrl
-from PyQt4.QtWebKit import QWebView
 
 from codeaide.interface import implements
 from codeaide.ide import api
 from codeaide.ide.simple.utils import call_on_idle
 
 
-
-class HelpBrowser(QWebView):
-    
-    def __init__(self, parent):
-        QWebView.__init__(self, parent)
-        call_on_idle(self.load, QUrl("http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/classes.html"))
-
-
-
         
 class HelpDock(DockBase):
     implements(api.Dock)
 
 
     def create_widget(self, parent):
+        from PyQt4.QtWebKit import QWebView
+
+        class HelpBrowser(QWebView):
+            
+            def __init__(self, parent):
+                QWebView.__init__(self, parent)
+                call_on_idle(self.load, QUrl("http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/classes.html"))
+    
+
         browser = HelpBrowser(parent)
         browser.resize(300, 300)
         return browser

File codeaide/ide/simple/python.py

 
 from PyQt4.QtCore import Qt, SIGNAL, QUrl, QDir
 from PyQt4.QtGui import QColor, QTreeWidget, QTreeWidgetItem, QTreeView, QFileSystemModel, QDirModel, QFrame
-from PyQt4.QtWebKit import QWebView
 
 from codeaide.interface import implements
 from codeaide.ide.base import (
         self.setFrameStyle(QFrame.NoFrame)
         self.fs_model = QFileSystemModel()
         self.fs_model.setNameFilters(["*.py"])
-
-        self.fs_model.setRootPath(QDir.currentPath())
+        
+        #self.fs_model.setRootPath(QDir.currentPath())
+        self.fs_model.setRootPath(os.path.abspath(api.Project.instance.root_path))
         self.fs_model.setNameFilterDisables(True)
 
         self.setModel(self.fs_model)

File codeaide/main.py

         doc = self.document()
         filename = filename or doc.filename
         FileIO.instance.save(filename, unicode(doc.toPlainText()))
+        doc.setModified(False)
 
 
+    def rename_buffer(self, filename):
+        doc = self.document()
+        doc.filename = filename
+        
+
     def switch_buffer(self, num):
         doc = Buffer[num]
         self.setDocument(doc)
 
 
     def paintEvent(self, event):
+        # callbacks to paint background (wrap indicator etc)
         viewport = self.viewport()
         before = self.active_paint_hooks_before
         if before:
                 if callback(event, painter, viewport):
                     return
             painter.end()
+        # render text
         QPlainTextEdit.paintEvent(self, event)
+        # callbacks to render foreground (whitespace etc)
         after = self.active_paint_hooks_after
         if after:
             painter = QPainter(viewport)

File codeaide/modes/language/outline.py

-from codeaide.base import *
+# -*- coding: utf-8 -*-
+from PyQt4.QtCore import SIGNAL
+from codeaide.base import ModeBase
+from codeaide.utils import IdleBackgroundCall
 
 
 class OutlineBase(ModeBase):
         self.textedit.structure = []
         self.call = None
         self.init_outline()
-        #self.update_structure()
-        #self.textedit.connect(
-        #   self.textedit, SIGNAL("documentChanged()"), self.on_document_changed)
 
 
     def init_outline(self):
         pass
 
-    
-    def on_document_changed(self):
-        print "doc changed"
-        self.update_structure()
-
 
     def contents_change_hook(self, block_number, block, text, user_data):
         # XXX: better call on QPlainTextEdit.blockCountChanged(int) or