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


Python Action.setChecked方法代码示例

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


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

示例1: __init__

# 需要导入模块: from action import Action [as 别名]
# 或者: from action.Action import setChecked [as 别名]

#.........这里部分代码省略.........
		action.activated.connect(self._rotateCounterClockwise, sender=rotateLeftAction)
		action.activated.connect(self._rotateClockwise, sender=rotateRightAction)
		action.activated.connect(self._zoomIn, sender=zoomInAction)
		action.activated.connect(self._zoomOut, sender=zoomOutAction)
		action.activated.connect(self._resetZoom, sender=zoomResetAction)
		action.activated.connect(self._captureScreen, sender=screenshotAction)
	
		self._viewGroup = ActionGroup(name=u"View group")
		self._viewGroup.addAction(rotateLeftAction)
		self._viewGroup.addAction(rotateRightAction)
		self._viewGroup.addAction(zoomInAction)
		self._viewGroup.addAction(zoomOutAction)
		self._viewGroup.addAction(zoomResetAction)
		self._viewGroup.addAction(screenshotAction)
		
		self._toolbar.addAction(self._viewGroup)
		self._toolbar.adaptLayout()
		
	def _clearToolbarButtons(self):
		""" Remove toolbar buttons """
		self._toolbar.removeAction(self._viewGroup)
		self._toolbar.adaptLayout()
		self._viewGroup = None
		
	def _setMode(self, mode):
		""" Set the editor mode """
		if (mode == MapEditor.INSERTING) and (not self._object):
			self._statusbar.setText(u'Please select object first')
			mode = self._mode

		self._ignoreToggles = True
		# Update toolbox buttons
		if (mode == MapEditor.INSERTING):
			self._drawAction.setChecked(True)
		elif mode == MapEditor.REMOVING:
			self._removeAction.setChecked(True)
		elif mode == MapEditor.MOVING:
			self._moveAction.setChecked(True)
		elif mode == MapEditor.OBJECTPICKER:
			self._objectpickerAction.setChecked(True)
		else:
			self._selectAction.setChecked(True)
		self._ignoreToggles = False

		self._mode = mode
		if self._debug: print "Entered mode " + mode
		self._statusbar.setText(mode)
		self._updateCursor()
		
	def _zoomIn(self, zoom=1.10):
		self._controller.setZoom(self._controller.getZoom()*zoom)
		
	def _zoomOut(self, zoom=1.10):
		self._controller.setZoom(self._controller.getZoom()/zoom)
		
	def _resetZoom(self):
		""" Resets zoom level to 1:1 """
		self._controller.setZoom(1)
		
	def _rotateCounterClockwise(self):
		""" Rotates map counterclockwise """
		self._controller.rotateCounterClockwise()
		
	def _rotateClockwise(self):
		""" Rotates map clockwise """
		self._controller.rotateClockwise()
开发者ID:LilMouse,项目名称:fifengine,代码行数:70,代码来源:mapeditor.py

示例2: __init__

# 需要导入模块: from action import Action [as 别名]
# 或者: from action.Action import setChecked [as 别名]

#.........这里部分代码省略.........
		
		action.activated.connect(self.rotateCounterClockwise, sender=rotateLeftAction)
		action.activated.connect(self.rotateClockwise, sender=rotateRightAction)
		action.activated.connect(self.zoomIn, sender=zoomInAction)
		action.activated.connect(self.zoomOut, sender=zoomOutAction)
		action.activated.connect(self.resetZoom, sender=zoomResetAction)
		action.activated.connect(self.captureScreen, sender=screenshotAction)
	
		self._viewGroup = ActionGroup(name=u"View group")
		self._viewGroup.addAction(rotateLeftAction)
		self._viewGroup.addAction(rotateRightAction)
		self._viewGroup.addAction(zoomInAction)
		self._viewGroup.addAction(zoomOutAction)
		self._viewGroup.addAction(zoomResetAction)
		self._viewGroup.addAction(screenshotAction)
		
		self._toolbar.addAction(self._viewGroup)
		self._toolbar.adaptLayout()
		
	def _clearToolbarButtons(self):
		self._toolbar.removeAction(self._viewGroup)
		self._toolbar.adaptLayout()
		self._viewGroup = None
		
		
	def _setMode(self, mode):
		if (mode == INSERTING) and (not self._object):
			self._statusbar.setText(u'Please select object first')
			mode = self._mode

		self._ignoreToggles = True
		# Update toolbox buttons
		if (mode == INSERTING):
			self._drawAction.setChecked(True)
		elif mode == REMOVING:
			self._removeAction.setChecked(True)
		elif mode == MOVING:
			self._moveAction.setChecked(True)
		elif mode == OBJECTPICKER:
			self._objectpickerAction.setChecked(True)
		else:
			self._selectAction.setChecked(True)
		self._ignoreToggles = False

		self._mode = mode
		print "Entered mode " + mode
		self._statusbar.setText(mode.replace('_', ' ').capitalize())
		self._setCursor()
		
	def _buttonToggled(self, sender, toggled):
		if self._controller is None: return
		if self._ignoreToggles is True: return
	
		mode = SELECTING
		
		if toggled:
			if sender == self._selectAction:
				mode = SELECTING
			elif sender == self._moveAction:
				mode = MOVING
			elif sender == self._drawAction:
				mode = INSERTING
			elif sender == self._removeAction:
				mode = REMOVING
			elif sender == self._objectpickerAction:
				mode = OBJECTPICKER
开发者ID:m64,项目名称:PEG,代码行数:70,代码来源:mapeditor.py


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