def __getitem__(self, key):
return self.get_value(key)
+
def __setitem__(self, key, value):
return self.set_value(key, value)
return '[%d,%d,%d]' % (self.range.start, self.range.stop,
self.range.step)
+ def __eq__(self, other):
+ if isinstance(other, range):
+ return self.range == other
+ elif isinstance(other, IntRange):
+ return self.range == other.range
+ return False
+
if sys.version_info >= (3, 0):
IntRange = override(IntRange)
__all__.append('IntRange')
return '(int64)[%d,%d,%d]' % (self.range.start, self.range.stop,
self.range.step)
+ def __eq__(self, other):
+ if isinstance(other, range):
+ return self.range == other
+ elif isinstance(other, IntRange):
+ return self.range == other.range
+ return False
if sys.version_info >= (3, 0):
Int64Range = override(Int64Range)
gi_gst_int_range_from_value (const GValue * value)
{
gint min, max, step;
+ PyObject *int_range_type, *int_range, *range;
min = gst_value_get_int_range_min (value);
max = gst_value_get_int_range_max (value);
step = gst_value_get_int_range_step (value);
- return PyObject_CallFunction ((PyObject *) & PyRange_Type, "iii",
+ int_range_type = gi_gst_get_type ("IntRange");
+ range = PyObject_CallFunction ((PyObject *) & PyRange_Type, "iii",
min, max, step);
+ int_range = PyObject_CallFunction (int_range_type, "O", range);
+
+ Py_DECREF (int_range_type);
+ Py_DECREF (range);
+
+ return int_range;
}
static int
gi_gst_int64_range_from_value (const GValue * value)
{
gint64 min, max, step;
+ PyObject *int64_range_type, *int64_range, *range;
min = gst_value_get_int64_range_min (value);
max = gst_value_get_int64_range_max (value);
step = gst_value_get_int64_range_step (value);
- return PyObject_CallFunction ((PyObject *) & PyRange_Type, "LLL",
+ range = PyObject_CallFunction ((PyObject *) & PyRange_Type, "LLL",
min, max, step);
+ int64_range_type = gi_gst_get_type ("Int64Range");
+ int64_range = PyObject_CallFunction (int64_range_type, "O", range);
+
+ Py_DECREF (int64_range_type);
+ Py_DECREF (range);
+
+ return int64_range;
}
static int