Example #1
0
static PyObj
statement_load_rows(PyObj self, PyObj args, PyObj kw)
{
	char *words[] = {"rows_iter", NULL};
	PyObj row_iter, rob;
	uint32 total = 0;

	if (PyPgStatement_GetParameters(self) != Py_None)
	{
		PyErr_SetString(PyExc_TypeError,
			"cannot use load_rows with constant parameters");
		return(NULL);
	}

	if (!PyArg_ParseTupleAndKeywords(args, kw, "O:load_rows", words, &row_iter))
		return(NULL);

	if (DB_IS_NOT_READY())
		return(NULL);

	row_iter = PyObject_GetIter(row_iter);
	if (row_iter == NULL)
		return(NULL);

	if (load_rows(self, row_iter, &total))
		rob = NULL;
	else
		rob = PyLong_FromUnsignedLong(total);

	Py_DECREF(row_iter);

	return(rob);
}
void main_listctrl::reload_rows()
{
    // Run a busy cursor until we exit this function
    wxBusyCursor a_busy_cursor;

    // Delete the rows from the listctrl
    DeleteAllItems();

    // Clear them from our array
    m_row_channel_section_array.Clear();

    // Reload the rows
    load_rows();
}
Example #3
0
static PyObj
statement_load_chunks(PyObj self, PyObj args, PyObj kw)
{
	char *words[] = {"chunks_iter", NULL};
	PyObj chunk_iter, ob;
	uint32 total = 0;

	if (PyPgStatement_GetParameters(self) != Py_None)
	{
		PyErr_SetString(PyExc_TypeError,
			"cannot use load_rows with constant parameters");
		return(NULL);
	}

	if (!PyArg_ParseTupleAndKeywords(args, kw, "O:load_chunks", words, &chunk_iter))
		return(NULL);

	if (DB_IS_NOT_READY())
		return(NULL);

	chunk_iter = PyObject_GetIter(chunk_iter);
	if (chunk_iter == NULL)
		return(NULL);

	while ((ob = PyIter_Next(chunk_iter)))
	{
		PyObj row_iter;
		int r;

		row_iter = PyObject_GetIter(ob);
		Py_DECREF(ob);
		if (row_iter == NULL)
		{
			Py_DECREF(chunk_iter);
			return(NULL);
		}

		r = load_rows(self, row_iter, &total);
		Py_DECREF(row_iter);

		if (r)
		{
			Py_DECREF(chunk_iter);
			return(NULL);
		}
	}
	Py_DECREF(chunk_iter);

	return(PyLong_FromUnsignedLong(total));
}
//Initialize the list control.
void main_listctrl::init()
{       
    // wxListCtrl uses a wxImageList to insert its graphics.  Set the wxImageList that the
    // listctrl should use, to the shared image list that is used throughout the application.
    // The second argument just tells the type of image list, that it is a small type.
    // Usually we hide the listctrl while we insert rows (then show when done , but here it
    // is not needed, since the whole main dialog is not visible yet, so therefore the
    // main_listctrl is already hidden too at this stage.
    SetImageList( the_small_image_list, wxIMAGE_LIST_SMALL );
 
    // Load the channels into the rows of the table
    load_rows();
    
    // Adjust the column widths (recycled on the OnSize event)    
    set_column_widths();   
    
    wxLogDebug( "Completed main_listctrl::init()" );
}