Browse Source

use EventHandler to close project

master 0.7.15
Randy Lai 3 years ago
parent
commit
981bab7f24
No known key found for this signature in database GPG Key ID: C624A96B760AC797
  1. 15
      project_manager.py
  2. 4
      project_manager.sublime-settings
  3. 6
      support/Default (Linux).sublime-keymap
  4. 6
      support/Default (Windows).sublime-keymap

15
project_manager.py

@ -487,7 +487,7 @@ def cancellable(func):
return _ret
class ProjectManagerCloseWindow(sublime_plugin.WindowCommand):
class ProjectManagerCloseProject(sublime_plugin.WindowCommand):
def run(self):
if self.window.project_file_name():
# if it is a project, close the project
@ -500,8 +500,17 @@ class ProjectManagerCloseWindow(sublime_plugin.WindowCommand):
return
# close the sidebar
self.window.run_command('close_project')
# close the window
self.window.run_command('close_window')
class ProjectManagerEventHandler(sublime_plugin.EventListener):
def on_window_command(self, window, command_name, args):
if sublime.platform() == "osx":
return
settings = sublime.load_settings('project_manager.sublime-settings')
if settings.get("close_project_when_close_window", True) and \
command_name == "close_window":
window.run_command("project_manager_close_project")
class ProjectManager(sublime_plugin.WindowCommand):

4
project_manager.sublime-settings

@ -8,6 +8,10 @@
// It would be useful if Sublime Text settings are synced across different computers.
"use_local_projects_dir": false,
// Windows/Linux only
// close projecct when the window is closed
"close_project_when_close_window": true,
// Show recent projects first
// if false, the projects are sorted alphabetically
"show_recent_projects_first": true,

6
support/Default (Linux).sublime-keymap

@ -6,9 +6,5 @@
// {
// "keys": ["ctrl+alt+o"],
// "command": "project_manager", "args": {"action": "new"}
// },
{
"keys": ["ctrl+shift+w"],
"command": "project_manager_close_window"
}
// }
]

6
support/Default (Windows).sublime-keymap

@ -6,9 +6,5 @@
// {
// "keys": ["ctrl+alt+o"],
// "command": "project_manager", "args": {"action": "new"}
// },
{
"keys": ["ctrl+shift+w"],
"command": "project_manager_close_window"
}
// }
]
Loading…
Cancel
Save