diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs index 09c603914e..4379bb92c2 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs @@ -155,6 +155,8 @@ namespace ICSharpCode.PythonBinding AppendDelegateCreateExpression((CodeDelegateCreateExpression)expression); } else if (expression is CodeCastExpression) { AppendCastExpression((CodeCastExpression)expression); + } else if (expression is CodeBinaryOperatorExpression) { + AppendBinaryOperatorExpression((CodeBinaryOperatorExpression)expression); } else { Console.WriteLine("AppendExpression: " + expression.GetType().Name); } @@ -371,6 +373,27 @@ namespace ICSharpCode.PythonBinding return attributes[typeof(InheritanceAttribute)] as InheritanceAttribute; } return null; - } + } + + /// + /// Appends expressions like "AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top" + /// + void AppendBinaryOperatorExpression(CodeBinaryOperatorExpression expression) + { + AppendExpression(expression.Left); + AppendBinaryOperator(expression.Operator); + AppendExpression(expression.Right); + } + + void AppendBinaryOperator(CodeBinaryOperatorType operatorType) + { + codeBuilder.Append(" "); + switch (operatorType) { + case CodeBinaryOperatorType.BitwiseOr: + codeBuilder.Append("|"); + break; + } + codeBuilder.Append(" "); + } } } diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs index 010a266254..7b870c177a 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs @@ -39,6 +39,7 @@ namespace PythonBinding.Tests.Designer Panel panel = (Panel)host.CreateComponent(typeof(Panel), "panel1"); panel.Location = new Point(10, 15); + panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; panel.TabIndex = 0; panel.Size = new Size(100, 120); TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1"); @@ -74,6 +75,7 @@ namespace PythonBinding.Tests.Designer " # \r\n" + " # panel1\r\n" + " # \r\n" + + " self._panel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right\r\n" + " self._panel1.Controls.Add(self._textBox1)\r\n" + " self._panel1.Location = System.Drawing.Point(10, 15)\r\n" + " self._panel1.Name = \"panel1\"\r\n" +