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]