本文整理汇总了Python中Manager.Manager.run方法的典型用法代码示例。如果您正苦于以下问题:Python Manager.run方法的具体用法?Python Manager.run怎么用?Python Manager.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager.Manager
的用法示例。
在下文中一共展示了Manager.run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SnippetsPlugin
# 需要导入模块: from Manager import Manager [as 别名]
# 或者: from Manager.Manager import run [as 别名]
class SnippetsPlugin(gedit.Plugin):
def __init__(self):
gedit.Plugin.__init__(self)
self.dlg = None
library = Library()
library.set_accelerator_callback(self.accelerator_activated)
if platform.platform() == 'Windows':
userdir = os.path.expanduser('~/gedit/snippets')
else:
userdir = os.path.expanduser('~/.gnome2/gedit/snippets')
library.set_dirs(userdir, self.system_dirs())
def system_dirs(self):
if platform.platform() != 'Windows':
if 'XDG_DATA_DIRS' in os.environ:
datadirs = os.environ['XDG_DATA_DIRS']
else:
datadirs = '/usr/local/share:/usr/share'
dirs = []
for d in datadirs.split(':'):
d = os.path.join(d, 'gedit-2', 'plugins', 'snippets')
if os.path.isdir(d):
dirs.append(d)
dirs.append(self.get_data_dir())
return dirs
def activate(self, window):
data = WindowHelper(self)
window._snippets_plugin_data = data
data.run(window)
def deactivate(self, window):
window._snippets_plugin_data.stop()
window._snippets_plugin_data = None
def update_ui(self, window):
window._snippets_plugin_data.update()
def create_configure_dialog(self):
if not self.dlg:
self.dlg = Manager(self.get_data_dir())
else:
self.dlg.run()
window = gedit.app_get_default().get_active_window()
if window:
self.dlg.dlg.set_transient_for(window)
return self.dlg.dlg
def accelerator_activated(self, group, obj, keyval, mod):
if hasattr(obj, '_snippets_plugin_data'):
obj._snippets_plugin_data.accelerator_activated(keyval, mod)
示例2: SnippetsPlugin
# 需要导入模块: from Manager import Manager [as 别名]
# 或者: from Manager.Manager import run [as 别名]
class SnippetsPlugin(GObject.Object, Peas.Activatable):
__gtype_name__ = "SnippetsPlugin"
object = GObject.Property(type=GObject.Object)
def __init__(self):
GObject.Object.__init__(self)
self.dlg = None
def system_dirs(self):
if 'XDG_DATA_DIRS' in os.environ:
datadirs = os.environ['XDG_DATA_DIRS']
else:
datadirs = '/usr/local/share' + os.pathsep + '/usr/share'
dirs = []
for d in datadirs.split(os.pathsep):
d = os.path.join(d, 'pluma', 'plugins', 'snippets')
if os.path.isdir(d):
dirs.append(d)
dirs.append(self.plugin_info.get_data_dir())
return dirs
def do_activate(self):
library = Library()
library.add_accelerator_callback(self.accelerator_activated)
snippetsdir = os.path.join(GLib.get_user_config_dir(), '/pluma/snippets')
library.set_dirs(snippetsdir, self.system_dirs())
self._helper = WindowHelper(self)
window = self.object
self._helper.run(window)
def do_deactivate(self):
library = Library()
library.remove_accelerator_callback(self.accelerator_activated)
self._helper.stop()
self._helper = None
def do_update_state(self):
self._helper.update()
def create_configure_dialog(self):
if not self.dlg:
self.dlg = Manager(self.plugin_info.get_data_dir())
else:
self.dlg.run()
window = Pluma.App.get_default().get_active_window()
if window:
self.dlg.dlg.set_transient_for(window)
return self.dlg.dlg
def accelerator_activated(self, group, obj, keyval, mod):
ret = False
if self._helper:
ret = self._helper.accelerator_activated(keyval, mod)
return ret