You are right, with the code it will be easier
As you can see the command open a quick panel. What i want is to add shortcuts to directly do one of the possibility of the quickpanel. This is for “easy” use.
so for example :
- “super+b”: quickpanel
- “super+shift+b”: build in debug
thanks
[code]import sublime, sublime_plugin
import os
def get_setting(key, default=None):
try:
s = sublime.active_window().active_view().settings()
if s.has(“akylasmake_%s” % key):
return s.get(“akylasmake_%s” % key)
except:
pass
return sublime.load_settings(“AkylasMake.sublime-settings”).get(key, default)
THIRDPARTIES = get_setting(“3rdparties”, “”)
class AkMakeCommand(sublime_plugin.WindowCommand):
mode_list = “cmake”, “build”,“clean”,“run”]
config_list = “release”,“debug”]
# platform_list = “ipad”,“iphone”, “android”, “web”]
mode = ''
config = ''
wdir = ''
# platform = ''
# notes = ''
def run(self, *args, **kwargs):
# p = self.window.active_view().file_name()
self.wdir = kwargs'working_dir']
self.window.show_quick_panel(self.mode_list , self._mode_list_callback)
def prebuild(self):
build = self.wdir + '/build_dest/' + self.config
self.window.run_command("exec",{"cmd":'mkdir', '-p', build]})
def launchMake(self):
sublime.log_commands(True)
sublime.active_window().run_command("show_panel", {"panel": "console", "toggle": True})
self.prebuild()
build = self.wdir + '/build_dest/' + self.config
if (self.mode == 'cmake'):
parameters = "cmake","-G","Unix Makefiles", self.wdir, "-DCMAKE_BUILD_TYPE=" + self.config]
else:
parameters = "make","-C",build]
if (self.mode == 'clean'):
parameters.append("clean")
print THIRDPARTIES
self.window.run_command("exec",{"cmd":parameters, "working_dir":build, "env":{"THIRDPARTIES_DIR":THIRDPARTIES}})
def _mode_list_callback(self, index):
if (index > -1):
self.mode = self.mode_list[index]
self.window.show_quick_panel(self.config_list , self._config_list_callback)
def _config_list_callback(self, index):
if (index > -1):
self.config = self.config_list[index]
self.launchMake()
# def _release_note_on_change(self, entry):
# sublime.error_message("dont know the meaning ...!")
# def _release_note_on_cancel(self):
# sublime.error_message("operation cancelled!")
[/code]