示例#1
0
    def __init__(self, currVersion):
        global instance
        instance = self
        self.currVersion = currVersion
        self.cV = "".join(self.currVersion.split("."))
        if len(self.cV) < 4:
            self.cV = self.cV[0] + self.cV[1] + "0" + self.cV[2]

        try:
            if Config.instance.cfgEnableUpdater == 1:
                conn = http.client.HTTPSConnection("raw.githubusercontent.com", 443)
                conn.request("GET", "/Turnermator13/ArduinoRacingDash/master/version.txt")
                versionStr = re.findall(r"\'(.+?)\'", str(conn.getresponse().read()))[0].split("|")
                self.remoteVersion = versionStr[0]
                self.reqArduinoUpdate = versionStr[1]
                self.changeLog = versionStr[2]
                self.statsURL = versionStr[3]
                conn.close()
        except Exception as e:
            Log.error("Couldn't get Version Information: %s" % e)
            self.updaterError = True
        logStats("Login")

        self.rV = "".join(self.remoteVersion.split("."))
        if len(self.rV) < 4:
            self.rV = self.rV[0] + self.rV[1] + "0" + self.rV[2]

        if (self.remoteVersion != 0) and (self.remoteVersion != Config.instance.cfgRemoteVersion)\
                and (int(self.rV) > int(self.cV)):
            self.isOpen = True
            if self.reqArduinoUpdate == "1":
                Log.info("New acSLI Version Available: v" + self.remoteVersion + ". Requires Arduino Sketch Update")
            else:
                Log.info("New acSLI Version Available: v" + self.remoteVersion)

            self.appWindow = Window("acSLI Updater", 400, 120).setVisible(1).setPos(760, 350)\
                .setBackgroundTexture("apps/python/acSLI/image/backUpdater.png")
            self.btnYes = Button(self.appWindow.app, bFunc_Yes, 110, 20, 20, 90, "Update")\
                .setAlign("center").hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backBtnUpdater.png")
            self.btnNo = Button(self.appWindow.app, bFunc_No, 110, 20, 145, 90, "Not Now")\
                .setAlign("center").hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backBtnUpdater.png")
            self.btnIgnore = Button(self.appWindow.app, bFunc_Ignore, 110, 20, 270, 90, "Ignore Version")\
                .setAlign("center").hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backBtnUpdater.png")

            self.lblVersionTxt = Label(self.appWindow.app, "New acSLI Version Available: v" + self.remoteVersion, 20, 30)\
                .setSize(360, 10).setAlign("center").setFontSize(20).setColor(Utils.rgb(Utils.colours["red"]))
            self.lblLog = Label(self.appWindow.app, self.changeLog, 20, 60)\
                .setSize(360, 10).setAlign("center").setColor(Utils.rgb(Utils.colours["green"]))
        else:
            if self.updaterError:
                Log.info("Updater Encounter an Error. Version Check Incomplete")
            elif Config.instance.cfgEnableUpdater == 1:
                Log.info("Running Latest Version (v%s)" % self.remoteVersion)
示例#2
0
    def __init__(self):
        self.simInfo = Info()
        self.appWindow = Window("acSLI", 250, 260).setBackgroundTexture("apps/python/acSLI/image/backMain.png")

        self.lblPort = Label(self.appWindow.app, "Connected COM Port: {}".format(Config.instance.cfgPort), 15, 40)\
            .setSize(220, 10).setAlign("center").setColor(Utils.rgb(Utils.colours["red"]))
        self.btnUnits = Button(self.appWindow.app, bFunc_SpeedUnits, 200, 20, 25, 90, "Speed Units: {}".format(Config.instance.cfgSpeedUnit))\
                .setAlign("center").hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backBtnLarge.png")
        self.btnFuel = Button(self.appWindow.app, bFunc_FuelDisp, 200, 20, 25, 120, "Fuel Display: {}".format(Config.instance.cfgFuelDisp))\
                .setAlign("center").hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backBtnLarge.png")

        self.spnStartPage = Spinner(self.appWindow.app, sFunc_StartPage, 220, 20, 15, 165, "Startup Page", 0, 7, Config.instance.cfgStartPage)
        self.spnIntensity = Spinner(self.appWindow.app, sFunc_Intensity, 220, 20, 15, 215, "Display Intensity", 0, 7, Config.instance.cfgIntensity)
示例#3
0
    def __init__(self, msg):
        global instance
        instance = self

        self.appWindow = Window("acSLI Error", 800, 100).setVisible(1).setPos(560, 360)\
            .setBackgroundTexture("apps/python/acSLI/image/backError.png")
        self.btnOkay = Button(self.appWindow.app, bFunc_Okay, 240, 20, 280, 70,
                              "Okay").setAlign("center")
        self.lblVersionTxt = Label(self.appWindow.app, msg, 30, 30)\
            .setSize(760, 10).setAlign("center").setFontSize(18)
    def __init__(self):
        global instance
        instance = self

        self.appWindow = Window("acSLI Com Selector", 650, 360).setPos(635, 240)\
            .setBackgroundTexture("apps/python/acSLI/image/backSelector.png")

        self.btnUP = Button(self.appWindow.app, bFunc_UP, 80, 40, 285, 90, "").setAlign("center").hasCustomBackground()
        self.btnDN = Button(self.appWindow.app, bFunc_DN, 80, 40, 285, 310, "").setAlign("center").hasCustomBackground()

        self.lblMsg = Label(self.appWindow.app, "", 30, 47).setSize(590, 10).setAlign("center").setFontSize(18)\
            .setColor(Utils.rgb(Utils.colours["red"]))
        self.btnAUTO = Button(self.appWindow.app, bFunc_AUTO, 160, 20, 440, 98, "Enable AUTO Mode").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backBtnAuto.png")

        self.btnB0 = Button(self.appWindow.app, bFunc_B0, 600, 20, 25, 150, "").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backList.png")
        self.btnB1 = Button(self.appWindow.app, bFunc_B1, 600, 20, 25, 190, "").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backList.png")
        self.btnB2 = Button(self.appWindow.app, bFunc_B2, 600, 20, 25, 230, "").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backList.png")
        self.btnB3 = Button(self.appWindow.app, bFunc_B3, 600, 20, 25, 270, "").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backList.png")

        self.appWindow.setVisible(0)
class Selector:

    appWindow = 0
    listPorts = []
    shift = 0
    maxShift = 0

    btnUP = 0
    btnDN = 0
    btnB0 = 0
    btnB1 = 0
    btnB2 = 0
    btnB3 = 0
    btnAUTO = 0
    lblMsg = 0
    lblInst = 0

    def __init__(self):
        global instance
        instance = self

        self.appWindow = Window("acSLI Com Selector", 650, 360).setPos(635, 240)\
            .setBackgroundTexture("apps/python/acSLI/image/backSelector.png")

        self.btnUP = Button(self.appWindow.app, bFunc_UP, 80, 40, 285, 90, "").setAlign("center").hasCustomBackground()
        self.btnDN = Button(self.appWindow.app, bFunc_DN, 80, 40, 285, 310, "").setAlign("center").hasCustomBackground()

        self.lblMsg = Label(self.appWindow.app, "", 30, 47).setSize(590, 10).setAlign("center").setFontSize(18)\
            .setColor(Utils.rgb(Utils.colours["red"]))
        self.btnAUTO = Button(self.appWindow.app, bFunc_AUTO, 160, 20, 440, 98, "Enable AUTO Mode").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backBtnAuto.png")

        self.btnB0 = Button(self.appWindow.app, bFunc_B0, 600, 20, 25, 150, "").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backList.png")
        self.btnB1 = Button(self.appWindow.app, bFunc_B1, 600, 20, 25, 190, "").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backList.png")
        self.btnB2 = Button(self.appWindow.app, bFunc_B2, 600, 20, 25, 230, "").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backList.png")
        self.btnB3 = Button(self.appWindow.app, bFunc_B3, 600, 20, 25, 270, "").setAlign("center")\
            .hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backList.png")

        self.appWindow.setVisible(0)

    def open(self, msg):

        self.listPorts = []
        for sPort, desc, hwid in sorted(serial.tools.list_ports.comports()):
            self.listPorts.append([sPort, desc, hwid])

        if len(self.listPorts) < 4:
            for x in range(len(self.listPorts), 4):
                self.listPorts.append(["-", "--", "--"])

        self.maxShift = len(self.listPorts) - 4
        self.lblMsg.setText(msg + ". Select a Port from the List:")
        self.scrollLogic()
        self.appWindow.setVisible(1)

    def scrollLogic(self):

        if self.shift == 0:
            self.btnUP = self.btnUP.setBackgroundTexture("apps/python/acSLI/image/btnUP1.png")
        else:
            self.btnUP = self.btnUP.setBackgroundTexture("apps/python/acSLI/image/btnUP0.png")

        if self.shift == self.maxShift:
            self.btnDN = self.btnDN.setBackgroundTexture("apps/python/acSLI/image/btnDN1.png")
        else:
            self.btnDN = self.btnDN.setBackgroundTexture("apps/python/acSLI/image/btnDN0.png")

        self.btnB0 = self.btnB0.setText("%s [%s]" % (self.listPorts[(0 + self.shift)][1], self.listPorts[(0 + self.shift)][2]))
        self.btnB1 = self.btnB1.setText("%s [%s]" % (self.listPorts[(1 + self.shift)][1], self.listPorts[(1 + self.shift)][2]))
        self.btnB2 = self.btnB2.setText("%s [%s]" % (self.listPorts[(2 + self.shift)][1], self.listPorts[(2 + self.shift)][2]))
        self.btnB3 = self.btnB3.setText("%s [%s]" % (self.listPorts[(3 + self.shift)][1], self.listPorts[(3 + self.shift)][2]))
示例#6
0
 def dispButton(self):
     global instance
     self.btnClose = Button(self.appWindow.app, bFunc_Close, 110, 20, 345, 70, "Okay")\
             .setAlign("center").hasCustomBackground().setBackgroundTexture("apps/python/acSLI/image/backBtnAuto.png")