# HG changeset patch
# User etisserant
# Date 1204308970 -3600
# Node ID d3e6484ebe85040bc3932e156f023d94727ff1c7
# Parent 99d77995b4eaa2b9bae02eecb23b6a337e88870f
changed the way icons are loaded for both toolbars and treectrl. Now, non editable items have different pyData.
diff -r 99d77995b4ea -r d3e6484ebe85 Images/ACTION.png
Binary file Images/ACTION.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/ACTIONS.png
Binary file Images/ACTIONS.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/CONFIGURATION.png
Binary file Images/CONFIGURATION.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/CONFIGURATIONS.png
Binary file Images/CONFIGURATIONS.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/DATATYPE.png
Binary file Images/DATATYPE.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/DATATYPES.png
Binary file Images/DATATYPES.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/F.png
Binary file Images/F.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/FB.png
Binary file Images/FB.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/FBD.png
Binary file Images/FBD.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/FUNCTION.png
Binary file Images/FUNCTION.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/FUNCTIONBLOCK.png
Binary file Images/FUNCTIONBLOCK.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/IL.png
Binary file Images/IL.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/LD.png
Binary file Images/LD.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/PROGRAM.png
Binary file Images/PROGRAM.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/PROJECT.png
Binary file Images/PROJECT.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/PROPERTIES.png
Binary file Images/PROPERTIES.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/RESOURCE.png
Binary file Images/RESOURCE.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/RESOURCES.png
Binary file Images/RESOURCES.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/SFC.png
Binary file Images/SFC.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/ST.png
Binary file Images/ST.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/TRANSITION.png
Binary file Images/TRANSITION.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/TRANSITIONS.png
Binary file Images/TRANSITIONS.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/action.png
Binary file Images/action.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/action.svg
--- a/Images/action.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_action.png
Binary file Images/add_action.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_block.png
Binary file Images/add_block.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_branch.png
Binary file Images/add_branch.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_coil.png
Binary file Images/add_coil.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_comment.png
Binary file Images/add_comment.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_connection.png
Binary file Images/add_connection.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_contact.png
Binary file Images/add_contact.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_divergence.png
Binary file Images/add_divergence.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_initial_step.png
Binary file Images/add_initial_step.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_jump.png
Binary file Images/add_jump.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_powerrail.png
Binary file Images/add_powerrail.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_rung.png
Binary file Images/add_rung.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_step.png
Binary file Images/add_step.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_transition.png
Binary file Images/add_transition.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_variable.png
Binary file Images/add_variable.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/add_wire.png
Binary file Images/add_wire.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/block.png
Binary file Images/block.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/block.svg
--- a/Images/block.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/branch.png
Binary file Images/branch.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/branch.svg
--- a/Images/branch.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/coil.png
Binary file Images/coil.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/coil.svg
--- a/Images/coil.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/comment.png
Binary file Images/comment.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/comment.svg
--- a/Images/comment.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/connection.png
Binary file Images/connection.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/connection.svg
--- a/Images/connection.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/contact.png
Binary file Images/contact.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/contact.svg
--- a/Images/contact.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/divergence.png
Binary file Images/divergence.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/divergence.svg
--- a/Images/divergence.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/genicons.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Images/genicons.sh Fri Feb 29 19:16:10 2008 +0100
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+INKSCAPE=/cygdrive/c/Program\ Files/Inkscape/inkscape.exe
+
+for i in `cat icons.svg |grep -o -e '%%[^%]*%%'|sed 's/%//g'`
+do
+ echo "$INKSCAPE" `cygpath -w \`pwd\`/icons.svg` -z -e `cygpath -w \`pwd\`/$i.png` -i $i
+ rm -f $i.png
+ "$INKSCAPE" `cygpath -w \`pwd\`/icons.svg` -z -e `cygpath -w \`pwd\`/$i.png` -i $i
+done
diff -r 99d77995b4ea -r d3e6484ebe85 Images/icons.svg
--- a/Images/icons.svg Fri Feb 29 11:01:03 2008 +0100
+++ b/Images/icons.svg Fri Feb 29 19:16:10 2008 +0100
@@ -2,47 +2,439 @@
diff -r 99d77995b4ea -r d3e6484ebe85 Images/initial_step.png
Binary file Images/initial_step.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/initial_step.svg
--- a/Images/initial_step.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/jump.png
Binary file Images/jump.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/jump.svg
--- a/Images/jump.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/poe.ico
Binary file Images/poe.ico has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/poe.png
Binary file Images/poe.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/powerrail.png
Binary file Images/powerrail.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/powerrail.svg
--- a/Images/powerrail.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/rung.png
Binary file Images/rung.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/rung.svg
--- a/Images/rung.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/select.png
Binary file Images/select.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/select.svg
--- a/Images/select.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/step.png
Binary file Images/step.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/step.svg
--- a/Images/step.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/transition.png
Binary file Images/transition.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/transition.svg
--- a/Images/transition.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/variable.png
Binary file Images/variable.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/variable.svg
--- a/Images/variable.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 Images/wire.png
Binary file Images/wire.png has changed
diff -r 99d77995b4ea -r d3e6484ebe85 Images/wire.svg
--- a/Images/wire.svg Fri Feb 29 11:01:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-
-
-
diff -r 99d77995b4ea -r d3e6484ebe85 PLCControler.py
--- a/PLCControler.py Fri Feb 29 11:01:03 2008 +0100
+++ b/PLCControler.py Fri Feb 29 19:16:10 2008 +0100
@@ -36,9 +36,25 @@
duration_model = re.compile("(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m(?!s))?(?:([0-9]{1,2})s)?(?:([0-9]{1,3}(?:.[0-9]*)?)ms)?")
-[ITEM_UNEDITABLE, ITEM_PROJECT, ITEM_POU, ITEM_CLASS, ITEM_VARIABLE,
- ITEM_TRANSITION, ITEM_ACTION, ITEM_CONFIGURATION, ITEM_RESOURCE,
- ITEM_DATATYPE] = range(10)
+ITEMS_EDITABLE = [ITEM_PROJECT,
+ ITEM_POU,
+ ITEM_VARIABLE,
+ ITEM_TRANSITION,
+ ITEM_ACTION,
+ ITEM_CONFIGURATION,
+ ITEM_RESOURCE,
+ ITEM_DATATYPE] = range(8)
+
+ITEMS_UNEDITABLE=[ITEM_DATATYPES,
+ ITEM_FUNCTION,
+ ITEM_FUNCTIONBLOCK,
+ ITEM_PROGRAM,
+ ITEM_TRANSITIONS,
+ ITEM_ACTIONS,
+ ITEM_CONFIGURATIONS,
+ ITEM_RESOURCES,
+ ITEM_PROPERTIES,
+ ]=range(9,18)
ScriptDirectory = os.path.split(os.path.realpath(__file__))[0]
@@ -254,12 +270,12 @@
def GetProjectInfos(self):
if self.Project:
infos = {"name": self.Project.getname(), "type": ITEM_PROJECT}
- datatypes = {"name": "Data Types", "type": ITEM_UNEDITABLE, "values":[]}
+ datatypes = {"name": "Data Types", "type": ITEM_DATATYPES, "values":[]}
for datatype in self.Project.getdataTypes():
datatypes["values"].append({"name": datatype.getname(), "type": ITEM_DATATYPE, "values": []})
- pou_types = {"function": {"name": "Functions", "type": ITEM_UNEDITABLE, "values":[]},
- "functionBlock": {"name": "Function Blocks", "type": ITEM_UNEDITABLE, "values":[]},
- "program": {"name": "Programs", "type": ITEM_UNEDITABLE, "values":[]}}
+ pou_types = {"function": {"name": "Functions", "type": ITEM_FUNCTION, "values":[]},
+ "functionBlock": {"name": "Function Blocks", "type": ITEM_FUNCTIONBLOCK, "values":[]},
+ "program": {"name": "Programs", "type": ITEM_PROGRAM, "values":[]}}
for pou in self.Project.getpous():
pou_type = pou.getpouType()
pou_infos = {"name": pou.getname(), "type": ITEM_POU}
@@ -268,26 +284,26 @@
transitions = []
for transition in pou.gettransitionList():
transitions.append({"name": transition.getname(), "type": ITEM_TRANSITION, "values": []})
- pou_values.append({"name": "Transitions", "type": ITEM_UNEDITABLE, "values": transitions})
+ pou_values.append({"name": "Transitions", "type": ITEM_TRANSITIONS, "values": transitions})
actions = []
for action in pou.getactionList():
actions.append({"name": action.getname(), "type": ITEM_ACTION, "values": []})
- pou_values.append({"name": "Actions", "type": ITEM_UNEDITABLE, "values": actions})
+ pou_values.append({"name": "Actions", "type": ITEM_ACTIONS, "values": actions})
if pou_type in pou_types:
pou_infos["values"] = pou_values
pou_types[pou_type]["values"].append(pou_infos)
- configurations = {"name": "Configurations", "type": ITEM_UNEDITABLE, "values": []}
+ configurations = {"name": "Configurations", "type": ITEM_CONFIGURATIONS, "values": []}
for config in self.Project.getconfigurations():
config_name = config.getname()
config_infos = {"name": config_name, "type": ITEM_CONFIGURATION, "values": []}
- resources = {"name": "Resources", "type": ITEM_UNEDITABLE, "values": []}
+ resources = {"name": "Resources", "type": ITEM_RESOURCES, "values": []}
for resource in config.getresource():
resource_name = resource.getname()
resource_infos = {"name": resource_name, "type": ITEM_RESOURCE, "values": []}
resources["values"].append(resource_infos)
config_infos["values"] = [resources]
configurations["values"].append(config_infos)
- infos["values"] = [{"name": "Properties", "type": ITEM_UNEDITABLE, "values": []},
+ infos["values"] = [{"name": "Properties", "type": ITEM_PROPERTIES, "values": []},
datatypes, pou_types["function"], pou_types["functionBlock"],
pou_types["program"], configurations]
return infos
diff -r 99d77995b4ea -r d3e6484ebe85 PLCOpenEditor.py
--- a/PLCOpenEditor.py Fri Feb 29 11:01:03 2008 +0100
+++ b/PLCOpenEditor.py Fri Feb 29 19:16:10 2008 +0100
@@ -104,31 +104,81 @@
] = [wx.NewId() for _init_coll_DefaultToolBar_Items in range(17)]
ToolBarItems = {
- "FBD" : [(True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "comment.png", "Create a new comment"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "variable.png", "Create a new variable"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "block.png", "Create a new block"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "connection.png", "Create a new connection")],
- "LD" : [(True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "comment.png", "Create a new comment"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARPOWERRAIL, "OnPowerRailTool", "powerrail.png", "Create a new power rail"),
- (False, DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARRUNG, "OnRungTool", "rung.png", "Create a new rung"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCOIL, "OnCoilTool", "coil.png", "Create a new coil"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONTACT, "OnContactTool", "contact.png", "Create a new contact"),
- (False, DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARBRANCH, "OnBranchTool", "branch.png", "Create a new branch"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "variable.png", "Create a new variable"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "block.png", "Create a new block"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "connection.png", "Create a new connection")],
- "SFC" : [(True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool", "comment.png", "Create a new comment"),
- (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARINITIALSTEP, "OnInitialStepTool", "initial_step.png", "Create a new initial step"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARSTEP, "OnStepTool", "step.png", "Create a new step"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARTRANSITION, "OnTransitionTool", "transition.png", "Create a new transition"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARACTIONBLOCK, "OnActionBlockTool", "action.png", "Create a new action block"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARDIVERGENCE, "OnDivergenceTool", "divergence.png", "Create a new divergence"),
- (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE, ID_PLCOPENEDITORTOOLBARJUMP, "OnJumpTool", "jump.png", "Create a new jump"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool", "variable.png", "Create a new variable"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool", "block.png", "Create a new block"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool", "connection.png", "Create a new connection"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARPOWERRAIL, "OnPowerRailTool", "powerrail.png", "Create a new power rail"),
- (True, FREEDRAWING_MODE, ID_PLCOPENEDITORTOOLBARCONTACT, "OnContactTool", "contact.png", "Create a new contact")],
+ "FBD" : [(True, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool",
+ "add_comment.png", "Create a new comment"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool",
+ "add_variable.png", "Create a new variable"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool",
+ "add_block.png", "Create a new block"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool",
+ "add_connection.png", "Create a new connection")],
+ "LD" : [(True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool",
+ "add_comment.png", "Create a new comment"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARPOWERRAIL, "OnPowerRailTool",
+ "add_powerrail.png", "Create a new power rail"),
+ (False, DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARRUNG, "OnRungTool",
+ "add_rung.png", "Create a new rung"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCOIL, "OnCoilTool",
+ "add_coil.png", "Create a new coil"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCONTACT, "OnContactTool",
+ "add_contact.png", "Create a new contact"),
+ (False, DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARBRANCH, "OnBranchTool",
+ "add_branch.png", "Create a new branch"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool",
+ "add_variable.png", "Create a new variable"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool",
+ "add_block.png", "Create a new block"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool",
+ "add_connection.png", "Create a new connection")],
+ "SFC" : [(True, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCOMMENT, "OnCommentTool",
+ "add_comment.png", "Create a new comment"),
+ (True, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARINITIALSTEP, "OnInitialStepTool",
+ "add_initial_step.png", "Create a new initial step"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARSTEP, "OnStepTool",
+ "add_step.png", "Create a new step"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARTRANSITION, "OnTransitionTool",
+ "add_transition.png", "Create a new transition"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARACTIONBLOCK, "OnActionBlockTool",
+ "add_action.png", "Create a new action block"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARDIVERGENCE, "OnDivergenceTool",
+ "add_divergence.png", "Create a new divergence"),
+ (False, FREEDRAWING_MODE|DRIVENDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARJUMP, "OnJumpTool",
+ "add_jump.png", "Create a new jump"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARVARIABLE, "OnVariableTool",
+ "add_variable.png", "Create a new variable"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARBLOCK, "OnBlockTool",
+ "add_block.png", "Create a new block"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCONNECTION, "OnConnectionTool",
+ "add_connection.png", "Create a new connection"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARPOWERRAIL, "OnPowerRailTool",
+ "add_powerrail.png", "Create a new power rail"),
+ (True, FREEDRAWING_MODE,
+ ID_PLCOPENEDITORTOOLBARCONTACT, "OnContactTool",
+ "add_contact.png", "Create a new contact")],
"ST" : [],
"IL" : []
}
@@ -416,11 +466,33 @@
icon = wx.Icon(os.path.join(CWD,"Images","poe.ico"),wx.BITMAP_TYPE_ICO)
self.SetIcon(icon)
- if wx.Platform != '__WXMSW__':
- self.TreeImageList = wx.ImageList(16, 16)
- for language in LANGUAGES:
- self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%language)))
- self.ProjectTree.AssignImageList(self.TreeImageList)
+ self.TreeImageList = wx.ImageList(16, 16)
+ self.TreeImageDict = {}
+ for language in LANGUAGES:
+ self.TreeImageDict[language]=self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%language)))
+
+ for imgname, itemtype in [
+ #editables
+ ("PROJECT", ITEM_PROJECT),
+ #("POU", ITEM_POU),
+ #("VARIABLE", ITEM_VARIABLE),
+ ("TRANSITION", ITEM_TRANSITION),
+ ("ACTION", ITEM_ACTION),
+ ("CONFIGURATION", ITEM_CONFIGURATION),
+ ("RESOURCE", ITEM_RESOURCE),
+ ("DATATYPE", ITEM_DATATYPE),
+ # uneditables
+ ("DATATYPES", ITEM_DATATYPES),
+ ("FUNCTION", ITEM_FUNCTION),
+ ("FUNCTIONBLOCK", ITEM_FUNCTIONBLOCK),
+ ("PROGRAM", ITEM_PROGRAM),
+ ("TRANSITIONS", ITEM_TRANSITIONS),
+ ("ACTIONS", ITEM_ACTIONS),
+ ("CONFIGURATIONS", ITEM_CONFIGURATIONS),
+ ("RESOURCES", ITEM_RESOURCES),
+ ("PROPERTIES", ITEM_PROPERTIES)]:
+ self.TreeImageDict[itemtype]=self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%imgname)))
+ self.ProjectTree.AssignImageList(self.TreeImageList)
self.CurrentToolBar = []
self.CurrentLanguage = ""
@@ -1016,8 +1088,11 @@
to_delete = []
self.ProjectTree.SetItemText(root, infos["name"])
self.ProjectTree.SetPyData(root, infos["type"])
- if infos["type"] == ITEM_POU and wx.Platform != '__WXMSW__':
- self.ProjectTree.SetItemImage(root, LANGUAGES.index(self.Controler.GetPouBodyType(infos["name"])))
+ if infos["type"] == ITEM_POU :
+ self.ProjectTree.SetItemImage(root,self.TreeImageDict[self.Controler.GetPouBodyType(infos["name"])])
+ else:
+ self.ProjectTree.SetItemImage(root,self.TreeImageDict[infos["type"]])
+
if wx.VERSION >= (2, 6, 0):
item, root_cookie = self.ProjectTree.GetFirstChild(root)
else:
@@ -1071,7 +1146,7 @@
def OnProjectTreeItemBeginEdit(self, event):
selected = event.GetItem()
- if self.ProjectTree.GetPyData(selected) == ITEM_UNEDITABLE:
+ if self.ProjectTree.GetPyData(selected) in ITEMS_UNEDITABLE:
event.Veto()
else:
event.Skip()
@@ -1285,7 +1360,7 @@
event.Skip()
def OnProjectTreeItemChanging(self, event):
- if self.ProjectTree.GetPyData(event.GetItem()) != ITEM_UNEDITABLE and self.SelectedItem is None:
+ if self.ProjectTree.GetPyData(event.GetItem()) not in ITEMS_UNEDITABLE and self.SelectedItem is None:
self.SelectedItem = event.GetItem()
event.Veto()
else:
@@ -1431,7 +1506,7 @@
elif type == ITEM_RESOURCE:
self.Bind(wx.EVT_MENU, self.OnRemoveResourceMenu, id=new_id)
self.PopupMenu(menu)
- elif type == ITEM_UNEDITABLE:
+ elif type in ITEMS_UNEDITABLE:
if name == "Data Types":
menu = wx.Menu(title='')
new_id = wx.NewId()