Ejemplo n.º 1
0
    def installHivemind(self,isFresh):
        message = ''
        if(isFresh):
            ret = dialog_yesno(localize(33000),localize(33001))
            log("Dialog YesNo -> {0}".format(ret))
            if(ret):
                waitDialog = WaitDialogHelper().create()
                try:
                    scriptPath = os.path.join(__addonpath__,'resources','lib','launchsetup.vbs')
                    log(('HiveMind setup launcher path = %s') % scriptPath)
                    si = subprocess.STARTUPINFO()
                    si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                    exitCode = subprocess.call(["cscript.exe", scriptPath, self.setupPath], startupinfo=si)
                    log('HiveMind setup exit code = ' + str(tohex(exitCode, 32)))

                    if (exitCode == 0):
                        if(dialog_yesno(localize(33005),localize(33006))):
                            xbmc.executebuiltin('Skin.SetBool(IsCoreComponentInstalled)')

                            si = subprocess.STARTUPINFO()
                            si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                            subprocess.call(["shutdown.exe", "/r", "/t", "0" ,"/f"], startupinfo=si)
                    else:
                        dialog_ok(localize(33003),localize(33004) + str(tohex(exitCode, 32)))
                except:
                    pass
                waitDialog.close()
        else:
            waitDialog = WaitDialogHelper().create()
            #try:
            import AlphaUIUtils
            setupPath = os.path.join(__addonpath__,'resources','lib')
            log(('HiveMind setup path = %s') % setupPath)

            retValue = AlphaUIUtils.LaunchHivemindSetup(setupPath)
            log('HiveMind setup return code = ' + str(retValue))

            if (retValue):
                if(dialog_yesno(localize(33005),localize(33006))):
                    si = subprocess.STARTUPINFO()
                    si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                    subprocess.call(["shutdown.exe", "/r", "/t", "0" ,"/f"], startupinfo=si)
            else:
                dialog_ok(localize(33003))
            #except:
                # dialog_ok(localize(33003))
            waitDialog.close()        
Ejemplo n.º 2
0
    def authenticateOrRemoveDevice(self, address):
        selectedDevice = self.findDeviceFromAddress(address)

        if (selectedDevice == None):
            xbmcgui.Dialog().notification(self.language(33018),
                                          self.language(33047),
                                          xbmcgui.NOTIFICATION_ERROR, 15000)
        else:
            self.lock.acquire()
            try:
                if (selectedDevice.Authenticated):
                    if (xbmcgui.Dialog().yesno(
                            self.language(33051),
                            self.language(33052).format(
                                selectedDevice.Name)) == 1):
                        if (selectedDevice.RemoveDevice()):
                            xbmcgui.Dialog().notification(
                                self.language(33020),
                                self.language(33054).format(
                                    selectedDevice.Name),
                                xbmcgui.NOTIFICATION_INFO, 15000)
                            self.bluetoothDevices = []
                        else:
                            xbmcgui.Dialog().notification(
                                self.language(33018),
                                self.language(33053).format(
                                    selectedDevice.Name),
                                xbmcgui.NOTIFICATION_ERROR, 15000)
                else:
                    self.waitDialog = WaitDialogHelper().create()
                    if (selectedDevice.Authenticate(self.callbackStatus,
                                                    self.callbackYesNo,
                                                    self.callbackUnknown)):
                        xbmcgui.Dialog().notification(
                            self.language(33020), self.language(33048),
                            xbmcgui.NOTIFICATION_INFO, 15000)
                        self.bluetoothDevices = []
                    else:
                        xbmcgui.Dialog().notification(
                            self.language(33018), self.language(33047),
                            xbmcgui.NOTIFICATION_ERROR, 15000)
                    self.waitDialog.close()
            finally:
                self.lock.release()