當前位置: 首頁>>代碼示例>>Python>>正文


Python Manager.activate方法代碼示例

本文整理匯總了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
開發者ID:mystilleef,項目名稱:scribes,代碼行數:58,代碼來源:Trigger.py

示例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
開發者ID:mystilleef,項目名稱:scribes,代碼行數:43,代碼來源:Trigger.py

示例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
開發者ID:mystilleef,項目名稱:scribes,代碼行數:42,代碼來源:Trigger.py

示例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
開發者ID:mystilleef,項目名稱:scribes,代碼行數:41,代碼來源:Trigger.py


注:本文中的Manager.Manager.activate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。