def readFromWebCamToBarcode(self): symbol = getBarcode() if symbol == "": QMessageBox.about(self, "Barcode Alert", "We couldn't find barcode!!!") else: QMessageBox.about(self, "Barcode Found", "We just found the barcode!!!") self.lineEdit_3.setText(symbol)
def main(): args = parseArgs() path = 'list.csv' if args.path != None: path = args.path db = database.DB(path) if args.add == True: db.addItem([inputWifi()]) if args.parse != None: inputFile = args.parse if len(inputFile) == 0: parse = [sys.stdin] else: parse = [open(File) for File in inputFile] parse = map(addParse, parse) parse = [wifi for wifi in parse if not db.checkIfExists(wifi.ssid, wifi.encryption, wifi.passphrase)] db.addItem(parse) data = getData(args.filter, db) id = args.id if (id == None or len(id) == 0) and (args.remove == True): parser.error("--remove requires id") elif id == None or len(id) == 0: id = [1] wifis = getWifiById(data,id) actions = [] if args.showShort: actions.append(lambda wifi: print(shortInfo(wifi))) if args.bar: actions.append(lambda wifi: print(barcode.getBarcode(wifi))) if args.show: actions.append(lambda wifi: print(showInfo(wifi))) if args.edit: actions.append(lambda wifi: replaceEdit(db, wifi)) if args.connect: connect(next(wifis)) # for obvious reasons connect to only one wifi if args.remove: actions.append(lambda wifi: db.removeItem(wifi)) for wifi in wifis: for action in actions: action(wifi) data = getData(args.filter, db) # ToDo reset filters bevor showing results minWidth = getColumnWidth() id = 0 for wifi in data: id += 1 print(formatWifi(id, wifi, minWidth))
def deleteFromBarcode(self): symbol = getBarcode() if symbol == "": QMessageBox.about(self, "Barcode Alert", "We couldn't find barcode!!!") else: QMessageBox.about(self, "Barcode Found", "We just found the barcode!!!") selected_products = Product.objects.filter(barcode=symbol) if len(selected_products) > 0: p = selected_products[0] index = self.comboBox.findItem(p.id) if index >= 0: self.comboBox.setCurrentIndex(index) else: QMessageBox.about(self, "Product Not Found!", "Please add to Product before add new Stock!!!")
def readFromWebCamToStock(self): symbol = getBarcode() if symbol == "": QMessageBox.about(self, "Barcode Alert", "We couldn't find barcode!!!") else: QMessageBox.about(self, "Barcode Found", "We just found the barcode!!!") selected_products = Product.objects.filter(barcode=symbol) if len(selected_products) > 0: index = 0 for p in Product.objects.all(): if p.id == selected_products[0].id: self.comboBox.setCurrentIndex(index) break index += 1 else: QMessageBox.about(self, "Product Not Found!", "Please add to Product before add new Stock!!!")