RoastMaster Utilities Progress

I finally got a rudimentary  GUI for my RoastMaster Utilities working.

2016-02-26 (1)

Here is the code with a brief explanation of the problem spot. If I had a bit of experience with python classes and inheritance, I probably wouldn’t have had problems.

from PyQt5 import QtCore, QtGui, QtWidgets
import coffeeMenu as cm
import RMPasteData as pd
import sys

from RMUtility2 import Ui_MainWindow


class MyWindow(Ui_MainWindow):
    '''
    Inherit from class created by Qt designer in the file RMUtility2
    The critical part is in the __init__ method (also known as a constructor)
     below. You usually see it as 
     super().__init__() which would call the __init__ method of the parent
     class however Qt Designer doesn't provide an __init__. It provides the
     setupUi method instead.
    '''
    def __init__(self):
        super().setupUi(MainWindow)

    def setupUi(self, MainWindow):
        print("In local setupUI")
        self.coffeeButton.clicked.connect(self.coffeeMenu)
        self.pasteDataButton.clicked.connect(self.pasteData)

    def coffeeMenu(self):
        debug = False
        roastmaster_db = 'C:/Users/kor/Dropbox/Apps/Roastmaster/Kor Database.sqlite'
        # roastmaster_db = 'c:/users/kor/dropbox/apps/roastmaster/Kor Database.sqlite'
        cm.check_db(roastmaster_db)
        cm.show_coffee_list(debug)
        cm.create_report()

    def pasteData(self):
        print("In pastData - local")
        debug = False
        roastmaster_db = 'c:/users/kor/dropbox/apps/roastmaster/Kor Database.sqlite'
        # roastmaster_db = 'C:/Users/kiley_000/Dropbox/Apps/Roastmaster/My Database.sqlite'
        pd.check_db(roastmaster_db)
        pd.show_coffee_list()
        pd.create_report()

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = MyWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

Author: korkiley

Systems Administrator at University of Vermont (retired as of 7/1/2012) Married Favorite Activities: Condor Glider Online Competition, Developing web sites, making espresso, and keeping a blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s