本文整理汇总了Python中Manager.Manager.activate方法的典型用法代码示例。如果您正苦于以下问题:Python Manager.activate方法的具体用法?Python Manager.activate怎么用?Python Manager.activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager.Manager
的用法示例。
在下文中一共展示了Manager.activate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Trigger
# 需要导入模块: from Manager import Manager [as 别名]
# 或者: from Manager.Manager import activate [as 别名]
class Trigger(SignalManager, TriggerManager):
def __init__(self, editor):
SignalManager.__init__(self)
TriggerManager.__init__(self, editor)
self.__init_attributes(editor)
self.connect(self.__trigger, "activate", self.__activate_cb)
self.connect(self.__trigger1, "activate", self.__activate_cb)
self.connect(self.__trigger2, "activate", self.__activate_cb)
def __init_attributes(self, editor):
self.__editor = editor
from Manager import Manager
self.__manager = Manager(editor)
name, shortcut, description, category = (
"open-recent-files",
"<ctrl><alt>r",
_("Open recent files"),
_("File Operations")
)
self.__trigger = self.create_trigger(name, shortcut, description, category)
self.__trigger.command = "activate"
name, shortcut, description, category = (
"reopen-closed-file",
"<ctrl><shift>w",
_("Reopen last closed file"),
_("File Operations")
)
self.__trigger1 = self.create_trigger(name, shortcut, description, category)
self.__trigger1.command = "open-last-file"
name, shortcut, description, category = (
"reopen-closed-files",
"<ctrl><shift>q",
_("Reopen last closed file"),
_("File Operations")
)
self.__trigger2 = self.create_trigger(name, shortcut, description, category)
self.__trigger2.command = "open-last-files"
return
def destroy(self):
self.disconnect()
self.remove_triggers()
if self.__manager: self.__manager.destroy()
del self
return False
def __activate(self, trigger):
command = trigger.command
self.__manager.activate(command)
return False
def __activate_cb(self, trigger):
from gobject import idle_add
idle_add(self.__activate, trigger)
return False
示例2: Trigger
# 需要导入模块: from Manager import Manager [as 别名]
# 或者: from Manager.Manager import activate [as 别名]
class Trigger(SignalManager, TriggerManager):
def __init__(self, editor):
SignalManager.__init__(self)
TriggerManager.__init__(self, editor)
self.__init_attributes(editor)
self.connect(self.__trigger1, "activate", self.__activate_cb)
self.connect(self.__trigger2, "activate", self.__activate_cb)
def __init_attributes(self, editor):
self.__editor = editor
from Manager import Manager
self.__manager = Manager(editor)
name, shortcut, description, category = (
"move-cursor-to-errors",
"F2",
_("Move cursor to errors in python code"),
_("Python"),
)
self.__trigger1 = self.create_trigger(name, shortcut, description, category)
self.__trigger1.command = "activate"
name, shortcut, description, category = (
"toggle-error-checking",
"<shift>F2",
_("Move cursor to errors in python code"),
_("Python"),
)
self.__trigger2 = self.create_trigger(name, shortcut, description, category)
self.__trigger2.command = "toggle-error-check"
return
def __activate_cb(self, trigger):
self.__manager.activate(trigger.command)
return
def destroy(self):
self.disconnect()
self.remove_triggers()
if self.__manager: self.__manager.destroy()
del self
return
示例3: Trigger
# 需要导入模块: from Manager import Manager [as 别名]
# 或者: from Manager.Manager import activate [as 别名]
class Trigger(SignalManager, TriggerManager):
def __init__(self, editor):
SignalManager.__init__(self)
TriggerManager.__init__(self, editor)
self.__init_attributes(editor)
self.connect(self.__trigger, "activate", self.__activate_cb)
def __init_attributes(self, editor):
self.__editor = editor
name, shortcut, description, category = (
"activate-foo-power",
"<ctrl><alt>f",
_("Activate the holy power of foo"),
_("Example")
)
self.__trigger = self.create_trigger(name, shortcut, description, category)
self.__manager = None
return
def destroy(self):
self.disconnect()
self.remove_triggers()
if self.__manager: self.__manager.destroy()
del self
return False
def __activate(self):
try:
self.__manager.activate()
except AttributeError:
from Manager import Manager
self.__manager = Manager(self.__editor)
self.__manager.activate()
return False
def __activate_cb(self, *args):
from gobject import idle_add
idle_add(self.__activate)
return False
示例4: Trigger
# 需要导入模块: from Manager import Manager [as 别名]
# 或者: from Manager.Manager import activate [as 别名]
class Trigger(object):
def __init__(self, editor):
self.__init_attributes(editor)
self.__sigid1 = editor.connect("quit", self.__quit_cb)
self.__sigid2 = editor.connect("supported-encodings-window", self.__activate_cb)
editor.register_object(self)
def __init_attributes(self, editor):
self.__editor = editor
self.__manager = None
return
def __destroy(self):
if self.__manager: self.__manager.destroy()
self.__editor.disconnect_signal(self.__sigid1, self.__editor)
self.__editor.disconnect_signal(self.__sigid2, self.__editor)
self.__editor.unregister_object(self)
del self
self = None
return False
def __activate(self):
try:
self.__manager.activate()
except AttributeError:
from Manager import Manager
self.__manager = Manager(self.__editor)
self.__manager.activate()
return False
def __quit_cb(self, *args):
self.__destroy()
return False
def __activate_cb(self, *args):
from gobject import idle_add
idle_add(self.__activate, priority=9999)
return False