def restore_grid(): """Restore grid preferences""" grid = get_repository_setting_value(guisettings.ID_Grid) grid_obj = app.get_grid() grid_obj.setspacing( grid['line spacing'] ) grid_obj.setnsubdivision( grid['line grouping'] ) color = format.byte_rgb_2_unit_rgba( grid['minor color'] ) grid_obj.setlightcolor(color[0], color[1], color[2], color[3]) color = format.byte_rgb_2_unit_rgba( grid['major color'] ) grid_obj.setdarkcolor(color[0], color[1], color[2], color[3]) grid_obj.setsnapenabled( grid['snap enabled'] )
def restore_grid(): """Restore grid preferences""" grid = get_repository_setting_value(guisettings.ID_Grid) grid_obj = app.get_grid() grid_obj.setspacing(grid['line spacing']) grid_obj.setnsubdivision(grid['line grouping']) color = format.byte_rgb_2_unit_rgba(grid['minor color']) grid_obj.setlightcolor(color[0], color[1], color[2], color[3]) color = format.byte_rgb_2_unit_rgba(grid['major color']) grid_obj.setdarkcolor(color[0], color[1], color[2], color[3]) grid_obj.setsnapenabled(grid['snap enabled'])
def __set_properties(self): # Grid grid = app.get_grid() self.float_grid_cell_size.set_value(grid.getspacing()) self.int_grid_line_grouping.set_value(grid.getnsubdivision()) self.color_grid_minor.SetColour( format.unit_rgb_2_byte_rgb(grid.getlightcolor())) self.color_grid_major.SetColour( format.unit_rgb_2_byte_rgb(grid.getdarkcolor())) # Angle snapping angle_snap = get_repository_setting_value(guisettings.ID_AngleSnapping) self.float_angle.set_value(angle_snap['angle']) # Size snapping size_snap = get_repository_setting_value(guisettings.ID_SizeSnapping) self.float_size.set_value(size_snap['size'])
def __set_properties(self): # Grid grid = app.get_grid() self.float_grid_cell_size.set_value( grid.getspacing() ) self.int_grid_line_grouping.set_value( grid.getnsubdivision() ) self.color_grid_minor.SetColour( format.unit_rgb_2_byte_rgb(grid.getlightcolor()) ) self.color_grid_major.SetColour( format.unit_rgb_2_byte_rgb(grid.getdarkcolor()) ) # Angle snapping angle_snap = get_repository_setting_value( guisettings.ID_AngleSnapping ) self.float_angle.set_value( angle_snap['angle'] ) # Size snapping size_snap = get_repository_setting_value( guisettings.ID_SizeSnapping ) self.float_size.set_value( size_snap['size'] )
def on_snap_to_grid(self, event): """Toggle snap to grid""" grid = cfg.Repository.getsettingvalue(cfg.ID_Grid) grid['snap enabled'] = event.Checked() app.get_grid().setsnapenabled( grid['snap enabled'] )
def on_snap_to_grid(self, event): """Toggle snap to grid""" grid = cfg.Repository.getsettingvalue(cfg.ID_Grid) grid['snap enabled'] = event.Checked() app.get_grid().setsnapenabled(grid['snap enabled'])
def on_major_color(self, event): color255 = self.color_grid_major.GetColour().Get() color = format.byte_rgb_2_unit_rgba(color255) app.get_grid().setdarkcolor(color[0], color[1], color[2], color[3]) get_repository_setting_value('grid')['major color'] = color255
def on_line_grouping(self, event): if self.int_grid_line_grouping.get_value() > 0: grouping = self.int_grid_line_grouping.get_value() app.get_grid().setnsubdivision(grouping) get_repository_setting_value('grid')['line grouping'] = grouping
def on_line_spacing(self, event): if self.float_grid_cell_size.get_value() > 0: spacing = self.float_grid_cell_size.get_value() app.get_grid().setspacing(spacing) get_repository_setting_value('grid')['line spacing'] = spacing