示例#1
0
 def popup(self, item):
     #check for existing data and fill entries with it
     with OpenSession() as session:
         item.pesticides.query(session)
     if item.pesticides.data is not None:
         self.fill_pesticides(item.pesticides)
     #show the dialog and transfer input to the database
     if self.exec_():
         with OpenSession() as session:
             self.create_from_input(session, item)
示例#2
0
 def populate_names(self):
     #populate the assay names combobox
     with OpenSession() as session:
         names = Chem_Names()
         names.get_names(session)
         self.chem_names = names.names
         self.entries['name_option'].populate(self.chem_names)
示例#3
0
 def save_note_click(self):
     if self.item.data is not None:
         new_note = self.ui.is_item_notePT.toPlainText()
         with OpenSession() as session:
             self.item.update(session, note=new_note)
     else:
         print("Warning: Load item data to save it's note.")
示例#4
0
 def popup(self, item):
     #check for existing data and fill entries with it
     with OpenSession() as session:
         item.moisture.query(session)
         item.density.query(session)
         item.avgwt.query(session)
     if item.moisture.data is not None:
         self.fill_moisture(item.moisture)
     if item.density.data is not None:
         self.fill_density(item.density)
     if item.avgwt.data is not None:
         self.fill_avgwt(item.avgwt)
     #show the dialog and transfer input to the database
     if self.exec_():
         with OpenSession() as session:
             self.create_from_input(session, item)
示例#5
0
 def update_name_list(self, name):
     if name == '':
         return False
     if name not in self.chem_names:
         with OpenSession() as session:
             names = Chem_Names()
             names.add_name(session, name)
     return True
示例#6
0
 def popup(self, item, selected_assay_name):
     #check for existing data and fill entries with it
     #with OpenSession() as session:
     #   item.assays.specific[selected_assay_name].query(session, selected_assay_name)
     if item.assays.specific[selected_assay_name].data is not None:
         self.fill_assay(item.assays.specific[selected_assay_name])
     #show the dialog and transfer input to the database
     if self.exec_():
         with OpenSession() as session:
             self.create_from_input(session, item, selected_assay_name)
示例#7
0
 def remove_chem_click(self):
     selected_chem_name = self.fetch_table_text(self.ui.is_chem_idTable, 0)
     if selected_chem_name is not None and selected_chem_name != '':
         text = "Are you sure you want to remove the selected chemical ID?"
         dialog = TextDialog(text)
         if dialog.exec_():
             with OpenSession() as session:
                 self.item.chem_ids.query(session)
                 self.item.chem_ids.specific[selected_chem_name].\
                 remove(session)
                 self.item.chem_ids.query(session)
         self.display.show_item(self.item)
示例#8
0
 def popup(self, item, selected_genus_species):
     #check for existing data and fill entries with it
     #with OpenSession() as session:
     #Idea: change specific to current, don't use dictionary to select specific things
     #use a select method to point to the desired one held in the plant_ids/assays
     #item.plant_ids.specific[selected_genus_species].select_name()
     #item.plant_ids.specific[selected_genus_species].query(session, selected_genus_species)
     if item.plant_ids.specific[selected_genus_species].data is not None:
         self.fill_plant(item.plant_ids.specific[selected_genus_species])
     #show the dialog and transfer input to the database
     if self.exec_():
         with OpenSession() as session:
             self.create_from_input(session, item, selected_genus_species)
示例#9
0
 def remove_plant_click(self):
     plant_names = []
     plant_names.append(self.fetch_table_text(self.ui.is_plant_idTable, 0))
     plant_names.append(self.fetch_table_text(self.ui.is_plant_idTable, 1))
     selected_plant_name = ' '.join(plant_names)
     if selected_plant_name is not None and selected_plant_name != '':
         text = "Are you sure you want to remove the selected botanical ID?"
         dialog = TextDialog(text)
         if dialog.exec_():
             with OpenSession() as session:
                 self.item.plant_ids.query(session)
                 self.item.plant_ids.specific[selected_plant_name].\
                 remove(session)
                 self.item.plant_ids.query(session)
         self.display.show_item(self.item)
示例#10
0
    def select_lot(self, new_item_number, new_lot_number):
        """update the lot number for all associations and run a query"""
        self.item_number = new_item_number
        self.data_access_dict['item_id'] = new_item_number
        self.lot_number = new_lot_number
        self.data_access_dict['lot_number'] = new_lot_number
        with OpenSession() as session:
            self.basis_query(session)

        #sequester this in a function to check ids
        new_lot_id = self.data.id
        self.location.select_item_number(new_item_number)
        self.receiving.select_item_number(new_item_number)
        self.sage_data.select_item_number(new_item_number)
        self.chem_id_results.select_item_number(new_item_number)
        self.plant_id_results.select_item_number(new_item_number)
        self.assay_results.select_item_number(new_item_number)
        self.hm_result.select_item_number(new_item_number)
        self.allergens_result.select_item_number(new_item_number)
        self.pesticides_result.select_item_number(new_item_number)
        self.organoleptics_result.select_item_number(new_item_number)
        self.moisture_result.select_item_number(new_item_number)
        self.density_result.select_item_number(new_item_number)
        self.avgwt_result.select_item_number(new_item_number)
        self.microbes_result.select_item_number(new_item_number)
        self.pathogens_result.select_item_number(new_item_number)
        self.rancidity_result.select_item_number(new_item_number)
        self.location.select_lot_id(new_lot_id)
        self.receiving.select_lot_id(new_lot_id)
        self.sage_data.select_lot_id(new_lot_id)
        self.chem_id_results.select_lot_id(new_lot_id)
        self.plant_id_results.select_lot_id(new_lot_id)
        self.assay_results.select_lot_id(new_lot_id)
        self.hm_result.select_lot_id(new_lot_id)
        self.allergens_result.select_lot_id(new_lot_id)
        self.pesticides_result.select_lot_id(new_lot_id)
        self.organoleptics_result.select_lot_id(new_lot_id)
        self.moisture_result.select_lot_id(new_lot_id)
        self.density_result.select_lot_id(new_lot_id)
        self.avgwt_result.select_lot_id(new_lot_id)
        self.microbes_result.select_lot_id(new_lot_id)
        self.pathogens_result.select_lot_id(new_lot_id)
        self.rancidity_result.select_lot_id(new_lot_id)
示例#11
0
 def select_item_number(self, new_item_number):
     """update the item number for all associations and run a query"""
     self.item_number = new_item_number
     self.data_access_dict['id'] = new_item_number
     self.lots.select_item_number(self.item_number)
     self.assays.select_item_number(self.item_number)
     self.chem_ids.select_item_number(self.item_number)
     self.plant_ids.select_item_number(self.item_number)
     self.hm.select_item_number(self.item_number)
     self.pesticides.select_item_number(self.item_number)
     self.allergens.select_item_number(self.item_number)
     self.organoleptics.select_item_number(self.item_number)
     self.moisture.select_item_number(self.item_number)
     self.density.select_item_number(self.item_number)
     self.avgwt.select_item_number(self.item_number)
     self.microbes.select_item_number(self.item_number)
     self.pathogens.select_item_number(self.item_number)
     self.rancidity.select_item_number(self.item_number)
     with OpenSession() as session:
         self.query(session)
示例#12
0
 def popup(self, item):
     #show the dialog and transfer input to the database
     if self.exec_():
         with OpenSession() as session:
             self.create_from_input(session, item)
示例#13
0
 def popup(self, item):
     if self.exec_():
         with OpenSession() as session:
             self.create_from_input(session, item)
示例#14
0
 def popup(self, item):
     self.fill_in_item_id(item)
     with OpenSession() as session:
         if self.exec_():
             self.create_from_input(session, item)