[Add] <resedit> You can now edit planet descriptions.
This commit is contained in:
parent
f205c0f3c3
commit
98443fd466
@ -72,7 +72,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="comFaction">
|
||||
<property name="width_request">182</property>
|
||||
<property name="width_request">180</property>
|
||||
<property name="height_request">24</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
@ -494,7 +494,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="comSpace">
|
||||
<property name="width_request">163</property>
|
||||
<property name="width_request">164</property>
|
||||
<property name="height_request">24</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
@ -529,6 +529,21 @@
|
||||
<property name="y">120</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="butDescription">
|
||||
<property name="width_request">240</property>
|
||||
<property name="height_request">25</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="label" translatable="yes">Edit Description</property>
|
||||
<property name="response_id">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="x">20</property>
|
||||
<property name="y">150</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
@ -538,4 +553,43 @@
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkWindow" id="winDescription">
|
||||
<property name="type">GTK_WINDOW_POPUP</property>
|
||||
<property name="title" translatable="yes">Edit Description</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkTextView" id="texDescription">
|
||||
<property name="width_request">400</property>
|
||||
<property name="height_request">400</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">10</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="butDescDone">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="label" translatable="yes">Done</property>
|
||||
<property name="response_id">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
|
@ -2,6 +2,8 @@
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<glade-interface>
|
||||
<widget class="GtkWindow" id="winResedit">
|
||||
<property name="title" translatable="yes">Lephisto Resource Editor</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
@ -136,7 +136,8 @@ class Space:
|
||||
"butComAdd":["clicked", self.__commodity_add],
|
||||
"butComRm":["clicked", self.__commodity_rm],
|
||||
"comSpace":["changed", self.__space_sel],
|
||||
"comExterior":["changed", self.__exterior_sel]
|
||||
"comExterior":["changed", self.__exterior_sel],
|
||||
"butDescription":["clicked", self.__edit_description]
|
||||
}
|
||||
for key, val in hooks.items():
|
||||
self.__pwidget(key).connect(val[0], val[1])
|
||||
@ -794,7 +795,7 @@ class Space:
|
||||
self.__pupdate()
|
||||
|
||||
"""
|
||||
Change the graphics.
|
||||
Change the planet graphics.
|
||||
"""
|
||||
def __space_sel(self, wgt=None, event=None):
|
||||
space = self.__pwidget("comSpace").get_active_text()
|
||||
@ -808,6 +809,39 @@ class Space:
|
||||
self.planets[self.cur_planet]["GFX"]["exterior"] = space
|
||||
self.__pupdate()
|
||||
|
||||
"""
|
||||
Open the description editor.
|
||||
"""
|
||||
def __edit_description(self, wgt=None, event=None):
|
||||
if self.cur_planet == "":
|
||||
return
|
||||
|
||||
wtree = gtk.glade.XML(self.planet_glade, "winDescription")
|
||||
wtree.get_widget("winDescription").show_all()
|
||||
|
||||
# Hooks.
|
||||
wtree.get_widget("butDescDone").connect("clicked", self.__desc_done)
|
||||
|
||||
# Set text.
|
||||
buf = gtk.TextBuffer()
|
||||
try:
|
||||
buf.set_text(self.planets[self.cur_planet]["general"]["description"])
|
||||
except:
|
||||
buf.set_text("")
|
||||
wtree.get_widget("texDescription").set_buffer(buf)
|
||||
|
||||
self.dtree = wtree
|
||||
|
||||
def __desc_done(self, wgt=None, event=None):
|
||||
buf = self.dtree.get_widget("texDescription").get_buffer()
|
||||
desc = buf.get_text(buf.get_start_iter(), buf.get_end_iter())
|
||||
if desc != "":
|
||||
self.planets[self.cur_planet]["general"]["description"] = desc
|
||||
else:
|
||||
if "description" in self.planets[self.cur_planet]["general"].keys():
|
||||
del self.planets[self.cur_planet]["general"]["description"]
|
||||
self.dtree.get_widget("winDescription").hide_all()
|
||||
|
||||
"""
|
||||
Create a new star system.
|
||||
"""
|
||||
@ -825,7 +859,7 @@ class Space:
|
||||
"""
|
||||
def __pnew(self, wgt=None, event=None):
|
||||
name = "new planet"
|
||||
gfx = { "space":"none.png" }
|
||||
gfx = { "space":"None" }
|
||||
gen = { "class":"A", "services":0 }
|
||||
pos = { "x":0, "y":0 }
|
||||
new_planet = { "GFX":gfx, "general":gen, "pos":pos }
|
||||
@ -871,6 +905,7 @@ class Space:
|
||||
|
||||
# Append to new location.
|
||||
self.systems[sys]["planets"].append(planet)
|
||||
print self.systems[sys]["planets"]
|
||||
|
||||
# Recreate the tree.
|
||||
self.__genPlanetTree()
|
||||
|
Loading…
Reference in New Issue
Block a user