Exemple #1
0
    def __init__(self, names, values):
        self.names = names
        self.values = values

        self.table = table = forms.GridView()
        table.ShowHeader = True
        table.DataStore = [[name, value] for name, value in zip(self.names, self.values)]

        c1 = forms.GridColumn()
        c1.HeaderText = 'Name'
        c1.Editable = False
        c1.DataCell = forms.TextBoxCell(0)
        table.Columns.Add(c1)

        c2 = forms.GridColumn()
        c2.HeaderText = 'Value'
        c2.Editable = True
        c2.DataCell = forms.TextBoxCell(1)
        table.Columns.Add(c2)

        tab_items = forms.StackLayoutItem(table, True)
        layout = forms.StackLayout()
        layout.Items.Add(tab_items)
        layout.HorizontalContentAlignment = forms.HorizontalAlignment.Stretch
        sub_layout = forms.DynamicLayout()
        sub_layout.AddRow(None, self.ok, self.cancel)
        layout.Items.Add(forms.StackLayoutItem(sub_layout))

        self.Title = 'RBE: update a list of properties'
        self.Padding = drawing.Padding(12)
        self.Resizable = True
        self.Content = layout
        self.ClientSize = drawing.Size(400, 600)
Exemple #2
0
        def grid():
            self.grid = forms.GridView()
            self.grid.BackgroundColor = drawing.Colors.LightGrey
            self.grid.Size = drawing.Size(300,470)
            self.grid.GridLines = forms.GridLines.Both
            self.grid.AllowMultipleSelection = True
            self.grid.CellEdited += self.OnCellEdited
            self.grid.CellFormatting += self.OnCellFormatting

            #COLUMNS
            numberColumn = forms.GridColumn()
            numberColumn.HeaderText = "#"
            numberColumn.DataCell = forms.TextBoxCell(0)
            numberColumn.DataCell.TextAlignment = forms.TextAlignment.Right

            nameColumn = forms.GridColumn()
            nameColumn.HeaderText = "Floor\t"
            nameColumn.Editable = True
            nameColumn.DataCell = forms.TextBoxCell(1)

            funcColumn = forms.GridColumn()
            funcColumn.HeaderText = "Program\t\t"
            funcColumn.DataCell = forms.TextBoxCell(2)
            funcColumn.Editable = True
            funcColumn.DataCell.TextAlignment = forms.TextAlignment.Center

            ftfColumn = forms.GridColumn()
            ftfColumn.HeaderText = "FTF\t"
            ftfColumn.DataCell = forms.TextBoxCell(3)
            ftfColumn.Editable = True
            ftfColumn.DataCell.TextAlignment = forms.TextAlignment.Right

            levelColumn = forms.GridColumn()
            levelColumn.HeaderText = "Height\t"
            levelColumn.Editable = True
            levelColumn.DataCell = forms.TextBoxCell(4)
            levelColumn.DataCell.TextAlignment = forms.TextAlignment.Right

            areaColumn = forms.GridColumn()
            areaColumn.HeaderText = "GFA\t"
            areaColumn.Editable = True
            areaColumn.DataCell = forms.TextBoxCell(5)
            areaColumn.DataCell.TextAlignment = forms.TextAlignment.Right

            commentColumn = forms.GridColumn()
            commentColumn.HeaderText = "Comments\t\t"
            commentColumn.Editable = True
            commentColumn.DataCell = forms.TextBoxCell(6)
            commentColumn.DataCell.TextAlignment = forms.TextAlignment.Left

            self.grid.Columns.Add(numberColumn)
            self.grid.Columns.Add(nameColumn)
            self.grid.Columns.Add(funcColumn)
            self.grid.Columns.Add(ftfColumn)
            self.grid.Columns.Add(levelColumn)
            self.grid.Columns.Add(areaColumn)
            self.grid.Columns.Add(commentColumn)
Exemple #3
0
    def __init__(self, settings):
        # super(SettingsForm, self).__init__()
        self._settings = None
        self._names = None
        self._values = None
        self.settings = settings

        self.table = table = forms.GridView()
        table.ShowHeader = True
        table.DataStore = [[name, value]
                           for name, value in zip(self.names, self.values)]
        table.Height = 300

        c1 = forms.GridColumn()
        c1.HeaderText = 'Name'
        c1.Editable = False
        c1.DataCell = forms.TextBoxCell(0)
        table.Columns.Add(c1)

        c2 = forms.GridColumn()
        c2.HeaderText = 'Value'
        c2.Editable = True
        c2.DataCell = forms.TextBoxCell(1)
        table.Columns.Add(c2)

        layout = forms.DynamicLayout()
        layout.AddRow(table)
        layout.Add(None)
        layout.BeginVertical()
        layout.BeginHorizontal()
        layout.AddRow(None, self.ok, self.cancel)
        layout.EndHorizontal()
        layout.EndVertical()

        self.Title = 'RBE: update settings'
        self.Padding = drawing.Padding(12)
        self.Resizable = False
        self.Content = layout
        self.ClientSize = drawing.Size(400, 600)
Exemple #4
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
Exemple #5
0
 def create_grid_view(num_columns, 
                      column_cell_types,
                      data_matrix,
                      column_headers=None, 
                      column_widths=None,
                      column_editable=True,
                      cell_selection_changed_event_method=None):
                            
     try:          
         #Create Gridview with gridview settings    
         gridview = forms.GridView()  
         
         if not isinstance(column_cell_types, list):
             column_cell_types = [column_cell_types]*num_columns   
             
         
         #Create RowValues objects with data rows and column data types
         collection = [] 
         if isinstance(data_matrix, list):
             for datarow in data_matrix:
                 collection.append(RowValues(datarow, column_cell_types))        
             gridview.DataStore = collection
                 
         if column_headers:
             gridview.ShowHeader = True
         if cell_selection_changed_event_method:
             gridview.SelectionChanged += cell_selection_changed_event_method                
             
         #Create columns with cells  
         
         for type_index in range(num_columns):
             
             cell_type = column_cell_types[type_index]  
             
             # column creation
             if cell_type == 'TextBox':
                 # create text box cell
                 column = GridViewUtil.create_textbox_column(type_index)
             if cell_type == 'CheckBox':  
                 #create checkbox cell    
                 column = GridViewUtil.create_checkbox_column(type_index)
             if cell_type == 'DropDown':
                 #create dropdown custom cell
                 column = GridViewUtil.create_dropdown_column(type_index)
             if cell_type == 'ListBox':
                 column = GridViewUtil.create_listbox_column(type_index)              
             
             #width 
             if isinstance(column_widths, list):
                 if len(column_widths) <= type_index:
                     column.Width = column_widths[-1]
                 else:
                     column.Width = column_widths[type_index]
             #headers
             if isinstance(column_headers, list) and \
                 len(column_headers) > type_index:
                 column.HeaderText = column_headers[type_index]
                 
             #editable
             if isinstance(column_editable, list):
                 if len(column_editable) <= type_index:
                     column.Editable = column_editable[-1]
                 else:
                     column.Editable = column_editable[type_index]
             else:
                 column.Editable = column_editable
             
             #add column to grid    
             gridview.Columns.Add(column)
     except Exception as e:
         print e
         
     return gridview