def BeginEdit(self, row, col, grid): self.startValue = grid.GetTable().GetValue(row, col) format = geocacher.config().coordinateFormat self._tc.SetValue(degToStr(self.startValue, format, self.mode)) self._tc.SetInsertionPointEnd() self._tc.SetFocus() self._tc.SetSelection(0, self._tc.GetLastPosition())
def TransferToWindow(self): textCtrl = self.GetWindow() value = self.data.get(self.key, 0) if self.new: textCtrl.SetValue("") else: textCtrl.SetValue(degToStr(value, geocacher.config().coordinateFormat, self.mode)) return True
def TransferToWindow(self): textCtrl = self.GetWindow() value = self.data.get(self.key, 0) if self.new: textCtrl.SetValue('') else: textCtrl.SetValue( degToStr(value, geocacher.config().coordinateFormat, self.mode)) return True
def Draw(self, grid, attr, dc, rect, row, col, isSelected): value = self.table.GetValue(row, col) try: text = degToStr(value, geocacher.config().coordinateFormat, self.mode) except: text = '' hAlign, vAlign = attr.GetAlignment() dc.SetFont(attr.GetFont()) if isSelected: bg = grid.GetSelectionBackground() fg = grid.GetSelectionForeground() else: bg = grid.GetDefaultCellBackgroundColour() fg = grid.GetDefaultCellTextColour() dc.SetTextBackground(bg) dc.SetTextForeground(fg) dc.SetBrush(wx.Brush(bg, wx.SOLID)) dc.SetPen(wx.TRANSPARENT_PEN) dc.DrawRectangleRect(rect) grid.DrawTextRectangle(dc, text, rect, hAlign, vAlign)
def GetBestSize(self, grid, attr, dc, row, col): value = self.table.GetValue(row, col) text = degToStr(value, geocacher.config().coordinateFormat, self.mode) w, h = dc.GetTextExtent(text) return wx.Size(w, h)
def Reset(self): self._tc.SetValue(degToStr(self.startValue, format, self.mode)) self._tc.SetInsertionPointEnd()