def __init__(self, curveId):
    offset = 10
    self.Text = "Annotate Curve"
    crvlabel = Label(Text="Curve ID = "+str(curveId), AutoSize=True)
    self.Controls.Add(crvlabel)
    width = crvlabel.Right
    pt = Point(crvlabel.Left,crvlabel.Bottom + offset)
    labelstart = Label(Text="Text at start", AutoSize=True)
    labelstart.Location = pt
    self.Controls.Add(labelstart)
    pt.X = labelstart.Right + offset
    inputstart = TextBox(Text="Start")
    inputstart.Location = pt
    self.Controls.Add(inputstart)
    if( inputstart.Right > width ):
      width = inputstart.Right
    self.m_inputstart = inputstart

    pt.X  = labelstart.Left
    pt.Y  = labelstart.Bottom + offset*3
    buttonApply = Button(Text="Apply", DialogResult=DialogResult.OK)
    buttonApply.Location = pt
    self.Controls.Add(buttonApply)
    pt.X = buttonApply.Right + offset
    buttonCancel = Button(Text="Cancel", DialogResult=DialogResult.Cancel)
    buttonCancel.Location = pt
    self.Controls.Add(buttonCancel)
    if( buttonCancel.Right > width ):
      width = buttonCancel.Right
    self.ClientSize = Size(width, buttonCancel.Bottom)
    self.AcceptButton = buttonApply
    self.CancelButton = buttonCancel
예제 #2
0
    def __init__(self, curveId):
        offset = 10
        self.Text = "Annotate Curve"
        crvlabel = Label(Text="Curve ID = " + str(curveId), AutoSize=True)
        self.Controls.Add(crvlabel)
        width = crvlabel.Right
        pt = Point(crvlabel.Left, crvlabel.Bottom + offset)
        labelstart = Label(Text="Text at start", AutoSize=True)
        labelstart.Location = pt
        self.Controls.Add(labelstart)
        pt.X = labelstart.Right + offset
        inputstart = TextBox(Text="Start")
        inputstart.Location = pt
        self.Controls.Add(inputstart)
        if (inputstart.Right > width):
            width = inputstart.Right
        self.m_inputstart = inputstart

        pt.X = labelstart.Left
        pt.Y = labelstart.Bottom + offset * 3
        buttonApply = Button(Text="Apply", DialogResult=DialogResult.OK)
        buttonApply.Location = pt
        self.Controls.Add(buttonApply)
        pt.X = buttonApply.Right + offset
        buttonCancel = Button(Text="Cancel", DialogResult=DialogResult.Cancel)
        buttonCancel.Location = pt
        self.Controls.Add(buttonCancel)
        if (buttonCancel.Right > width):
            width = buttonCancel.Right
        self.ClientSize = Size(width, buttonCancel.Bottom)
        self.AcceptButton = buttonApply
        self.CancelButton = buttonCancel
예제 #3
0
    def __init__(self, curveId):
        offset = 10
        index = 0

        # header
        self.Text = "Annotate Curve"

        #label
        crvlabel = Label(Text="Curve ID = " + str(curveId), AutoSize=True)
        self.Controls.Add(crvlabel)
        width = crvlabel.Right
        pt = Point(crvlabel.Left, crvlabel.Bottom + offset)

        #textInput
        labelstart = Label(Text="Text at start", AutoSize=True)
        labelstart.Location = pt
        self.Controls.Add(labelstart)
        pt.X = labelstart.Right + offset
        inputstart = TextBox(Text="Start")
        inputstart.Location = pt
        self.Controls.Add(inputstart)
        if (inputstart.Right > width):
            width = inputstart.Right
        self.m_inputstart = inputstart

        index += 1
        cb = CheckBox()
        cb.Parent = self
        cb.Location = Point(30, labelstart.Bottom + offset * index)
        cb.Text = "Show Title"
        cb.Checked = True

        pt.X = labelstart.Left
        pt.Y = labelstart.Bottom + offset * 3
        buttonApply = Button(Text="Apply", DialogResult=DialogResult.OK)
        buttonApply.Location = pt
        self.Controls.Add(buttonApply)
        pt.X = buttonApply.Right + offset
        buttonCancel = Button(Text="Cancel", DialogResult=DialogResult.Cancel)
        buttonCancel.Location = pt
        self.Controls.Add(buttonCancel)
        if (buttonCancel.Right > width):
            width = buttonCancel.Right
        self.ClientSize = Size(width, buttonCancel.Bottom)
        self.AcceptButton = buttonApply
        self.CancelButton = buttonCancel
def test_struct_construction():
    """Test construction of structs."""
    from System.Drawing import Point

    p = Point()
    assert p.X == 0
    assert p.Y == 0

    p = Point(0, 0)
    assert p.X == 0
    assert p.Y == 0

    p.X = 10
    p.Y = 10

    assert p.X == 10
    assert p.Y == 10
예제 #5
0
    def testStructConstruction(self):
        """Test construction of structs."""
        from System.Drawing import Point

        p = Point()
        self.assertTrue(p.X == 0)
        self.assertTrue(p.Y == 0)

        p = Point(0, 0)
        self.assertTrue(p.X == 0)
        self.assertTrue(p.Y == 0)

        p.X = 10
        p.Y = 10

        self.assertTrue(p.X == 10)
        self.assertTrue(p.Y == 10)
예제 #6
0
    def testStructConstruction(self):
        """Test construction of structs."""
        from System.Drawing import Point

        p = Point()
        self.assertTrue(p.X == 0)
        self.assertTrue(p.Y == 0)

        p = Point(0, 0)
        self.assertTrue(p.X == 0)
        self.assertTrue(p.Y == 0)

        p.X = 10
        p.Y = 10

        self.assertTrue(p.X == 10)
        self.assertTrue(p.Y == 10)
예제 #7
0
def test_struct_construction():
    """Test construction of structs."""
    from System.Drawing import Point

    p = Point()
    assert p.X == 0
    assert p.Y == 0

    p = Point(0, 0)
    assert p.X == 0
    assert p.Y == 0

    p.X = 10
    p.Y = 10

    assert p.X == 10
    assert p.Y == 10
예제 #8
0
    def testStructConstruction(self):
        """Test construction of structs."""
        from System.Drawing import Point

        def test():
            p = Point()

        self.failUnlessRaises(TypeError, test)

        p = Point(0, 0)
        self.failUnless(p.X == 0)
        self.failUnless(p.Y == 0)

        p.X = 10
        p.Y = 10

        self.failUnless(p.X == 10)
        self.failUnless(p.Y == 10)
예제 #9
0
    def testStructConstruction(self):
        """Test construction of structs."""
        from System.Drawing import Point

        def test():
            p = Point()

        self.failUnlessRaises(TypeError, test)

        p = Point(0, 0)
        self.failUnless(p.X == 0)
        self.failUnless(p.Y == 0)

        p.X = 10
        p.Y = 10

        self.failUnless(p.X == 10)
        self.failUnless(p.Y == 10)
예제 #10
0
def test_boxed_value_type_mutation_result():
    """Test behavior of boxed value types."""

    # This test actually exists mostly as documentation of an important
    # concern when dealing with value types. Python does not have any
    # value type semantics that can be mapped to the CLR, so it is easy
    # to accidentally write code like the following which is not really
    # mutating value types in-place but changing boxed copies.

    clr.AddReference('System.Drawing')

    from System.Drawing import Point
    from System import Array

    items = Array.CreateInstance(Point, 5)

    for i in range(5):
        items[i] = Point(i, i)

    for i in range(5):
        # Boxed items, so set_attr will not change the array member.
        assert items[i].X == i
        assert items[i].Y == i
        items[i].X = i + 1
        items[i].Y = i + 1
        assert items[i].X == i
        assert items[i].Y == i

    for i in range(5):
        # Demonstrates the workaround that will change the members.
        assert items[i].X == i
        assert items[i].Y == i
        item = items[i]
        item.X = i + 1
        item.Y = i + 1
        items[i] = item
        assert items[i].X == i + 1
        assert items[i].Y == i + 1
예제 #11
0
    def testBoxedValueTypeMutationResult(self):
        """Test behavior of boxed value types."""

        # This test actually exists mostly as documentation of an important
        # concern when dealing with value types. Python does not have any
        # value type semantics that can be mapped to the CLR, so it is easy
        # to accidentally write code like the following which is not really
        # mutating value types in-place but changing boxed copies.

        from System.Drawing import Point
        from System import Array

        items = Array.CreateInstance(Point, 5)

        for i in range(5):
            items[i] = Point(i, i)

        for i in range(5):
            # Boxed items, so settr will not change the array member.
            self.failUnless(items[i].X == i)
            self.failUnless(items[i].Y == i)
            items[i].X = i + 1
            items[i].Y = i + 1
            self.failUnless(items[i].X == i)
            self.failUnless(items[i].Y == i)

        for i in range(5):
            # Demonstrates the workaround that will change the members.
            self.failUnless(items[i].X == i)
            self.failUnless(items[i].Y == i)
            item = items[i]
            item.X = i + 1
            item.Y = i + 1
            items[i] = item
            self.failUnless(items[i].X == i + 1)
            self.failUnless(items[i].Y == i + 1)
예제 #12
0
    def testBoxedValueTypeMutationResult(self):
        """Test behavior of boxed value types."""

        # This test actually exists mostly as documentation of an important
        # concern when dealing with value types. Python does not have any
        # value type semantics that can be mapped to the CLR, so it is easy
        # to accidentally write code like the following which is not really
        # mutating value types in-place but changing boxed copies.

        from System.Drawing import Point
        from System import Array

        items = Array.CreateInstance(Point, 5)

        for i in range(5):
            items[i] = Point(i, i)

        for i in range(5):
            # Boxed items, so settr will not change the array member.
            self.failUnless(items[i].X == i)
            self.failUnless(items[i].Y == i)
            items[i].X = i + 1
            items[i].Y = i + 1
            self.failUnless(items[i].X == i)
            self.failUnless(items[i].Y == i)

        for i in range(5):
            # Demonstrates the workaround that will change the members.
            self.failUnless(items[i].X == i)
            self.failUnless(items[i].Y == i)
            item = items[i]
            item.X = i + 1
            item.Y = i + 1
            items[i] = item
            self.failUnless(items[i].X == i + 1)
            self.failUnless(items[i].Y == i + 1)
예제 #13
0
  def __init__(self, curveId):
    
    label_width = 30
    offset = 30
    index = 0
    
    # header
    self.Text = "Annotate Curve"
    
    #label
    index += 1

    crvlabel = Label(Text="Curve ID = "+str(curveId), AutoSize=True)
    self.Controls.Add(crvlabel)
    width = crvlabel.Right
    pt = Point(crvlabel.Left,crvlabel.Bottom + offset)
    
    #textInput
    labelstart = Label(Text="Text at start", AutoSize=True)
    labelstart.Location = Point(label_width, offset* index)
    self.Controls.Add(labelstart)
    pt.X = labelstart.Right + offset
    inputstart = TextBox(Text="Start")
    inputstart.Location = pt
    self.Controls.Add(inputstart)
    if( inputstart.Right > width ):
      width = inputstart.Right
    self.m_inputstart = inputstart

    index += 1
    cb = CheckBox( AutoSize=True)
    cb.Parent = self
    cb.Location = Point(label_width, offset* index)
    cb.Text = "Show Title"
    cb.Checked = True

    
    
    index += 1
    cbb = ComboBox(Text="select tool", Location=Point(label_width, offset * index), Parent=self)
    cbb.Items.AddRange(("Inner contour",
            "Outer contour",
            "Pocket",
            "Engrave",
            "Clamex horizontal"))
    
    self.cbb_tool = cbb

    index += 1
    cbb = ComboBox(Text="Outer contour", Location=Point(label_width, offset * index), Parent=self)
    cbb.Items.AddRange(("Inner contour",
            "Outer contour",
            "Pocket",
            "Engrave",
            "Clamex horizontal"))    
    
    self.cbb_operation = cbb
            
    index += 1
    sb = NumericUpDown( AutoSize=True, Location=Point(label_width, offset * index), Parent=self , DecimalPlaces = 2) 
    sb.Parent = self
    sb.Location = Point(label_width, offset* index)
    sb.DecimalPlaces  = 2
    sb.Text = "Show Title"
  
            
      

    
    index += 1
    pt.X  = labelstart.Left
    pt.Y  = labelstart.Bottom + offset*index
    buttonApply = Button(Text="Apply", DialogResult=DialogResult.OK)
    buttonApply.Location = pt
    self.Controls.Add(buttonApply)
    pt.X = buttonApply.Right + offset
    buttonCancel = Button(Text="Cancel", DialogResult=DialogResult.Cancel)
    buttonCancel.Location = pt
    self.Controls.Add(buttonCancel)
    if( buttonCancel.Right > width ):
      width = buttonCancel.Right
    self.ClientSize = Size(width, buttonCancel.Bottom)
    self.AcceptButton = buttonApply
    self.CancelButton = buttonCancel
예제 #14
0
    def __init__(self, tools):

        label_width = 30
        offset = 30
        index = 0

        # header
        self.Text = "Add layer"
        width = 400

        #label

        #textInput
        # labelstart = Label(Text="Text at start", AutoSize=True)
        # labelstart.Location = Point(label_width, offset* index)
        # self.Controls.Add(labelstart)
        # pt.X = labelstart.Right + offset
        # inputstart = TextBox(Text="Start")
        # inputstart.Location = pt
        # self.Controls.Add(inputstart)
        # if( inputstart.Right > width ):
        # width = inputstart.Right
        # self.m_inputstart = inputstart

        # TOOL SELECTON
        index += 1
        cbb = ComboBox(
            Text="Outer contour",
            Location=Point(label_width, offset * index),
            Parent=self,
            Width=200,
        )
        cbb.Items.AddRange(
            ("Inner contour", "Outer contour", "Pocket", "Engrave", "Drill",
             "Saw X", "Saw Y", "Clamex verticaal", "Clamex horizontaal"))
        cbb.TextChanged += self.updateLabelLayername
        self.cbb_operation = cbb

        # TOOL SELECTON
        index += 1
        cbb = ComboBox(Text=tools[0],
                       Location=Point(label_width, offset * index),
                       Parent=self,
                       Width=200)
        cbb.Items.AddRange(tools)
        cbb.TextChanged += self.updateLabelLayername

        self.cbb_tool = cbb

        index += 1
        sb = NumericUpDown(AutoSize=True,
                           Location=Point(label_width, offset * index),
                           Parent=self,
                           DecimalPlaces=2)
        sb.ValueChanged += self.updateLabelLayername

        self.sb_height = sb

        index += 1
        cb = CheckBox(Text="use depth from top of workpiece",
                      AutoSize=True,
                      Location=Point(label_width, offset * index),
                      Parent=self)
        cb.Checked = False
        cb.CheckedChanged += self.updateLabelLayername

        self.cb_depth = cb

        index += 1
        la = Label(Text="<layername>",
                   Location=Point(label_width, offset * index),
                   Parent=self,
                   AutoSize=True)
        self.la_layername = la

        index += 1
        pt = Point(label_width, offset * index)

        buttonApply = Button(Text="Apply", DialogResult=DialogResult.OK)
        buttonApply.Location = pt
        self.Controls.Add(buttonApply)
        pt.X = buttonApply.Right + offset
        buttonCancel = Button(Text="Cancel", DialogResult=DialogResult.Cancel)
        buttonCancel.Location = pt
        self.Controls.Add(buttonCancel)
        if (buttonCancel.Right > width):
            width = buttonCancel.Right
        self.ClientSize = Size(width, buttonCancel.Bottom + 10)
        self.AcceptButton = buttonApply
        self.CancelButton = buttonCancel