コード例 #1
0
def declar03(request, idfoy):

    description = DataTable(InputTable).description
    compo = request.session.get('compo', default=None)
    if idfoy is None:
        idfoy = 0
    else:
        idfoy = int(idfoy)

    if request.method == 'POST':
        form = Declar3Form(request.POST, description=description)
        print 'declar 3: is form valid :', form.is_valid()
        if form.is_valid():
            compo.get_declar3(form=form, idfoy=idfoy)
            form = compo.create_declar3(idfoy=idfoy, description=description)
            request.session['compo'] = compo
            for indiv, val in compo.scenario.indiv.iteritems():
                print indiv
                print val

            return HttpResponseRedirect('/simulation/declar04/' + str(idfoy))

    else:

        form = Declar3Form(description=description)

    request.session['compo'] = compo
    c = {'form': form}
    c.update(csrf(request))
    return render(request, 'simulation/declar03.html', c)
コード例 #2
0
ファイル: lanceur.py プロジェクト: TibbersBear/openfisca
 def compute(self):
     '''
     Computes the totals  
     '''
     input_table = DataTable(InputTable, scenario=self.scenario)
     population_courant = SystemSf(ModelFrance, self.param_courant,
                                   self.param_default)
     population_courant.set_inputs(input_table)
     self.data_courant = gen_output_data(population_courant)
コード例 #3
0
ファイル: views.py プロジェクト: TibbersBear/openfisca
def declar03(request):
    description = DataTable(InputTable).description
    form = Declar3Form(description = description)
        
    if request.method == 'POST':
        if True:
#        if form.is_valid():
            request.session.modified = True
            return HttpResponseRedirect('/mahdi/declar04/')
    else:
        form = Declar3Form(description = description) 

    return render(request, 'mahdi/declar03.html', {'form' : form})
コード例 #4
0
    def compute(self):
        '''
        Computes the totals  
        '''
        input_table = DataTable(InputTable, scenario=self.scenario)
        population_courant = SystemSf(ModelSF, self.param_courant,
                                      self.param_default)
        population_courant.set_inputs(input_table)

        from web.settings import SRC_PATH
        fname = os.path.join(SRC_PATH, 'france', 'totaux.xml')

        self.data_courant = gen_output_data(population_courant, fname)
コード例 #5
0
 def load_survey_data(self):
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     try:
         # liberate some memory before loading new data
         self.reset_aggregate()
         gc.collect()
         fname = CONF.get('paths', 'survey_data/file')
         self.survey = DataTable(InputTable, survey_data=fname)
         self._dataframe_widget.set_dataframe(self.survey.table)
         return True
     except Exception, e:
         self.aggregate_enabled = False
         QMessageBox.warning(
             self, u"Impossible de lire les données",
             u"OpenFisca n'a pas réussi à lire les données d'enquête et passe en mode barème. L'erreur suivante a été renvoyé:\n%s\n\nVous pouvez charger des nouvelles données d'enquête dans Fichier>Paramètres>Chemins>Données d'enquête"
             % e)
         self.emit(SIGNAL('baremeOnly()'))
         return False
コード例 #6
0
    def refresh_bareme(self):
        # Consistency check on scenario
        msg = self.scenario.check_consistency()
        if msg:
            QMessageBox.critical(self, u"Ménage non valide", msg,
                                 QMessageBox.Ok, QMessageBox.NoButton)
            return False
        # Si oui, on lance le calcul
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        self.statusbar.showMessage(u"Calcul en cours...")
        self.action_refresh_bareme.setEnabled(False)
        # set the table model to None before changing data
        self._table.clearModel()

        P_default = self._parametres.getParam(defaut=True)
        P_courant = self._parametres.getParam(defaut=False)

        input_table = DataTable(InputTable, scenario=self.scenario)

        population_courant = SystemSf(ModelFrance, P_courant, P_default)
        population_courant.set_inputs(input_table)
        data_courant = gen_output_data(population_courant)

        if self.reforme:
            population_default = SystemSf(ModelFrance, P_default, P_default)
            population_default.set_inputs(input_table)
            data_default = gen_output_data(population_default)
            data_courant.difference(data_default)
        else:
            data_default = data_courant
        self._table.updateTable(data_courant,
                                reforme=self.reforme,
                                mode=self.mode,
                                dataDefault=data_default)
        self._graph.updateGraph(data_courant,
                                reforme=self.reforme,
                                mode=self.mode,
                                dataDefault=data_default)

        self.statusbar.showMessage(u"")
        QApplication.restoreOverrideCursor()