示例#1
0
 def openDeclaration(self):
     """
     Open the declaration widget
     """
     noi = int(self.sender().objectName()[3])
     self.scenario.genNbEnf()
     msg = self.scenario.check_consistency()
     if msg:
         QMessageBox.critical(self, u"Ménage non valide", msg,
                              QMessageBox.Ok, QMessageBox.NoButton)
         return False
     self._declaration = Declaration(self, noi)
     self._declaration.exec_()
     self.emit(SIGNAL('compoChanged()'))
 def openDeclaration(self):
     """
     Open the declaration widget
     """
     noi = int(self.sender().objectName()[3])
     self.scenario.genNbEnf()
     msg = self.scenario.check_consistency()
     if msg:
         QMessageBox.critical(self, u"Ménage non valide",
                              msg,
                              QMessageBox.Ok, QMessageBox.NoButton)
         return False
     self._declaration = Declaration(self, noi)
     self._declaration.exec_()
     self.emit(SIGNAL('compoChanged()'))
 def load(self):
     cas_type_dir = self.get_option('import_dir')
     fileName = QFileDialog.getOpenFileName(self,
                                            _("Open a test case"),
                                            cas_type_dir,
                                            u"Cas type OpenFisca (*.ofct)")
     if not fileName == '':
         n = len(self.scenario.indiv)
         try:
             self.scenario.openFile(fileName)
             while n < self.nbRow():
                 self.addRow()
                 n += 1
             while n > self.nbRow():
                 self.rmvRow()
                 n -= 1
             self.emit(SIGNAL('compoChanged()'))
             self.emit(SIGNAL("ok()"))
         except Exception, e:
             QMessageBox.critical(
                 self, "Erreur", u"Erreur lors de l'ouverture du fichier : le fichier n'est pas reconnu : \n " + e,
                 QMessageBox.Ok, QMessageBox.NoButton)
示例#4
0
 def load(self):
     cas_type_dir = self.get_option('import_dir')
     fileName = QFileDialog.getOpenFileName(self, _("Open a test case"),
                                            cas_type_dir,
                                            u"Cas type OpenFisca (*.ofct)")
     if not fileName == '':
         n = len(self.scenario.indiv)
         try:
             self.scenario.openFile(fileName)
             while n < self.nbRow():
                 self.addRow()
                 n += 1
             while n > self.nbRow():
                 self.rmvRow()
                 n -= 1
             self.emit(SIGNAL('compoChanged()'))
             self.emit(SIGNAL("ok()"))
         except Exception, e:
             QMessageBox.critical(
                 self, "Erreur",
                 u"Erreur lors de l'ouverture du fichier : le fichier n'est pas reconnu : \n "
                 + e, QMessageBox.Ok, QMessageBox.NoButton)
示例#5
0
    def compute(self):
        """
        Computing the test case
        """
        self.starting_long_process(_("Computing test case ..."))
        # Consistency check on scenario
        msg = self.simulation.scenario.check_consistency()
        if msg:
            QMessageBox.critical(self, u"Ménage non valide",
                                 msg,
                                 QMessageBox.Ok, QMessageBox.NoButton)
            return False
        # If it is consistent starts the computation

        self.action_compute.setEnabled(False)

        P, P_default = self.main.parameters.getParam(), self.main.parameters.getParam(defaut = True)
        self.simulation.set_param(P, P_default)

        self.simulation.compute()
        self.main.refresh_test_case_plugins()
        self.ending_long_process( _("Test case results are updated"))