Browse Source

use EventHandler to close project

tags/0.7.15^0
Randy Lai 2 years ago
parent
commit
981bab7f24
No known key found for this signature in database GPG Key ID: C624A96B760AC797
4 changed files with 18 additions and 13 deletions
  1. +12
    -3
      project_manager.py
  2. +4
    -0
      project_manager.sublime-settings
  3. +1
    -5
      inux).sublime-keymap
  4. +1
    -5
      indows).sublime-keymap

+ 12
- 3
project_manager.py View File

@@ -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
- 0
project_manager.sublime-settings View File

@@ -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,


support/Default → inux).sublime-keymap View File

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

support/Default → indows).sublime-keymap View File

@@ -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