Anonymous avatar Anonymous committed 93227b5

Only reporting changes to interesting files for SOI

Comments (0)

Files changed (1)

ropemacs/__init__.py

     @lisphook
     def before_save_actions(self):
         if self.project is not None:
+            if not self._is_python_file(lisp.buffer_file_name()):
+                return
             resource = self._get_resource()
-            if resource is not None and resource.exists():
+            if resource.exists():
                 self.old_content = resource.read()
             else:
                 self.old_content = ''
         root = lisputils.ask_directory('Rope project root folder: ')
         if self.project is not None:
             self.close_project()
+        base = 'Opening "%s" project ... ' % root
+        lisputils.message(base)
         self.project = project.Project(root)
-        lisputils.message('Project "%s" opened' % self.project.address)
+        lisputils.message(base + 'done')
 
     @interactive
     def close_project(self):
         if self.project is not None:
-            path = self.project.address
+            base = 'Closing "%s" project ... ' % self.project.address
+            lisputils.message(base)
             self.project.close()
             self.project = None
-            lisp.message('Project "%s" closed' % path)
+            lisp.message(base + 'done')
 
     @interactive
     def undo_refactoring(self):
         for buffer in buffers:
             filename = lisp.buffer_file_name(buffer)
             if filename:
-                if self._is_a_project_python_file(filename) and \
+                if self._is_python_file(filename) and \
                    lisp.buffer_modified_p(buffer):
                     if not ask or lisp.y_or_n_p('Save %s buffer?' % filename):
                         lisp.set_buffer(buffer)
                         lisp.save_buffer()
         lisp.set_buffer(initial)
 
-    def _is_a_project_python_file(self, path):
+    def _is_python_file(self, path):
         resource = self._get_resource(path)
-        return (resource is not None and resource.exists() and
+        return (resource is not None and
                 resource.project == self.project and
                 self.project.pycore.is_python_file(resource))
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.