class Form(QMainWindow):
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)
        self.createGui()

    def createGui(self):
        self.btnScrapCat = QPushButton("&Scrap Category")
        self.btnScrapCat.clicked.connect(self.scrapCategoryAction)
        self.browserCat = QTextBrowser()

        self.btnScrapProduct = QPushButton("&Scrap Product")
        self.btnScrapProduct.clicked.connect(self.scrapProductAction)
        self.browserProduct = QTextBrowser()

        self.btnScrapBrand = QPushButton("&Scrap Brand")
        self.btnScrapBrand.clicked.connect(self.scrapBrandAction)
        self.browserBrand = QTextBrowser()

        layout = QGridLayout()
        layout.addWidget(self.btnScrapCat, 0, 0)
        layout.addWidget(self.browserCat, 0, 1)
        layout.addWidget(self.btnScrapProduct, 1, 0)
        layout.addWidget(self.browserProduct, 1, 1)
        layout.addWidget(self.btnScrapBrand, 2, 0)
        layout.addWidget(self.browserBrand, 2, 1)

        widget = QWidget()
        widget.setLayout(layout)

        self.setCentralWidget(widget)
        self.setWindowTitle("Cs Catering.")
        screen = QDesktopWidget().screenGeometry()
        self.resize(screen.width() - 150, screen.height() - 150)

    def scrapCategoryAction(self):
        self.csCat = CsCat()
        self.csCat.start()
        self.csCat.notifyCategory.connect(self.categoryStatus)

    def scrapProductAction(self):
        #        self.csProduct = CsProduct()
        self.csProduct = CsTest()
        self.csProduct.start()
        self.csProduct.notifyProduct.connect(self.productStatus)

    def scrapBrandAction(self):
        self.csBrand = CsBrands()
        self.csBrand.start()
        self.csBrand.notifyBrand.connect(self.brandStatus)

    def categoryStatus(self, data):
        self.browserCat.append(data)

    def productStatus(self, data):
        self.browserProduct.append(data)

    def brandStatus(self, data):
        self.browserBrand.append(data)
Example #2
0
def scrapCsBrand():
    csBrand = CsBrands()
    csBrand.scrapBrands()
 def scrapBrandAction(self):
     self.csBrand = CsBrands()
     self.csBrand.start()
     self.csBrand.notifyBrand.connect(self.brandStatus)