Exemplo n.º 1
0
int PyView::setSlice(int s, int e, const PWOSequence& lst) {
  int sz = GetSize();
  if (s < 0)
    s += sz;
  if (e < 0)
    e += sz;
  if (e > sz)
    e = sz;
  int i = 0;
  for (; i < lst.len() && s < e; i++, s++)
    setItem(s, lst[i]);
  for (; i < lst.len(); i++, s++)
  {
    if (_base)
      Fail(PyExc_RuntimeError, "Can't insert in this view");
    insertAt(s, lst[i]);
  }
  if (s < e)
    if (_base)
      while (s < e)
      {
        int ndx = _base->GetIndexOf(GetAt(s));
        _base->RemoveAt(ndx, 1);
        --e;
      }
    else
      RemoveAt(s, e - s);
  return 0;
}
Exemplo n.º 2
0
void PyView::addProperties(const PWOSequence& lst) {
  for (int i=0; i<lst.len(); i++) {
    if (PyProperty_Check((PyObject* )lst[i])) {
      AddProperty(*(PyProperty*)(PyObject* )lst[i]);
    }
  }
}
Exemplo n.º 3
0
int PyViewer::GetSize() {
  return _data.len();
}