def on_validate(self): idx_counter = self.comboCounter.currentIndex() value_counter = int(self.lEdit.text()) if idx_counter == 0 or value_counter == "": self.close() return allcounters = Counter.findAll() counter = allcounters[idx_counter-1] r = Recording(counter.id, self.current_date, value_counter) r.insert() self.closed.emit() self.close()
gaz.insert() print(gaz) print("") #### List all the counters print("List all : ") allcounters = Counter.findAll() for c in allcounters: print(str(c)) #### Put some recordings r = Recording(elec.id, datetime.datetime.strptime("2015-10-01", "%Y-%m-%d"), 1000) r.insert() r = Recording(elec.id, datetime.datetime.strptime("2015-10-05", "%Y-%m-%d"), 1500) r.insert() r = Recording(gaz.id, datetime.datetime.strptime("2015-10-01", "%Y-%m-%d"), 100) r.insert() r = Recording(gaz.id, datetime.datetime.strptime("2015-10-10", "%Y-%m-%d"), 200) r.insert() #### List all the counters print("List all : ") s = Recording.findAll() for r in s: print(str(r))