本文整理汇总了Python中sublime.message_dialog方法的典型用法代码示例。如果您正苦于以下问题:Python sublime.message_dialog方法的具体用法?Python sublime.message_dialog怎么用?Python sublime.message_dialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sublime
的用法示例。
在下文中一共展示了sublime.message_dialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_pre_save
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def on_pre_save(self, view):
file_syntax = view.settings().get('syntax')
if file_syntax != "Packages/Graphviz/DOT.sublime-syntax":
return
# The file is saved for the first time
if view.settings().get("persistence") is None:
sublime.message_dialog("This is the first time the file is saved, "\
"so the image filename has been changed according to the filename. "\
"Please close temp~.png and reopen image again using keyboard shortcuts or menus.")
view.settings().set("persistence", True)
self.rendering(view)
# If `render_in_realtime` is enabled, we don't need to render on save as this
# has been done in on_modified().
if not st_settings.get("render_in_realtime"):
self.rendering(view)
# Trigger rendering if setting the file syntax to DOT
示例2: rmtree
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def rmtree(self, path) :
if node_variables.NODE_JS_OS == "win" :
import string
from ctypes import windll, c_int, c_wchar_p
UNUSUED_DRIVE_LETTER = ""
for letter in string.ascii_uppercase:
if not os.path.exists(letter+":") :
UNUSUED_DRIVE_LETTER = letter+":"
break
if not UNUSUED_DRIVE_LETTER :
sublime.message_dialog("Can't remove node.js! UNUSUED_DRIVE_LETTER not found.")
return
DefineDosDevice = windll.kernel32.DefineDosDeviceW
DefineDosDevice.argtypes = [ c_int, c_wchar_p, c_wchar_p ]
DefineDosDevice(0, UNUSUED_DRIVE_LETTER, path)
try:
shutil.rmtree(UNUSUED_DRIVE_LETTER)
except Exception as e:
print("Error: "+traceback.format_exc())
finally:
DefineDosDevice(2, UNUSUED_DRIVE_LETTER, path)
else :
shutil.rmtree(path)
示例3: delete_and_create
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def delete_and_create(self, should_create=False):
gid = settings.get('gist_id')
try:
gist.Gist(
token=settings.get('access_token'),
http_proxy=settings.get('http_proxy'),
https_proxy=settings.get('https_proxy')
).delete(gid)
settings.update('gist_id', '')
# delete information related to the deleted gist
version.update_config_file({})
if should_create:
self.window.run_command('sync_settings_create_and_upload')
pass
except gist.NotFoundError as e:
msg = (
'Sync Settings:\n\n'
'{}\n\n'
'Please check if the access token was created with the gist scope.\n\n'
'If the access token is correct, please, delete the value of `gist_id` property manually.'
)
sublime.message_dialog(msg.format(str(e)))
except Exception as e:
logger.exception(e)
sublime.message_dialog('Sync Settings:\n\n{}'.format(str(e)))
示例4: check_settings
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def check_settings(*props):
def check_settings_wrapper(func):
@wraps(func)
def check_settings_inner(self, *args, **kwargs):
for prop in props:
if not settings.get(prop):
prop_text = 'properties' if len(args) > 1 else 'property'
msg = (
'Sync Settings:\n\n'
'The {} {}, must be defined. Edit your settings file.'
)
sublime.message_dialog(msg.format(prop_text, ' and '.join(props)))
sublime.active_window().run_command('open_file', {
'file': '${packages}/User/SyncSettings.sublime-settings'
})
return
func(self, *args, **kwargs)
return check_settings_inner
return check_settings_wrapper
示例5: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def run():
if not ST.conn:
ST.selectConnectionQuickPanel(callback=lambda: Window().run_command('st_remove_saved_query'))
return
queriesList = queriesStore.all()
if len(queriesList) == 0:
sublime.message_dialog('No saved queries.')
return
options = []
for alias, query in queriesList.items():
options.append([str(alias), str(query)])
options.sort()
def cb(index):
if index < 0:
return None
return queriesStore.delete(options[index][0])
try:
Window().show_quick_panel(options, cb)
except Exception:
pass
示例6: plugin_loaded
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def plugin_loaded():
try:
from package_control import events
if events.install(__name__):
logger.info('Installed %s!' % events.install(__name__))
elif events.post_upgrade(__name__):
logger.info('Upgraded to %s!' % events.post_upgrade(__name__))
sublime.message_dialog(('{0} was upgraded.' +
'If you have any problem,' +
'just restart your Sublime Text.'
).format(__name__)
)
except Exception:
pass
startPlugin()
reload()
示例7: clean_dead_projects
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def clean_dead_projects(self):
projects_to_remove = []
for pname, pi in self.projects_info.items():
folder = pi['folder']
if not os.path.exists(folder):
projects_to_remove.append(pname)
def remove_projects_iteratively():
pname = projects_to_remove[0]
self._remove_project(pname)
projects_to_remove.remove(pname)
if len(projects_to_remove) > 0:
sublime.set_timeout(remove_projects_iteratively, 100)
if len(projects_to_remove) > 0:
sublime.set_timeout(remove_projects_iteratively, 100)
else:
sublime.message_dialog('No Dead Projects.')
示例8: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def run(self, action=None, caller=None):
self.manager = Manager(self.window)
if action is None:
self.show_options()
elif action == 'add_project':
self.manager.add_project()
elif action == 'import_sublime_project':
self.manager.import_sublime_project()
elif action == 'clear_recent_projects':
self.manager.clear_recent_projects()
elif action == 'remove_dead_projects':
self.manager.clean_dead_projects()
else:
self.caller = caller
callback = eval('self.on_' + action)
self.projects, display = self.manager.display_projects()
if not self.projects:
sublime.message_dialog('Project list is empty.')
return
self.show_quick_panel(display, callback)
示例9: load
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def load(self, default=[]):
self.fdir = os.path.dirname(self.fpath)
if not os.path.isdir(self.fdir):
os.makedirs(self.fdir)
if os.path.exists(self.fpath):
with open(self.fpath, mode='r', encoding=self.encoding) as f:
content = f.read()
try:
data = sublime.decode_value(content)
except Exception:
sublime.message_dialog('%s is bad!' % self.fpath)
raise
if not data:
data = default
else:
with open(self.fpath, mode='w', encoding=self.encoding, newline='\n') as f:
data = default
f.write(sublime.encode_value(data, True))
return data
示例10: show_list
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def show_list(self, data):
m = json.loads(data)
if len(m) == 0:
sublime.message_dialog(
"There aren't any lightning components "
" in this org.")
return
print("data: " + str(m))
self.messages.append(["All Bundles", "*", "Every Bundle",
"All the lightning bundles "
"in your org!"])
print("And now here")
for mm in m:
x = [mm['MasterLabel'], mm['Id'], mm["DeveloperName"],
mm["Description"]]
self.messages.append(x)
self.window = sublime.active_window()
self.window.show_quick_panel(self.messages,
self.open_selected_bundle,
sublime.MONOSPACE_FONT)
示例11: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def run(self):
(staged_entries,
unstaged_entries,
untracked_entries,
conflict_entries) = self.sort_status_entries(self.get_status())
if len(unstaged_entries) + len(conflict_entries) > 0:
sublime.message_dialog(
"Unable to perform rebase actions while repo is in unclean state."
)
return
if len(staged_entries) == 0:
sublime.message_dialog(
"No staged files."
)
return
super().run()
示例12: run_async
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def run_async(self):
short_hash = self.get_selected_short_hash()
if not short_hash:
return
# Cannot squash first commit.
if self.interface.entries[0].short_hash == short_hash:
sublime.message_dialog("Unable to squash first commit.")
return
squash_idx, squash_entry, _ = self.get_idx_entry_and_prev(short_hash)
if self.commit_is_merge(squash_entry.long_hash):
sublime.message_dialog("Unable to squash a merge.")
return
self.squash_idx = squash_idx
self.squash_entry = squash_entry
if self.step:
self.do_action(self.interface.entries[squash_idx - 1].long_hash)
else:
reversed_logs = list(reversed(self.interface.entries[0:squash_idx]))
show_log_panel(reversed_logs, self.do_action)
示例13: log
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def log(msg, *args, dialog=False, error=False, **kwargs):
"""
Generate a message to the console and optionally as either a message or
error dialog. The message will be formatted and dedented before being
displayed, and will be prefixed with its origin.
"""
msg = textwrap.dedent(msg.format(*args, **kwargs)).strip()
if error:
print("my_package error:")
return sublime.error_message(msg)
for line in msg.splitlines():
print("my_package: {msg}".format(msg=line))
if dialog:
sublime.message_dialog(msg)
### ---------------------------------------------------------------------------
示例14: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def run(self, edit, languageName=None, set_fallback=False, is_init=False):
view = self.view
global currentView
currentView = view
if self.downloading:
sublime.message_dialog('Another progress is working for checkout ' + self.downloading + '. Please try again later.')
return
self.languageList, index = getLanguageList(languageName)
self.set_fallback = set_fallback
if languageName:
self.updateLanguage(index)
else:
currentView.window().show_quick_panel(self.languageList, self.updateLanguage, sublime.KEEP_OPEN_ON_FOCUS_LOST)
示例15: checkoutLanguage
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import message_dialog [as 别名]
def checkoutLanguage(self):
global language
languageName = self.languageName
if not self.downloadLanguageGZ(languageName):
if getSetting('debug'):
print('download error')
return False
setSetting('language', languageName)
language = languageName
languageSettings = currentSettings.get('languages')
languageSettings[languageName] = 'gz'
setSetting('languages', languageSettings)
if self.set_fallback:
setSetting('language_fallback', languageName)
loadLanguage()
sublime.message_dialog('Language ' + languageName + ' is checked out')