Exemplo n.º 1
0
    def update(self):

        # use skeleton below for exceptions
        errorSkeleton = {
            'title': self.uiTitle + ' (Update)',
            'menu': { '*': self.popSubstep },
            # add 'body'
        }

        # check for numeric input
        try:
            selected = int(self.userinput)-1    # revert to 0-indexed
        except ValueError:                      # non-integer input
            tz = None
        else:
            sortedTimezones = list(self.timezones.sortedIter())
            if 0 <= selected < len(sortedTimezones):
                tz = sortedTimezones[selected]
            else:
                tz = None

        if not tz:
            self.pushSubstep()
            errorSkeleton['body'] = helpText
            self.setSubstepEnv(errorSkeleton)
            return

        # register the choice
        userchoices.setTimezone(tz.zoneName, tz.offset, tz.city)
        tz.runtimeAction()
        log.debug('set tz to %s (%s)' % (tz.zoneName, tz.city))

        # choice acepted
        self.setSubstepEnv( {'next': self.askConfirm } )
Exemplo n.º 2
0
    def __init__(self):
        super(TimezoneWindow, self).__init__()
        self.substep = self.start
        self.timezones = TimezoneList()
        self.userinput = None
        self.uiTitle = 'Timezone'

        if not userchoices.getTimezone():  # not set in userchoices
            # copy default timezone values into userchoices
            dtz = self.timezones.defaultTimezone
            userchoices.setTimezone(dtz.zoneName, dtz.offset, dtz.city)
            dtz.runtimeAction()

        self.scrollable = None
Exemplo n.º 3
0
 def getNext(self):
     tz = self.selectedTZ
     userchoices.setTimezone(tz.zoneName, tz.offset, tz.city)
     tz.runtimeAction()
Exemplo n.º 4
0
 def getNext(self):
     tz = self.selectedTZ
     userchoices.setTimezone(tz.zoneName, tz.offset, tz.city)
     tz.runtimeAction()