Beispiel #1
0
    def populate_model(self):
        """"
        Method to initially populate the model on startup
        """
        self.clear()
        results = Lookups.select().where(Lookups.is_active == "True",
                                         Lookups.type == "Vessel Number") \
            .order_by(Lookups.value.asc())

        for result in results:
            item = dict()
            item["id"] = result.lookup
            item["text"] = result.description
            self.appendItem(item)
Beispiel #2
0
 def populate_model(self):
     """
     Method to retrieve all of measurements + units of measurement from the database lookups table
     and use them to populate the cbMeasurement combobox on the SensorDataFeeds.qml page
     :return:
     """
     self.clear()
     records = Lookups.select(Lookups.value, Lookups.subvalue, Lookups.lookup)\
         .where(Lookups.type == "Measurement", Lookups.is_active == "True")\
         .order_by(Lookups.value.asc()) \
         .group_by(Lookups.value, Lookups.subvalue)
     for record in records:
         item = dict()
         item["lookup_id"] = record.lookup
         item["text"] = record.value + ", " + record.subvalue \
             if record.subvalue else record.value
         self.appendItem(item)
Beispiel #3
0
    def populate_model(self):
        """
        Method to retrieve all of the measurements form the database lookups table
        and use them to populate the cbMeasurement combobox on the NewMeasurementDialog.qml
        called from the SensorDataFeeds.qml screen
        :return:
        """
        self.clear()

        records = Lookups.select(Lookups.value, Lookups.lookup) \
            .where(Lookups.type == "Measurement", Lookups.is_active == "True")\
            .order_by(Lookups.value.asc()) \
            .group_by(Lookups.value)
        for record in records:
            item = dict()
            item["lookup_id"] = record.lookup
            item["text"] = record.value
            self.appendItem(item)
Beispiel #4
0
    def populate_model(self):
        """
        Method to retrieve all of the units of measurement from the database lookups table
        and use them to populate the cbUnitOfMeasurement combobox on the
        NewMeasurementDialog.qml that is called from the SensorDataFeeds.qml page
        :return:
        """
        self.clear()

        # TODO - Ensure that the units of measurement returned are unique
        records = Lookups.select(Lookups.subvalue, Lookups.lookup) \
            .where(Lookups.type == "Measurement", Lookups.is_active == "True") \
            .order_by(Lookups.subvalue.asc()) \
            .group_by(Lookups.subvalue)
        for record in records:
            item = dict()
            item["lookup_id"] = record.lookup
            item["text"] = record.subvalue
            self.appendItem(item)