当前位置: 首页>>代码示例>>Python>>正文


Python Manager.Manager类代码示例

本文整理汇总了Python中Manager.Manager的典型用法代码示例。如果您正苦于以下问题:Python Manager类的具体用法?Python Manager怎么用?Python Manager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Manager类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Trigger

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.__show_window_cb)

	def __init_attributes(self, editor):
		self.__editor = editor
		self.__manager = None
		self.__trigger = self.create_trigger("show-advanced-configuration-window")
		from MenuItem import MenuItem
		self.__menuitem = MenuItem(editor)
		return

	def __show_window_cb(self, *args):
		try:
			self.__manager.show()
		except AttributeError:
			from Manager import Manager
			self.__manager = Manager(self.__editor)
			self.__manager.show()
		return

	def destroy(self):
		if self.__manager: self.__manager.destroy()
		if self.__menuitem: self.__menuitem.destroy()
		self.remove_triggers()
		self.disconnect()
		del self
		return
开发者ID:mystilleef,项目名称:scribes,代码行数:32,代码来源:Trigger.py

示例2: init

def init():
    """
    Game initialization function.
        1. Creates a L{Debugger} (debugger) and L{EventTimer} (eventTimer) and 
           stores references to them in an instance of L{EventManager}.
        2. Several listeners are started and registered with eventManager:
            - Instance of L{Universe} (universe)
            - Instance of L{UserInterface} (ui)
            - Instance of L{Window} (gameWindow)
        3. We send the eventManager a message to start the game
            - This message is interpreted by the gameWindow
    """
    
    debugger = Debugger()
    eventTimer = EventTimer()
    
    #Create the event manager for low-level events
    eventManager = Manager(eventTimer,debugger) #FIXME: more specific manager\
                                                #classes will be needed later?
    try:                                            
        client = GameClient(eventManager,host='10.41.24.79',port=1567)
    except:
        pass
    
    #Create the occurence manager for high-level events (same across client and server)
    #FIXME: NOT YET IMPLEMENTED
    #Note: Do we even need this anymore? - Julian
    #Response: I don't think so.  - Jared
    
    #===========================================
    #Create and register the standard listeners
    #With the event manager
    #===========================================
    #FIXME: Not yet fully implemented
    
    #THIS WILL BE CHANGED LATER TO ACCOUNT FOR LOADING, ETC.

    # World w is set to the activeWorld of the universe
    universe = Universe(eventManager)
    ui = UserInterface(eventManager,universe.activeWorld)
    
    gameWindow = Window(eventManager,width=1024,height=768)
    
    w = World()
    universe.changeWorld(w)
    
    #===========================================
    
    # Initialize 500 entities in World w
    for i in range(100):
        #w.addEntity(Entity('ball.png',i*50,i*50, w, (255,255,255)))
        #w.addEntity(TestEntity('testBuilding.png', i*50, i*50, w, 'alpha'))
        w.addEntity(TestEntity('testCraft.png',i*50,i*50,w,'alpha'))

    eventManager.post(Event.WorldManipulationEvent())
    
    #Notify the manager that the window should start to accept input:
    eventManager.post(Event.StartEvent())
    return eventManager.eventTypesToListeners
开发者ID:jceipek,项目名称:Complete-Galactic-Dominion,代码行数:59,代码来源:testClient.py

示例3: init

def init(host='localhost',server=None):
    """
    Most of this code is copied from init() function in client.py
    
    Game initialization function.
        1. Creates a L{Debugger} (debugger) and L{EventTimer} (eventTimer) and 
           stores references to them in an instance of L{EventManager}.
        2. Several listeners are started and registered with eventManager:
            - Instance of L{Universe} (universe)
            - Instance of L{UserInterface} (ui)
            - Instance of L{Window} (gameWindow)
        3. We send the eventManager a message to start the game
            - This message is interpreted by the gameWindow
    """
    
    #Creates a Debugger that posts events to the terminal for debugging purposes
    debugger = Debugger()
    eventTimer = EventTimer()
    
    #Create the event manager for low-level events
    eventManager = Manager(eventTimer,debugger) #FIXME: more specific manager\
    Entity.manager = eventManager    

    # World w is set to the activeWorld of the universe
    universe = Universe(eventManager)
    ui = UserInterface(eventManager,universe.activeWorld,'BROADCASTSERVER')

    gameWindow = Window(eventManager,width=1024,height=768)
    gameWindow.fullscreenMode = False
    gameWindow.updateScreenMode()

    w = World(universe)
    s.world=w

    networked = True
    client = GameClient(eventManager,host=s.host,port=1567)

	#wait until the client is assigned an ID before proceeding
    while client.ID == None:
        import time
        time.sleep(.02)
    print 'Got an ID',client.ID
    clientID = client.ID

    ui.setClientID(clientID)

    wManipulator = WorldManipulator(eventManager,w,networked,gameClientID = clientID)
    
    #generate the resources in the server, the existance of these
    #resources will propogate through to every client when they connect
    w._generateResources()
    
    #Notify the manager that the window should start to accept input:
    eventManager.post(Event.StartEvent())

    return eventManager.eventTypesToListeners
开发者ID:jceipek,项目名称:Complete-Galactic-Dominion,代码行数:56,代码来源:broadcastServer.py

示例4: selectOptions

class Inventory:
	option = 0
	def selectOptions(self):
		print("press 1 to purchase:")
		print("press 2 to return:")
		print("press 3 to display Inventory:")
		return int(raw_input())

	def __init__(self):
		self.manager = Manager()
		self.cashier = Cashier()
		flag = True
		while flag:
			self.option = self.selectOptions()
			if self.option == 1:
				self.client_id = random.randint(1, 1000)
				self.manager.itemList()
				orderDetails = self.manager.takeOrder(self.client_id)
				if orderDetails[0] == "checkout":
					self.cashier.checkout(orderDetails[1])
					self.manager.displayInventory()
				elif orderDetails[0] == "don't checkout":
					print("we have ordered the requested items right away! please wait for us to get back to you.")
			elif self.option ==2:
				self.manager.close()
				self.cashier.close()
				flag = False
				sys.exit(0)
			elif self.option == 3:
				self.manager.displayInventory()
开发者ID:raghavs1108,项目名称:OOMDProject,代码行数:30,代码来源:Pharmacy.py

示例5: main

def main():
    if len(sys.argv) == 2:
        c = Config(sys.argv[1])
    else:
        print("Usage : ./main.py [config_file]")

    m = Manager(c.stock, c.process)

    m.linkStock()

    print("")
    m.displayStock()
开发者ID:danysousa,项目名称:krpsim,代码行数:12,代码来源:main.py

示例6: __init_attributes

	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
开发者ID:mystilleef,项目名称:scribes,代码行数:29,代码来源:Trigger.py

示例7: Trigger

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
		self.__manager = None
		name, shortcut, description, category = (
			"toggle-comments",
			"<alt>c",
			_("Toggle comments"),
			_("Line Operations")
		)
		self.__trigger = self.create_trigger(name, shortcut, description, category)
		return

	def __get_manager(self):
		if self.__manager: return self.__manager
		from Manager import Manager
		self.__manager = Manager(self.__editor)
		return self.__manager

	def __activate(self):
		if self.__editor.readonly: return False
		self.__get_manager().activate()
		return False

	def __activate_cb(self, *args):
		from gobject import idle_add
		idle_add(self.__activate)
		return False

	def __destroy(self):
		self.disconnect()
		self.remove_triggers()
		if self.__manager: self.__manager.destroy()
		del self
		return False

	def destroy(self):
		from gobject import idle_add
		idle_add(self.__destroy)
		return False
开发者ID:mystilleef,项目名称:scribes,代码行数:47,代码来源:Trigger.py

示例8: __activate

	def __activate(self):
		try:
			self.__manager.activate()
		except AttributeError:
			from Manager import Manager
			self.__manager = Manager(self.__editor)
			self.__manager.activate()
		return False
开发者ID:mystilleef,项目名称:scribes,代码行数:8,代码来源:Trigger.py

示例9: __activate_cb

	def __activate_cb(self, *args):
		try:
			self.__manager.match()
		except AttributeError:
			from Manager import Manager
			self.__manager = Manager(self.__editor)
			self.__manager.match()
		return False
开发者ID:mystilleef,项目名称:scribes,代码行数:8,代码来源:Trigger.py

示例10: __show_window_cb

	def __show_window_cb(self, *args):
		try:
			self.__manager.show()
		except AttributeError:
			from Manager import Manager
			self.__manager = Manager(self.__editor)
			self.__manager.show()
		return
开发者ID:mystilleef,项目名称:scribes,代码行数:8,代码来源:Trigger.py

示例11: installStandardDAR

def installStandardDAR(darfile, installDir):
    """
    _installStandardDAR_

    Installation of a standard DARball
    
    """
    config = {
        "dar_shared_pool" : os.getcwd(),
        "dar_dist_pool" : os.getcwd(),
        "dar_inst_pool" : os.getcwd(),
        "dar_tmp_dir" : os.getcwd(),
        }
    
    darConf = []
    darConf.append("use dar file %s\n" % darfile)

    manager = Manager( darConf, cnf=config, pltf=Platform() )
    manager.installApplication( installDir, None )

    return installDir
开发者ID:nataliaratnikova,项目名称:DAR2,代码行数:21,代码来源:DARInterface.py

示例12: create_configure_dialog

        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
开发者ID:mate-desktop,项目名称:pluma,代码行数:12,代码来源:__init__.py

示例13: create_configure_dialog

 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
开发者ID:haniokasai,项目名称:netwalker-rootfs,代码行数:12,代码来源:__init__.py

示例14: Trigger

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,代码行数:40,代码来源:Trigger.py


注:本文中的Manager.Manager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。