-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathbrowser.py
34 lines (25 loc) · 966 Bytes
/
browser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright (c) 2014, Guillermo López-Anglada. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
import sublime
import sublime_plugin
from Dart.lib.sdk import SDK
class DartShowUserBrowsersCommand(sublime_plugin.WindowCommand):
@property
def browsers(self):
sdk = SDK()
browsers = sdk.user_browsers
self.BROWSERS = [k for k in sorted(browsers.keys()) if
k != 'default']
final = []
for k in self.BROWSERS:
final.append([k, '' if k != browsers['default'] else 'default'])
return final
def run(self):
self.window.show_quick_panel(self.browsers, self.on_done)
def on_done(self, idx):
if idx == -1:
return
name = self.browsers[idx][0]
sdk = SDK()
sdk.path_to_default_user_browser = name