예제 #1
0
    def TakeAction(self, item):
        dialog = xbmcgui.Dialog()
        selectednetwork = self.allnetworks[int(item.getProperty('index'))]
        isaction = False
        isConnected = selectednetwork.connected
        self.activeUuid = selectednetwork.uuid

        if not selectednetwork.connected:            
            try:
                if selectednetwork.securityenabled:
                    passwd = dialog.input(xbmc.getLocalizedString(31714).format(selectednetwork.ssid),type=xbmcgui.INPUT_ALPHANUM, option=xbmcgui.ALPHANUM_HIDE_INPUT)
                    if passwd != "":
                        selectednetwork.connect(passwd)
                        isaction = True
                else:
                    selectednetwork.connectNoPassword()
                    isaction = True
            except:
                dialog.notification(xbmc.getLocalizedString(31715), xbmc.getLocalizedString(31716), xbmcgui.NOTIFICATION_ERROR, 10000)

        else:
            try:
                ret = dialog.yesno(xbmc.getLocalizedString(31717), xbmc.getLocalizedString(31718).format(selectednetwork.ssid))
                if ret:
                    selectednetwork.disconnect()
                    isaction = True
            except:
                dialog.notification(xbmc.getLocalizedString(31715), xbmc.getLocalizedString(31719), xbmcgui.NOTIFICATION_ERROR, 10000)

        if isaction:
            confirmDialog = ConfirmDialog()
            if isConnected:
                dialogStr = xbmc.getLocalizedString(31729) + xbmc.getLocalizedString(31724)
            else:
                dialogStr = xbmc.getLocalizedString(31729) + xbmc.getLocalizedString(31728)

            ret = confirmDialog.doModalWithCallback(dialogStr,ConfirmDialogType.ok,20,self.RefreshWifiState)
            del confirmDialog
            wifis = AlphaUINetworkUtils.WiFis()

            for wifi in wifis:
                if wifi.UUID == self.activeUuid:
                    if isConnected:
                        if wifi.State != 4 and wifi.State != 1:
                            dialog.notification(xbmc.getLocalizedString(31715), xbmc.getLocalizedString(31719), xbmcgui.NOTIFICATION_ERROR, 5000)
                    else:
                        if wifi.State != 1:
                            dialog.notification(xbmc.getLocalizedString(31715), xbmc.getLocalizedString(31716), xbmcgui.NOTIFICATION_ERROR, 5000)
            self.FillList()
        pass
예제 #2
0
 def setMode(self,modeIndex,rateIndex):        
     try:
         selectedMode = self.modes[modeIndex]
         self.display.SetMode(selectedMode,rateIndex)
         confirmDialog = ConfirmDialog()
         ret = confirmDialog.doModal(xbmc.getLocalizedString(31617),ConfirmDialogType.yesNo,15)
         del confirmDialog
         if ret == 0:
             self.oldMode = selectedMode
             self.oldRefreshRateIndex = rateIndex
             return True
         else:
             #print "old mode {0} , old refreshrateindex {1}".format(self.oldMode.Name, self.oldRefreshRateIndex)
             self.display.SetMode(self.oldMode,self.oldRefreshRateIndex)
             return False
     except:
         print "displayhelper.py::setMode:", sys.exc_info()[0]
예제 #3
0
 def setMode(self, modeIndex, rateIndex):
     try:
         selectedMode = self.modes[modeIndex]
         self.display.SetMode(selectedMode, rateIndex)
         confirmDialog = ConfirmDialog()
         ret = confirmDialog.doModal(xbmc.getLocalizedString(31617),
                                     ConfirmDialogType.yesNo, 15)
         del confirmDialog
         if ret == 0:
             self.oldMode = selectedMode
             self.oldRefreshRateIndex = rateIndex
             return True
         else:
             #print "old mode {0} , old refreshrateindex {1}".format(self.oldMode.Name, self.oldRefreshRateIndex)
             self.display.SetMode(self.oldMode, self.oldRefreshRateIndex)
             return False
     except:
         print "displayhelper.py::setMode:", sys.exc_info()[0]
예제 #4
0
파일: settings.py 프로젝트: kcm117/Kodi
    def setAudioOutput(self,selectedIndex):
        if self.IsInitDone:
            retVal = self.audioHelper.setOutput(selectedIndex)
            if retVal:
                confirmDialog = ConfirmDialog()
                ret = confirmDialog.doModal(xbmc.getLocalizedString(31640),ConfirmDialogType.cancelRestart,0)
                del confirmDialog

                if ret == 1:
                    AlphaUIUtils.RestartSystem();
            else:
                confirmDialog = ConfirmDialog()
                ret = confirmDialog.doModal(xbmc.getLocalizedString(31641),ConfirmDialogType.ok,0)
                del confirmDialog
            print self.audioHelper.getSelectedOutput()
            self.audioOutputSpinControl.selectText(self.audioHelper.getSelectedOutput())
            self.setAudioOutputApplyButtonState()
            if self.audioOutputSpinControl.rightArrowEnabled or self.audioOutputSpinControl.leftArrowEnabled:
                self.audioOutputSpinControl.setFocus(True);
예제 #5
0
    def setAudioOutput(self, selectedIndex):
        if self.IsInitDone:
            retVal = self.audioHelper.setOutput(selectedIndex)
            if retVal:
                confirmDialog = ConfirmDialog()
                ret = confirmDialog.doModal(xbmc.getLocalizedString(31640),
                                            ConfirmDialogType.cancelRestart, 0)
                del confirmDialog

                if ret == 1:
                    AlphaUIUtils.RestartSystem()
            else:
                confirmDialog = ConfirmDialog()
                ret = confirmDialog.doModal(xbmc.getLocalizedString(31641),
                                            ConfirmDialogType.ok, 0)
                del confirmDialog
            print self.audioHelper.getSelectedOutput()
            self.audioOutputSpinControl.selectText(
                self.audioHelper.getSelectedOutput())
            self.setAudioOutputApplyButtonState()
            if self.audioOutputSpinControl.rightArrowEnabled or self.audioOutputSpinControl.leftArrowEnabled:
                self.audioOutputSpinControl.setFocus(True)
예제 #6
0
    def TakeAction(self, item):
        dialog = xbmcgui.Dialog()
        selectednetwork = self.allnetworks[int(item.getProperty('index'))]
        isaction = False
        isConnected = selectednetwork.connected
        self.activeUuid = selectednetwork.uuid

        if not selectednetwork.connected:
            try:
                if selectednetwork.securityenabled:
                    passwd = dialog.input(
                        xbmc.getLocalizedString(31714).format(
                            selectednetwork.ssid),
                        type=xbmcgui.INPUT_ALPHANUM,
                        option=xbmcgui.ALPHANUM_HIDE_INPUT)
                    if passwd != "":
                        selectednetwork.connect(passwd)
                        isaction = True
                else:
                    selectednetwork.connectNoPassword()
                    isaction = True
            except:
                dialog.notification(xbmc.getLocalizedString(31715),
                                    xbmc.getLocalizedString(31716),
                                    xbmcgui.NOTIFICATION_ERROR, 10000)

        else:
            try:
                ret = dialog.yesno(
                    xbmc.getLocalizedString(31717),
                    xbmc.getLocalizedString(31718).format(
                        selectednetwork.ssid))
                if ret:
                    selectednetwork.disconnect()
                    isaction = True
            except:
                dialog.notification(xbmc.getLocalizedString(31715),
                                    xbmc.getLocalizedString(31719),
                                    xbmcgui.NOTIFICATION_ERROR, 10000)

        if isaction:
            confirmDialog = ConfirmDialog()
            if isConnected:
                dialogStr = xbmc.getLocalizedString(
                    31729) + xbmc.getLocalizedString(31724)
            else:
                dialogStr = xbmc.getLocalizedString(
                    31729) + xbmc.getLocalizedString(31728)

            ret = confirmDialog.doModalWithCallback(dialogStr,
                                                    ConfirmDialogType.ok, 20,
                                                    self.RefreshWifiState)
            del confirmDialog
            wifis = AlphaUINetworkUtils.WiFis()

            for wifi in wifis:
                if wifi.UUID == self.activeUuid:
                    if isConnected:
                        if wifi.State != 4 and wifi.State != 1:
                            dialog.notification(xbmc.getLocalizedString(31715),
                                                xbmc.getLocalizedString(31719),
                                                xbmcgui.NOTIFICATION_ERROR,
                                                5000)
                    else:
                        if wifi.State != 1:
                            dialog.notification(xbmc.getLocalizedString(31715),
                                                xbmc.getLocalizedString(31716),
                                                xbmcgui.NOTIFICATION_ERROR,
                                                5000)
            self.FillList()
        pass