コード例 #1
0
    def putFile(self,
                absRemoteFile,
                absLocalFile,
                remoteFileExists,
                force=False):
        if not force and remoteFileExists:
            fileName = absRemoteFile.split('/')[-1]
            AddNotificationWithCallback(
                lambda ret: self.putFileCallback(
                    ret, absRemoteFile, absLocalFile, remoteFileExists),
                MessageBox,
                _("A file with this name (%s) already exists on the remote host.\nDo you want to overwrite it?"
                  ) % (fileName),
            )
        else:
            self.currentLength = 0
            self.lastLength = 0
            self.lastTime = 0
            self.lastApprox = 0

            def sendfile(consumer, fileObj):
                FileSender().beginFileTransfer(
                    fileObj, consumer, transform=self.putProgress).addCallback(
                        lambda _: consumer.finish()).addCallback(
                            self.putComplete).addErrback(self.putFailed)

            try:
                self.fileSize = int(os_path.getsize(absLocalFile))
                self.file = open(absLocalFile, 'rb')
            except (IOError, OSError) as e:
                # TODO: handle this
                raise e
            else:
                dC, dL = self.ftpclient.storeFile(absRemoteFile)
                dC.addCallback(sendfile, self.file)
コード例 #2
0
def timeCallback(isCallback=True):
	"""Time Callback/Autostart management."""
	thInstance = eDVBLocalTimeHandler.getInstance()
	if isCallback:
		# NOTE: this assumes the clock is actually ready when called back
		# this may not be true, but we prefer silently dying to waiting forever
		thInstance.m_timeUpdated.get().remove(timeCallback)
	elif not thInstance.ready():
		thInstance.m_timeUpdated.get().append(timeCallback)
		return

	if config.plugins.epgrefresh.wakeup.value:
		now = localtime()
		begin = int(mktime(
			(now.tm_year, now.tm_mon, now.tm_mday,
			config.plugins.epgrefresh.begin.value[0],
			config.plugins.epgrefresh.begin.value[1],
			0, now.tm_wday, now.tm_yday, now.tm_isdst)
		))
		# booted +- 6min from begin of timespan
		cur_day = int(now.tm_wday)
		if abs(time() - begin) < 360 and config.plugins.epgrefresh_extra.day_refresh[cur_day].value:
			from Tools.Notifications import AddNotificationWithCallback
			from Tools.BoundFunction import boundFunction
			# XXX: we use a notification because this will be suppressed otherwise
			AddNotificationWithCallback(
				boundFunction(standbyQuestionCallback, epgrefresh.session),
				MessageBox,
				_("This might have been an automated bootup to refresh the EPG. For this to happen it is recommended to put the receiver to Standby.\nDo you want to do this now?"),
				timeout = 30
			)
	epgrefresh.start()
コード例 #3
0
def autostart(reason, **kwargs):
	if reason == 0 and kwargs.has_key("session"):
		session = kwargs["session"]
		epgrefresh.session = session

		if config.plugins.epgrefresh.enabled.value:
			if config.plugins.epgrefresh.wakeup.value:
				now = localtime()
				begin = int(mktime(
					(now.tm_year, now.tm_mon, now.tm_mday,
					config.plugins.epgrefresh.begin.value[0],
					config.plugins.epgrefresh.begin.value[1],
					0, now.tm_wday, now.tm_yday, now.tm_isdst)
				))
				# booted +- 10min from begin of timespan
				if abs(time() - begin) < 600:
					from Screens.MessageBox import MessageBox
					from Tools.Notifications import AddNotificationWithCallback
					from Tools.BoundFunction import boundFunction
					# XXX: we use a notification because this will be suppressed otherwise
					AddNotificationWithCallback(
						boundFunction(standbyQuestionCallback, session),
						MessageBox,
						_("This might have been an automated bootup to refresh the EPG. For this to happen it is recommended to put the receiver to Standby.\nDo you want to do this now?"),
						timeout = 15
					)

			epgrefresh.start(session)

	elif reason == 1:
		epgrefresh.stop()
コード例 #4
0
    def getFile(self, absRemoteFile, absLocalFile, fileSize, force=False):
        if not force and os_path.exists(absLocalFile):
            fileName = absRemoteFile.split('/')[-1]
            AddNotificationWithCallback(
                lambda ret: self.getFileCallback(ret, absRemoteFile,
                                                 absLocalFile, fileSize),
                MessageBox,
                _("A file with this name (%s) already exists locally.\nDo you want to overwrite it?"
                  ) % (fileName),
            )
        else:
            self.currentLength = 0
            self.lastLength = 0
            self.lastTime = 0
            self.lastApprox = 0
            self.fileSize = fileSize

            try:
                self.file = open(absLocalFile, 'w')
            except IOError as ie:
                # TODO: handle this
                raise ie
            else:
                d = self.ftpclient.retrieveFile(absRemoteFile, self, offset=0)
                d.addCallback(self.getFinished).addErrback(self.getFailed)
コード例 #5
0
ファイル: plugin.py プロジェクト: vuteam/dvbapp2-gui
    def opkg_upgrade_finished(self, result, retval, extra_args=None):
        is_update = False
        if len(result):
            check_result = result.split('\n', 10)
            if len(check_result):
                for line in check_result:
                    line = line.split(' - ')
                    if len(line) >= 3:
                        is_update = True
                        break

        if is_update:
            self.upgradable_packages = result
            config.usage.update_available.value = True
            if config.usage.show_notification_for_updates.value:
                message = _(
                    'There are updates available.\nDo you want to open Software Update menu ?'
                )
                AddNotificationWithCallback(boundFunction(
                    self.show_NewsCenter),
                                            MessageBox,
                                            message,
                                            timeout=0)
            else:
                self.show_NewsCenter(res=None)
        else:
            config.usage.update_available.value = False
            if config.usage.check_for_updates.value > 0:
                intervall = config.usage.check_for_updates.value * 1000 * 3600
                self.update_timer.start(intervall, True)
コード例 #6
0
 def _onUpdateAvailable(self):
     text = self._fpUpdateText()
     AddNotificationWithCallback(self._onUpdateAnswer,
                                 MessageBox,
                                 text,
                                 type=MessageBox.TYPE_YESNO,
                                 windowTitle=_("New Firmware"))
コード例 #7
0
 def showFWUpdateNoti(self):
     _title = _("New firmware detected for VUPLUS-BLE-RCU.\n\n")
     _title += _(
         "While the update is progress, RCU can not be used and other bluetooth device must be disconnected.\n\n"
     )
     _title += _("Current FW version : %d\nNew FW version : %d") % (
         self.rcuAppVersion, self.firmwareFileVersion)
     choiceList = ((_("Upgrade now"), "update"),
                   (_("Remind Me later"), "no"), (_("Skip this version"),
                                                  "skip"))
     AddNotificationWithCallback(self.showFWUpdateAnswer, ChoiceBox, _title,
                                 choiceList)
コード例 #8
0
	def _onDeviceListChanged(self):
		if config.misc.firstrun.value: #Wizard will run!
			return
		if not config.inputDevices.settings.firstDevice.value:
			return
		devices = self._dm.getAvailableDevices();
		if devices:
			config.inputDevices.settings.firstDevice.value = False
			config.inputDevices.settings.save()

			for device in devices:
				if device.ready():
					return
			AddNotificationWithCallback(self._onDiscoveryAnswered, MessageBox, _("A new bluetooth remote has been discovered. Connect now?"), type=MessageBox.TYPE_YESNO, windowTitle=_("New Bluetooth Remote"))
コード例 #9
0
	def _onUpdateAvailable(self):
		AddNotificationWithCallback(self._onUpdateAnswer, MessageBox, _("There is a new firmware for your frontprocessor available. Update now?"), type=MessageBox.TYPE_YESNO, windowTitle=_("New Firmware"))