IMPORT FormPopularFormSupp IMPORT FormSupp
__version__ = "1.0.0" Form (QtGui.QDialog): __init__ (self, parent = NONE): (Form, self). __init__ (parent) = QtGui.QAction (QtGui.QIcon (":/ edit_add.png"), "& Додати", self, = self.add_item) = QtGui.QAction (QtGui.QIcon (":/ remove.png"), "& Видалити" , self, = self.delete_item) = QtGui.QAction (QtGui.QIcon (":/ category.png"), "& Категорії", self, = self.show_categories) = QtGui.QAction (QtGui.QIcon ( ":/ database.png"), "& Транзакції", self, = self.show_transactions) = QtGui.QAction (QtGui.QIcon (":/ chart_bar.png"), "& Популярні товари" , self, = self.show_popular) = QtGui.QAction (QtGui.QIcon (":/ calculator.png"), "& Правила", self, = self.show_rules) = QtGui.QAction (QtGui.QIcon ( ":/ cart2.png"), "& Кошик", self, = self.show_cart) = QtGui.QAction (QtGui.QIcon (":/ refresh.png"), "& Товари", self, = self.show_items) = QtGui.QAction (QtGui.QIcon (":/ help.png"), "& Про програму", self, = self.help_about) = QtGui.QToolBar ()
# init grid.tableWidget = QtGui.QTableWidget (). refreshTable () =
self.setWindowTitle (u "Apriori. Допомога в підборі товару при покупці")
self.setGeometry (250, 250, 950, 40). TableWidget.setColumnWidth (1, 400). TableWidget.setColumnWidth (2, 400) item in Item.get (): = self.tableWidget.rowCount (). TableWidget.insertRow (no). TableWidget.setItem (no, 0, QtGui.QTableWidgetItem (str (item.id))). tableWidget.setItem (no, 1, QtGui.QTableWidgetItem (item.name)). tableWidget.setItem (no, 2, QtGui.QTableWidgetItem (Category.get (item . category_id). get_name ())). tableWidget.setRowHeight (no, 20) show_rules (self): = FormSupp () forms.exec_ (): = FormRules (minsupp = forms.minText.text (). toInt () [ 0], maxsupp = forms.maxText.text (). toInt () [0]). exec_ () show_popular (self): = FormSupp () forms.exec_ (): = FormPopular (minsupp = forms.minText.text ( ). toInt () [0], maxsupp = forms.maxText.text (). toInt () [0]). exec_ () show_cart (self): = FormCart (). exec_ () add_item (self): = FormItem (). exec_ (). refreshTable () edit_item (self): = self.tableWidget.currentRow () no! = -1: = self.tableWidget.item (no, 0). text () = FormItem (model = Item . get (id)). exec_ (). refreshTable () delete_item (self): = QtGui.QMessageBox.question (self,
"Видалення",
"Запис буде видалена! Ви впевнені? ", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes: = self.tableWidget.currentRow ()! = -1: = self.tableWidget.item (no, 0). text () (id = id ). delete (). refreshTable () show_items (self): = FormResult (). exec_ () show_transactions (self): = FormTransactions (). exec_ () show_categories (self): = FormCategories (). exec_ () help_about ( self):. QMessageBox.about (self, "Apriori - Про програму",
"" " Apriori v {0}