當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。