def on_angle_snap(self, event): """Toggle angle snap""" angle = cfg.Repository.getsettingvalue(cfg.ID_AngleSnapping) angle['enabled'] = event.Checked() if angle['enabled']: app.get_rotate_tool().setsnap( angle['angle'] ) else: app.get_rotate_tool().setsnap(0)
def on_angle_snap(self, event): """Toggle angle snap""" angle = cfg.Repository.getsettingvalue(cfg.ID_AngleSnapping) angle['enabled'] = event.Checked() if angle['enabled']: app.get_rotate_tool().setsnap(angle['angle']) else: app.get_rotate_tool().setsnap(0)
def restore_angle_snapping(): """Restore angle snapping preferences""" angle_snap = get_repository_setting_value(guisettings.ID_AngleSnapping) rotate = app.get_rotate_tool() if angle_snap['enabled']: rotate.setsnap(angle_snap['angle']) else: rotate.setsnap(0)
def restore_angle_snapping(): """Restore angle snapping preferences""" angle_snap = get_repository_setting_value( guisettings.ID_AngleSnapping ) rotate = app.get_rotate_tool() if angle_snap['enabled']: rotate.setsnap( angle_snap['angle'] ) else: rotate.setsnap(0)
def __init__(self, parent): togwin.ChildToggableDialog.__init__(self, "Tool info", parent) # Number of decimals used in all float representations self.decimals = 2 # Tool ids and paths self.ID_TerrainRaise = wx.NewId() self.ID_TerrainFlatten = wx.NewId() self.ID_TerrainSlope = wx.NewId() self.ID_TerrainSmooth = wx.NewId() self.ID_TerrainNoise = wx.NewId() self.ID_TerrainPaint = wx.NewId() self.ID_TerrainHole = wx.NewId() self.ID_Measure = wx.NewId() self.tool_paths = { toolscmds.ID_TranslateObjTool: app.get_translate_tool().getfullname(), toolscmds.ID_RotateObjTool: app.get_rotate_tool().getfullname(), toolscmds.ID_ScaleObjTool: app.get_scale_tool().getfullname(), self.ID_TerrainRaise: trn.get_terrain_tool_path('toolRaiseLow'), self.ID_TerrainFlatten: trn.get_terrain_tool_path('toolFlatten'), self.ID_TerrainSlope: trn.get_terrain_tool_path('toolSlope'), self.ID_TerrainSmooth: trn.get_terrain_tool_path('toolSmooth'), self.ID_TerrainNoise: trn.get_terrain_tool_path('toolNoise'), self.ID_TerrainPaint: trn.get_terrain_tool_path('toolPaint'), self.ID_TerrainHole: trn.get_terrain_tool_path('toolHole'), self.ID_Measure: app.get_measure_tool().getfullname() } self.current_tool = toolscmds.ID_NullTool # Label names and values. They're init with an empty string, # but with a width long enough to contain any name/value. # Each tool will then update the labels as it needs. self.label_names = [] self.label_values = [] for i in range(5): self.label_names.append( wx.StaticText(self, -1, "", size=(80, -1), style=wx.ALIGN_RIGHT)) self.label_values.append( wx.StaticText(self, -1, "", size=(125, -1))) # Short help displayed while waiting for the first signal # (created last to be on top of other labels) self.label_help = wx.StaticText(self, -1, "For most tools, click and" \ " drag to display\ninformation.\n\nSome tools doesn't give " \ "information at all.", pos=(10,10)) self.__do_layout() self.__bind_events()
def __init__(self, parent): togwin.ChildToggableDialog.__init__( self, "Tool info", parent ) # Number of decimals used in all float representations self.decimals = 2 # Tool ids and paths self.ID_TerrainRaise = wx.NewId() self.ID_TerrainFlatten = wx.NewId() self.ID_TerrainSlope = wx.NewId() self.ID_TerrainSmooth = wx.NewId() self.ID_TerrainNoise = wx.NewId() self.ID_TerrainPaint = wx.NewId() self.ID_TerrainHole = wx.NewId() self.ID_Measure = wx.NewId() self.tool_paths = { toolscmds.ID_TranslateObjTool: app.get_translate_tool().getfullname(), toolscmds.ID_RotateObjTool: app.get_rotate_tool().getfullname(), toolscmds.ID_ScaleObjTool: app.get_scale_tool().getfullname(), self.ID_TerrainRaise: trn.get_terrain_tool_path('toolRaiseLow'), self.ID_TerrainFlatten: trn.get_terrain_tool_path('toolFlatten'), self.ID_TerrainSlope: trn.get_terrain_tool_path('toolSlope'), self.ID_TerrainSmooth: trn.get_terrain_tool_path('toolSmooth'), self.ID_TerrainNoise: trn.get_terrain_tool_path('toolNoise'), self.ID_TerrainPaint: trn.get_terrain_tool_path('toolPaint'), self.ID_TerrainHole: trn.get_terrain_tool_path('toolHole'), self.ID_Measure: app.get_measure_tool().getfullname() } self.current_tool = toolscmds.ID_NullTool # Label names and values. They're init with an empty string, # but with a width long enough to contain any name/value. # Each tool will then update the labels as it needs. self.label_names = [] self.label_values = [] for i in range(5): self.label_names.append( wx.StaticText(self, -1, "", size=(80,-1), style=wx.ALIGN_RIGHT) ) self.label_values.append( wx.StaticText(self, -1, "", size=(125,-1)) ) # Short help displayed while waiting for the first signal # (created last to be on top of other labels) self.label_help = wx.StaticText(self, -1, "For most tools, click and" \ " drag to display\ninformation.\n\nSome tools doesn't give " \ "information at all.", pos=(10,10)) self.__do_layout() self.__bind_events()