GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 8eb224c6 authored by Bruno Coudoin's avatar Bruno Coudoin

Minor feature enhancement, now in delete mode, a click on a

	component in the selector change the tool to select mode.
parent 08713491
2006-01-10 Bruno coudoin <bruno.coudoin@free.fr>
Minor feature enhancement, now in delete mode, a click on a
component in the selector change the tool to select mode.
* src/boards/python/electric.py:
2006-01-10 Bruno coudoin <bruno.coudoin@free.fr>
Remade searace icons from image in openclipart.org
......
......@@ -224,6 +224,9 @@ class Gcompris_electric:
self.old_tool_item = item
self.old_tool_item.set(pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[i][2])))
gcompris.set_cursor(self.tools[i][3]);
# Add the item in self.tools for later use
self.tools[i].append(item)
# Return the textual form of the current selected tool
......@@ -238,14 +241,22 @@ class Gcompris_electric:
if event.type == gtk.gdk.BUTTON_PRESS:
if event.button == 1:
# Deactivate old button
self.old_tool_item.set(pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[self.current_tool][1])))
self.assign_tool(tool)
return True
return False
# Activate new button
self.current_tool = tool
self.old_tool_item = item
self.old_tool_item.set(pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[self.current_tool][2])))
gcompris.set_cursor(self.tools[self.current_tool][3]);
def assign_tool(self, newtool):
# Deactivate old button
item = self.tools[self.current_tool][4]
item.set(pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[self.current_tool][1])))
# Activate new button
self.current_tool = newtool
item = self.tools[newtool][4]
item.set(pixbuf = gcompris.utils.load_pixmap(gcompris.skin.image_to_skin(self.tools[self.current_tool][2])))
gcompris.set_cursor(self.tools[self.current_tool][3]);
def create_components(self):
......@@ -1275,8 +1286,10 @@ class Selector:
# Callback event on the component
def component_click(self, widget, event, component_class):
if(self.electric.get_current_tools()=="DEL"):
return True
if (event.state & gtk.gdk.BUTTON1_MASK
and self.electric.get_current_tools()=="DEL"):
# Switch to select mode
self.electric.assign_tool(1)
if event.type == gtk.gdk.MOTION_NOTIFY:
if event.state & gtk.gdk.BUTTON1_MASK:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment