mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-02 07:25:45 -04:00
allow the Delete key to remove current patch
This commit is contained in:
parent
7368743681
commit
d71e0c4267
1 changed files with 19 additions and 0 deletions
|
@ -158,6 +158,23 @@ class HellowWorldGTK:
|
||||||
gtk.gdk.INTERP_NEAREST
|
gtk.gdk.INTERP_NEAREST
|
||||||
))
|
))
|
||||||
|
|
||||||
|
def patch_list_key(self,treeview,event):
|
||||||
|
"""handle key press events on the patch list"""
|
||||||
|
if gtk.keysyms.Delete == event.keyval:
|
||||||
|
offs,col = treeview.get_cursor()
|
||||||
|
# remove from data structure
|
||||||
|
texture = self.wip_textures[self.current_texture()]
|
||||||
|
del texture.patches[offs[0]]
|
||||||
|
# remove from UI
|
||||||
|
model = treeview.get_model()
|
||||||
|
iter = model.get_iter(offs)
|
||||||
|
model.remove(iter)
|
||||||
|
# redraw RHS
|
||||||
|
self.init_texture_pixbuf(texture)
|
||||||
|
wip_image = self.wTree.get_widget("wip_texture")
|
||||||
|
wip_image.set_from_pixbuf(texture.pixbuf)
|
||||||
|
self.scale_up_texture(wip_image)
|
||||||
|
|
||||||
def cell_callback(self, cellrenderertext, path, new_text):
|
def cell_callback(self, cellrenderertext, path, new_text):
|
||||||
"""cell edited in patch list"""
|
"""cell edited in patch list"""
|
||||||
current_texture = self.wip_textures[self.current_texture()]
|
current_texture = self.wip_textures[self.current_texture()]
|
||||||
|
@ -235,6 +252,8 @@ class HellowWorldGTK:
|
||||||
column.pack_start(cell, False)
|
column.pack_start(cell, False)
|
||||||
column.add_attribute(cell, "text", 2)
|
column.add_attribute(cell, "text", 2)
|
||||||
|
|
||||||
|
patch_list.connect("key-press-event", self.patch_list_key)
|
||||||
|
|
||||||
# populate the RHS list with patch names
|
# populate the RHS list with patch names
|
||||||
# yes, I learnt perl once.
|
# yes, I learnt perl once.
|
||||||
patches = {}
|
patches = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue