Esempio n. 1
0
 def onPopupUpdate(self, event):
     for i in self.selectedCells:
         row = i.GetRow()
         col = i.GetCol()
         rowName = self.GetRowLabelValue(row)
         colName = self.GetColLabelValue(col)
         coord = grid.GridCellCoords(row, col)
         if coord in self.changedCells:
             self.GetParent().db3File.setCellData(
                 self.table, rowName, colName, self.GetCellValue(row, col))
             self.GetParent().db3File.save()
             self.changedCells.remove(grid.GridCellCoords(row, col))
             self.SetCellTextColour(row, col, wx.Color(0, 0, 0))
     if not len(self.changedCells):
         self.GetParent().GetParent().GetParent().GetParent().GetParent(
         ).enableSaveTool(False)
     self.ForceRefresh()
Esempio n. 2
0
 def _navigate_to_matching_user_keyword(self, row, col):
     value = self.GetCellValue(row, col)
     uk = self._plugin.get_user_keyword(value)
     if uk:
         self._toggle_underlined((grid.GridCellCoords(row, col)))
         self._marked_cell = None
         wx.CallAfter(self._tree.select_user_keyword_node, uk)
         return True
     return False
Esempio n. 3
0
    def _bounds_for(self, row, col):
        """ Returns the coordinates and size of the specified cell in the form:
            ( x, y, dx, dy ).
        """
        grid = self.editor.grid
        coords = wxg.GridCellCoords(row, col)
        x, y, dx, dy = grid._grid.BlockToDeviceRect(coords, coords)
        x, y = grid._grid_window.ClientToScreenXY(x, y)

        return (x, y, dx, dy)
Esempio n. 4
0
 def onCellChanged(self, event):
     row = event.GetRow()
     col = event.GetCol()
     self.GetParent().changed = True
     self.GetParent().GetParent().GetParent().GetParent().GetParent(
     ).enableSaveTool()
     coord = grid.GridCellCoords(row, col)
     if coord not in self.changedCells:
         self.changedCells.append(coord)
         self.SetCellTextColour(row, col, wx.Color(255, 0, 0))
Esempio n. 5
0
    def getSelectedCells(self):
        self.selectedCells = []
        blockTl = self.GetSelectionBlockTopLeft()
        blockBr = self.GetSelectionBlockBottomRight()
        for i in range(len(blockTl)):
            for row in range(blockTl[i][0], blockBr[i][0] + 1):
                for col in range(blockTl[i][1], blockBr[i][1] + 1):
                    self.selectedCells.append(grid.GridCellCoords(row, col))
        for i in self.GetSelectedRows():
            for col in range(self.GetNumberCols()):
                self.selectedCells.append(grid.GridCellCoords(i, col))
        for i in self.GetSelectedCols():
            for row in range(self.GetNumberRows()):
                self.selectedCells.append(grid.GridCellCoords(row, i))
        for i in self.GetSelectedCells():
            self.selectedCells.append(grid.GridCellCoords(i[0], i[1]))


#-------------------------------------------------------------------------------
# Eof
#-------------------------------------------------------------------------------
Esempio n. 6
0
 def onCellRClick(self, event):
     if not hasattr(self, 'menuId'):
         self.menuId = wx.NewId()
         self.Bind(wx.EVT_MENU, self.onPopupUpdate, id=self.menuId)
     menu = wx.Menu()
     self.getSelectedCells()
     if len(self.selectedCells):
         item = wx.MenuItem(menu, self.menuId,
                            'Update data in selected cells')
     else:
         self.selectedCells.append(
             grid.GridCellCoords(event.GetRow(), event.GetCol()))
         item = wx.MenuItem(menu, self.menuId,
                            'Update data in clicked cell')
     menu.AppendItem(item)
     self.PopupMenu(menu)
     menu.Destroy()