Пример #1
0
 def create_layout_from_control_matrix(control_matrix,
                                       padding=drawing.Padding(5, 5),
                                       scale_height = False,
                                       spacing = drawing.Size(5, 5)):
     layout = forms.TableLayout(Spacing = spacing)
     layout.Padding = padding
     for control_row in control_matrix:
         cells = [forms.TableCell(elem) for elem in control_row]
         row = forms.TableRow(cells)
         row.ScaleHeight = scale_height
         layout.Rows.Add(row)
         
     return layout 
Пример #2
0
    def __init__(self):
        self.Title = "EasyCut"
        self.selected = []
        self.edgeshighlightMode = -1
        self.m_gridview = forms.GridView()
        self.m_gridview.ShowHeader = True
        self.Padding = drawing.Padding(10)
        self.Resizable = True
        num = 0
        for idx in range(len(ATTRS)):
            if num == QUANTITY_COLUMN_POS:
                attr = QUANT_FIELD
                column = forms.GridColumn()
                column.HeaderText = attr.name
                column.Editable = attr.isEditable
                column.DataCell = forms.TextBoxCell(num)
                self.m_gridview.Columns.Add(column)
                num += 1
            attr = ATTRS[idx]
            if attr.isOn:

                column = forms.GridColumn()
                column.HeaderText = attr.name
                column.Editable = attr.isEditable
                column.DataCell = forms.TextBoxCell(num)
                self.m_gridview.Columns.Add(column)
                num += 1

        self.precision_dropdownlist = forms.DropDown()
        self.precision_dropdownlist.DataStore = [
            '1', '0.1', '0.01', '0.001', '0.0001', '0.00001'
        ]
        self.precision_dropdownlist.SelectedIndex = DIM_PRECISION
        self.precision_label = forms.Label(Text="Dimensions precision ")
        self.precision_dropdownlist.DropDownClosed += self.changePrecisionVal

        layout0 = forms.TableLayout()
        cell = forms.TableCell(self.precision_label, scaleWidth=False)
        cell.ScaleWidth = False
        cell2 = forms.TableCell(self.precision_dropdownlist, scaleWidth=False)
        cell2.ScaleWidth = False
        row = forms.TableRow(None, cell, cell2)
        row.ScaleHeight = False
        layout0.Rows.Add(row)

        self.m_gridview.CellClick += self.gridClick
        self.m_gridview.SelectionChanged += self.gridSelChanged
        self.m_gridview.CellEdited += self.gridEdited
        self.m_gridview.CellFormatting += self.OnCellFormatting
        self.buttonAutoNum = forms.Button(self.buttonAutoNumClick)
        self.buttonAutoNum.Text = "Auto number"
        self.button = forms.Button(self.buttonClick)
        self.button.Text = "Export"
        layout = forms.TableLayout()
        layout.Spacing = drawing.Size(5, 5)
        cell = forms.TableCell(self.m_gridview)
        row = forms.TableRow(cell)
        row.ScaleHeight = True
        layout.Rows.Add(layout0)
        layout.Rows.Add(row)

        layout2 = forms.TableLayout()
        layout2.Spacing = drawing.Size(5, 5)

        cell = forms.TableCell(self.button, True)
        cell2 = forms.TableCell(self.buttonAutoNum, True)
        row = forms.TableRow([cell, cell2])

        layout2.Rows.Add(row)
        layout.Rows.Add(layout2)
        layout2 = forms.TableLayout()
        layout2.Spacing = drawing.Size(5, 5)
        self.m_linkbutton = forms.LinkButton(Text='Easycut')
        self.m_linkbutton.Click += self.OnLinkButtonClick
        self.m_donatebutton = forms.LinkButton(Text='Donate',
                                               Style="right-align")
        self.m_donatebutton.Click += self.OnDonateButtonClick
        cell = forms.TableCell(self.m_linkbutton, True)
        cell2 = forms.TableCell(None, False)
        cell3 = forms.TableCell(self.m_donatebutton, False)
        row = forms.TableRow([cell, cell2, cell3])
        layout2.Rows.Add(row)

        layout.Rows.Add(layout2)

        self.Content = layout