Exemple #1
0
 def on_actionProductEdit_triggered(self):
     if self.meals.selected.product.system_product==True:
         from caloriestracker.ui.frmProductsAdd import frmProductsAdd
         w=frmProductsAdd(self.mem, self.meals.selected.product, self)
         w.setReadOnly()
         w.exec_()
     elif self.meals.selected.product.system_product==False:
         if self.meals.selected.product.elaboratedproducts_id==None:
             from caloriestracker.ui.frmProductsAdd import frmProductsAdd
             w=frmProductsAdd(self.mem, self.meals.selected.product, self)
             w.exec_()
         else:#Elaborated product
             from caloriestracker.ui.frmProductsElaboratedAdd import frmProductsElaboratedAdd
             elaborated=self.mem.data.elaboratedproducts.find_by_id(self.meals.selected.product.elaboratedproducts_id)
             w=frmProductsElaboratedAdd(self.mem, elaborated, self)
             w.exec_()
         self.on_calendar_selectionChanged()
Exemple #2
0
 def on_actionProductEdit_triggered(self):
     if self.tblProducts.selected.system_product == True:
         from caloriestracker.ui.frmProductsAdd import frmProductsAdd
         w = frmProductsAdd(self.mem, self.tblProducts.selected, self)
         if self.mem.isProductsMaintainerMode() == False:
             w.setReadOnly()
         w.exec_()
     elif self.tblProducts.selected.system_product == False:
         if self.tblProducts.selected.elaboratedproducts_id == None:
             from caloriestracker.ui.frmProductsAdd import frmProductsAdd
             w = frmProductsAdd(self.mem, self.tblProducts.selected, self)
             w.exec_()
             self.on_cmd_pressed()
         else:  #Elaborated product
             from caloriestracker.ui.frmProductsElaboratedAdd import frmProductsElaboratedAdd
             elaborated = self.mem.data.elaboratedproducts.find_by_id(
                 self.tblProducts.selected.elaboratedproducts_id)
             w = frmProductsElaboratedAdd(self.mem, elaborated, self)
             w.exec_()
     self.on_cmd_pressed()
 def on_actionProductEdit_triggered(self):
     if self.elaboratedproduct.products_in.selected.product.system_product==True:
         qmessagebox(
             self.tr("This is a system product so you can't edit it.") + "\n" +
             self.tr("Please, if it's something wrong with it create an issue at") + "\n" + 
             "https://github.com/turulomio/caloriestracker/issues"+ "\n" +
             self.tr("I'll fix it as soon as posible. ;)")
         )
     elif self.elaboratedproduct.products_in.selected.product.system_product==False:
         if self.elaboratedproduct.products_in.selected.product.elaboratedproducts_id==None:
             from caloriestracker.ui.frmProductsAdd import frmProductsAdd
             w=frmProductsAdd(self.mem, self.elaboratedproduct.products_in.selected.product, self)
             w.exec_()
         else:#Elaborated product
             from caloriestracker.ui.frmProductsElaboratedAdd import frmProductsElaboratedAdd
             elaborated=self.mem.data.elaboratedproducts.find_by_id(self.elaboratedproduct.products_in.selected.product.elaboratedproducts_id)
             w=frmProductsElaboratedAdd(self.mem, elaborated, self)
             w.exec_()
         self.elaboratedproduct.products_in.qtablewidget(self.tblProductsIn)
Exemple #4
0
 def on_actionProductNew_triggered(self):
     from caloriestracker.ui.frmProductsAdd import frmProductsAdd
     w = frmProductsAdd(self.mem, None, self)
     w.exec_()
     self.on_cmd_pressed()