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


Python ConfirmDlg.display方法代码示例

本文整理汇总了Python中ConfirmDlg.ConfirmDlg.display方法的典型用法代码示例。如果您正苦于以下问题:Python ConfirmDlg.display方法的具体用法?Python ConfirmDlg.display怎么用?Python ConfirmDlg.display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfirmDlg.ConfirmDlg的用法示例。


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

示例1: __init__

# 需要导入模块: from ConfirmDlg import ConfirmDlg [as 别名]
# 或者: from ConfirmDlg.ConfirmDlg import display [as 别名]
class GalaxyRestartDlg:
	def __init__(self, app):
		self.app = app
		self.confirmDlg = ConfirmDlg(self.app)
		self.createUI()

	def display(self, restartAction = None):
		# show window
		self.restartAction = restartAction
		if not self.win.visible:
			self.win.show()

	def update(self):
		if self.win.visible:
			self.show()

	def show(self):
		pass

	def hide(self):
		self.win.setStatus(_("Ready."))
		self.win.hide()

	def onRestart(self, widget, action, data):
		self.confirmDlg.display(_('Are you really really sure you want to restart this galaxy?'), _('No'),
			('Yes'), cancelAction = self.onRealyRestart)

	def onRealyRestart(self):
		self.hide()
		if self.restartAction:
			self.restartAction(self.win.vMsg.text)

	def onClose(self, widget, action, data):
		self.hide()

	def createUI(self):
		screenWidth, screenHeight = gdata.scrnSize
		# size of dialog in layout metrics (for SimpleGridLM)
		cols = 25
		rows = 20
		# dialog width and height in pixels
		width = cols * 20 + 5
		height = rows * 20 + 4
		#creating dialog window
		self.win = ui.Window(self.app,
			modal = 1,
			escKeyClose = 1,
			movable = 0,
			title = _("Galaxy restart"),
			rect = ui.Rect((screenWidth - width) / 2, (screenHeight - height) / 2, width, height),
			layoutManager = ui.SimpleGridLM(),
		)
		self.win.subscribeAction('*', self)
		# first row is window title
		rows -= 1

		ui.Label(self.win, layout = (0, 0, cols, 1), text = _("If you are sure to restart this galaxy, click on Restart button."), align = ui.ALIGN_W)
		ui.Label(self.win, layout = (0, 1, cols, 1), text = _("You can enter message visible in restart announcement below."), align = ui.ALIGN_W)

		s = ui.Scrollbar(self.win, layout = (cols - 1, 2, 1, rows - 3))
		t = ui.Text(self.win, layout = (0, 2, cols - 1, rows - 3), id = 'vMsg')
		t.attachVScrollbar(s)

		# dialog bottom line
		ui.Title(self.win, layout = (0, rows - 1, cols - 10, 1))
		ui.TitleButton(self.win, layout = (cols - 10, rows - 1, 5, 1), text = _("Restart"), action = 'onRestart')
		ui.TitleButton(self.win, layout = (cols - 5, rows - 1, 5, 1), text = _("Cancel"), action = 'onClose')
开发者ID:mozts2005,项目名称:OuterSpace,代码行数:69,代码来源:GalaxyRestartDlg.py

示例2: __init__

# 需要导入模块: from ConfirmDlg import ConfirmDlg [as 别名]
# 或者: from ConfirmDlg.ConfirmDlg import display [as 别名]
class MainGameDlg:

	def __init__(self, app):
		self.app = app
		self.starSystemDlg = StarSystemDlg(self.app)
		self.fleetDlg = FleetDlg(self.app)
		self.researchDlg = ResearchDlg(self.app)
		self.confirmDlg = ConfirmDlg(self.app)
		self.diplomacyDlg = DiplomacyDlg.DiplomacyDlg(self.app)
		self.constructionDlg = ConstructionDlg(self.app)
		self.messagesDlg = MessagesDlg(self.app)
		self.planetsOverviewDlg = PlanetsOverviewDlg(self.app)
		self.globalQueuesDlg = GlobalQueuesDlg(self.app)
		self.systemOverviewDlg = SystemOverviewDlg(self.app)
		self.fleetsOverviewDlg = FleetsOverviewDlg(self.app)
		self.optionsDlg = OptionsDlg(self.app)
		self.searchDlg = SearchDlg(self.app)
		self.problemsDlg = ProblemsDlg.ProblemsDlg(self.app)
		self.empireOverviewDlg = EmpireOverviewDlg.EmpireOverviewDlg(self.app)
		self.galaxyRestartDlg = GalaxyRestartDlg(self.app)
		self.planetsAnalysisDlg = PlanetsAnalysisDlg(app)
		self.fleetsAnalysisDlg = FleetsAnalysisDlg(app)
		self.mapWidget = None
		self.createUI()
		self.centered = 0

	def display(self):
		gdata.showBackground = 0
		gdata.mainGameDlg = self
		self.win.show()
		# register for updates
		gdata.updateDlgs.append(self)
		#self.refocus()

	def refocus(self):
		#log.debug("refocusing")
		self.app.setFocus(self.mapWidget)

	def onCmdInProgress(self, inProgress):
		if inProgress:
			self.win.vTurn.background = (0xff, 0xff, 0x00)
		else:
			self.win.vTurn.background = None

	def hide(self):
		gdata.showBackground = 1
		self.win.hide()
		gdata.mainGameDlg = None
		# unregister updates
		if self in gdata.updateDlgs:
			gdata.updateDlgs.remove(self)

	def onQuit(self, widget, action, data):
		self.app.setStatus(_('Logging out and exitting...'))
		self.app.exit()

	def onSelectMapObj(self, widget, action, data):
		self.win.vStarMap.highlightPos = None
		obj = client.get(data, noUpdate = 1)
		if obj == None:
			self.app.setStatus(_('Cannot select object on map'))
			return
		if obj.type in (T_PLANET, T_SYSTEM, T_WORMHOLE):
			self.starSystemDlg.display(data)
		elif obj.type == T_FLEET:
			self.fleetDlg.display(data)

	def onResearch(self, widget, action, data):
		self.researchDlg.display()

	def onDiplomacy(self, widget, action, data):
		self.diplomacyDlg.display()

	def onMessages(self, widget, action, data):
		self.messagesDlg.display()

	def onConstruction(self, widget, action, data):
		self.constructionDlg.display()

	def onPlanetsMenu(self, widget, action, data):
		self.systemPlanetMenu.show((16*20, 0))
		
	def onPlanets(self, widget, action, data):
		self.planetsOverviewDlg.display()

	def onSystems(self, widget, action, data):
		self.systemOverviewDlg.display()

	def onPlanetAnalysis(self, widget, action, data):
		self.planetsAnalysisDlg.display()
		
	def onGlobalQueues(self, widget, action, data):
		self.globalQueuesDlg.display()
		
	def onFleetsMenu(self, widget, action, data):
		self.systemFleetMenu.show((20*20, 0))
		
	def onFleets(self, widget, action, data):
		self.fleetsOverviewDlg.display()

#.........这里部分代码省略.........
开发者ID:Lukc,项目名称:ospace-lukc,代码行数:103,代码来源:MainGameDlg.py

示例3: __init__

# 需要导入模块: from ConfirmDlg import ConfirmDlg [as 别名]
# 或者: from ConfirmDlg.ConfirmDlg import display [as 别名]
class LoginDlg:

	def __init__(self, app):
		self.app = app
		self.newAccDlg = NewAccDlg(app)
		self.confirmDlg = ConfirmDlg(app)
		self.firstlogin = True
		self.createUI()

	def display(self, caller = None, message = None):
		self.caller = caller
		self.win.vCreate.visible = gdata.config.game.accountcreated == None
		if gdata.config.game.lastlogin != None:
			self.win.vLogin.text = gdata.config.game.lastlogin
		if gdata.config.game.lastpassword:
			self.win.vPassword.text = gdata.config.game.lastpassword
		if gdata.config.game.lastpasswordcrypted:
			self.win.vPassword.text = binascii.a2b_base64(gdata.config.game.lastpasswordcrypted)
		if not gdata.config.game.lastgameid:
			gdata.config.game.lastgameid = 'Alpha'
		self.win.vMessage.text = message
		#if gdata.config.game.autologin != 'yes':	# enable this to disable auto-login after change in options
		#	self.firstlogin = false
		self.win.show()

	def hide(self):
		self.win.hide()

	def autoLogin(self):
		if self.firstlogin:
			self.firstlogin = False
			self.win.vMessage.text = _('Auto-login in progress ...')
			login = self.win.vLogin.text
			password = self.win.vPassword.text
			gameID = gdata.config.game.lastgameid
			self.doLogin(gameID,login,password)

	def onLogin(self, widget, action, data):
		self.firstlogin = False
		login = self.win.vLogin.text
		password = self.win.vPassword.text
		gameID = gdata.config.game.lastgameid
		self.win.vMessage.text = _('Login in progress ...')
		# self.win.hide()
		self.doLogin(gameID,login,password)

	def doLogin(self,gameID,login,password):
		result = client.login(gameID, login, password)
		self.win.hide()
		if result == 1:
			gdata.config.game.lastlogin = login
			# TODO: remove in 0.6
			gdata.config.game.lastpassword = None
			#
			if gdata.savePassword:
				gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
			else:
				gdata.config.game.lastpasswordcrypted = None
			gdata.config.game.lastgameid = gameID
			gdata.config.game.accountcreated = 1
			# write configuration
			gdata.config.save('var/osci.ini')
			gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
			# init ruleset
			Rules.initRules(os.path.join("res", "rules", client.rulesetName))
			# check version
			if (client.lastClientVersion != version or client.lastClientRevision != revision) and version != (0,0,0,'a'):
				# wow, a different version!
				self.confirmDlg.display(
					_("Your client version does not match server version %d.%d.%d%s [Revision %d]. Do you want to continue?") % (
						client.lastClientVersion[0],
						client.lastClientVersion[1],
						client.lastClientVersion[2],
						client.lastClientVersion[3],
						client.lastClientRevision,
					),
					_('Yes'), _('No'), self.onContinueWithOld, self.app.exit)
				return
			# show main dialog
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase()
		elif result == 2:
			pass
		else:
			# login failed
			self.win.vPassword.text = ''
			self.win.vMessage.text = _('Wrong login and/or password')
			self.win.show()

	def onCancel(self, widget, action, data):
		self.win.hide()
		if self.caller:
			self.caller.display()
		else:
			self.app.exit()

	def onContinueWithOld(self):
			# show main dialog
#.........这里部分代码省略.........
开发者ID:mozts2005,项目名称:OuterSpace,代码行数:103,代码来源:LoginDlg.py

示例4: __init__

# 需要导入模块: from ConfirmDlg import ConfirmDlg [as 别名]
# 或者: from ConfirmDlg.ConfirmDlg import display [as 别名]
class MessagesDlg:

	def __init__(self, app):
		self.app = app
		self.createUI()
		#
		self.selectedObjID = None
		self.selectedForum = None
		self.selectedTopic = None
		self.selectedType = None
		self.newMessageDlg = NewMessageDlg(app)
		self.newMsgs = 0
		self.confirmDlg = ConfirmDlg(app)
		self.uignore = []
		self.gignore = []
		self.lignore = []
		if  gdata.config.ignore.universe:
			self.uignore = gdata.config.ignore.universe.split(',')
		if  gdata.config.ignore.galaxy:
			self.gignore = gdata.config.ignore.galaxy.split(',')
		if  gdata.config.ignore.local:
			self.lignore = gdata.config.ignore.local.split(',')

	def display(self):
		self.show()
		self.win.show()
		# register for updates
		if self not in gdata.updateDlgs:
			gdata.updateDlgs.append(self)

	def hide(self):
		self.win.setStatus(_("Ready."))
		self.win.hide()
		# unregister updates
		if self in gdata.updateDlgs:
			gdata.updateDlgs.remove(self)

	def update(self):
		self.show()

	def show(self, updateForum = 1):
		self.newMsgs = 0
		#
		player = client.getPlayer()
		objList = [player.oid]
		objList.extend(player.galaxies)
		objList.append(OID_UNIVERSE)
		# show forums
		items = []
		colors = [gdata.sevColors[gdata.INFO], gdata.sevColors[gdata.MIN]]
		# Inbox
		msgs, new = self.getMsgsNumber(player.oid, "INBOX",'local')
		self.newMsgs += new
		spec = gdata.mailboxSpec[T_PLAYER, "INBOX"]
		item = ui.Item(_(spec[0]), tObjID = player.oid, tForum = "INBOX",
			tType = T_PLAYER, tMsgs = _("%d / %d") % (new, msgs), foreground = colors[new > 0])
		items.append(item)
		# Events
		msgs, new = self.getMsgsNumber(player.oid, "EVENTS")
		self.newMsgs += new
		spec = gdata.mailboxSpec[T_PLAYER, "EVENTS"]
		eventsItem = ui.Item(_(spec[0]), tObjID = player.oid, tForum = "EVENTS",
			tType = T_PLAYER, tMsgs = _("%d / %d") % (new, msgs), foreground = colors[new > 0])
		items.append(eventsItem)
		# Outbox
		msgs, new = self.getMsgsNumber(player.oid, "OUTBOX")
		self.newMsgs += new
		spec = gdata.mailboxSpec[T_PLAYER, "OUTBOX"]
		item = ui.Item(_(spec[0]), tObjID = player.oid, tForum = "OUTBOX",
			tType = T_PLAYER, tMsgs = _("%d / %d") % (new, msgs), foreground = colors[new > 0])
		items.append(item)
		# galaxies
		for galaxyID in player.galaxies:
			galaxy = client.get(galaxyID)
			# folder
			item = ui.Item(_("Galaxy %s") % galaxy.name, tObjID = OID_NONE, tForum = "", tMsgs = "", foreground = colors[0])
			items.append(item)
			# news
			msgs, new = self.getMsgsNumber(galaxyID, "NEWS")
			self.newMsgs += new
			spec = gdata.mailboxSpec[T_GALAXY, "NEWS"]
			item = ui.Item("   %s" % _(spec[0]), tObjID = galaxyID, tForum = "NEWS",
				tType = T_GALAXY, tMsgs = _("%d / %d") % (new, msgs), foreground = colors[new > 0])
			items.append(item)
			# public
			msgs, new = self.getMsgsNumber(galaxyID, "PUBLIC",'galaxy')
			self.newMsgs += new
			spec = gdata.mailboxSpec[T_GALAXY, "PUBLIC"]
			item = ui.Item("   %s" % _(spec[0]), tObjID = galaxyID, tForum = "PUBLIC",
				tType = T_GALAXY, tMsgs = _("%d / %d") % (new, msgs), foreground = colors[new > 0])
			items.append(item)
		# universe
		item = ui.Item(_("Outer Space"), tObjID = OID_NONE, tForum = "", tMsgs = "", foreground = colors[0])
		items.append(item)
		# news
		msgs, new = self.getMsgsNumber(OID_UNIVERSE, "NEWS")
		self.newMsgs += new
		spec = gdata.mailboxSpec[T_UNIVERSE, "NEWS"]
		item = ui.Item("   %s" % _(spec[0]), tObjID = OID_UNIVERSE, tForum = "NEWS",
			tType = T_UNIVERSE, tMsgs = _("%d / %d") % (new, msgs), foreground = colors[new > 0])
#.........这里部分代码省略.........
开发者ID:OuterDeepSpace,项目名称:OuterDeepSpace,代码行数:103,代码来源:MessagesDlg.py

示例5: __init__

# 需要导入模块: from ConfirmDlg import ConfirmDlg [as 别名]
# 或者: from ConfirmDlg.ConfirmDlg import display [as 别名]
class NewAccountDlg:
	""" Called for a new player."""

	def __init__(self, app):
		self.app = app
		self.createUI()
		self.confirmDlg = ConfirmDlg(app)
		self.confirmDlg.setTitle(_("No free starting position"))

	def display(self, caller = None):
		self.caller = caller
		if self.show():
			self.win.show()

	def hide(self):
		self.win.hide()

	def show(self):
		positions = client.cmdProxy.getStartingPositions()
		if not positions:
			# there are no positions -- pop up a dialog
			self.confirmDlg.display(
				_("We are sorry, but there are no starting positions available at this moment. Please, try again later."),
				_("Refresh"), _("Exit"), self.display, self.app.exit
			)
			return False
		items = []
		for objID, name, posType in positions:
			item = ui.Item(name, tObjID = objID, tPosType = posType)
			if posType == STARTPOS_NEWPLAYER:
				item.tPos = _('Independent player')
			elif posType == STARTPOS_AIPLAYER:
				item.tPos = _("Rebel faction")
			elif posType == STARTPOS_PIRATE:
				item.tPos = _("Pirate faction [VIP password needed]")
			else:
				item.tPos = _('Unknown. You cannot use this.')
			items.append(item)
		self.win.vPos.setItems(items)
		return True

	def onSelect(self, widget, action, data):
		if not self.win.vPos.selection:
			self.win.setStatus(_('Select position.'))
			return
		item = self.win.vPos.selection[0]
		if item.tPosType == STARTPOS_NEWPLAYER:
			self.win.setStatus(_('Executing CREATE NEW PLAYER command...'))
			playerID = client.cmdProxy.createNewPlayer(item.tObjID)
			self.win.setStatus(_('Command has been executed.'))
			self.hide()
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase(clearDB = 1)
		elif item.tPosType == STARTPOS_AIPLAYER:
			self.win.setStatus(_('Executing TAKE OVER REBEL FACTION command...'))
			playerID = client.cmdProxy.takeOverAIPlayer(item.tObjID)
			self.win.setStatus(_('Command has been executed.'))
			self.hide()
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase(clearDB = 1)
		elif item.tPosType == STARTPOS_PIRATE:
			password = self.win.vPassword.text
			if not password:
				self.win.setStatus(_("Supply VIP password, please."))
				return
			self.win.setStatus(_('Executing TAKE OVER PIRATE FACTION command...'))
			try:
				playerID = client.cmdProxy.takeOverPirate(item.tObjID, password)
			except ige.SecurityException:
				self.win.setStatus(_("Supply valid VIP password."))
				return
			self.win.setStatus(_('Command has been executed.'))
			self.hide()
			if not gdata.mainGameDlg:
				gdata.mainGameDlg = MainGameDlg(self.app)
				gdata.mainGameDlg.display()
			client.updateDatabase(clearDB = 1)

	def onCancel(self, widget, action, data):
		self.win.hide()
		if self.caller:
			self.caller.display()
		else:
			self.app.exit()

	def createUI(self):
		w, h = gdata.scrnSize
		self.win = ui.Window(self.app,
			modal = 1,
			movable = 0,
			title = _('Select starting position'),
			rect = ui.Rect((w - 424) / 2, (h - 264) / 2, 424, 264),
			layoutManager = ui.SimpleGridLM(),
			tabChange = True
		)
		ui.Listbox(self.win, layout = (0, 0, 21, 10), id = 'vPos',
#.........这里部分代码省略.........
开发者ID:Lukc,项目名称:ospace-lukc,代码行数:103,代码来源:NewAccountDlg.py

示例6: __init__

# 需要导入模块: from ConfirmDlg import ConfirmDlg [as 别名]
# 或者: from ConfirmDlg.ConfirmDlg import display [as 别名]
class LoginDlg:
    def __init__(self, app):
        self.app = app
        self.newAccDlg = NewAccDlg(app)
        self.confirmDlg = ConfirmDlg(app)
        self.firstlogin = True
        self.versionChecked = False
        self.createUI()

    def display(self, caller=None, message=None):
        self.caller = caller
        # get game names from the server
        try:
            self.gameIDs = client.cmdProxy.getRegisteredGames()
        except IClientException:
            # server is probably down, what to do?
            self.gameIDs = {"UNDEFINED": "Not available"}
        except KeyError:
            # server does not support this call
            self.gameIDs = {"Alpha": "Alpha"}
        # show / hide new account button
        self.win.vCreate.visible = gdata.config.game.accountcreated == None
        # fill in default values
        if gdata.config.game.lastlogin != None:
            self.win.vLogin.text = gdata.config.game.lastlogin
        if gdata.config.game.lastpassword:
            self.win.vPassword.text = gdata.config.game.lastpassword
        if gdata.config.game.lastpasswordcrypted:
            self.win.vPassword.text = binascii.a2b_base64(gdata.config.game.lastpasswordcrypted)
        if not gdata.config.game.lastgameid:
            gdata.config.game.lastgameid = "Alpha"
        if gdata.config.game.lastgameid not in self.gameIDs:
            # use first gameid returned by server
            gdata.config.game.lastgameid = sorted(self.gameIDs.keys())[0]
        self.win.vUniverse.text = self.gameIDs[gdata.config.game.lastgameid]
        self.win.vUniverse.data = gdata.config.game.lastgameid
        # disable Universe selection if there's just one universe on the server
        self.win.vUniverse.enabled = len(self.gameIDs) > 1
        self.win.vMessage.text = message
        # if gdata.config.game.autologin != 'yes':    # enable this to disable auto-login after change in options
        #    self.firstlogin = false
        self.win.show()
        if gdata.config.game.autologin == "yes":
            self.autoLogin()

    def hide(self):
        self.win.hide()

    def autoLogin(self):
        if self.firstlogin:
            self.firstlogin = False
            self.win.vMessage.text = _("Auto-login in progress ...")
            login = self.win.vLogin.text
            password = self.win.vPassword.text
            gameID = self.win.vUniverse.data
            self.doLogin(gameID, login, password)

    def onLogin(self, widget, action, data):
        self.firstlogin = False
        login = self.win.vLogin.text
        password = self.win.vPassword.text
        gameID = self.win.vUniverse.data
        self.win.vMessage.text = _("Login in progress ...")
        # self.win.hide()
        self.doLogin(gameID, login, password)

    def doLogin(self, gameID, login, password):
        result = client.login(gameID, login, password)
        self.win.hide()
        if result == 1:
            gdata.config.game.lastlogin = login
            # TODO: remove in 0.6
            gdata.config.game.lastpassword = None
            #
            if gdata.savePassword:
                gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
            else:
                gdata.config.game.lastpasswordcrypted = None
            gdata.config.game.lastgameid = gameID
            gdata.config.game.accountcreated = 1
            # write configuration
            gdata.config.save()
            gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
            # check version
            log.debug("Comparing server and client versions", client.serverVersion, version)
            if client.serverVersion != version and not self.versionChecked:
                # don't check next time in this session
                self.versionChecked = True
                # wow, a different version!
                self.confirmDlg.display(
                    _("Your client version does not match server version %d.%d.%d%s. Do you want to continue?")
                    % (
                        client.serverVersion["major"],
                        client.serverVersion["minor"],
                        client.serverVersion["revision"],
                        client.serverVersion["status"],
                    ),
                    _("Yes"),
                    _("No"),
                    self.onContinueWithOld,
#.........这里部分代码省略.........
开发者ID:ospaceteam,项目名称:outerspace,代码行数:103,代码来源:LoginDlg.py

示例7: __init__

# 需要导入模块: from ConfirmDlg import ConfirmDlg [as 别名]
# 或者: from ConfirmDlg.ConfirmDlg import display [as 别名]
class MainGameDlg:

    def __init__(self, app):
        self.app = app
        self.starSystemDlg = StarSystemDlg(self.app)
        self.fleetDlg = FleetDlg(self.app)
        self.researchDlg = ResearchDlg(self.app)
        self.confirmDlg = ConfirmDlg(self.app)
        self.diplomacyDlg = DiplomacyDlg.DiplomacyDlg(self.app)
        self.constructionDlg = ConstructionDlg(self.app)
        self.messagesDlg = MessagesDlg(self.app)
        self.planetsOverviewDlg = PlanetsOverviewDlg(self.app)
        self.globalQueuesDlg = GlobalQueuesDlg(self.app)
        self.systemOverviewDlg = SystemOverviewDlg(self.app)
        self.fleetsOverviewDlg = FleetsOverviewDlg(self.app)
        self.optionsDlg = OptionsDlg(self.app)
        self.searchDlg = SearchDlg(self.app)
        self.problemsDlg = ProblemsDlg.ProblemsDlg(self.app)
        self.empireOverviewDlg = EmpireOverviewDlg.EmpireOverviewDlg(self.app)
        self.galaxyFinishDlg = GalaxyFinishDlg(self.app)
        self.planetsAnalysisDlg = PlanetsAnalysisDlg(app)
        self.fleetsAnalysisDlg = FleetsAnalysisDlg(app)
        self.mapWidget = None
        self.createUI()
        self.centered = 0

    def display(self):
        self.app.showBackground = False
        gdata.mainGameDlg = self
        self.win.show()
        # register for updates
        gdata.updateDlgs.append(self)
        #self.refocus()

    def refocus(self):
        #log.debug("refocusing")
        self.app.setFocus(self.mapWidget)

    def onCmdInProgress(self, inProgress):
        if inProgress:
            self.win.vTurn.background = (0xff, 0xff, 0x00)
        else:
            self.win.vTurn.background = None

    def hide(self):
        self.app.showBackground = True
        self.win.hide()
        gdata.mainGameDlg = None
        # unregister updates
        if self in gdata.updateDlgs:
            gdata.updateDlgs.remove(self)

    def onExit(self, widget, action, data):
        self.app.setStatus(_('Exitting a session...'))
        self.hide()
        self.app.exitLocal()

    def onSelectMapObj(self, widget, action, data):
        self.win.vStarMap.highlightPos = None
        obj = client.get(data, noUpdate = 1)
        if obj == None:
            self.app.setStatus(_('Cannot select object on map'))
            return
        if obj.type in (Const.T_PLANET, Const.T_SYSTEM, Const.T_WORMHOLE):
            self.starSystemDlg.onSelectMapObj(None, None, data)
        elif obj.type == Const.T_FLEET:
            self.fleetDlg.display(data)

    def onResearch(self, widget, action, data):
        self.researchDlg.display()

    def onDiplomacy(self, widget, action, data):
        self.diplomacyDlg.display()

    def onMessages(self, widget, action, data):
        self.messagesDlg.display()

    def onConstruction(self, widget, action, data):
        self.constructionDlg.display()

    def onPlanetsMenu(self, widget, action, data):
        self.systemPlanetMenu.show((16*20, 0))

    def onPlanets(self, widget, action, data):
        self.planetsOverviewDlg.display()

    def onSystems(self, widget, action, data):
        self.systemOverviewDlg.display()

    def onPlanetAnalysis(self, widget, action, data):
        self.planetsAnalysisDlg.display()

    def onGlobalQueues(self, widget, action, data):
        self.globalQueuesDlg.display()

    def onFleetsMenu(self, widget, action, data):
        self.systemFleetMenu.show((20*20, 0))

    def onFleets(self, widget, action, data):
        self.fleetsOverviewDlg.display()
#.........这里部分代码省略.........
开发者ID:ospaceteam,项目名称:outerspace,代码行数:103,代码来源:MainGameDlg.py


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