# Hide fields not meant for display.
for i, field in enumerate(self.fields):
if field not in self.view_list_fields:
- self.view_list.setColumnHidden(i, True)
+ self.view_list.hideColumn(i)
# Stretch headers to fill all available width.
self.view_list.setSelectionMode(QtGui.QTableView.SingleSelection)
"""
return (
(getattr(self.views, self.basename + 'Add'), 'clicked()', self.add),
- #connect(ui.bookTable->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
- # mapper, SLOT(setCurrentModelIndex(QModelIndex)));
-
- (self.view_list.selectionModel(), 'currentRowChanged(QModelIndex,QModelIndex)',
+ (self.view_list.selectionModel(),
+ 'currentRowChanged(QModelIndex,QModelIndex)',
self.view_display, 'setCurrentModelIndex(QModelIndex)'),
(getattr(self.views, self.basename + 'Save'), 'clicked()',
self.save),
self.view_list.selectRow(num_rows)
# Disable adding more than one row.
- getattr(self.views, self.basename + 'Add').setEnabled(False)
+ self.getFieldWidget('Add').setEnabled(False)
# Focust to the first displayed field.
self.getFieldWidget(self.getDisplayFields()[0]).setFocus()
for field in self.getDisplayFields():
self.getFieldWidget(field).clear()
- def select(self, row):
- """
- Select an object from the list.
- """
- # Fill in form based on selection.
-
-
- #self.parent.ui.connectionName.setText(self.currentConnection.name)
- #self.parent.ui.connectionLocalIpAddress.setText(
- # self.currentConnection.local_ip_address)
- #self.parent.ui.connectionLocalPort.setText(
- # unicode(self.currentConnection.local_port))
- #self.parent.ui.connectionFreeswitchIpAddress.setText(
- # self.currentConnection.freeswitch_ip_address)
- #self.parent.ui.connectionFreeswitchPort.setText(
- # unicode(self.currentConnection.freeswitch_port))
-
def save(self):
"""
- TODO: Default implementation.
+ Save currently selected object.
"""
- return NotImplemented
+ #print self.model.isDirty(self.view_list.currentRow())
+ #print self.view_list.selectedIndexes()[0].row()
+
+ #if self.model.isDirty(self.view_display.currentIndex()), self.model.rowCount()
+ self.view_display.submit()
+ self.getFieldWidget('Add').setEnabled(True)
+
class ConnectionController(BaseController):
This creates a new connection with bound data copied from another one.
"""
- def save(self):
+ def _save(self):
"""
Save new or existing connection.
"""