Exemplo n.º 1
0
    def MoveColumn(self, frm, to):
        '''
        Moves a column from one given location to another.

        Arguments
        frm: Location to move the column from.
        to:  Location to move the column.
        '''
        grid = self.GetView()

        if grid:
            # Move the cols
            old = self.colNames[frm]
            del self.colNames[frm]

            if to > frm:
                self.colNames.insert(to - 1, old)
            else:
                self.colNames.insert(to, old)

            # Notify the grid
            grid.BeginBatch()

            msg = Grid.GridTableMessage(self,
                                        Grid.GRIDTABLE_NOTIFY_COLS_INSERTED,
                                        to, 1)
            grid.ProcessTableMessage(msg)

            msg = Grid.GridTableMessage(self,
                                        Grid.GRIDTABLE_NOTIFY_COLS_DELETED,
                                        frm, 1)
            grid.ProcessTableMessage(msg)

            grid.EndBatch()
Exemplo n.º 2
0
    def ResetView(self, grid):
        """
        (Grid) -> Reset the grid view.   Call this to
        update the grid if rows and columns have been added or deleted
        """
        grid.BeginBatch()

        for current, new, delmsg, addmsg in [
            (self._rows, self.GetNumberRows(),
             Grid.GRIDTABLE_NOTIFY_ROWS_DELETED,
             Grid.GRIDTABLE_NOTIFY_ROWS_APPENDED),
            (self._cols, self.GetNumberCols(),
             Grid.GRIDTABLE_NOTIFY_COLS_DELETED,
             Grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
        ]:

            if new < current:
                msg = Grid.GridTableMessage(self, delmsg, new, current - new)
                grid.ProcessTableMessage(msg)
            elif new > current:
                msg = Grid.GridTableMessage(self, addmsg, new - current)
                grid.ProcessTableMessage(msg)
                self.UpdateValues(grid)

        grid.EndBatch()

        self._rows = self.GetNumberRows()
        self._cols = self.GetNumberCols()
        # update the column rendering plugins
        self._updateColAttrs(grid)

        # update the scrollbars and the displayed part of the grid
        grid.AdjustScrollbars()
        grid.ForceRefresh()
Exemplo n.º 3
0
    def refresh(self):
        """
        (Grid) -> Reset the grid view.   Call this to
        update the grid if rows and columns have been added or deleted
        """
        oldrows = self._table._rows
        oldcols = self._table._cols

        self._table._rows = math.ceil(
            len(self._binary_data) / self._editor.format.width)
        # if (len(self._binary_data) % self._editor.format.width) == 1:
        #     self._table._rows += 1
        self._table._cols = self._editor.format.width

        self.BeginBatch()
        for current, new, delmsg, addmsg in [
            (
                oldrows,
                self._table._rows,
                Grid.GRIDTABLE_NOTIFY_ROWS_DELETED,
                Grid.GRIDTABLE_NOTIFY_ROWS_APPENDED,
            ),
            (
                oldcols,
                self._table._cols,
                Grid.GRIDTABLE_NOTIFY_COLS_DELETED,
                Grid.GRIDTABLE_NOTIFY_COLS_APPENDED,
            ),
        ]:
            if new < current:
                msg = Grid.GridTableMessage(self._table, delmsg, new,
                                            current - new)
                self.ProcessTableMessage(msg)
            elif new > current:
                msg = Grid.GridTableMessage(self._table, addmsg, new - current)
                self.ProcessTableMessage(msg)
                # This sends an event to the grid table to update all of the displayed values
                msg = Grid.GridTableMessage(
                    self._table, Grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
                self.ProcessTableMessage(msg)
        self.EndBatch()

        # update the scrollbars and the displayed part of the grid
        self.SetColMinimalAcceptableWidth(0)

        # get height of a the biggest char of the font
        dc = wx.MemoryDC()
        dc.SetFont(self._table.font)
        (char_width, char_height) = dc.GetTextExtent("M")
        self.SetDefaultRowSize(char_height + 2)

        # settings for each column
        hexcol_width = (char_width * 2) + 5
        for col in range(self._table._cols):
            logger.debug("hexcol %d width=%d" % (col, hexcol_width))
            self.SetColMinimalWidth(col, 0)
            self.SetColSize(col, hexcol_width)

        self.AdjustScrollbars()
        self.ForceRefresh()
Exemplo n.º 4
0
    def reset_view(self, grid):
        """
        视图重置
        """
        grid.BeginBatch()

        for current, new, del_msg, add_msg in [
            (self._rows, self.GetNumberRows(),
             gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED,
             gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED),
            (self._cols, self.GetNumberCols(),
             gridlib.GRIDTABLE_NOTIFY_COLS_DELETED,
             gridlib.GRIDTABLE_NOTIFY_COLS_APPENDED),
        ]:
            if new < current:
                msg = gridlib.GridTableMessage(self, del_msg, new,
                                               current - new)
                grid.ProcessTableMessage(msg)
            elif new > current:
                msg = gridlib.GridTableMessage(self, add_msg, new - current)
                grid.ProcessTableMessage(msg)
                msg = gridlib.GridTableMessage(
                    self, gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
                grid.ProcessTableMessage(msg)

        grid.EndBatch()

        self._rows = self.GetNumberRows()
        self._cols = self.GetNumberCols()

        grid.AdjustScrollbars()
        grid.ForceRefresh()
Exemplo n.º 5
0
    def OnColMove(self, evt):
        frm = evt.GetMoveColumn()  # Column being moved
        to = evt.GetBeforeColumn()  # Before which column to insert

        print 'frm', frm
        print 'to', to
        grid = self.GetView()

        if grid:
            # Move the rowLabels and data rows
            oldLabel = self.rowLabels[frm]
            oldData = self.data[frm]
            del self.rowLabels[frm]
            del self.data[frm]

            if to > frm:
                self.rowLabels.insert(to - 1, oldLabel)
                self.data.insert(to - 1, oldData)
            else:
                self.rowLabels.insert(to, oldLabel)
                self.data.insert(to, oldData)

            # Notify the grid
            grid.BeginBatch()

            msg = gridlib.GridTableMessage(
                self, gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED, frm, 1)

            grid.ProcessTableMessage(msg)

            msg = gridlib.GridTableMessage(
                self, gridlib.GRIDTABLE_NOTIFY_ROWS_INSERTED, to, 1)

            grid.ProcessTableMessage(msg)
            grid.EndBatch()
Exemplo n.º 6
0
    def ResetView(self, grid):
        """
        (Grid) -> Reset the grid view.   Call this to
        update the grid if rows and columns have been added or deleted
        """
        grid.BeginBatch()

        for current, new, delmsg, addmsg in [
            (self._rows, self.GetNumberRows(),
             Grid.GRIDTABLE_NOTIFY_ROWS_DELETED,
             Grid.GRIDTABLE_NOTIFY_ROWS_APPENDED)
        ]:
            if new < current:
                msg = Grid.GridTableMessage(self, delmsg, new, current - new)
                self.GetView().ProcessTableMessage(msg)
            elif new > current:
                msg = Grid.GridTableMessage(self, addmsg, new - current)
                self.GetView().ProcessTableMessage(msg)
                msg = Grid.GridTableMessage(
                    self, Grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
                grid.ProcessTableMessage(msg)

        grid.EndBatch()

        self._rows = self.GetNumberRows()

        # update the scrollbars and the displayed part of the grid
        grid.AdjustScrollbars()
        grid.Refresh()
Exemplo n.º 7
0
 def ResetView(self):
     """Trim/extend the control's rows and update all values"""
     if self.GetView() is None:
         return
     self.clear_cache()
     self.GetView().BeginBatch()
     for current, new, delmsg, addmsg in [
         (self.GetView().GetNumberRows(), self.GetNumberRows(),
          grid.GRIDTABLE_NOTIFY_ROWS_DELETED,
          grid.GRIDTABLE_NOTIFY_ROWS_APPENDED),
         (self.GetView().GetNumberCols(), self.GetNumberCols(),
          grid.GRIDTABLE_NOTIFY_COLS_DELETED,
          grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
     ]:
         if new < current:
             msg = grid.GridTableMessage(
                 self,
                 delmsg,
                 new,  # position
                 current - new,
             )
             self.GetView().ProcessTableMessage(msg)
         elif new > current:
             msg = grid.GridTableMessage(self, addmsg, new - current)
             self.GetView().ProcessTableMessage(msg)
     self.GetView().EndBatch()
Exemplo n.º 8
0
    def MoveRow(self,frm,to):
        grid = self.GetView()

        if grid:
            # Move the rowLabels and data rows
            oldLabel = self.rowLabels[frm]
            oldData = self.data[frm]
            del self.rowLabels[frm]
            del self.data[frm]

            if to > frm:
                self.rowLabels.insert(to-1,oldLabel)
                self.data.insert(to-1,oldData)
            else:
                self.rowLabels.insert(to,oldLabel)
                self.data.insert(to,oldData)

            # Notify the grid
            grid.BeginBatch()

            msg = gridlib.GridTableMessage(
                    self, gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED, frm, 1
                    )

            grid.ProcessTableMessage(msg)

            msg = gridlib.GridTableMessage(
                    self, gridlib.GRIDTABLE_NOTIFY_ROWS_INSERTED, to, 1
                    )

            grid.ProcessTableMessage(msg)
            grid.EndBatch()
Exemplo n.º 9
0
    def MoveColumn(self,frm,to):
        grid = self.GetView()

        if grid:
            # Move the identifiers
            old = self.identifiers[frm]
            del self.identifiers[frm]

            if to > frm:
                self.identifiers.insert(to-1,old)
            else:
                self.identifiers.insert(to,old)

            # Notify the grid
            grid.BeginBatch()
            msg = gridlib.GridTableMessage(
                    self, gridlib.GRIDTABLE_NOTIFY_COLS_DELETED, frm, 1
                    )

            grid.ProcessTableMessage(msg)

            msg = gridlib.GridTableMessage(
                    self, gridlib.GRIDTABLE_NOTIFY_COLS_INSERTED, to, 1
                    )

            grid.ProcessTableMessage(msg)
            grid.EndBatch()
Exemplo n.º 10
0
    def ResetView(self, values=None):
        """
        (Grid) -> Reset the grid view.   Call this to
        update the grid if rows and columns have been added or deleted
        """
        oldrows = self._rows
        oldcols = self._cols

        if values:
            self.values = values

        self.grid.BeginBatch()

        for current, new, delmsg, addmsg in [
            (oldrows, self.GetNumberRows(), Grid.GRIDTABLE_NOTIFY_ROWS_DELETED,
             Grid.GRIDTABLE_NOTIFY_ROWS_APPENDED),
            (oldcols, self.GetNumberCols(), Grid.GRIDTABLE_NOTIFY_COLS_DELETED,
             Grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
        ]:

            if new < current:
                msg = Grid.GridTableMessage(self, delmsg, new, current - new)
                self.grid.ProcessTableMessage(msg)
            elif new > current:
                msg = Grid.GridTableMessage(self, addmsg, new - current)
                self.grid.ProcessTableMessage(msg)
                self.UpdateValues()
        self.grid.EndBatch()

        self._rows = self.GetNumberRows()
        self._cols = self.GetNumberCols()

        self.grid.AdjustScrollbars()
        self.grid.ForceRefresh()
Exemplo n.º 11
0
 def LoadTable(self, lst):
     n = self.GetNumberRows()
     msg = grid.GridTableMessage(self, grid.GRIDTABLE_NOTIFY_ROWS_DELETED,
                                 0, n - 1)
     self.GetView().ProcessTableMessage(msg)
     self.data = lst
     msg = grid.GridTableMessage(self, grid.GRIDTABLE_NOTIFY_ROWS_APPENDED,
                                 self.GetNumberRows() - 1)
     self.GetView().ProcessTableMessage(msg)
Exemplo n.º 12
0
        def SendTableMessage(current, new, deleteMessage, addMessage):
            if new == current: return

            if new < current:
                message = wxGrid.GridTableMessage(gridTable, deleteMessage,
                                                  new, current - new)
            elif new > current:
                message = wxGrid.GridTableMessage(gridTable, addMessage,
                                                  new - current)
            self.ProcessTableMessage(message)
Exemplo n.º 13
0
    def ResetView(self, grid, *args, **kwargs):
        """
        (Grid) -> Reset the grid view.   Call this to
        update the grid if rows and columns have been added or deleted
        """
        current_rows, current_cols = self._rows, self._cols
        self.ResetViewProcessArgs(grid, *args, **kwargs)
        new_rows, new_cols = self.get_data_rows(), self._cols
        log.debug("resetting view for %s: old rows=%s, new_rows=%s" % (grid, current_rows, new_rows))

        self._rows = new_rows
        self._cols = new_cols

        grid.BeginBatch()

        for current, new, delmsg, addmsg in [
            (current_rows, new_rows, Grid.GRIDTABLE_NOTIFY_ROWS_DELETED, Grid.GRIDTABLE_NOTIFY_ROWS_APPENDED),
            (current_cols, new_cols, Grid.GRIDTABLE_NOTIFY_COLS_DELETED, Grid.GRIDTABLE_NOTIFY_COLS_APPENDED),
        ]:

            if new < current:
                msg = Grid.GridTableMessage(self,delmsg,new,current-new)
                grid.ProcessTableMessage(msg)
                log.debug("Fewer %s: old=%d new=%d" % ("cols" if delmsg == Grid.GRIDTABLE_NOTIFY_COLS_DELETED else "rows", current, new))
            elif new > current:
                msg = Grid.GridTableMessage(self,addmsg,new-current)
                grid.ProcessTableMessage(msg)
                log.debug("More %s: old=%d new=%d" % ("cols" if delmsg == Grid.GRIDTABLE_NOTIFY_COLS_DELETED else "rows", current, new))
                self.UpdateValues(grid)
        grid.EndBatch()

        # update the scrollbars and the displayed part of the grid
        dc = wx.MemoryDC()
        dc.SetFont(grid.segment_viewer.preferences.text_font)
        (width, height) = dc.GetTextExtent("M")
        grid.SetDefaultRowSize(height)
        grid.SetColMinimalAcceptableWidth(width)
        grid.SetRowMinimalAcceptableHeight(height + 1)

        for col in range(self._cols):
            # Can't share GridCellAttrs among columns; causes crash when
            # freeing them.  So, have to individually allocate the attrs for
            # each column
            self.set_col_attr(grid, col, width)

        label_font = grid.segment_viewer.preferences.text_font.Bold()
        grid.SetLabelFont(label_font)
        dc.SetFont(label_font)
        (width, height) = dc.GetTextExtent("M")
        grid.SetColLabelSize(height + 4)
        text = self.GetRowLabelValue(self._rows - 1)
        grid.SetRowLabelSize(width * len(text) + 4)

        grid.AdjustScrollbars()
        grid.ForceRefresh()
Exemplo n.º 14
0
    def DeleteRows(self, rows):
        delete_count = self.pars.delete_rows(rows)

        msg = gridlib.GridTableMessage(self,\
            gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED, self.GetNumberRows(),\
             delete_count)
        self.GetView().ProcessTableMessage(msg)
        msg = gridlib.GridTableMessage(self,\
                    gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
        self.GetView().ProcessTableMessage(msg)
        self.parent._grid_changed()
Exemplo n.º 15
0
 def change_grid():
     view.BeginBatch()
     msg = grid.GridTableMessage(self,
                                 grid.GRIDTABLE_NOTIFY_ROWS_DELETED,
                                 mover_row, 1)
     view.ProcessTableMessage(msg)
     msg = grid.GridTableMessage(self,
                                 grid.GRIDTABLE_NOTIFY_ROWS_INSERTED,
                                 index_row, 1)
     view.ProcessTableMessage(msg)
     view.EndBatch()
Exemplo n.º 16
0
 def Reload(self):
     self.workset = self.init_workset(self.data)
     ext = len(self.workset)
     if ext == self.rowcount:
         return
     if ext > self.rowcount:
         msg = gridlib.GridTableMessage(self, gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED, ext - self.rowcount)
     else:
         msg = gridlib.GridTableMessage(self, gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED, ext, self.rowcount - ext)
     self.rowcount = ext
     self.GetView().ProcessTableMessage(msg)
Exemplo n.º 17
0
    def InsertRow(self, row):
        self.pars.insert_row(row)

        msg = gridlib.GridTableMessage(self,\
                gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED, 1)
        self.GetView().ProcessTableMessage(msg)
        msg = gridlib.GridTableMessage(self,\
                gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
        self.GetView().ProcessTableMessage(msg)
        self.GetView().ForceRefresh()
        self.parent._grid_changed()
        return True
Exemplo n.º 18
0
    def _adjustDimension(self, grid, current, new, isCol):
        if isCol:
            delmsg, addmsg = Grid.GRIDTABLE_NOTIFY_COLS_DELETED, Grid.GRIDTABLE_NOTIFY_COLS_APPENDED
        else:
            delmsg, addmsg = Grid.GRIDTABLE_NOTIFY_ROWS_DELETED, Grid.GRIDTABLE_NOTIFY_ROWS_APPENDED

        if new < current:
            msg = Grid.GridTableMessage(self, delmsg, new, current - new)
            grid.ProcessTableMessage(msg)
        elif new > current:
            msg = Grid.GridTableMessage(self, addmsg, new - current)
            grid.ProcessTableMessage(msg)
Exemplo n.º 19
0
    def AppendRows(self, num_rows=1):
        #print num_rows
        [self.pars.append() for i in range(rows)]

        msg = gridlib.GridTableMessage(self,\
                gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED, rows)
        self.GetView().ProcessTableMessage(msg)
        msg = gridlib.GridTableMessage(self,\
                gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
        self.GetView().ProcessTableMessage(msg)
        self.GetView().ForceRefresh()
        self.parent._grid_changed()
        return True
Exemplo n.º 20
0
	def UpdateRowBehavioralData(self, model):

		### delete only behavioral rows
		m = gridlib.GridTableMessage(self,  # the table
								gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED, # what
								self.nb_graphic_var,  # from here
								self.nb_behavior_var) # how many

		self.Populate(model)

		self.GetView().ProcessTableMessage(m)

		msg = gridlib.GridTableMessage(self, gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES )
		self.GetView().ProcessTableMessage(msg)
Exemplo n.º 21
0
 def update_grid(self):
     try:
         try:
             wx.BeginBusyCursor()
             old_rows_count = self.grid.get_number_rows()
             new_data = self.grid.create_data(
                                 self.natives, 
                                 self.pattern
                                 )
             self.grid.set_data(new_data)
             self.grid.data = new_data
             # Get new values
             msg = gridlib.GridTableMessage(
                         self.grid.table,
                         gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES
                         )
             self.grid.ProcessTableMessage(msg)
             new_rows_count = self.grid.get_number_rows()
             if new_rows_count > 0:
                 rows_diff = old_rows_count - new_rows_count       
                 # Add or delete rows dynamically
                 if rows_diff > 0:                
                     msg = gridlib.GridTableMessage(
                                 self.grid.table,
                                 gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED, 
                                 new_rows_count - rows_diff, 
                                 rows_diff
                                 )
                     self.grid.ProcessTableMessage(msg)
                 elif rows_diff < 0:
                     msg = gridlib.GridTableMessage(
                                 self.grid.table,
                                 gridlib.GRIDTABLE_NOTIFY_ROWS_INSERTED, 
                                 old_rows_count, 
                                 -rows_diff
                                 )
                     self.grid.ProcessTableMessage(msg)
             else:
                 msg = gridlib.GridTableMessage(
                             self.grid.table,
                             gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED, 
                             old_rows_count, 
                             old_rows_count
                             )
                 self.grid.ProcessTableMessage(msg)
         finally:
             wx.EndBusyCursor()
     except:
         # make sure any errors are not hidden
         raise
Exemplo n.º 22
0
 def UpdateNumberRows(self):
     """Only consider adding or removing rows."""
     current, new, delmsg, addmsg =\
         (self._number_rows, self.table.GetNumberRows(),
         gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED,
         gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED)
     if new < current:
         msg = gridlib.GridTableMessage(self.table, delmsg, new,
                                        current - new)
         self.ProcessTableMessage(msg)
     elif new > current:
         msg = gridlib.GridTableMessage(self.table, addmsg, new - current)
         self.ProcessTableMessage(msg)
     self._number_rows = new
Exemplo n.º 23
0
    def ProcessUpdates(self, curNumRows, newNumRows):
        self.View.BeginBatch()
        if newNumRows < curNumRows:
            msg = gridlib.GridTableMessage(
                self, gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED,
                curNumRows - newNumRows, curNumRows - newNumRows)
            self.View.ProcessTableMessage(msg)

        if newNumRows > curNumRows:
            msg = gridlib.GridTableMessage(
                self, gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED,
                newNumRows - curNumRows)
            self.View.ProcessTableMessage(msg)
        self.View.EndBatch()
Exemplo n.º 24
0
    def AppendRows(self, newData=None):
        self.datas.append(newData)
        self.isModified = True
        gridView = self.GetView()
        gridView.BeginBatch()
        appendMsg = grid.GridTableMessage(self,
                                          grid.GRIDTABLE_NOTIFY_ROWS_APPENDED,
                                          1)
        gridView.ProcessTableMessage(appendMsg)
        gridView.EndBatch()
        getValueMsg = grid.GridTableMessage(
            self, grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
        gridView.ProcessTableMessage(getValueMsg)

        return True
Exemplo n.º 25
0
    def SetValue(self, row, col, value):
        if col == self.hex_cols:
            pass
        else:
            addr = row * self.hex_cols + col
            value = struct.pack('B', int(value, 16))
            #value = chr(int("6c", 16))

            attr = self.GetAttr(row, col)
            saved_val = self._get_value_by_addr(addr)

            in_range = addr < self.length  # add undo for addr < length

            if saved_val != value and self._set_value_by_addr(addr, value):
                self._changed_cell_attr.IncRef()
                self.SetAttr(self._changed_cell_attr, row, col)
                if in_range:
                    self._add_undo_action(self.Actions.EditCell,
                                          (addr, saved_val, attr))
                else:
                    if col == self.hex_cols - 1:
                        # this is the last row/col, append a row
                        msg = wxgrid.GridTableMessage(
                            self, wxgrid.GRIDTABLE_NOTIFY_ROWS_APPENDED, 1)
                        self.GetView().ProcessTableMessage(msg)
Exemplo n.º 26
0
 def AppendCols(self, *args):
     self.num_cols += 1
     msg = gridlib.GridTableMessage(self,  # The table
                            gridlib.GRIDTABLE_NOTIFY_COLS_APPENDED, # what we did to it
                            1)                                       # how many
     self.GetView().ProcessTableMessage(msg)
     return True
Exemplo n.º 27
0
    def AddRow(self):
        self.msg = gridlib.GridTableMessage(
            self,  # The table
            gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED,  # what we did to it
            1  # how many
        )

        self.GetView().ProcessTableMessage(self.msg)
Exemplo n.º 28
0
    def SetData(self, data=None):
        # debug
        """
        Set the whole content of the table to data
        """
        data = self.cleanFromMask(data)
        self.ClearTable()
        self.data = data
        n_rows = self.GetNumberRows()
        self.GetView().ProcessTableMessage(
            gridlib.GridTableMessage(self,
                                     gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED,
                                     n_rows))

        self.GetView().ProcessTableMessage(
            gridlib.GridTableMessage(
                None, gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES))
Exemplo n.º 29
0
 def TriggerViewUpdate(self):
     self.msg = gridlib.GridTableMessage(
         self,  # The table
         gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES,  # what we did to it
         0,
         0)
     self.GetView().ProcessTableMessage(self.msg)
     self.GetView().Scroll(2, self.GetView().GetNumberRows())
Exemplo n.º 30
0
 def Reset(self):
     "Reset Grid"
     self.BeginBatch()
     current = self._rows
     new = self.GetNumberRows()
     delmsg = Grid.GRIDTABLE_NOTIFY_ROWS_DELETED
     addmsg = Grid.GRIDTABLE_NOTIFY_ROWS_APPENDED
     tab = self.GetTable()
     if new < current:
         msg = Grid.GridTableMessage(tab, delmsg, new, current - new)
         self.ProcessTableMessage(msg)
     elif new > current:
         msg = Grid.GridTableMessage(tab, addmsg, new - current)
         self.ProcessTableMessage(msg)
     self.EndBatch()
     self.AdjustScrollbars()
     self.ForceRefresh()