try: splash_pix = QtGui.QPixmap("Resources/splash.png") splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() # Database.connect(host="localhost", # databaseName="salaryManagement_test_1", # username="******", # password="******") Database.connect(host="remotemysql.com", username="******", password="******", databaseName="ll703lm6tX") w = MainWindow() styleSheetFile = QtCore.QFile("styleSheet/flatStyleSheet.css") styleSheetFile.open(QtCore.QIODevice.ReadOnly) w.setStyleSheet(str(styleSheetFile.readAll())) w.show() splash.finish(w) except mysql.connector.Error as e: splash.close() ShowMysqlError(e)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.__parent = parent self.title = "Calculate Salary" self.__desig = None self.__emp = None t = datetime.now() self.month = QComboBox() self.month.addItems([ "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER" ]) self.month.setCurrentIndex(t.month - 1) self.year = QSpinBox() self.year.setRange(1900, 3000) self.year.setValue(t.year) self.name = SearchBox(self) self.name.setPlaceholderText("Enter Name") self.nameList = [] self.nameList = Database.getdb().getEmployeeNameList() self.name.setList(self.nameList) self.id = QComboBox() self.designation = QLineEdit() self.designation.setReadOnly(True) self.originalPay = QLineEdit() self.originalPay.setReadOnly(True) self.originalPayGrade = QLineEdit() self.originalPayGrade.setReadOnly(True) self.DOJ = QLineEdit() self.DOJ.setReadOnly(True) self.pan = QLineEdit() self.pan.setReadOnly(True) self.presentPay = QLineEdit() self.presentPay.setReadOnly(True) self.da_percent = ValueBox() self.hra_percent = ValueBox() self.ta_percent = ValueBox() self.it_percent = ValueBox() self.pt_percent = ValueBox() self.name.editTextChanged.connect(self.clearInfo) self.bttnCalculate = QPushButton("Calculate") self.bttnCalculate.clicked.connect(self.calculate) self.bttnCancel = QPushButton("Back") self.bttnCancel.clicked.connect(self.goBack) self.bttnCalculate.setObjectName("OkButton") self.bttnCancel.setObjectName("CancelButton") self.name.returnPressed.connect(self.setIDList) self.id.currentIndexChanged.connect( lambda: self.loadInfo(self.id.currentText())) self.setupUI()
clean_field_names = [] for table_fields in field_names: # loop through the list of dicts clean_dict = {} for key in table_fields.keys(): # loop through key, value sets clean_dict[key] = '' # reset value clean_field_names.append(clean_dict) return clean_field_names # main of the driver if __name__ == '__main__': # load categories from csv file categories = CSVUtils.readCSV('../categories/categories.csv', dict_output=True) # connect to the budget_db (or create it if does not exist) budget_db = Database('../databases/Budget.db') field_names = initialize_database(budget_db) # create tables if do not exist cln_field_names = clean_field_names(field_names) # cleans dictionaries but retain keys # Get cmd line args args = sys.argv[1:] if 'help' in args: print ''' Command Description --------------------------------------------------------------------- load Add a path to a statement to load into the db new Creates a new table db entry update Updates a current db entry calc totals Generates a spending report for all time
def insertToDatabase(self, database): database.cursor.execute("INSERT INTO n11 VALUES(?,?,?,?,?)", (self.name, self.seller, self.price, self.freeShipping, self.lastFileName)) database.con.commit() def __str__(self): return "name: {}\nprice: {}\nfree shipping: {}\nseller: {}\nimgName: {}".format( self.name, self.price, self.freeShipping, self.seller, self.imgName) try: homeDir = os.getcwd() database = Database() key = input("keyword: ") count = int(input("Take x objects: ")) url = "https://www.n11.com/arama?q=" + key.replace(" ", "+") response = requests.get(url) html_content = response.content soup = BeautifulSoup(html_content, "html.parser") products = soup.find("ul", {"class": "clearfix"}) for product in products.find_all("li", {"class": "column"}, limit=count): p = Product(product) print(p)
def loadDesignations(self): self.chooseDesignation.clear() self.desigList = Database.getdb().getDesignations() self.chooseDesignation.addItems(self.desigList) self.chooseDesignation.setCurrentIndex(-1)
try: splash_pix = QtGui.QPixmap("Resources/splash.png") splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() # Database.connect(host="localhost", # databaseName="salaryManagement_test_1", # username="******", # password="******") Database.connect(host="remotemysql.com", username="******", password="******", databaseName="41Ng5H2E1B") w = MainWindow() styleSheetFile = QtCore.QFile("styleSheet/flatStyleSheet.css") styleSheetFile.open(QtCore.QIODevice.ReadOnly) w.setStyleSheet(str(styleSheetFile.readAll())) w.show() splash.finish(w) except mysql.connector.Error as e: splash.close() ShowMysqlError(e)