From 72f0a93c3060c7c3b8becd76bac1093c48cef632 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Sat, 22 Jun 2013 14:36:03 +0100
Subject: [PATCH] [Add] <resedit> Changing planet class is supported now.

---
 utils/resedit/space.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/utils/resedit/space.py b/utils/resedit/space.py
index c68807a..5872768 100644
--- a/utils/resedit/space.py
+++ b/utils/resedit/space.py
@@ -132,6 +132,7 @@ class Space:
         "trePlanets":["button-release-event", self.__pupdate],
         "comSystem":["changed", self.__pnewSys],
         "comFaction":["changed", self.__pnewFact],
+        "comClass":["changed", self.__class_sel],
         "butSave":["clicked", self.savePlanets],
         "butComAdd":["clicked", self.__commodity_add],
         "butComRm":["clicked", self.__commodity_rm],
@@ -334,7 +335,8 @@ class Space:
 
   def __pupdate(self, wgt=None, event=None):
     # Store the current values
-    self.__pstore()
+    if self.cur_planet != self.__curPlanet():
+      self.__pstore()
 
     self.__genPlanetTree()
 
@@ -809,6 +811,15 @@ class Space:
       self.planets[self.cur_planet]["GFX"]["exterior"] = space
       self.__pupdate()
 
+  """
+  Change the planet class.
+  """
+  def __class_sel(self, wgt=None, event=None):
+    cls = self.__pwidget("comClass").get_active_text()
+    if self.cur_planet != "":
+      self.planets[self.cur_planet]["general"]["class"] = cls
+      self.__pupdate()
+
   """
   Open the description editor.
   """
@@ -905,7 +916,6 @@ class Space:
 
     # Append to new location.
     self.systems[sys]["planets"].append(planet)
-    print self.systems[sys]["planets"]
 
     # Recreate the tree.
     self.__genPlanetTree()