GSOC Day 14 – Stuck in the Orders


I continued to work on the OrdersPanel today. It was Saturday in Australia, so Mithro didn’t appear until much later than usual. When he did, I was rather happy to see him, because I was completely stuck. I don’t have much to show for today’s work, because most of it I spent digging through the code looking for any clue as to how to replace the following:

		# Build the argument list
		orderdesc = objects.OrderDescs()[type]

		# sequence, id, slot, type, turns, resources
		args = [0, self.oid, -1, type, 0, []]
		for name, type in orderdesc.names:
			args += defaults[type]


It turned out that the “defaults” dict had been removed, and the OrderDescs() had become dynamic, so the new structure has a .properties, kind of similar to objects. However, this means that I’ll have to replace the simple code there with some longer sets of if statements to determine proper defaults for each type of order parameter. Something similar to:

for property in orderdesc.properties:
	if isinstance(property, parameters.OrderParamAbsSpaceCoords):
		# Add a set of default coordinates here.
	elif .........

So it shouldn’t be that bad in the end, but I had quite a bit of trouble trying to figure out what the equivalent was on my own.

I’ll work on this more tomorrow, and we’ll see how many other silly questions I have to ask before I can get this working again.

Advertisements

~ by greywhind on June 6, 2009.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: