Changeset 1178
- Timestamp:
- 03/07/10 15:49:29 (5 months ago)
- Location:
- trunk/camelot
- Files:
-
- 4 modified
-
admin/object_admin.py (modified) (3 diffs)
-
view/controls/formview.py (modified) (1 diff)
-
view/controls/tableview.py (modified) (1 diff)
-
view/wizard/importwizard.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/camelot/admin/object_admin.py
r1141 r1178 113 113 searched. For use with one2many, many2one or many2many fields, the same 114 114 rules as for the list_filter attribute apply 115 116 .. attribute:: confirm_delete 117 118 Indicates if the deletion of an object should be confirmed by the user, defaults 119 to False. Can be set to either True, False, or the message to display when asking 120 confirmation of the deletion. 115 121 116 122 .. attribute:: form_size … … 172 178 list_actions = [] 173 179 list_search = [] 180 confirm_delete = False 174 181 list_size = (600, 400) 175 182 form_size = (700, 500) … … 234 241 def get_entity_admin(self, entity): 235 242 return self.app_admin.get_entity_admin(entity) 243 244 def get_confirm_delete(self): 245 if self.confirm_delete: 246 if self.confirm_delete==True: 247 return _('Are you sure you want to delete this') 248 return self.confirm_delete 249 return False 236 250 237 251 @model_function -
trunk/camelot/view/controls/formview.py
r1176 r1178 38 38 39 39 class FormView( AbstractView ): 40 40 41 def __init__( self, title, admin, model, index ): 41 42 AbstractView.__init__( self ) -
trunk/camelot/view/controls/tableview.py
r1164 r1178 372 372 """delete the selected rows in this tableview""" 373 373 logger.debug( 'delete selected rows called' ) 374 for row in set( map( lambda x: x.row(), self.table.selectedIndexes() ) ): 375 self._table_model.removeRow( row ) 374 confirmation_message = self.admin.get_confirm_delete() 375 confirmed = True 376 if confirmation_message: 377 if QtGui.QMessageBox.question(self, 378 _('Please confirm'), 379 unicode(confirmation_message), 380 QtGui.QMessageBox.Yes, 381 QtGui.QMessageBox.No) == QtGui.QMessageBox.No: 382 confirmed = False 383 if confirmed: 384 for row in set( map( lambda x: x.row(), self.table.selectedIndexes() ) ): 385 self._table_model.removeRow( row ) 376 386 377 387 @gui_function -
trunk/camelot/view/wizard/importwizard.py
r1038 r1178 342 342 row_data_admin.get_columns 343 343 ) 344 344 self.setWindowTitle(_(self.window_title)) 345 self.add_pages(model, row_data_admin) 346 self.setOption(QtGui.QWizard.NoCancelButton) 347 348 def add_pages(self, model, row_data_admin): 349 """ 350 Add all pages to the import wizard, reimplement this method to add 351 custom pages to the wizard 352 :param model: the CollectionProxy that will be used to display the to be imported data 353 :param row_dat_admin: the admin interface to be used to display the model, this admin 354 is automatically derived from the admin of the data once it is imported 355 """ 345 356 self.addPage(SelectFilePage(parent=self)) 346 357 self.addPage( … … 351 362 ) 352 363 ) 353 self.addPage(FinalPage(parent=self, model=model)) 354 self.setWindowTitle(_(self.window_title)) 355 356 self.setOption(QtGui.QWizard.NoCancelButton) 364 self.addPage(FinalPage(parent=self, model=model))
