Change Square_lattice to Lattice_square
This commit is contained in:
parent
36f5226107
commit
fba87c564a
@ -24,18 +24,18 @@ class Lattice():
|
||||
specs=spec.split(":")
|
||||
# check type of lattice
|
||||
if specs[0]=="square":
|
||||
return Square_lattice.new_square(specs[1:],spec)
|
||||
return Lattice_square.new_square(specs[1:],spec)
|
||||
else:
|
||||
return(None,"error: unrecognized lattice type: '"+specs[0]+"'")
|
||||
|
||||
|
||||
# square lattice
|
||||
class Square_lattice(Lattice):
|
||||
class Lattice_square(Lattice):
|
||||
def __init__(self,**kwargs):
|
||||
|
||||
self.spacing=kwargs.get("spacing",1.)
|
||||
|
||||
super(Square_lattice,self).__init__(**kwargs,type="square")
|
||||
super(Lattice_square,self).__init__(**kwargs,type="square")
|
||||
|
||||
# lattice point nearest to point
|
||||
def nearest(self,point):
|
||||
@ -49,12 +49,12 @@ class Square_lattice(Lattice):
|
||||
def new_square(specs,spec):
|
||||
# no optional args
|
||||
if len(specs)==0:
|
||||
return (Square_lattice(),"")
|
||||
return (Lattice_square(),"")
|
||||
if len(specs)>1:
|
||||
return (None,"error: '"+spec+"' is not a valid specification for the square lattice: should be 'square[:spacing]'")
|
||||
try:
|
||||
spacing=float(specs[0])
|
||||
return (Square_lattice(spacing=spacing),"")
|
||||
return (Lattice_square(spacing=spacing),"")
|
||||
except:
|
||||
return (None,"error: '"+spec+"' is not a valid specification for the square lattice: should be 'square[:spacing]'")
|
||||
|
||||
|
@ -7,7 +7,6 @@ from kivy.graphics import Color,Line
|
||||
from point import Point
|
||||
from polyomino import Cross
|
||||
from polyomino import Square_element
|
||||
from lattice import Square_lattice
|
||||
|
||||
from tools import remove_fromlist
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user