コード例 #1
0
    def load(self, progress=True):
        start = datetime.now()

        self.activities = ActivityManager(self.mem)
        self.weightwishes = WeightWishManager(self.mem)

        self.companies = CompanyAllManager(self.mem)
        self.companies.load_all()

        self.foodtypes = FoodTypeManager_all(self.mem)
        self.additiverisks = AdditiveRiskManager_all(self.mem)
        self.additives = AdditiveManager_all(self.mem)

        self.products = ProductAllManager(self.mem)
        self.products.load_all()

        self.elaboratedproducts = ProductElaboratedManager_from_sql(
            self.mem, "select * from elaboratedproducts order by name")

        self.users = UserManager_from_db(self.mem, "select * from users",
                                         progress)
        self.mem.user = self.mem.data.users.find_by_id(
            int(self.mem.settings.value("mem/currentuser", 1)))
        if self.mem.user == None:
            self.mem.user = self.mem.data.users.find_by_id(
                1)  #For empty databases (contribution)
        self.mem.user.needStatus(1)

        debug("DBData took {}".format(datetime.now() - start))
コード例 #2
0
 def __init__(self, mem, only_system_products=False, parent=None):
     QWidget.__init__(self, parent)
     self.setupUi(self)
     self.mem = mem
     self.tblProducts.setSettings(self.mem.settings, "wdgProducts",
                                  "tblProducts")
     self.tblProducts.table.customContextMenuRequested.connect(
         self.on_tblProducts_customContextMenuRequested)
     if only_system_products == True:
         self.products = ProductManager(self.mem)
         self.products.load_from_db("select * from products order by name")
     else:
         self.products = ProductAllManager(self.mem)
     self.cmb.setCurrentIndex(
         int(self.mem.settings.value("wdgProducts/cmb", "0")))
     self.products.qtablewidget(self.tblProducts)
コード例 #3
0
 def __init__(self, mem, only_system_products=False, parent=None):
     QWidget.__init__(self, parent)
     self.setupUi(self)
     self.mem = mem
     self.tblProducts.settings(self.mem.settings, "wdgProducts",
                               "tblProducts")
     self.tblProducts.table.customContextMenuRequested.connect(
         self.on_tblProducts_customContextMenuRequested)
     self.tblProducts.table.itemSelectionChanged.connect(
         self.on_tblProducts_itemSelectionChanged)
     if only_system_products == True:
         self.products = ProductManager(self.mem)
         self.products.load_from_db("select * from products order by name")
         self.products.qtablewidget(self.products, self.tblProducts)
     else:
         self.products = ProductAllManager(self.mem)
         self.products.qtablewidget(self.tblProducts)