Browse Source

some updates

master
Randy Lai 8 years ago
parent
commit
de5b2cedbc
  1. 12
      Default.sublime-commands
  2. 6
      README.md
  3. 65
      pm.py

12
Default.sublime-commands

@ -2,5 +2,17 @@
{
"caption": "Project Manager",
"command": "project_manager"
},
{
"caption": "Project Manager: Append Project",
"command": "project_manager_list", "args": {"callback": "on_append"}
},
{
"caption": "Project Manager: Remove Project",
"command": "project_manager_list", "args": {"callback": "on_remove"}
},
{
"caption": "Project Manager: Edit Project",
"command": "project_manager_list", "args": {"callback": "on_edit"}
}
]

6
README.md

@ -1,15 +1,13 @@
Project Manager for Sublime Text 3
===
Dont't have any idea what `*.sublime-project` and `*.sublime-workspace` are doing? Forget where the project files are? Project Manager helps in organizing the project files by putting all files under `Packages/Users/Projects/`.
[SideBarFolders](https://github.com/SublimeText/SideBarFolders) is a lot lighter than the bulit-in project system, but it does not have any management functionality at all. I really hate that a folder cannot be easily removed in SideBarFolders. Now, you have a new option other than SiderBarFolders. Project Manager helps in managing multiple projects with a minimal amount of effort. It is inspired by Atom's [Project Manager](https://atom.io/packages/project-manager).
Dont't have any idea what `*.sublime-project` and `*.sublime-workspace` are doing? Forget where the project files are? Project Manager helps in organizing the project files by putting all files under `Packages/Users/Projects/`. It is inspired by Atom's [Project Manager](https://atom.io/packages/project-manager).
![](https://raw.githubusercontent.com/randy3k/Project-Manager/master/pm.png)
### Installation
You can install Project Manager via Package Control. To launch the Project Manager, you can either open it under the `Project` menu, or use the hotkey `ctrl+cmd+p` (`ctrl+alt+p` for windows/linux).
You can install Project Manager via Package Control. To launch the Project Manager, you can either open it under the `Project` menu, via the command palette, or use the hotkey `ctrl+cmd+p` (`ctrl+alt+p` for windows/linux).
### Usage
Drag some folders into your Sublime Text window and add a project to Project Manager. The options are self-explained, enjoy!

65
pm.py

@ -100,7 +100,7 @@ class Manager:
sublime_project = os.path.join(self.projects_dir, "%s.sublime-project" % project)
subprocess.Popen([executable_path, "-a", "--project", sublime_project])
sublime.set_timeout(on_switch, 100)
sublime.set_timeout(on_switch, 10)
def open_in_new_window(self, project):
@ -131,21 +131,17 @@ class ProjectManager(sublime_plugin.WindowCommand):
def show_quick_panel(self, items, on_done):
sublime.set_timeout(
lambda: self.window.show_quick_panel(items, on_done),
100)
10)
def run(self, action=None):
def run(self):
self.manager = Manager(self.window)
self.callback_on_cancel = action is None
self.project_list = self.manager.list_projects()
self.options = [
["[-] Project Manager", "List all projects, edit projects"],
["[-] Add Project", "Add project to Project Manager"]
]
if action is not None:
self.on_open(action)
else:
self.show_quick_panel(self.options + self.project_list, self.on_open)
self.show_quick_panel(self.options + self.project_list, self.on_open)
def on_open(self, action):
if action<0:
@ -161,26 +157,10 @@ class ProjectManager(sublime_plugin.WindowCommand):
action = action-len(self.options)
self.manager.switch_project(self.project_list[action][0])
def on_append(self, action):
if action>=0:
self.manager.append_project(self.project_list[action][0])
elif self.callback_on_cancel:
sublime.set_timeout(self.run, 100)
def on_remove(self, action):
if action>=0:
self.manager.remove_project(self.project_list[action][0])
elif self.callback_on_cancel:
sublime.set_timeout(self.run, 100)
def on_edit(self, action):
if action>=0:
self.manager.edit_project(self.project_list[action][0])
elif self.callback_on_cancel:
sublime.set_timeout(self.run, 100)
def on_list(self, action):
if action>=0:
if action<0:
sublime.set_timeout(self.run, 10)
elif action>=0:
items = [
["Open", "Open in current window"],
["Open in new window", "Open in a new window"],
@ -205,5 +185,34 @@ class ProjectManager(sublime_plugin.WindowCommand):
self.show_quick_panel(items, callback)
class ProjectManagerList(sublime_plugin.WindowCommand):
def show_quick_panel(self, items, on_done):
sublime.set_timeout(
lambda: self.window.show_quick_panel(items, on_done),
10)
def run(self, callback):
self.manager = Manager(self.window)
self.project_list = self.manager.list_projects()
callback = eval("self." + callback)
self.show_quick_panel(self.project_list, callback)
def on_append(self, action):
if action>=0:
self.manager.append_project(self.project_list[action][0])
elif self.callback_on_cancel:
sublime.set_timeout(self.run, 10)
def on_remove(self, action):
if action>=0:
self.manager.remove_project(self.project_list[action][0])
elif self.callback_on_cancel:
sublime.set_timeout(self.run, 10)
def on_edit(self, action):
if action>=0:
self.manager.edit_project(self.project_list[action][0])
elif self.callback_on_cancel:
sublime.set_timeout(self.run, 100)
sublime.set_timeout(self.run, 10)

Loading…
Cancel
Save