コード例 #1
0
 def EndEdit(self, row, col, grid):
     """
     Complete the editing of the current cell. Returns True if the value
     has changed.  If necessary, the control may be destroyed.
     *Must Override*
     """
     if self.value == 1:
         grid.GetTable().SetValue(row, col, "0")
     else:
         grid.GetTable().SetValue(row, col, "1")
     if grid.GetParent().saved:
         grid.GetParent().DoUnsaved()
     return True
コード例 #2
0
	def GetValueAsText( self, grid, row, col ):
		"""Customisation Point: Retrieve the current value for row,col as a text string"""
		row = grid.GetTable().GetValue(row, col)		
		#value = self.GetCurrentTableValue( row, col )
		if row is None:
			return ""
		return row.getLabel()
コード例 #3
0
 def BeginEdit(self, row, col, grid):
     ## wxPython
     if self.debug: print('Beginning edit')
     self.start_val = grid.GetTable().GetValue(row, col)
     self.pwd_editor.SetValue(self.start_val)
     self.pwd_editor.SetInsertionPointEnd()
     self.pwd_editor.SetFocus()
     self.pwd_editor.SetSelection(0, self.pwd_editor.GetLastPosition())
コード例 #4
0
 def ApplyEdit(self, row, col, grid):
     val = self._tc.GetValue()
     grid.GetTable().SetValue(row, col, val)  # update the table
     self._original_value = ''
     self._tc.SetValue('')
     # if self._value and val != '':  # DEBUG Fix #1967 crash when click other cell
     # this will cause deleting all text in edit mode not working
     self._grid.cell_value_edited(row, col, self._value)
コード例 #5
0
    def ApplyEdit(self, row, col, grid):
        val = self._tc.GetValue()
        grid.GetTable().SetValue(row, col, val)  # update the table

        self._original_value = ''
        self._tc.SetValue('')
        if self._value and val != '':  # DEBUG Fix #1967 crash when click other cell
            self._grid.cell_value_edited(row, col, self._value)
コード例 #6
0
 def BeginEdit(self, row, col, grid):
     """
     Fetch the value from the table and prepare the edit control
     to begin editing.  Set the focus to the edit control.
     *Must Override*
     """
     self.Show(False)
     self.value = int(grid.GetTable().GetValue(row, col))
     self.EndEdit(row, col, grid)
コード例 #7
0
    def ApplyEdit(self, row, col, grid):
        val = self._tc.GetValue()
        grid.GetTable().SetValue(row, col, val)  # update the table

        self._original_value = ''
        self._tc.SetValue('')
        if wx.VERSION >= (3, 0, 2, ''):  # DEBUG wxPhoenix
            if self._value or val == '':
                self._grid.cell_value_edited(row, col, self._value)
コード例 #8
0
 def BeginEdit(self, row, column, grid):
     if self.__event_handler:
         self.__chooser.PopEventHandler()
     self.__grid = grid
     self.__row = row
     self.__column = column
     self.__init_val = grid.GetTable().GetValue(row, column)
     self.__chooser.SetStringSelection(self.__init_val)
     self.__chooser.SetFocus()
コード例 #9
0
	def GetBestSize(self, grid, attr, dc, row, col):
		row = grid.GetTable().GetValue(row, col)
		#row = grid.GetCellValue(row, col)
		if row is None:
			return wx.Size(0,0)
		text = row.getLabel()
		dc.SetFont(attr.GetFont())
		w, h = dc.GetTextExtent(text)
		return wx.Size(w, h)
コード例 #10
0
 def on_column_resize(self, event):
     grid = self.grid
     col = event.GetRowOrCol()
     width = grid.GetColSize(col)
     table = grid.GetTable()
     self.column_size[col] = int(width * 1.1) / grid.CharWidth
     tm = wx.grid.GridTableMessage(
         self, wx.grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
     grid.ProcessTableMessage(tm)
     grid.ForceRefresh()
コード例 #11
0
 def BeginEdit(self, row, col, grid):
     self.startValue = grid.GetTable().GetValue(row, col)
     for i in range(self._tc.GetCount()):
         if self._tc.GetClientData(i) == self.startValue:
             self._tc.SetSelection(i)
     if USE_WX_COMBO:
         if not self._tc.IsPopupShown():
             self._tc.ShowPopup()
     else:
         self._tc.SetFocus()
コード例 #12
0
 def BeginEdit(self, row, column, grid):
     if self.__event_handler:
         self.__chooser.PopEventHandler()
     self.__init_val = grid.GetTable().GetValue(row, column)
     self.__grid = grid
     self.__row = row
     self.__column = column
     self.__chooser.SetValue(self.__init_val)
     # wx v2.8 has issues with this
     self.__chooser.SetFocus()
コード例 #13
0
 def EndEdit(self, row, col, grid):
     ## wxPython
     changed = False
     val = self.pwd_editor.GetValue()
     if val != self.start_val:
         changed = True
         grid.GetTable().SetValue(row, col, val)  ## update the table
     self.start_val = ''
     # self.pwd_editor.SetValue("")
     return changed
コード例 #14
0
ファイル: grid_editor.py プロジェクト: Wangler2333/my_tools
 def BeginEdit(self, row, col, grid):
     """
     Fetch the value from the table and prepare the edit control
     to begin editing.  Set the focus to the edit control.
     *Must Override*
     """
     self.startValue = grid.GetTable().GetValue(row, col)
     self._tc.SetValue(self.startValue)
     self._tc.SetInsertionPointEnd()
     self._tc.SetFocus()
     self._tc.SetSelection(0, self._tc.GetLastPosition())
コード例 #15
0
    def BeginEdit(self, row, col, grid):
        """ Fetch the value from the table and prepare edit control to begin editing.
            Set the focus to the edit control.  Must Override.
        """
        self._startValue = grid.GetTable().GetValue(row, col)
        self._tc.SetValue(self._startValue)
        self._tc.SetFocus()

        # Select the text when initiating an edit so that subsequent typing
        # replaces the contents.
        self._tc.SetSelection(0, self._tc.GetLastPosition())
コード例 #16
0
ファイル: Columns.py プロジェクト: oferchen/cx_PyGenLib
 def ApplyEdit(self, rowIndex, colIndex, grid):
     value = None
     table = grid.GetTable()
     column = table.GetColumn(colIndex)
     wxDate = self.control.GetValue()
     if wxDate.IsValid():
         dateValue = datetime.datetime(wxDate.GetYear(),
                                       wxDate.GetMonth() + 1,
                                       wxDate.GetDay())
         value = dateValue.strftime(column.dateFormat)
     table.SetValue(rowIndex, colIndex, value)
コード例 #17
0
    def ApplyEdit(self, row, col, grid):
        val = self._tc.GetValue()
        grid.GetTable().SetValue(row, col, val)  # update the table

        self._original_value = ''
        self._tc.SetValue('')
        if wx.VERSION >= (3, 0, 2, ''):  # DEBUG wxPhoenix
            if self._value and val != '':  # DEBUG Fix #1967 crash when click other cell
                self._grid.cell_value_edited(row, col, self._value)
            else:
                self._tc.hide()
コード例 #18
0
ファイル: hdfGrid.py プロジェクト: warlock8hz/h5pyViewer
  def OnSetView(usrData,value,msg):
    gridFrm =usrData.slider.Parent.Parent
    grid=gridFrm.grid
    tbl=grid.GetTable()
    data=tbl.data
    sl=ut.GetSlice(tbl.idxXY,data.shape,gridFrm.wxAxCtrlLst)

    #tbl.view = tbl.data[value,...]
    tbl.view = tbl.data[sl]
    grid.ClearGrid()
    pass
コード例 #19
0
 def BeginEdit(self, row, column, grid):
     if self.__event_handler:
         self.__chooser.PopEventHandler()
     self.__init_val = grid.GetTable().GetValue(row, column)
     self.__grid = grid
     self.__row = row
     self.__column = column
     self.__chooser.SetValue(self.__init_val)
     # wx v2.8 has issues with this
     if wx.MAJOR_VERSION == 3:
         self.__chooser.Bind(wx.EVT_KILL_FOCUS, self.FocusLost)
     self.__chooser.SetFocus()
コード例 #20
0
    def ApplyEdit(self, row, col, grid):
        """
        This function should save the value of the control into the
        grid or grid table. It is called only after EndEdit() returns
        a non-None value.
        *Must Override*
        """
        val = self._tc.GetValue()
        grid.GetTable().SetValue(row, col, val)  # update the table

        self.startValue = ''
        self._tc.SetValue('')
コード例 #21
0
    def EndEdit(self, row, col, grid):
        """ Commit editing the current cell. Returns True if the value has changed.
            If necessary, the control may be destroyed. Must Override.
        """
        changed = False  # Assume value not changed
        val = self._tc.GetValue()  # Get value in edit control
        if val != self._startValue:  # Compare
            changed = True  # If different then changed is True
            grid.GetTable().SetValue(row, col, val)  # Update the table
        self._startValue = ''  # Clear the class' start value
        self._tc.SetValue('')  # Clear contents of the edit control

        return changed
コード例 #22
0
ファイル: Columns.py プロジェクト: oferchen/cx_PyGenLib
 def BeginEdit(self, rowIndex, colIndex, grid):
     self.initialValue = None
     table = grid.GetTable()
     column = table.GetColumn(colIndex)
     initialValue = table.GetValue(rowIndex, colIndex)
     if initialValue:
         dateValue = datetime.datetime.strptime(initialValue,
                                                column.dateFormat)
         self.initialValue = wx.DateTime.FromDMY(dateValue.day,
                                                 dateValue.month - 1,
                                                 dateValue.year)
         self.control.SetValue(self.initialValue)
     self.control.SetFocus()
コード例 #23
0
    def EndEdit(self, row, col, grid):
        changed = False

        val = self._tc.GetClientData(self._tc.GetSelection())
        if val != self.startValue:
            changed = True
            grid.GetTable().SetValue(row, col, val)  # update the table

        self.startValue = 'zero'
        self._tc.SetStringSelection('zero')
        if USE_WX_COMBO:
            if self._tc.IsPopupShown():
                self._tc.HidePopup()

        return changed
コード例 #24
0
ファイル: grid_editor.py プロジェクト: Wangler2333/my_tools
    def EndEdit(self, row, col, grid):
        """
        Complete the editing of the current cell. Returns True if the value
        has changed.  If necessary, the control may be destroyed.
        *Must Override*
        """
        changed = False

        val = self._tc.GetValue()

        if val != self.startValue:
            changed = True
            grid.GetTable().SetValue(row, col, val)  # update the table

        self.startValue = ''
        self._tc.SetValue('')
        return changed
コード例 #25
0
ファイル: kweditor.py プロジェクト: jnhyperion/RIDE
 def ApplyEdit(self, row, col, grid):
     val = self._tc.GetValue()
     grid.GetTable().SetValue(row, col, val)  # update the table
     self._original_value = ''
     self._grid.cell_value_edited(row, col, val)
コード例 #26
0
ファイル: hdfGrid.py プロジェクト: warlock8hz/h5pyViewer
  def __init__(self, parent,lbl,hid):
    wx.Frame.__init__(self, parent, title='HDFGridView: '+lbl,size=wx.Size(750, 650))
    imgDir=ut.Path.GetImage()
    icon = wx.Icon(os.path.join(imgDir,'h5pyViewer.ico'), wx.BITMAP_TYPE_ICO)
    self.SetIcon(icon)

    pan = wx.Panel(self, -1)

    t=type(hid)
    if t==h5py.h5d.DatasetID:
      data=h5py.Dataset(hid)
    elif t==np.ndarray:
      data=hid
    else:
      raise(TypeError('unhandled type'))
    grid = Grid(pan, data)

    tbl=grid.GetTable()

    sizer = wx.BoxSizer(wx.VERTICAL)
    sizer.Add(grid, 1, wx.EXPAND)
    wxAxCtrlLst=[]
    l=len(data.shape)
    if l==1:
      if type(hid.get_type())==h5py.h5t.TypeCompoundID:
        tbl = Table1DCompound(data)
      else:
        tbl = Table1DArray(data)
    else:
      idxXY=(l-2,l-1)
      #idxXY=(l-1,l-2)
      for idx,l in enumerate(data.shape):
        if idx in idxXY:
          continue
        wxAxCtrl=ut.SliderGroup(pan, label='Axis:%d'%idx,range=(0,l-1))
        wxAxCtrl.idx=idx
        wxAxCtrlLst.append(wxAxCtrl)
        sizer.Add(wxAxCtrl.sizer, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
        wxAxCtrl.SetCallback(Grid.OnSetView,wxAxCtrl)

      sl=ut.GetSlice(idxXY,data.shape,wxAxCtrlLst)

      if type(hid.get_type())==h5py.h5t.TypeCompoundID:
        tbl = Table2DArray(data)
      else:
        tbl = Table2DArray(data)
      tbl.idxXY=idxXY
      if idxXY[0]<idxXY[1]:
        tbl.view = tbl.data[sl]
      else:
        tbl.view = tbl.data[sl].T
    self.wxAxCtrlLst=wxAxCtrlLst
    #print type(tbl)

    grid.SetTable (tbl, True)
    #AutoSize must be called after SetTable, but takes lot of time on big tables!
    if tbl.GetNumberCols()*tbl.GetNumberRows()<50*50:
      grid.AutoSizeColumns(True);grid.AutoSizeRows(True)
    #grid.SetDefaultColSize(200, True)       
    self.grid=grid

    pan.SetSizer(sizer)
    pan.Layout()
    self.Centre()
    self.BuildMenu()
    grid.Bind(wx.grid.EVT_GRID_CMD_COL_SIZE, self.OnColSize)
コード例 #27
0
def apply_dbif_operation(operation, *grids):
    grid_tables = [grid.GetTable() for grid in grids]
    relations = [grid_table.relation for grid_table in grid_tables]
    relation_tables = [relation.table for relation in relations]
    result_table = operation(*relation_tables)
    return result_table
コード例 #28
0
 def BeginEdit(self, row, col, grid):  # pylint: disable=arguments-differ
     self.start_value = grid.GetTable().GetValue(row, col)
     self.control.text_ctrl.SetValue(self.start_value)
     self.control.text_ctrl.SetInsertionPointEnd()
     self.control.SetFocus()