Ejemplo n.º 1
0
	def run(self, *args):
		params = dict(arg.split("=") for arg in sys.argv[2].split("&"))
		self.debug('Found parameters: %s' %str(params))
		self._dialog = params.get("dialog")
		self._dialog = 'string' if self._dialog is None or self._dialog == '' or (self._dialog.lower() != 'string' and self._dialog.lower() != 'number' and self._dialog.lower() != 'date' and self._dialog.lower() != 'time' and self._dialog.lower() != 'ipaddr' and self._dialog.lower() != 'select' and self._dialog.lower() != 'none') else self._dialog
		self.trace('Using dialog type: %s' % str(self._dialog))
		self._wid = params.get("window")
		self.trace('Using window id: %s' % str(self._wid))
		self._title = params.get("title")
		self.trace('Using window title: %s' % str(self._title))
		self._property = params.get("property")
		self.trace('Using window property: %s' % str(self._property))
		self._control = params.get("control")
		self.trace('Using window field: %s' % str(self._control))
		self._data = params.get("data")
		self.trace('Using data: %s' % str(self._data))
		self._default = params.get("default")
		self.trace('Using default input data: %s' % str(self._default))
		self._callback = params.get("callback")
		self.trace('Using callback data: %s' % str(self._callback))
		try:
			if self._wid is None:
				self._wid = xbmcgui.getCurrentWindowId() if self._wid is None else self._wid
				self._wid= xbmcgui.getCurrentWindowDialogId() if self._wid is None else self._wid
			self._window = xbmcgui.Window(self._wid)
			self.trace('Detected window id: %s' % str(self._wid))
		except BaseException as be:
			self.error("Error discovering window handler: %s" %str(be))
			self._window = None
		if self._window is not None and self._dialog != 'none':
			self._presetup()
			if self._dialog == 'string':
				self._data = common.StringInputDialog(title=self._title, default=self._default)
			elif self._dialog == 'number':
				self._data = common.NumberInputDialog(title=self._title, default=self._default)
			elif self._dialog == 'date':
				self._data = common.DateInputDialog(title=self._title, default=self._default)
			elif self._dialog == 'time':
				self._data = common.TimeInputDialog(title=self._title, default=self._default)
			elif self._dialog == 'ipaddr':
				self._data = common.IPAddrInputDialog(title=self._title, default=self._default)
			elif self._dialog == 'select':
				self._data = common.SelectDialog(title=self._title, default=self._default, options=self._data, output="value")
			else:
				self._data = None
			self._setup()
		else:
			if self._dialog != 'none':
				self.error("Window handler is unknown")
			else:
				self.debug("Process skipped due to rejected input dialog from XML window definition")
		# process callback process
		if self._callback is not None:
			common.runBuiltinCommand(self._callback, wait=True)
Ejemplo n.º 2
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")
Ejemplo n.º 3
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")
Ejemplo n.º 4
0
 def run(self, *args):
     params = self.params(args)
     if "mode" in params:
         self.mode = params['mode'] if params['mode'] in [
             "backup", "restore"
         ] else "backup"
     if not self._isrunnung():
         self.info("Starting system recovery process in %s mode" %
                   self.mode)
         common.runBuiltinCommand("RunScript", "program.recovery",
                                  "mode=%s" % self.mode)
         while self._isrunnung():
             common.sleep()
         self.info("Ending system recovery process")
     else:
         self.warn("Recovery process is already running")
Ejemplo n.º 5
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")
Ejemplo n.º 6
0
 def _setup(self):
     if self._data is not None and self._property is not None:
         self.trace('Setting [%s] window property with value: %s' %
                    (self._property, str(self._data)))
         #self._window.setProperty(self._property, str(self._data ))
         # nasty workaround for Kodi bug
         common.runBuiltinCommand("SetProperty",
                                  param=self._property,
                                  values=str(self._data),
                                  wait=True)
     elif self._data == '' and self._property is not None:
         self.debug('Making [%s] window property empty' % self._property)
         #self._window.setProperty(self._property, "")
         # nasty workaround for Kodi bug
         common.runBuiltinCommand("SetProperty",
                                  param=self._property,
                                  values="",
                                  wait=True)
Ejemplo n.º 7
0
 def cancelreboot(self):
     common.runBuiltinCommand(
         "SetPrClearPropertyoperty(System.Reboot,10000)")
Ejemplo n.º 8
0
 def mark4reboot(self):
     common.runBuiltinCommand("SetProperty(System.Reboot,on,10000)")
Ejemplo n.º 9
0
 def show(self):
     common.runBuiltinCommand("Dialog.Close(busydialog)")
     self.doModal()
Ejemplo n.º 10
0
if hasattr(sys.modules["__main__"], "xbmc"):
    xbmc = sys.modules["__main__"].xbmc
else:
    import xbmc

if __name__ == "__main__":
    searchstring = None

    if len(sys.argv) > 1:
        params = dict(arg.split("=") for arg in sys.argv[1].split("&"))
        if searchstring is not None and searchstring != '':
            searchstring = params.get("searchstring")
            searchstring = common.urlunquote(searchstring)

    if searchstring is None or searchstring == '':
        # close busydialog - if is open and running
        common.runBuiltinCommand("Dialog.Close(busydialog)")
        # get search string from input
        keyboard = xbmc.Keyboard('', common.translate(32101), False)
        keyboard.doModal()
        if keyboard.isConfirmed():
            searchstring = keyboard.getText()

    if searchstring is not None and searchstring != '':
        search = GlobalSearch("GlobalSearch.xml",
                              common.AddonPath(),
                              searchstring=searchstring)
        search.show()
        del search