Ejemplo n.º 1
0
 def delete_selected_rows(self):
     assert object_thread( self )
     logger.debug( 'delete selected rows called' )
     confirmed = True
     rows = set( index.row() for index in self.selectedIndexes() )
     if not rows:
         return
     if self._admin.get_delete_mode()=='on_confirm':
         if QtGui.QMessageBox.question(self,
                                       _('Please confirm'),
                                       unicode(self._admin.get_delete_message(None)),
                                       QtGui.QMessageBox.Yes,
                                       QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
             confirmed = False
     if confirmed:
         #
         # if there is an open editor on a row that will be deleted, there
         # might be an assertion failure in QT, or the data of the editor 
         # might be pushed to the row that replaces the deleted one
         #
         progress_dialog = ProgressDialog(_('Removing'))
         self.model().rows_removed_signal.connect( progress_dialog.finished )
         self.model().exception_signal.connect( progress_dialog.exception )
         self.close_editor()
         self.model().remove_rows( set( rows ) )
         progress_dialog.exec_()
Ejemplo n.º 2
0
 def delete_selected_rows(self):
     logger.debug("delete selected rows called")
     confirmation_message = self._admin.get_confirm_delete()
     confirmed = True
     rows = set(index.row() for index in self.selectedIndexes())
     if not rows:
         return
     if confirmation_message:
         if (
             QtGui.QMessageBox.question(
                 self,
                 _("Please confirm"),
                 unicode(confirmation_message),
                 QtGui.QMessageBox.Yes,
                 QtGui.QMessageBox.No,
             )
             == QtGui.QMessageBox.No
         ):
             confirmed = False
     if confirmed:
         #
         # if there is an open editor on a row that will be deleted, there
         # might be an assertion failure in QT
         #
         progress_dialog = ProgressDialog(_("Removing"))
         self.model().rows_removed_signal.connect(progress_dialog.finished)
         self.model().exception_signal.connect(progress_dialog.exception)
         self.close_editor()
         self.model().remove_rows(set(rows))
         progress_dialog.exec_()
Ejemplo n.º 3
0
 def is_connection_valid(self):
     profilename, info = self.collect_info()
     mt = SignalSlotModelThread(lambda:None)
     mt.start()
     progress = ProgressDialog(_('Verifying database settings'))
     mt.post(lambda:self.test_connection( info ),
         progress.finished, progress.exception)
     progress.exec_()
     return self._connection_valid
Ejemplo n.º 4
0
 def is_connection_valid(self):
     profilename, info = self.collect_info()
     mt = SignalSlotModelThread(lambda: None)
     mt.start()
     progress = ProgressDialog(_('Verifying database settings'))
     mt.post(lambda: self.test_connection(info), progress.finished,
             progress.exception)
     progress.exec_()
     return self._connection_valid
Ejemplo n.º 5
0
 def is_connection_valid(self):
     info = self.collect_info()
     mt = SignalSlotModelThread(lambda: None)
     mt.start()
     progress = ProgressDialog(_("Verifying database settings"))
     mt.post(
         lambda: self.test_connection(info["dialect"], info["host"], info["user"], info["pass"], info["database"]),
         progress.finished,
         progress.exception,
     )
     progress.exec_()
     return self._connection_valid
Ejemplo n.º 6
0
 def delete_selected_rows(self):
     logger.debug('delete selected rows called')
     confirmation_message = self._admin.get_confirm_delete()
     confirmed = True
     rows = set(index.row() for index in self.selectedIndexes())
     if not rows:
         return
     if confirmation_message:
         if QtGui.QMessageBox.question(
                 self, _('Please confirm'), unicode(confirmation_message),
                 QtGui.QMessageBox.Yes,
                 QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
             confirmed = False
     if confirmed:
         #
         # if there is an open editor on a row that will be deleted, there
         # might be an assertion failure in QT
         #
         progress_dialog = ProgressDialog(_('Removing'))
         self.model().rows_removed_signal.connect(progress_dialog.finished)
         self.model().exception_signal.connect(progress_dialog.exception)
         self.close_editor()
         self.model().remove_rows(set(rows))
         progress_dialog.exec_()