Beispiel #1
0
    def popup(self, pos):

        from ui.ligne_edit import EditLigneViewWidget
        from ui.deleteview import DeleteViewWidget
        from data_helper import check_befor_update_data
        row = self.selectionModel().selection().indexes()[0].row()
        if (len(self.data) - 1) < row:
            return False
        menu = QMenu()
        editaction = menu.addAction("Modifier cette ligne")
        delaction = menu.addAction("Supprimer cette ligne")
        action = menu.exec_(self.mapToGlobal(pos))
        report = Report.get(id=self.data[row][-1])
        if action == editaction:
            try:
                self.parent.open_dialog(EditLigneViewWidget, modal=True,
                                        table_p=self, report=report)
            except IndexError:
                pass
        if action == delaction:
            list_error = check_befor_update_data(report)
            if list_error == []:
                if len(self.data) < 2:
                    self.parent.cancellation()
                else:
                    self.parent.open_dialog(
                        DeleteViewWidget, modal=True, obj=report, table_p=self,)
            else:
                from Common.ui.util import raise_error
                raise_error(u"Impossible de supprimer", """<h3>L'article {} :</h3>
                        Aura <b>{}</b> comme dernier restant.""".format(
                    report.product.name, list_error[-1]))
Beispiel #2
0
    def popup(self, pos):

        from ui.ligne_edit import EditLigneViewWidget
        from ui.deleteview import DeleteViewWidget
        from data_helper import check_befor_update_data
        row = self.selectionModel().selection().indexes()[0].row()
        if (len(self.data) - 1) < row:
            return False
        menu = QMenu()
        editaction = menu.addAction("Modifier cette ligne")
        delaction = menu.addAction("Supprimer cette ligne")
        action = menu.exec_(self.mapToGlobal(pos))
        report = Report.get(id=self.data[row][-1])
        if action == editaction:
            try:
                self.parent.open_dialog(EditLigneViewWidget, modal=True,
                                        table_p=self, report=report)
            except IndexError:
                pass
        if action == delaction:
            list_error = check_befor_update_data(report)
            if list_error == []:
                if len(self.data) < 2:
                    self.parent.cancellation()
                else:
                    self.parent.open_dialog(
                        DeleteViewWidget, modal=True, obj=report, table_p=self,)
            else:
                from Common.ui.util import raise_error
                raise_error(u"Impossible de supprimer", """<h3>L'article {} :</h3>
                        Aura <b>{}</b> comme dernier restant.""".format(
                    report.product.name, list_error[-1]))
def testing():
    r = Report.current()
    r = Report.get(Key('ahBpbWF6b24tcHJvdG90eXBlcg4LEgZSZXBvcnQYiaECDA'))
    logging.info("report " + unicode(r))
    ee_resource = 'MOD09GA'
    ndfi = NDFI(ee_resource,
            r.comparation_range(),
            r.range())
    #return str(ndfi.mapid2())
    return str(ndfi.freeze_map(1089491, r.key().id()))
Beispiel #4
0
    def testReportGeneration(self):

        # With non-ascii text in batch
        BATCH_1 = {
            'speed': [0 for x in range(10)],
            'narrative': [
                None, None, "Narrative", "Test", "", u"Làst", None, None, None,
                None
            ]
        }
        self.__createNewRecords(BATCH_1, first_dt=datetime.now())

        specs = {
            'sensortype_id': self.spedometer.key().id(),
            'columns': ['narrative', 'speed']
        }
        r = Report.Create(self.e, type=REPORT.SENSOR_DATA_REPORT, specs=specs)
        r.put()
        r.run(None)

        self.execute_tasks_until_empty()

        r = Report.get(r.key())
        self.assertTrue(r.isDone())