(self)
| 21 | super(MyApp, self).__init__(*args) |
| 22 | |
| 23 | def main(self): |
| 24 | wid = gui.VBox(width=500, height=500, style={'margin':'5px auto', 'padding': '10px'}) |
| 25 | |
| 26 | lbl_description = gui.Label("""Example about TableWidget usage. |
| 27 | Change rows and columns count in order to see the behaviour. |
| 28 | After changing the size, 'Fill the table' content by means of the button.""") |
| 29 | |
| 30 | wid.append(lbl_description) |
| 31 | |
| 32 | table = gui.TableWidget(10, 3, True, True, width=300, height=300) |
| 33 | table.style['font-size'] = '8px' |
| 34 | |
| 35 | container = gui.HBox(width='100%') |
| 36 | lbl_row_count = gui.Label('Rows:') |
| 37 | spin_row_count = gui.SpinBox(10, 0, 15) |
| 38 | spin_row_count.onchange.do(self.on_row_count_change, table) |
| 39 | container.append(lbl_row_count) |
| 40 | container.append(spin_row_count) |
| 41 | wid.append(container) |
| 42 | |
| 43 | container = gui.HBox(width='100%') |
| 44 | lbl_column_count = gui.Label('Columns:') |
| 45 | spin_column_count = gui.SpinBox(3, 0, 4) |
| 46 | spin_column_count.onchange.do(self.on_column_count_change, table) |
| 47 | container.append(lbl_column_count) |
| 48 | container.append(spin_column_count) |
| 49 | wid.append(container) |
| 50 | |
| 51 | bt_fill_table = gui.Button('Fill table', width=100) |
| 52 | bt_fill_table.onclick.do(self.fill_table, table) |
| 53 | wid.append(bt_fill_table) |
| 54 | |
| 55 | chk_use_title = gui.CheckBoxLabel('Use title', True) |
| 56 | chk_use_title.onchange.do(self.on_use_title_change, table) |
| 57 | wid.append(chk_use_title) |
| 58 | |
| 59 | self.fill_table(table, table) |
| 60 | |
| 61 | table.on_item_changed.do(self.on_table_item_changed) |
| 62 | |
| 63 | wid.append(table) |
| 64 | # returning the root widget |
| 65 | return wid |
| 66 | |
| 67 | def on_row_count_change(self, emitter, value, table): |
| 68 | table.set_row_count(int(value)) |
nothing calls this directly
no test coverage detected