示例#1
0
 def onClick_1216(self):
     if self.YesNoDialog(31995):
         if not self._isupdaterunnung():
             self.setPropertyControlDisable(1216)
             self.info("Starting system update process")
             self._lock()
             common.runBuiltinCommand("RunScript", "service.clue",
                                      "service.sysupdate,silent=off")
             common.setSkinProperty(10000, "SystemUpdate.Running", "true")
             while self._isupdaterunnung():
                 common.sleep()
             self._unlock()
             self.setPropertyControlEnable(1216)
         else:
             self.warn("System update process is already running")
示例#2
0
 def onClick_1215(self):
     if self.YesNoDialog(31994):
         if not self._isrecoveryrunnung():
             self.setPropertyControlDisable(1215)
             self.info("Starting system backup process")
             self._lock()
             common.runBuiltinCommand("RunScript", "service.clue",
                                      "service.recovery,mode=backup")
             common.setSkinProperty(10000, "SystemRecovery.Running", "true")
             while self._isrecoveryrunnung():
                 common.sleep()
             self._unlock()
             self.setPropertyControlEnable(1215)
         else:
             self.warn("System backup process is already running")
示例#3
0
	def run(self, *args):
		params = self.params(args)
		if "silent" in params:
			self.silent = self.any2bool(params['silent'])
		common.setSkinProperty(10000, "SystemUpdate.Running", "true")
		update = self.sys.check_updates()
		if update is not None:
			common.DlgNotificationMsg(32903, time=7500)
			common.sleep(10)
			update = self.sys.doanload_updates()
			if update:
				if not self.silent:
					common.AskRestart(32904)
				else:
					self.notice("Reboot system to apply downloaded release update")
					common.runBuiltinCommand("Reboot")
		common.setSkinProperty(10000, "SystemUpdate.Running")
示例#4
0
 def setProvider(self, config):
     """Runs configuration flow to setup or to change the provider"""
     if str(config) == "ProviderCode":
         options = self.getProviderNames()
         common.debug("Selecting new provider from the list: %s" %
                      str(options))
         index = common.SelectDialog(title=32201, options=options)
         if index >= 0:
             provider = self.getProviderByName(options[index])
             common.setsetting("Enabled", "true")
             if provider is not None:
                 provider.clear()
                 common.setsetting("ProviderCode", provider.code())
                 common.setsetting("ProviderCodeAction", provider.name())
                 common.setSkinProperty(12600, "SkinProviderCode",
                                        provider.code())
             else:
                 common.setsetting("ProviderCode")
                 common.setsetting("ProviderCodeAction")
                 common.setSkinProperty(12600, "SkinProviderCode")
             # reset dependent settings
             common.setsetting("APIKey")
             common.setsetting("APIKeyAction")
             for index in range(1, 6):
                 common.setsetting("Location%iAction" % index)
                 common.setsetting("Location%i" % index)
                 common.debug('Reset location %i' % index)
             # trigger provider validation
             try:
                 provider.validate()
                 common.debug("Provider validation is not required")
                 common.setsetting("ShowAPIKeyOption", "false")
                 common.setsetting("ShowLocationOption", "true")
                 common.setsetting("APIKey")
                 common.setsetting("APIKeyAction")
             except:
                 common.debug("Asking for provider validation")
                 common.setsetting("ShowAPIKeyOption", "true")
                 common.setsetting("ShowLocationOption", "false")
         else:
             common.debug("Provider configuration was cancelled")
     elif str(config) == "ProviderKey":
         common.debug("Setting new provider API key")
         inputval = common.StringInputDialog(32122,
                                             self.getDetectedAPIKey())
         if inputval is not None and inputval != '':
             common.setsetting("APIKey", inputval)
             common.setsetting("APIKeyAction", "".rjust(len(inputval), "*"))
             common.setSkinProperty(12600, "SkinProviderAPIKey", inputval)
             # trigger provider validation
             try:
                 provider = self.getDetectedProvider()
                 if provider is None:
                     raise RuntimeError(
                         "No content provider found for configuration to run the validation process"
                     )
                 provider.validate()
                 common.debug("Provider validation is completed")
                 common.setsetting("ShowLocationOption", "true")
             except RuntimeError as re:
                 common.debug(
                     "Provider validation returned an error for '%s' API key: %s"
                     % (inputval, str(re)))
                 common.setsetting("ShowLocationOption", "false")
                 common.DlgNotificationMsg(32121)
         else:
             common.debug("Provider API key configuration was cancelled")
     else:
         common.debug("Unknown provider configuration option: %s" % config)
示例#5
0
 def run(self, index):
     """ Runs package for content discovery and processing"""
     # check if forecast workflow is enabled
     if not common.setting('Enabled'):
         return
     # check provider configuration
     provider = self.getProviderByCode(common.setting('ProviderCode'))
     common.debug("Found provider to run forecast workflow: %s" % provider)
     if provider is None:
         common.NotificationMsg(32202, 15000)
         return
     if provider is not None and (
         (common.setting('APIKey') == ''
          or common.setting('APIKey') is None)
             and common.any2bool(common.setting("ShowAPIKeyOption"))):
         common.NotificationMsg(32123, 15000)
         return
     # validate provider configuration
     if common.any2bool(common.setting("ShowAPIKeyOption")):
         try:
             provider.validate()
             common.debug(
                 "Content provider is valid, running weather forecast workflow"
             )
         except BaseException as err:
             common.debug(
                 "Content provider is invalid, reset forecast skin properties: %s"
                 % str(err))
             common.NotificationMsg(32203, 20000)
             provider.clear()
             return
     # normalize locations
     count = 0
     found = False
     for id in range(1, 6):
         locname = common.setting('Location%iAction' % id)
         locid = common.setting('Location%i' % id)
         if not found and (locname != '' and locid != ''):
             count += 1
         elif not found and (locname == '' or locid == ''):
             found = True
         if found:
             common.setSkinProperty(12600, 'Location%i' % id)
             common.setsetting('Location%iAction' % id)
             common.setsetting('Location%i' % id)
         else:
             common.setSkinProperty(12600, 'Location%i' % id, locname)
     common.setSkinProperty(12600, 'Locations', str(count))
     common.debug("Active locations: %s" % str(count))
     # identify the right location
     if index is None:
         common.debug(
             'Run GeoIP location discovery due to missing configuration')
         locname, locid = provider.geoip()
     else:
         common.debug("Using location index: %s" % str(index))
         locname = common.setting('Location%sAction' % str(index))
         locid = common.setting('Location%s' % str(index))
     if locid == '' and common.any2int(index) > 1:
         common.debug(
             'Trying first location instead, due to invalid index defined in previous configuration'
         )
         locname = common.setting('Location1Action')
         locid = common.setting('Location1')
     if locid == '':
         common.debug(
             'Run GeoIP location discovery due to wrong configuration')
         locname, locid = provider.geoip()
     # run forecast workflow
     if locname != '':
         # reset skin properties when the location is changed
         if locid != provider.skininfo("Current.Location"):
             provider.clear()
         # publish provider details
         provider.skinproperty('WeatherProvider', provider.name())
         if os.path.isfile(
                 common.path('resources', 'media',
                             provider.code() + '.png')):
             provider.skinproperty(
                 'WeatherProviderLogo',
                 common.path('resources', 'media',
                             provider.code() + '.png'))
         else:
             provider.skinproperty('WeatherProviderLogo',
                                   common.path('icon.png'))
         # call provider forecast
         common.debug('Call forecast for location %s (%s)' %
                      (locname, locid))
         provider.forecast(locname, locid)
     else:
         common.warn('No location found or configured')
         provider.clear()