Esempio n. 1
0
	def __init__(self, session, args = None):
		Screen.__init__(self, session)
		
		self.sliderPackages = { "Settop Box-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
		
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Upgrading Settop Box... Please wait"))
		self["status"] = self.status
		self.package = StaticText()
		self["package"] = self.package
		
		self.packages = 0
		self.error = 0
		
		self.activity = 0
		self.activityTimer = eTimer()
		self.activityTimer.callback.append(self.doActivityTimer)

		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)

		self.firsttime = True
		self.onShown.append(self.confirmUpdate)
Esempio n. 2
0
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Software Update"))

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }

		self.setTitle(_("Software update"))
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self.channellist_only = 0
		self.channellist_name = ''
		self.SettingsBackupDone = False
		self.ImageBackupDone = False
		self.autobackuprunning = False

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None
		if self.isProtected() and config.ParentalControl.servicepin[0].value:
			self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList=[x.value for x in config.ParentalControl.servicepin], triesEntry=config.ParentalControl.retries.servicepin, title=_("Please enter the correct pin code"), windowTitle=_("Enter pin code")))
		else:
                        self.checkNetworkState()
Esempio n. 3
0
 def __init__(self, session, *args):
     Screen.__init__(self, session)
     ProtectedScreen.__init__(self)
     Screen.setTitle(self, _('Software Update'))
     self.sliderPackages = {'ini-dvb-modules': 1,
      'enigma2': 2,
      'tuxbox-image-info': 3}
     self.slider = Slider(0, 4)
     self['slider'] = self.slider
     self.activityslider = Slider(0, 100)
     self['activityslider'] = self.activityslider
     self.status = StaticText(_('Please wait...'))
     self['status'] = self.status
     self.package = StaticText(_('Package list update'))
     self['package'] = self.package
     self.oktext = _('Press OK on your remote control to continue.')
     self['tl_off'] = Pixmap()
     self['tl_red'] = Pixmap()
     self['tl_yellow'] = Pixmap()
     self['tl_green'] = Pixmap()
     self['feedStatusMSG'] = Label()
     self.channellist_only = 0
     self.channellist_name = ''
     self.SettingsBackupDone = False
     self.ImageBackupDone = False
     self.autobackuprunning = False
     self.packages = 0
     self.error = 0
     self.processed_packages = []
     self.total_packages = None
     self.onFirstExecBegin.append(self.checkNetworkState)
Esempio n. 4
0
 def __init__(self, session, *args):
     Screen.__init__(self, session)
     self.sliderPackages = {'dreambox-dvb-modules': 1,
      'enigma2': 2,
      'tuxbox-image-info': 3}
     self.setTitle(_('Software update'))
     self.slider = Slider(0, 4)
     self['slider'] = self.slider
     self.activityslider = Slider(0, 100)
     self['activityslider'] = self.activityslider
     self.status = StaticText(_('Please wait...'))
     self['status'] = self.status
     self.package = StaticText(_('Package list update'))
     self['package'] = self.package
     self.oktext = _('Press OK on your remote control to continue.')
     self.packages = 0
     self.error = 0
     self.processed_packages = []
     self.total_packages = None
     self.channellist_only = 0
     self.channellist_name = ''
     self.updating = False
     self.ipkg = IpkgComponent()
     self.ipkg.addCallback(self.ipkgCallback)
     self.onClose.append(self.__close)
     self['actions'] = ActionMap(['WizardActions'], {'ok': self.exit,
      'back': self.exit}, -1)
     self.activity = 0
     self.activityTimer = eTimer()
     self.activityTimer.callback.append(self.checkTraficLight)
     self.activityTimer.callback.append(self.doActivityTimer)
     self.activityTimer.start(100, True)
Esempio n. 5
0
 def __init__(self, session, args = None):
     Screen.__init__(self, session)
     self.sliderPackages = {'ini-dvb-modules': 1,
      'enigma2': 2,
      'egami-version-info': 3}
     self.slider = Slider(0, 4)
     self['slider'] = self.slider
     self.activityslider = Slider(0, 100)
     self['activityslider'] = self.activityslider
     self.status = StaticText(_('Please wait...'))
     self['status'] = self.status
     self.package = StaticText(_('Verifying your internet connection...'))
     self['package'] = self.package
     self.oktext = _('Press OK on your remote control to continue.')
     self.packages = 0
     self.error = 0
     self.processed_packages = []
     self.activity = 0
     self.activityTimer = eTimer()
     self.activityTimer.callback.append(self.doActivityTimer)
     self.ipkg = IpkgComponent()
     self.ipkg.addCallback(self.ipkgCallback)
     self.updating = False
     self['actions'] = ActionMap(['WizardActions'], {'ok': self.exit,
      'back': self.exit}, -1)
     iNetwork.checkNetworkState(self.checkNetworkCB)
     self.onClose.append(self.cleanup)
Esempio n. 6
0
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Software Update"))

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }

		self.setTitle(_("Software update"))
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self.channellist_only = 0
		self.channellist_name = ''
		self.SettingsBackupDone = False
		self.ImageBackupDone = False
		self.autobackuprunning = False

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None
		self.checkNetworkState()
Esempio n. 7
0
	def __init__(self, session):
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		
		self.cfglist = []
		ConfigListScreen.__init__(self, self.cfglist, session, on_change = self._changed)
		
		self._session = session
		self._hasChanged = False
		self.version = getVersion()
		self.controller = None
		self.selected = None
		self.sampleUse = False
		self.aspect = getAspect()
		self.old_service = self.session.nav.getCurrentlyPlayingServiceReference()	
			
		self["txt_green"] = Label()
		self["btn_green"] = Pixmap()

		self["statusbar"] = Pixmap()
		self["txt_arrows"] = Label()
		self["txt_statusbar"] = Label()
		self["txt_statusbar_info"] = Label()

		self["version"] = StaticText()

		self["txt_green"].setText(_("Save"))
		self["txt_arrows"].setText(_("Use < > to jump with 10 in slider"))
		self["version"].text = self.version
		
		# Disable OSD Transparency
		try:
			self.can_osd_alpha = open("/proc/stb/video/alpha", "r") and True or False
		except:
			self.can_osd_alpha = False
		
		if config.plugins.enigmalight.sampleBackground.getValue() == True:
			self.showBackground()

		self["setupActions"] = ActionMap(["SetupActions", "ColorActions", "EL_Settings"],
		{
			"green": self.keySave,
			"cancel": self.exitTuning,
			"ok": self.ok,
			"left": self.keyLeft,
			"right": self.keyRight,
			"bouquet_up":	self.keyBouquetUp,
			"bouquet_down":	self.keyBouquetDown,
			"jumpNextMark":	self.keyNext,
			"jumpPreviousMark": self.keyPrev,
		}, -2)

		self.createSetup()
		
		log("",self,"Finisch layout..")

		#self["config"].onSelectionChanged.append(self.updateHelp)
		self.onLayoutFinish.append(self.finishLayout)
Esempio n. 8
0
	def __init__(self, session, emutype):
		Screen.__init__(self, session)
		self.session = session
		self.skin = SKIN_DWN
		self.emutype = emutype
		self.setTitle(_("Please wait"))
		self["status"] = StaticText()
		self.iConsole = iConsole()
		self["status"].text = _("Restarting...")
		self.iConsole.ePopen("/etc/init.d/%s restart" % self.emutype, self.sleep_time)
Esempio n. 9
0
	def __init__(self, session, emutype):
		Screen.__init__(self, session)
		self.session = session
		self.skin = SKIN_DWN
		self.emutype = emutype
		self.setTitle(_("Please wait"))
		self["status"] = StaticText()
		self.iConsole = iConsole()
		self["status"].text = _("Stoping...")
		self.iConsole.ePopen("/etc/init.d/%s stop" % self.emutype, self.emuRemoveScriptStop)
Esempio n. 10
0
	def __init__(self, session):
		log("",self,"Moodlamp Opened succesfull..")
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		
		self.cfglist = []
		ConfigListScreen.__init__(self, self.cfglist, session, on_change = self._changed)
		
		self._session = session
		self._hasChanged = False
		
		self.selected = None
		self.controller = None

		self["txt_green"] = Label()
		self["txt_yellow"] = Label()

		self["canvas_text"] = StaticText()
		
		self["help"] = StaticText()

		self["btn_green"] = Pixmap()
		self["btn_yellow"] = Pixmap()

		self["statusbar"] = Pixmap()
		self["txt_statusbar"] = Label()
		self["txt_statusbar_info"] = Label()

		self["Canvas"] = CanvasSource()
		
		self["setupActions"] = ActionMap(["SetupActions", "ColorActions", "EL_Settings"],
		{
			"green": self.keySave,
			"red": self.keyCancel,
			"cancel": self.keyCancel,
			"ok": self.ok,
			"left": self.keyLeft,
			"right": self.keyRight,
			"bouquet_up":	self.keyBouquetUp,
			"bouquet_down":	self.keyBouquetDown,
			"jumpNextMark":	self.keyNext,
			"jumpPreviousMark": self.keyPrev,
		}, -2)

		self["txt_green"].setText(_("Save"))

		self["canvas_text"].text = _("Static color:")
		self.createList()

		log("",self,"Finisch layout..")
		
		self["config"].onSelectionChanged.append(self.updateHelp)
		self.onLayoutFinish.append(self.finishLayout)
Esempio n. 11
0
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		ProtectedScreen.__init__(self)
		Screen.setTitle(self, _("Software Update"))

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)
		self['actions'].csel = self
		self["actions"].setEnabled(False)

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self['tl_off'] = Pixmap()
		self['tl_red'] = Pixmap()
		self['tl_yellow'] = Pixmap()
		self['tl_green'] = Pixmap()
		self['feedStatusMSG'] = Label()

		self.channellist_only = 0
		self.channellist_name = ''
		self.SettingsBackupDone = False
		self.ImageBackupDone = False
		self.autobackuprunning = False
		self.updating = False

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None
		self.onFirstExecBegin.append(self.checkNetworkState)
Esempio n. 12
0
    def __init__(self, session, *args):
        Screen.__init__(self, session)
        Screen.setTitle(self, _("Software Update"))

        self.sliderPackages = {"dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3}

        self.setTitle(_("Software update"))

        self.slider = Slider(0, 4)
        self["slider"] = self.slider
        self.activityslider = Slider(0, 100)
        self["activityslider"] = self.activityslider
        self.status = StaticText(_("Please wait..."))
        self["status"] = self.status
        self.package = StaticText(_("Package list update"))
        self["package"] = self.package
        self.oktext = _("Press OK on your remote control to continue.")

        status_msgs = {
            "stable": _("Feeds status:   Stable"),
            "unstable": _("Feeds status:   Unstable"),
            "updating": _("Feeds status:   Updating"),
            "unknown": _("No connection"),
        }
        self["tl_off"] = Pixmap()
        self["tl_red"] = Pixmap()
        self["tl_yellow"] = Pixmap()
        self["tl_green"] = Pixmap()
        self.feedsStatus()
        self["feedStatusMSG"] = Label(status_msgs[self.trafficLight])

        self.channellist_only = 0
        self.channellist_name = ""
        self.SettingsBackupDone = False
        self.ImageBackupDone = False
        self.autobackuprunning = False

        self.packages = 0
        self.error = 0
        self.processed_packages = []
        self.total_packages = None
        self.checkNetworkState()
Esempio n. 13
0
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		ProtectedScreen.__init__(self)

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }

		self.setTitle(_("Software update"))
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None

		self.channellist_only = 0
		self.channellist_name = ''
		self.updating = False
		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)
		self.onClose.append(self.__close)
		self.Console = Console()

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)

		self.activity = 0
		self.activityTimer = eTimer()
		self.activityTimer.callback.append(self.checkTraficLight1)
		self.activityTimer.callback.append(self.doActivityTimer)
		self.activityTimer.start(20, True)
Esempio n. 14
0
 def __init__(self, session):
     Screen.__init__(self, session)
     self.list = []
     self.list.append(getConfigListEntry(_('Timeout Harddisk in min:'), config.usage.hdd_standby))
     self.list.append(getConfigListEntry(_('Acoustics Harddisk:'), config.usage.hdd_acoustics))
     self.list.append(getConfigListEntry(_('Enable/Disable UDMA'), config.usage.hdd_udma))
     ConfigListScreen.__init__(self, self.list)
     self['oktext'] = Label(_('OK'))
     self['canceltext'] = Label(_('Exit'))
     self['conn'] = StaticText(_('Status: HDD is active'))
     l = os.popen('hdparm -C /dev/sda', 'r').readlines()
     if l[2].find('standby') != -1:
         self['conn'].text = _('Status: HDD is in Standby')
     
     self['actions'] = ActionMap([
         'WizardActions',
         'ColorActions'], {
         'red': self.close,
         'back': self.close,
         'green': self.saveSetting })
     self.onShown.append(self.setWindowTitle)
Esempio n. 15
0
	def __init__(self, session, args = None):
		Screen.__init__(self, session)

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }

		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Verifying your internet connection..."))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.modified_packages = []

		self.activity = 0
		self.activityTimer = eTimer()
		self.activityTimer_conn = self.activityTimer.timeout.connect(self.doActivityTimer)

		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)

		self.updating = False
		self.rebootRequired = False
		self.device_name = iSoftwareTools.hardware_info.device_name

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)

		self.checkNetwork()
		self.onClose.append(self.cleanup)
Esempio n. 16
0
 def __init__(self, session, *args):
     Screen.__init__(self, session)
     Screen.setTitle(self, _('Software Update'))
     self.sliderPackages = {'dreambox-dvb-modules': 1,
      'enigma2': 2,
      'tuxbox-image-info': 3}
     self.setTitle(_('Software update'))
     self.slider = Slider(0, 4)
     self['slider'] = self.slider
     self.activityslider = Slider(0, 100)
     self['activityslider'] = self.activityslider
     self.status = StaticText(_('Please wait...'))
     self['status'] = self.status
     self.package = StaticText(_('Package list update'))
     self['package'] = self.package
     self.oktext = _('Press OK on your remote control to continue.')
     status_msgs = {'stable': _('Feeds status:   Stable'),
      'unstable': _('Feeds status:   Unstable'),
      'updating': _('Feeds status:   Updating'),
      'unknown': _('No connection')}
     self['tl_off'] = Pixmap()
     self['tl_red'] = Pixmap()
     self['tl_yellow'] = Pixmap()
     self['tl_green'] = Pixmap()
     self.feedsStatus()
     self['feedStatusMSG'] = Label(status_msgs[self.trafficLight])
     self.channellist_only = 0
     self.channellist_name = ''
     self.SettingsBackupDone = False
     self.ImageBackupDone = False
     self.autobackuprunning = False
     self.packages = 0
     self.error = 0
     self.processed_packages = []
     self.total_packages = None
     self.checkNetworkState()
     return
Esempio n. 17
0
 def setText(txt):
     StaticText.setText(self["title"], txt)
     self["titellabel"].setText(txt)
Esempio n. 18
0
    def __init__(self, session, args=0):
        self.session = session
        Screen.__init__(self, session)
        if debug:
            print pluginPrintname, "Displays config screen"

        self.onChangedEntry = []

        self.list = [
            getConfigListEntry(_("Active Time Profile"),
                               config.plugins.elektro.profile,
                               _("The active Time Profile is (1 or 2).")),
            getConfigListEntry(
                _("Enable Elektro Power Save"), config.plugins.elektro.enable,
                _("Unless this is enabled, this plugin won't run automatically."
                  )),
            getConfigListEntry(
                _("Use both profiles alternately"),
                config.plugins.elektro.profileShift,
                _("Both profiles are used alternately. When shutting down the other profile is enabled. This allows two time cycles per day. Do not overlap the times."
                  )),
            getConfigListEntry(_("Standby on boot"),
                               config.plugins.elektro.standbyOnBoot,
                               _("Puts the box in standby mode after boot.")),
            getConfigListEntry(
                _("Standby on manual boot"),
                config.plugins.elektro.standbyOnManualBoot,
                _("Whether to put the box in standby when booted manually. On manual boot the box will not go to standby before the next deep standby interval starts, even if this option is set. This option is only active if 'Standby on boot' option is set, too."
                  )),
            getConfigListEntry(
                _("Standby on boot screen timeout"),
                config.plugins.elektro.standbyOnBootTimeout,
                _("Specify how long to show the standby query on boot screen. This value can be set to ensure the box does not shut down to deep standby again too fast when in standby mode."
                  )),
            getConfigListEntry(
                _("Force sleep (even when not in standby)"),
                config.plugins.elektro.force,
                _("Forces deep standby, even when not in standby mode. Scheduled recordings remain unaffected."
                  )),
            getConfigListEntry(
                _("Avoid deep standby when HDD is active, e.g. for FTP"),
                config.plugins.elektro.hddsleep,
                _("Wait for the HDD to enter sleep mode. Depending on the configuration this can prevent the box entirely from entering deep standby mode."
                  )),
            getConfigListEntry(
                _("Check IPs (press OK to edit)"),
                config.plugins.elektro.IPenable,
                _("This list of IP addresses is checked. Elektro waits until addresses no longer responds to ping."
                  )),
            getConfigListEntry(
                _("NAS Poweroff (press OK to edit)"),
                config.plugins.elektro.NASenable,
                _("A NAS/Server can be shut down. Is required activated Telnet."
                  )),
            getConfigListEntry(
                _("Don't wake up"), config.plugins.elektro.dontwakeup,
                _("Do not wake up at the end of next deep standby interval.")),
            getConfigListEntry(
                _("Holiday mode (experimental)"),
                config.plugins.elektro.holiday,
                _("The box always enters deep standby mode, except for recording."
                  )),
            getConfigListEntry(
                _("Show in"), config.plugins.elektro.menu,
                _("Specify whether plugin shall show up in plugin menu or extensions menu (needs GUI restart)"
                  )),
            getConfigListEntry(
                _("Name"), config.plugins.elektro.name,
                _("Specify plugin name to be used in menu (needs GUI restart)."
                  )),
            getConfigListEntry(
                _("Description"), config.plugins.elektro.description,
                _("Specify plugin description to be used in menu (needs GUI restart)."
                  )),
        ]

        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=session,
                                  on_change=self.changed)

        def selectionChanged():
            if self["config"].current:
                self["config"].current[1].onDeselect(self.session)
            self["config"].current = self["config"].getCurrent()
            if self["config"].current:
                self["config"].current[1].onSelect(self.session)
            for x in self["config"].onSelectionChanged:
                x()

        self["config"].selectionChanged = selectionChanged
        self["config"].onSelectionChanged.append(self.configHelp)

        self["key_red"] = Button(_("Cancel"))
        self["key_green"] = Button(_("Ok"))
        self["key_yellow"] = Button(_("Help"))
        self["key_blue"] = Button(_("Times"))
        self["help"] = StaticText()

        self["setupActions"] = ActionMap(
            ["SetupActions", "ColorActions"], {
                "red": self.keyCancel,
                "green": self.keySave,
                "yellow": self.help,
                "blue": self.profile,
                "save": self.keySave,
                "cancel": self.keyCancel,
                "ok": self.keyOK,
            }, -2)

        # Trigger change
        self.changed()

        self.onLayoutFinish.append(self.setCustomTitle)
Esempio n. 19
0
class UpdatePlugin(Screen):
    def __init__(self, session, *args):
        Screen.__init__(self, session)
        Screen.setTitle(self, _("Software Update"))

        self.sliderPackages = {"dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3}

        self.setTitle(_("Software update"))

        self.slider = Slider(0, 4)
        self["slider"] = self.slider
        self.activityslider = Slider(0, 100)
        self["activityslider"] = self.activityslider
        self.status = StaticText(_("Please wait..."))
        self["status"] = self.status
        self.package = StaticText(_("Package list update"))
        self["package"] = self.package
        self.oktext = _("Press OK on your remote control to continue.")

        status_msgs = {
            "stable": _("Feeds status:   Stable"),
            "unstable": _("Feeds status:   Unstable"),
            "updating": _("Feeds status:   Updating"),
            "unknown": _("No connection"),
        }
        self["tl_off"] = Pixmap()
        self["tl_red"] = Pixmap()
        self["tl_yellow"] = Pixmap()
        self["tl_green"] = Pixmap()
        self.feedsStatus()
        self["feedStatusMSG"] = Label(status_msgs[self.trafficLight])

        self.channellist_only = 0
        self.channellist_name = ""
        self.SettingsBackupDone = False
        self.ImageBackupDone = False
        self.autobackuprunning = False

        self.packages = 0
        self.error = 0
        self.processed_packages = []
        self.total_packages = None
        self.checkNetworkState()

    def feedsStatus(self):
        from urllib import urlopen
        import socket

        self["tl_red"].hide()
        self["tl_yellow"].hide()
        self["tl_green"].hide()
        currentTimeoutDefault = socket.getdefaulttimeout()
        socket.setdefaulttimeout(3)
        try:
            d = urlopen("http://openvix.co.uk/TrafficLightState.php")
            self.trafficLight = d.read()
            if self.trafficLight == "unstable":
                self["tl_off"].hide()
                self["tl_red"].show()
            elif self.trafficLight == "updating":
                self["tl_off"].hide()
                self["tl_yellow"].show()
            elif self.trafficLight == "stable":
                self["tl_off"].hide()
                self["tl_green"].show()
            else:
                self.trafficLight = "unknown"
                self["tl_off"].show()
        except:
            self.trafficLight = "unknown"
            self["tl_off"].show()
        socket.setdefaulttimeout(currentTimeoutDefault)

    def checkNetworkState(self):
        cmd1 = "opkg update"
        self.CheckConsole = Console()
        self.CheckConsole.ePopen(cmd1, self.checkNetworkStateFinished)

    def checkNetworkStateFinished(self, result, retval, extra_args=None):
        if "bad address" in result:
            self.session.openWithCallback(
                self.close,
                MessageBox,
                _("Your %s %s is not connected to the internet, please check your network settings and try again.")
                % (getMachineBrand(), getMachineName()),
                type=MessageBox.TYPE_INFO,
                timeout=10,
                close_on_any_key=True,
            )
        elif ("wget returned 1" or "wget returned 255" or "404 Not Found") in result:
            self.session.openWithCallback(
                self.close,
                MessageBox,
                _(
                    "Sorry feeds are down for maintenance, please try again later. If this issue persists please check openvix.co.uk or world-of-satellite.com."
                ),
                type=MessageBox.TYPE_INFO,
                timeout=10,
                close_on_any_key=True,
            )
        elif "Collected errors" in result:
            self.session.openWithCallback(
                self.close,
                MessageBox,
                _("A background update check is in progress, please wait a few minutes and try again."),
                type=MessageBox.TYPE_INFO,
                timeout=10,
                close_on_any_key=True,
            )
        else:
            self.startCheck()

    def startCheck(self):
        self.activity = 0
        self.activityTimer = eTimer()
        self.activityTimer.callback.append(self.doActivityTimer)

        self.ipkg = IpkgComponent()
        self.ipkg.addCallback(self.ipkgCallback)

        self.updating = False

        self["actions"] = ActionMap(["WizardActions"], {"ok": self.exit, "back": self.exit}, -1)

        self.updating = True
        self.activityTimer.start(100, False)
        self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)

    def doActivityTimer(self):
        self.activity += 1
        if self.activity == 100:
            self.activity = 0
        self.activityslider.setValue(self.activity)

    def showUpdateCompletedMessage(self):
        self.setEndMessage(
            ngettext(
                "Update completed, %d package was installed.",
                "Update completed, %d packages were installed.",
                self.packages,
            )
            % self.packages
        )

    def ipkgCallback(self, event, param):
        if event == IpkgComponent.EVENT_DOWNLOAD:
            self.status.setText(_("Downloading"))
        elif event == IpkgComponent.EVENT_UPGRADE:
            if self.sliderPackages.has_key(param):
                self.slider.setValue(self.sliderPackages[param])
            self.package.setText(param)
            self.status.setText(_("Upgrading") + ": %s/%s" % (self.packages, self.total_packages))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_INSTALL:
            self.package.setText(param)
            self.status.setText(_("Installing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_REMOVE:
            self.package.setText(param)
            self.status.setText(_("Removing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_CONFIGURING:
            self.package.setText(param)
            self.status.setText(_("Configuring"))

        elif event == IpkgComponent.EVENT_MODIFIED:
            if config.plugins.softwaremanager.overwriteConfigFiles.value in ("N", "Y"):
                self.ipkg.write(True and config.plugins.softwaremanager.overwriteConfigFiles.value)
            else:
                self.session.openWithCallback(
                    self.modificationCallback,
                    MessageBox,
                    _(
                        "A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?"
                    )
                    % param,
                )
        elif event == IpkgComponent.EVENT_ERROR:
            self.error += 1
        elif event == IpkgComponent.EVENT_DONE:
            if self.updating:
                self.updating = False
                self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
            elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
                from urllib import urlopen
                import socket

                currentTimeoutDefault = socket.getdefaulttimeout()
                socket.setdefaulttimeout(3)
                status = urlopen("http://www.openvix.co.uk/feeds/status").read()
                if "404 Not Found" in status:
                    status = "1"
                config.softwareupdate.updateisunstable.setValue(status)
                socket.setdefaulttimeout(currentTimeoutDefault)
                self.total_packages = None
                if config.softwareupdate.updateisunstable.value == "1" and config.softwareupdate.updatebeta.value:
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = (
                        _("The current update may be unstable")
                        + "\n"
                        + _("Are you sure you want to update your %s %s ?") % (getMachineBrand(), getMachineName())
                        + "\n("
                        + (
                            ngettext(
                                "%s updated package available", "%s updated packages available", self.total_packages
                            )
                            % self.total_packages
                        )
                        + ")"
                    )
                elif config.softwareupdate.updateisunstable.value == "0":
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = (
                        _("Do you want to update your %s %s ?") % (getMachineBrand(), getMachineName())
                        + "\n("
                        + (
                            ngettext(
                                "%s updated package available", "%s updated packages available", self.total_packages
                            )
                            % self.total_packages
                        )
                        + ")"
                    )
                if self.total_packages:
                    global ocram
                    for package_tmp in self.ipkg.getFetchedList():
                        if package_tmp[0].startswith("enigma2-plugin-picons-tv-ocram"):
                            ocram = (
                                ocram
                                + "[ocram-picons] "
                                + package_tmp[0].split("enigma2-plugin-picons-tv-ocram.")[1]
                                + "updated "
                                + package_tmp[2]
                                + "\n"
                            )
                        elif package_tmp[0].startswith("enigma2-plugin-settings-ocram"):
                            ocram = (
                                ocram
                                + "[ocram-settings] "
                                + package_tmp[0].split("enigma2-plugin-picons-tv-ocram.")[1]
                                + "updated "
                                + package_tmp[2]
                                + "\n"
                            )
                    config.softwareupdate.updatefound.setValue(True)
                    choices = [(_("View the changes"), "changes"), (_("Upgrade and reboot system"), "cold")]
                    if path.exists("/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/BackupManager.pyo"):
                        if (
                            not config.softwareupdate.autosettingsbackup.value
                            and config.backupmanager.backuplocation.value
                        ):
                            choices.append(
                                (
                                    _("Perform a settings backup,")
                                    + "\n\t"
                                    + _("making a backup before updating")
                                    + "\n\t"
                                    + _("is strongly advised."),
                                    "backup",
                                )
                            )
                        if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                            choices.append((_("Perform a full image backup"), "imagebackup"))
                    choices.append((_("Update channel list only"), "channels"))
                    choices.append((_("Cancel"), ""))
                    upgrademessage = self.session.openWithCallback(
                        self.startActualUpgrade,
                        ChoiceBox,
                        title=message,
                        list=choices,
                        skin_name="SoftwareUpdateChoices",
                        var=self.trafficLight,
                    )
                    upgrademessage.setTitle(_("Software update"))
                else:
                    upgrademessage = self.session.openWithCallback(
                        self.close,
                        MessageBox,
                        _("Nothing to upgrade"),
                        type=MessageBox.TYPE_INFO,
                        timeout=10,
                        close_on_any_key=True,
                    )
                    upgrademessage.setTitle(_("Software update"))
            elif self.channellist_only > 0:
                if self.channellist_only == 1:
                    self.setEndMessage(_("Could not find installed channel list."))
                elif self.channellist_only == 2:
                    self.slider.setValue(2)
                    self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {"package": self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 3:
                    self.slider.setValue(3)
                    self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {"package": self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 4:
                    self.showUpdateCompletedMessage()
                    eDVBDB.getInstance().reloadBouquets()
                    eDVBDB.getInstance().reloadServicelist()
            elif self.error == 0:
                self.showUpdateCompletedMessage()
            else:
                self.activityTimer.stop()
                self.activityslider.setValue(0)
                error = _(
                    "Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s."
                ) % (getMachineBrand(), getMachineName(), getMachineBrand(), getMachineName())
                if self.packages == 0:
                    error = _("No updates available. Please try again later.")
                if self.updating:
                    error = _("Update failed. Your %s %s does not have a working internet connection.") % (
                        getMachineBrand(),
                        getMachineName(),
                    )
                self.status.setText(_("Error") + " - " + error)
        elif event == IpkgComponent.EVENT_LISTITEM:
            if "enigma2-plugin-settings-" in param[0] and self.channellist_only > 0:
                self.channellist_name = param[0]
                self.channellist_only = 2
                # print event, "-", param
        pass

    def setEndMessage(self, txt):
        self.slider.setValue(4)
        self.activityTimer.stop()
        self.activityslider.setValue(0)
        self.package.setText(txt)
        self.status.setText(self.oktext)

    def startActualUpgrade(self, answer):
        if not answer or not answer[1]:
            self.close()
            return

        if answer[1] == "menu":
            if config.softwareupdate.updateisunstable.value == "1":
                message = (
                    _("The current update may be unstable")
                    + "\n"
                    + _("Are you sure you want to update your %s %s ?") % (getMachineBrand(), getMachineName())
                    + "\n(%s " % self.total_packages
                    + _("Packages")
                    + ")"
                )
            elif config.softwareupdate.updateisunstable.value == "0":
                message = (
                    _("Do you want to update your %s %s ?") % (getMachineBrand(), getMachineName())
                    + "\n(%s " % self.total_packages
                    + _("Packages")
                    + ")"
                )
            choices = [(_("View the changes"), "changes"), (_("Upgrade and reboot system"), "cold")]
            if (
                not self.SettingsBackupDone
                and not config.softwareupdate.autosettingsbackup.value
                and config.backupmanager.backuplocation.value
            ):
                choices.append(
                    (_("Perform a settings backup, making a backup before updating is strongly advised."), "backup")
                )
            if (
                not self.ImageBackupDone
                and not config.softwareupdate.autoimagebackup.value
                and config.imagemanager.backuplocation.value
            ):
                choices.append((_("Perform a full image backup"), "imagebackup"))
            choices.append((_("Update channel list only"), "channels"))
            choices.append((_("Cancel"), ""))
            upgrademessage = self.session.openWithCallback(
                self.startActualUpgrade,
                ChoiceBox,
                title=message,
                list=choices,
                skin_name="SoftwareUpdateChoices",
                var=self.trafficLight,
            )
            upgrademessage.setTitle(_("Software update"))
        elif answer[1] == "changes":
            self.session.openWithCallback(self.startActualUpgrade, SoftwareUpdateChanges)
        elif answer[1] == "backup":
            self.doSettingsBackup()
        elif answer[1] == "imagebackup":
            self.doImageBackup()
        elif answer[1] == "channels":
            self.channellist_only = 1
            self.slider.setValue(1)
            self.ipkg.startCmd(IpkgComponent.CMD_LIST, args={"installed_only": True})
        elif answer[1] == "cold":
            if (config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value) or (
                config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value
            ):
                self.doAutoBackup()
            else:
                self.session.open(TryQuitMainloop, retvalue=42)
                self.close()

    def modificationCallback(self, res):
        self.ipkg.write(res and "N" or "Y")

    def doSettingsBackup(self):
        backup = None
        from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles

        self.BackupFiles = BackupFiles(self.session, True)
        Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
        Components.Task.job_manager.in_background = False
        for job in Components.Task.job_manager.getPendingJobs():
            if job.name == dgettext("vix", "Backup Manager"):
                break
        self.showJobView(job)

    def doImageBackup(self):
        backup = None
        from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup

        self.ImageBackup = ImageBackup(self.session, True)
        Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
        Components.Task.job_manager.in_background = False
        for job in Components.Task.job_manager.getPendingJobs():
            if job.name == dgettext("vix", "Image Manager"):
                break
        self.showJobView(job)

    def doAutoBackup(self, val=False):
        self.autobackuprunning = True
        if (
            config.softwareupdate.autosettingsbackup.value
            and config.backupmanager.backuplocation.value
            and not self.SettingsBackupDone
        ):
            self.doSettingsBackup()
        elif (
            config.softwareupdate.autoimagebackup.value
            and config.imagemanager.backuplocation.value
            and not self.ImageBackupDone
        ):
            self.doImageBackup()
        else:
            self.session.open(TryQuitMainloop, retvalue=42)
            self.close()

    def showJobView(self, job):
        if job.name == dgettext("vix", "Image Manager"):
            self.ImageBackupDone = True
        elif job.name == dgettext("vix", "Backup Manager"):
            self.SettingsBackupDone = True
        from Screens.TaskView import JobView

        Components.Task.job_manager.in_background = False
        if not self.autobackuprunning:
            self.session.openWithCallback(
                self.startActualUpgrade(("menu", "menu")),
                JobView,
                job,
                cancelable=False,
                backgroundable=False,
                afterEventChangeable=False,
                afterEvent="close",
            )
        else:
            self.session.openWithCallback(
                self.doAutoBackup,
                JobView,
                job,
                cancelable=False,
                backgroundable=False,
                afterEventChangeable=False,
                afterEvent="close",
            )

    def exit(self):
        if not self.ipkg.isRunning():
            if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
                self.session.openWithCallback(
                    self.exitAnswer,
                    MessageBox,
                    _("Upgrade finished.")
                    + " "
                    + _("Do you want to reboot your %s %s") % (getMachineBrand(), getMachineName()),
                )
            else:
                self.close()
        else:
            if not self.updating:
                self.close()

    def exitAnswer(self, result):
        if result is not None and result:
            self.session.open(TryQuitMainloop, retvalue=2)
        self.close()
Esempio n. 20
0
	def __init__(self, session, what):
		global HDSKIN, sizeH
		self.session = session
		self.what = what
		self.firstrun = True
		self.listchange = True
		self.scrolling = False
		self.webif_data = self.readXML(typ = self.what)
		ypos = 10
		ysize = 350
		self.rows = 12
		self.itemheight = 25
		self.sizeLH = sizeH - 20
		self.skin = """<screen position="center,center" size="%d, %d" title="Client Info" >""" % (sizeH, ysize)
		button_width = int(sizeH / 4)
		for k, v in enumerate(["red", "green", "yellow", "blue"]):
			xpos = k * button_width
			self.skin += """<ePixmap name="%s" position="%d,%d" size="35,25" pixmap="/usr/share/enigma2/skin_default/buttons/key_%s.png" zPosition="1" transparent="1" alphatest="on" />""" % (v, xpos, ypos, v)
			self.skin += """<widget source="key_%s" render="Label" position="%d,%d" size="%d,%d" font="Regular;18" zPosition="1" valign="center" transparent="1" />""" % (v, xpos + 40, ypos, button_width, 22)
		self.skin +="""<ePixmap name="divh" position="0,37" size="%d,2" pixmap="/usr/share/enigma2/skin_default/div-h.png" transparent="1" alphatest="on" />""" % sizeH
		self.skin +="""<widget name="output" position="10,45" size="%d,%d" zPosition="1" scrollbarMode="showOnDemand" />""" % ( self.sizeLH, ysize - 50)
		self.skin += """</screen>"""
		Screen.__init__(self, session)
		self.mlist = ncMenuList([])
		self["output"] = self.mlist
		self.errmsg = ""
		self["key_red"] = StaticText(_("Close"))
		if self.what == "c":
			self["key_green"] = StaticText("")
			self["key_yellow"] = StaticText(_("Servers"))
			self["key_blue"] = StaticText(_("Log"))
		elif self.what == "s":
			self["key_green"] = StaticText(_("Clients"))
			self["key_yellow"] = StaticText("")
			self["key_blue"] = StaticText(_("Log"))
		elif self.what == "l":
			self["key_green"] = StaticText(_("Clients"))
			self["key_yellow"] = StaticText(_("Servers"))
			self["key_blue"] = StaticText("")
		else:
			self["key_green"] = StaticText(_("Clients"))
			self["key_yellow"] = StaticText(_("Servers"))
			self["key_blue"] = StaticText(_("Log"))
		if config.ncaminfo.autoupdate.value:
			self.loop = eTimer()
			self.loop.callback.append(self.showData)
			timeout = config.ncaminfo.intervall.value * 1000
			self.loop.start(timeout, False)
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
					{
						"ok": self.key_ok,
						"cancel": self.exit,
						"red": self.exit,
						"green": self.key_green,
						"yellow": self.key_yellow,
						"blue": self.key_blue,
						"up": self.key_up,
						"down": self.key_down,
						"right": self.key_right,
						"left": self.key_left,
						"moveUp": self.key_moveUp,
						"moveDown": self.key_moveDown
					}, -1)
		self.onLayoutFinish.append(self.showData)
Esempio n. 21
0
class UpdatePlugin(Screen):

    def __init__(self, session, *args):
        Screen.__init__(self, session)
        Screen.setTitle(self, _('Software Update'))
        self.sliderPackages = {'dreambox-dvb-modules': 1,
         'enigma2': 2,
         'tuxbox-image-info': 3}
        self.setTitle(_('Software update'))
        self.slider = Slider(0, 4)
        self['slider'] = self.slider
        self.activityslider = Slider(0, 100)
        self['activityslider'] = self.activityslider
        self.status = StaticText(_('Please wait...'))
        self['status'] = self.status
        self.package = StaticText(_('Package list update'))
        self['package'] = self.package
        self.oktext = _('Press OK on your remote control to continue.')
        status_msgs = {'stable': _('Feeds status:   Stable'),
         'unstable': _('Feeds status:   Unstable'),
         'updating': _('Feeds status:   Updating'),
         'unknown': _('No connection')}
        self['tl_off'] = Pixmap()
        self['tl_red'] = Pixmap()
        self['tl_yellow'] = Pixmap()
        self['tl_green'] = Pixmap()
        self.feedsStatus()
        self['feedStatusMSG'] = Label(status_msgs[self.trafficLight])
        self.channellist_only = 0
        self.channellist_name = ''
        self.SettingsBackupDone = False
        self.ImageBackupDone = False
        self.autobackuprunning = False
        self.packages = 0
        self.error = 0
        self.processed_packages = []
        self.total_packages = None
        self.checkNetworkState()
        return

    def feedsStatus(self):
        from urllib import urlopen
        import socket
        self['tl_red'].hide()
        self['tl_yellow'].hide()
        self['tl_green'].hide()
        currentTimeoutDefault = socket.getdefaulttimeout()
        socket.setdefaulttimeout(3)
        try:
            d = urlopen('http://openvix.co.uk/TrafficLightState.php')
            self.trafficLight = d.read()
            if self.trafficLight == 'unstable':
                self['tl_off'].hide()
                self['tl_red'].show()
            elif self.trafficLight == 'updating':
                self['tl_off'].hide()
                self['tl_yellow'].show()
            elif self.trafficLight == 'stable':
                self['tl_off'].hide()
                self['tl_green'].show()
            else:
                self.trafficLight = 'unknown'
                self['tl_off'].show()
        except:
            self.trafficLight = 'unknown'
            self['tl_off'].show()

        socket.setdefaulttimeout(currentTimeoutDefault)

    def checkNetworkState(self):
        cmd1 = 'opkg update'
        self.CheckConsole = Console()
        self.CheckConsole.ePopen(cmd1, self.checkNetworkStateFinished)

    def checkNetworkStateFinished(self, result, retval, extra_args = None):
        if 'No space left on device' in result:
            self.session.openWithCallback(self.close, MessageBox, _('Your %s %s have a FULL flash memory, please free memory or expand in USB') % (getMachineBrand(), getMachineName()), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
        elif 'bad address' in result:
            self.session.openWithCallback(self.close, MessageBox, _('Your %s %s is not connected to the internet, please check your network settings and try again.') % (getMachineBrand(), getMachineName()), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
        elif ('wget returned 1' or 'wget returned 255' or '404 Not Found') in result:
            self.session.openWithCallback(self.close, MessageBox, _('Sorry feeds are down for maintenance, please try again later. If this issue persists please check www.italysat.eu'), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
        elif 'Collected errors' in result:
            self.session.openWithCallback(self.close, MessageBox, _('A background update check is in progress, please wait a few minutes and try again.'), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
        else:
            self.startCheck()

    def startCheck(self):
        self.activity = 0
        self.activityTimer = eTimer()
        self.activityTimer.callback.append(self.doActivityTimer)
        self.ipkg = IpkgComponent()
        self.ipkg.addCallback(self.ipkgCallback)
        self.updating = False
        self['actions'] = ActionMap(['WizardActions'], {'ok': self.exit,
         'back': self.exit}, -1)
        self.updating = True
        self.activityTimer.start(100, False)
        self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)

    def doActivityTimer(self):
        self.activity += 1
        if self.activity == 100:
            self.activity = 0
        self.activityslider.setValue(self.activity)

    def showUpdateCompletedMessage(self):
        self.setEndMessage(ngettext('Update completed, %d package was installed.', 'Update completed, %d packages were installed.', self.packages) % self.packages)

    def ipkgCallback(self, event, param):
        global ocram
        if event == IpkgComponent.EVENT_DOWNLOAD:
            self.status.setText(_('Downloading'))
        elif event == IpkgComponent.EVENT_UPGRADE:
            if self.sliderPackages.has_key(param):
                self.slider.setValue(self.sliderPackages[param])
            self.package.setText(param)
            self.status.setText(_('Upgrading') + ': %s/%s' % (self.packages, self.total_packages))
            if param not in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_INSTALL:
            self.package.setText(param)
            self.status.setText(_('Installing'))
            if param not in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_REMOVE:
            self.package.setText(param)
            self.status.setText(_('Removing'))
            if param not in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_CONFIGURING:
            self.package.setText(param)
            self.status.setText(_('Configuring'))
        elif event == IpkgComponent.EVENT_MODIFIED:
            if config.plugins.softwaremanager.overwriteConfigFiles.value in ('N', 'Y'):
                self.ipkg.write(True and config.plugins.softwaremanager.overwriteConfigFiles.value)
            else:
                self.session.openWithCallback(self.modificationCallback, MessageBox, _('A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?') % param)
        elif event == IpkgComponent.EVENT_ERROR:
            self.error += 1
        elif event == IpkgComponent.EVENT_DONE:
            if self.updating:
                self.updating = False
                self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
            elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
                from urllib import urlopen
                import socket
                currentTimeoutDefault = socket.getdefaulttimeout()
                socket.setdefaulttimeout(3)
                status = urlopen('http://feeds.italysat.eu/status').read()
                if '404 Not Found' in status:
                    status = '1'
                config.softwareupdate.updateisunstable.setValue(status)
                socket.setdefaulttimeout(currentTimeoutDefault)
                self.total_packages = None
                if config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value:
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _('The current update may be unstable') + '\n' + _('Are you sure you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(' + ngettext('%s updated package available', '%s updated packages available', self.total_packages) % self.total_packages + ')'
                elif config.softwareupdate.updateisunstable.value == '0':
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _('Do you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(' + ngettext('%s updated package available', '%s updated packages available', self.total_packages) % self.total_packages + ')'
                if self.total_packages:
                    for package_tmp in self.ipkg.getFetchedList():
                        if package_tmp[0].startswith('enigma2-plugin-picons-tv-ocram'):
                            ocram = ocram + '[ocram-picons] ' + package_tmp[0].split('enigma2-plugin-picons-tv-ocram.')[1] + 'updated ' + package_tmp[2] + '\n'
                        elif package_tmp[0].startswith('enigma2-plugin-settings-ocram'):
                            ocram = ocram + '[ocram-settings] ' + package_tmp[0].split('enigma2-plugin-picons-tv-ocram.')[1] + 'updated ' + package_tmp[2] + '\n'

                    config.softwareupdate.updatefound.setValue(True)
                    choices = [(_('Upgrade and reboot system'), 'cold')]
                    if path.exists('/usr/lib/enigma2/python/ItalySat/ItalysatBackupManager.pyo'):
                        if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
                            choices.append((_('Perform a settings backup,') + '\n\t' + _('making a backup before updating') + '\n\t' + _('is strongly advised.'), 'backup'))
                        if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                            choices.append((_('Perform a full image backup'), 'imagebackup'))
                    choices.append((_('Cancel'), ''))
                    upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name='SoftwareUpdateChoices', var=self.trafficLight)
                    upgrademessage.setTitle(_('Software update'))
                else:
                    upgrademessage = self.session.openWithCallback(self.close, MessageBox, _('Nothing to upgrade'), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
                    upgrademessage.setTitle(_('Software update'))
            elif self.channellist_only > 0:
                if self.channellist_only == 1:
                    self.setEndMessage(_('Could not find installed channel list.'))
                elif self.channellist_only == 2:
                    self.slider.setValue(2)
                    self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 3:
                    self.slider.setValue(3)
                    self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 4:
                    self.showUpdateCompletedMessage()
                    eDVBDB.getInstance().reloadBouquets()
                    eDVBDB.getInstance().reloadServicelist()
            elif self.error == 0:
                self.showUpdateCompletedMessage()
            else:
                self.activityTimer.stop()
                self.activityslider.setValue(0)
                error = _('Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s.') % (getMachineBrand(),
                 getMachineName(),
                 getMachineBrand(),
                 getMachineName())
                if self.packages == 0:
                    error = _('No updates available. Please try again later.')
                if self.updating:
                    error = _('Update failed. Your %s %s does not have a working internet connection.') % (getMachineBrand(), getMachineName())
                self.status.setText(_('Error') + ' - ' + error)
        elif event == IpkgComponent.EVENT_LISTITEM:
            if 'enigma2-plugin-settings-' in param[0] and self.channellist_only > 0:
                self.channellist_name = param[0]
                self.channellist_only = 2
        return

    def setEndMessage(self, txt):
        self.slider.setValue(4)
        self.activityTimer.stop()
        self.activityslider.setValue(0)
        self.package.setText(txt)
        self.status.setText(self.oktext)

    def startActualUpgrade(self, answer):
        if not answer or not answer[1]:
            self.close()
            return
        if answer[1] == 'menu':
            if config.softwareupdate.updateisunstable.value == '1':
                message = _('The current update may be unstable') + '\n' + _('Are you sure you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(%s ' % self.total_packages + _('Packages') + ')'
            elif config.softwareupdate.updateisunstable.value == '0':
                message = _('Do you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(%s ' % self.total_packages + _('Packages') + ')'
            choices = [(_('Upgrade and reboot system'), 'cold')]
            if not self.SettingsBackupDone and not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
                choices.append((_('Perform a settings backup, making a backup before updating is strongly advised.'), 'backup'))
            if not self.ImageBackupDone and not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                choices.append((_('Perform a full image backup'), 'imagebackup'))
            choices.append((_('Cancel'), ''))
            upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name='SoftwareUpdateChoices', var=self.trafficLight)
            upgrademessage.setTitle(_('Software update'))
        elif answer[1] == 'changes':
            self.session.openWithCallback(self.startActualUpgrade, SoftwareUpdateChanges)
        elif answer[1] == 'backup':
            self.doSettingsBackup()
        elif answer[1] == 'imagebackup':
            self.doImageBackup()
        elif answer[1] == 'channels':
            self.channellist_only = 1
            self.slider.setValue(1)
            self.ipkg.startCmd(IpkgComponent.CMD_LIST, args={'installed_only': True})
        elif answer[1] == 'cold':
            if config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value or config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                self.doAutoBackup()
            else:
                self.session.open(TryQuitMainloop, retvalue=42)
                self.close()

    def modificationCallback(self, res):
        self.ipkg.write(res and 'N' or 'Y')

    def doSettingsBackup(self):
        backup = None
        from ItalySat.ItalysatBackupManager import BackupFiles
        self.BackupFiles = BackupFiles(self.session, True)
        Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
        Components.Task.job_manager.in_background = False
        for job in Components.Task.job_manager.getPendingJobs():
            if job.name == dgettext('italysat', 'Backup Manager'):
                break

        self.showJobView(job)
        return

    def doImageBackup(self):
        backup = None
        from ItalySat.ItalysatImageManager import ImageBackup
        self.ImageBackup = ImageBackup(self.session, True)
        Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
        Components.Task.job_manager.in_background = False
        for job in Components.Task.job_manager.getPendingJobs():
            if job.name == dgettext('italysat', 'Image Manager'):
                break

        self.showJobView(job)
        return

    def doAutoBackup(self, val = False):
        self.autobackuprunning = True
        if config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value and not self.SettingsBackupDone:
            self.doSettingsBackup()
        elif config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value and not self.ImageBackupDone:
            self.doImageBackup()
        else:
            self.session.open(TryQuitMainloop, retvalue=42)
            self.close()

    def showJobView(self, job):
        if job.name == dgettext('italysat', 'Image Manager'):
            self.ImageBackupDone = True
        elif job.name == dgettext('italysat', 'Backup Manager'):
            self.SettingsBackupDone = True
        from Screens.TaskView import JobView
        Components.Task.job_manager.in_background = False
        if not self.autobackuprunning:
            self.session.openWithCallback(self.startActualUpgrade(('menu', 'menu')), JobView, job, cancelable=False, backgroundable=False, afterEventChangeable=False, afterEvent='close')
        else:
            self.session.openWithCallback(self.doAutoBackup, JobView, job, cancelable=False, backgroundable=False, afterEventChangeable=False, afterEvent='close')

    def exit(self):
        if not self.ipkg.isRunning():
            if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
                self.session.openWithCallback(self.exitAnswer, MessageBox, _('Upgrade finished.') + ' ' + _('Do you want to reboot your %s %s') % (getMachineBrand(), getMachineName()))
            else:
                self.close()
        elif not self.updating:
            self.close()

    def exitAnswer(self, result):
        if result is not None and result:
            self.session.open(TryQuitMainloop, retvalue=2)
        self.close()
        return
Esempio n. 22
0
class AutomaticCleanupSetup(Screen, ConfigListScreen):  # config

    skin = """
		<screen name="SystemCleanup" position="center,center" size="630,315" title="Automatic System Cleanup Setup" >
			<ePixmap pixmap="skin_default/buttons/red.png" position="5,5" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/green.png" position="165,5" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/yellow.png" position="325,5" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/blue.png" position="485,5" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			
			<widget render="Label" source="key_red" position="5,5" size="140,40" zPosition="2" valign="center" halign="center" backgroundColor="red" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget render="Label" source="key_green" position="165,5" size="140,40" zPosition="2" valign="center" halign="center" backgroundColor="red" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget render="Label" source="key_yellow" position="325,5" size="140,40" zPosition="2" valign="center" halign="center" backgroundColor="red" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />

			<widget name="config" position="5,60" size="620,155" scrollbarMode="showOnDemand" />

			<ePixmap pixmap="skin_default/div-h.png" position="0,220" zPosition="1" size="630,2" />
			<widget source="help" render="Label" position="5,235" size="620,75" font="Regular;21" /> 
		</screen>"""

    def __init__(self, session):
        Screen.__init__(self, session)

        #Summary
        self.setup_title = _("Automatic System Cleanup Setup")

        self.onChangedEntry = []

        self.list = [
            getConfigListEntry(
                _("Delete system setting backups"),
                config.plugins.AutomaticCleanup.deleteSettingsOlderThan,
                _("Specify, how long system setting backups shall be kept at most (even if maximum number is not yet exceeded). Latest backup will be kept anyway!"
                  )),
            getConfigListEntry(
                _("Maximum number of system setting backups"),
                config.plugins.AutomaticCleanup.keepSettings,
                _("Maximum number of system setting backups to keep, regardless of retention period."
                  )),
            getConfigListEntry(
                _("Delete orphaned movie files"),
                config.plugins.AutomaticCleanup.deleteOrphanedMovieFiles,
                _("If enabled, orphaned movie files will be automatically deleted from movie directories."
                  )),
            getConfigListEntry(
                _("Delete crashlogs"),
                config.plugins.AutomaticCleanup.deleteCrashlogsOlderThan,
                _('Sorry, this feature is not available due to license reasons. To get the full version, please search the web for "dreambox automaticcleanup."'
                  )),
            getConfigListEntry(
                _("Maximum number of crashlogs"),
                config.plugins.AutomaticCleanup.keepCrashlogs,
                _('Sorry, this feature is not available due to license reasons. To get the full version, please search the web for "dreambox automaticcleanup."'
                  )),
        ]

        try:
            # try to import EMC module to check for its existence
            from Plugins.Extensions.EnhancedMovieCenter.EnhancedMovieCenter import EnhancedMovieCenterMenu
            self.EMC_timer_autocln = config.EMC.timer_autocln.value
        except ImportError, ie:
            print pluginPrintname, "EMC not installed:", ie
            self.EMC_timer_autocln = False

        if self.EMC_timer_autocln:  # Timer cleanup enabled in EMC plugin?
            self.list.append(
                getConfigListEntry(
                    _("Delete timerlist entries"),
                    config.plugins.AutomaticCleanup.deleteTimersOlderThan,
                    _("Timerlist cleanup is enabled in EMC plugin! To avoid crashes, we won't delete entries whilst this option is enabled in EMC."
                      )))  # Avoid duplicate cleanup
        else:
            self.list.append(
                getConfigListEntry(
                    _("Delete timerlist entries"),
                    config.plugins.AutomaticCleanup.deleteTimersOlderThan,
                    _("Specify, how long expired timer list entries shall be kept at most. Deactivated repeat timer entries won't be deleted ever."
                      )))

        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=session,
                                  on_change=self.changed)

        def selectionChanged():
            if self["config"].current:
                self["config"].current[1].onDeselect(self.session)
            self["config"].current = self["config"].getCurrent()
            if self["config"].current:
                self["config"].current[1].onSelect(self.session)
            for x in self["config"].onSelectionChanged:
                x()

        self["config"].selectionChanged = selectionChanged
        self["config"].onSelectionChanged.append(self.configHelp)

        # Initialize Buttons
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["key_yellow"] = StaticText(_("Help"))

        self["help"] = StaticText()

        # Define Actions
        self["setupActions"] = ActionMap(
            ["SetupActions", "ColorActions"], {
                "red": self.keyCancel,
                "green": self.keySave,
                "yellow": self.keyHelp,
                "cancel": self.keyCancel,
                "save": self.keySave,
                "ok": self.keySave,
            }, -2)

        # Trigger change
        self.changed()

        self.onLayoutFinish.append(self.setCustomTitle)
Esempio n. 23
0
    def ShowServiceInformation(self):
        menu_path = self.menu_path
        if self.type == TYPE_SERVICE_INFO:
            screentitle = _("Service & PIDs")
            if config.usage.show_menupath.value == 'large':
                menu_path += screentitle
                title = menu_path
                self["menu_path_compressed"] = StaticText("")
            elif config.usage.show_menupath.value == 'small':
                title = screentitle
                self["menu_path_compressed"] = StaticText(
                    menu_path +
                    " >" if not menu_path.endswith(' / ') else menu_path[:-3] +
                    " >" or "")
            else:
                title = screentitle
                self["menu_path_compressed"] = StaticText("")
            Screen.setTitle(self, title)

            if self.feinfo or self.transponder_info:
                self["key_blue"].text = self["blue"].text = _(
                    "Tuner settings values")
            if self.session.nav.getCurrentlyPlayingServiceOrGroup():
                name = ServiceReference(
                    self.session.nav.getCurrentlyPlayingServiceReference(
                    )).getServiceName()
                refstr = self.session.nav.getCurrentlyPlayingServiceReference(
                ).toString()
                reftype = self.session.nav.getCurrentlyPlayingServiceReference(
                ).type
            else:
                name = _("N/A")
                refstr = _("N/A")
                reftype = 0
            aspect = "-"
            videocodec = "-"
            resolution = "-"
            if self.info:
                videocodec = ("MPEG2", "AVC", "MPEG1", "MPEG4-VC", "VC1",
                              "VC1-SM", "HEVC", "N/A")[self.info.getInfo(
                                  iServiceInformation.sVideoType)]
                width = self.info.getInfo(iServiceInformation.sVideoWidth)
                height = self.info.getInfo(iServiceInformation.sVideoHeight)
                if width > 0 and height > 0:
                    resolution = videocodec + " - "
                    resolution += "%dx%d - " % (width, height)
                    resolution += str(
                        (self.info.getInfo(iServiceInformation.sFrameRate) +
                         500) / 1000)
                    resolution += ("i", "p", "")[self.info.getInfo(
                        iServiceInformation.sProgressive)]
                    aspect = self.getServiceInfoValue(
                        iServiceInformation.sAspect)
                    aspect = aspect in (1, 2, 5, 6, 9, 0xA, 0xD,
                                        0xE) and "4:3" or "16:9"
                    resolution += " - " + aspect + ""
            if "%3a//" in refstr and reftype not in (1, 257, 4098, 4114):
                fillList = [
                    (_("Service name"), name, TYPE_TEXT),
                    (_("Videocodec, size & format"), resolution, TYPE_TEXT),
                    (_("Service reference"), ":".join(refstr.split(":")[:9]),
                     TYPE_TEXT),
                    (_("URL"), refstr.split(":")[10].replace("%3a",
                                                             ":"), TYPE_TEXT)
                ]
            else:
                if ":/" in refstr:
                    fillList = [(_("Service name"), name, TYPE_TEXT),
                                (_("Videocodec, size & format"), resolution,
                                 TYPE_TEXT),
                                (_("Service reference"),
                                 ":".join(refstr.split(":")[:9]), TYPE_TEXT),
                                (_("Filename"), refstr.split(":")[10],
                                 TYPE_TEXT)]
                else:
                    fillList = [
                        (_("Service name"), name, TYPE_TEXT),
                        (_("Provider"),
                         self.getServiceInfoValue(
                             iServiceInformation.sProvider), TYPE_TEXT),
                        (_("Videocodec, size & format"), resolution, TYPE_TEXT)
                    ]
                    if "%3a//" in refstr:
                        fillList = fillList + [
                            (_("Service reference"), ":".join(
                                refstr.split(":")[:9]), TYPE_TEXT),
                            (_("URL"), refstr.split(":")[10].replace(
                                "%3a", ":"), TYPE_TEXT)
                        ]
                    else:
                        fillList = fillList + [
                            (_("Service reference"), refstr, TYPE_TEXT)
                        ]
                fillList = fillList + [
                    (_("Namespace"),
                     self.getServiceInfoValue(
                         iServiceInformation.sNamespace), TYPE_VALUE_HEX, 8),
                    (_("Service ID"),
                     self.getServiceInfoValue(
                         iServiceInformation.sSID), TYPE_VALUE_HEX_DEC, 4),
                    (_("Video PID"),
                     self.getServiceInfoValue(iServiceInformation.sVideoPID),
                     TYPE_VALUE_HEX_DEC, 4),
                    (_("Audio PID"),
                     self.getServiceInfoValue(iServiceInformation.sAudioPID),
                     TYPE_VALUE_HEX_DEC, 4),
                    (_("PCR PID"),
                     self.getServiceInfoValue(
                         iServiceInformation.sPCRPID), TYPE_VALUE_HEX_DEC, 4),
                    (_("PMT PID"),
                     self.getServiceInfoValue(
                         iServiceInformation.sPMTPID), TYPE_VALUE_HEX_DEC, 4),
                    (_("TXT PID"),
                     self.getServiceInfoValue(
                         iServiceInformation.sTXTPID), TYPE_VALUE_HEX_DEC, 4),
                    (_("TSID"),
                     self.getServiceInfoValue(
                         iServiceInformation.sTSID), TYPE_VALUE_HEX_DEC, 4),
                    (_("ONID"),
                     self.getServiceInfoValue(
                         iServiceInformation.sONID), TYPE_VALUE_HEX_DEC, 4)
                ]
            self.fillList(fillList)
        elif self.transponder_info:
            self.fillList(self.getFEData(self.transponder_info))
Esempio n. 24
0
 def __init__(self, session, parent):
     Screen.__init__(self, session, parent=parent)
     self["message"] = StaticText("")
     self.parent.onText.append(self.onText)
Esempio n. 25
0
class UpdatePlugin(Screen):
    def __init__(self, session, *args):
        Screen.__init__(self, session)
        Screen.setTitle(self, _("Software Update"))

        self.sliderPackages = {
            "dreambox-dvb-modules": 1,
            "enigma2": 2,
            "tuxbox-image-info": 3
        }

        self.setTitle(_("Software update"))
        self.slider = Slider(0, 4)
        self["slider"] = self.slider
        self.activityslider = Slider(0, 100)
        self["activityslider"] = self.activityslider
        self.status = StaticText(_("Please wait..."))
        self["status"] = self.status
        self.package = StaticText(_("Package list update"))
        self["package"] = self.package
        self.oktext = _("Press OK on your remote control to continue.")

        self.channellist_only = 0
        self.channellist_name = ''
        self.SettingsBackupDone = False
        self.ImageBackupDone = False
        self.autobackuprunning = False

        self.packages = 0
        self.error = 0
        self.processed_packages = []
        self.total_packages = None
        self.checkNetworkState()

    def checkNetworkState(self):
        cmd1 = "opkg update"
        self.CheckConsole = Console()
        self.CheckConsole.ePopen(cmd1, self.checkNetworkStateFinished)

    def checkNetworkStateFinished(self, result, retval, extra_args=None):
        if 'bad address' in result:
            self.session.openWithCallback(
                self.close,
                MessageBox,
                _("Your %s %s is not connected to the internet, please check your network settings and try again."
                  ) % (getMachineBrand(), getMachineName()),
                type=MessageBox.TYPE_INFO,
                timeout=10,
                close_on_any_key=True)
        elif ('wget returned 1' or 'wget returned 255'
              or '404 Not Found') in result:
            self.session.openWithCallback(
                self.close,
                MessageBox,
                _("Sorry feeds are down for maintenance, please try again later."
                  ),
                type=MessageBox.TYPE_INFO,
                timeout=10,
                close_on_any_key=True)
        elif 'Collected errors' in result:
            self.session.openWithCallback(
                self.close,
                MessageBox,
                _("A background update check is in progress, please wait a few minutes and try again."
                  ),
                type=MessageBox.TYPE_INFO,
                timeout=10,
                close_on_any_key=True)
        else:
            self.startCheck()

    def startCheck(self):
        self.activity = 0
        self.activityTimer = eTimer()
        self.activityTimer.callback.append(self.doActivityTimer)

        self.ipkg = IpkgComponent()
        self.ipkg.addCallback(self.ipkgCallback)

        self.updating = False

        self["actions"] = ActionMap(["WizardActions"], {
            "ok": self.exit,
            "back": self.exit
        }, -1)

        self.updating = True
        self.activityTimer.start(100, False)
        self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)

    def doActivityTimer(self):
        self.activity += 1
        if self.activity == 100:
            self.activity = 0
        self.activityslider.setValue(self.activity)

    def showUpdateCompletedMessage(self):
        self.setEndMessage(
            ngettext("Update completed, %d package was installed.",
                     "Update completed, %d packages were installed.",
                     self.packages) % self.packages)

    def ipkgCallback(self, event, param):
        if event == IpkgComponent.EVENT_DOWNLOAD:
            self.status.setText(_("Downloading"))
        elif event == IpkgComponent.EVENT_UPGRADE:
            if self.sliderPackages.has_key(param):
                self.slider.setValue(self.sliderPackages[param])
            self.package.setText(param)
            self.status.setText(
                _("Upgrading") + ": %s/%s" %
                (self.packages, self.total_packages))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_INSTALL:
            self.package.setText(param)
            self.status.setText(_("Installing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_REMOVE:
            self.package.setText(param)
            self.status.setText(_("Removing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_CONFIGURING:
            self.package.setText(param)
            self.status.setText(_("Configuring"))

        elif event == IpkgComponent.EVENT_MODIFIED:
            if config.plugins.softwaremanager.overwriteConfigFiles.value in (
                    "N", "Y"):
                self.ipkg.write(
                    True and
                    config.plugins.softwaremanager.overwriteConfigFiles.value)
            else:
                self.session.openWithCallback(
                    self.modificationCallback, MessageBox,
                    _("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?"
                      ) % param)
        elif event == IpkgComponent.EVENT_ERROR:
            self.error += 1
        elif event == IpkgComponent.EVENT_DONE:
            if self.updating:
                self.updating = False
                self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
            elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
                from urllib import urlopen
                import socket
                currentTimeoutDefault = socket.getdefaulttimeout()
                socket.setdefaulttimeout(3)
                config.softwareupdate.updateisunstable.setValue(
                    urlopen(
                        "http://enigma2.world-of-satellite.com/feeds/status").
                    read())
                if ('404 Not Found'
                    ) in config.softwareupdate.updateisunstable.value:
                    config.softwareupdate.updateisunstable.setValue('1')
                socket.setdefaulttimeout(currentTimeoutDefault)
                self.total_packages = None
                if config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value:
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _(
                        "The current update may be unstable") + "\n" + _(
                            "Are you sure you want to update your %s %s ?"
                        ) % (getMachineBrand(), getMachineName()) + "\n(" + (
                            ngettext("%s updated package available",
                                     "%s updated packages available",
                                     self.total_packages) %
                            self.total_packages) + ")"
                elif config.softwareupdate.updateisunstable.value == '0':
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _("Do you want to update your %s %s ?") % (
                        getMachineBrand(), getMachineName()) + "\n(" + (
                            ngettext("%s updated package available",
                                     "%s updated packages available",
                                     self.total_packages) %
                            self.total_packages) + ")"
                if self.total_packages:
                    global ocram
                    for package_tmp in self.ipkg.getFetchedList():
                        if package_tmp[0].startswith(
                                'enigma2-plugin-picons-tv-ocram'):
                            ocram = ocram + '[ocram-picons] ' + package_tmp[
                                0].split('enigma2-plugin-picons-tv-ocram.')[
                                    1] + 'updated ' + package_tmp[2] + '\n'
                        elif package_tmp[0].startswith(
                                'enigma2-plugin-settings-ocram'):
                            ocram = ocram + '[ocram-settings] ' + package_tmp[
                                0].split('enigma2-plugin-picons-tv-ocram.')[
                                    1] + 'updated ' + package_tmp[2] + '\n'
                    config.softwareupdate.updatefound.setValue(True)
                    choices = [(_("View the changes"), "changes"),
                               (_("Upgrade and reboot system"), "cold")]
                    if path.exists(
                            "/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/BackupManager.pyo"
                    ):
                        if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
                            choices.append(
                                (_("Perform a settings backup,") + '\n\t' +
                                 _("making a backup before updating") +
                                 '\n\t' + _("is strongly advised."), "backup"))
                        if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                            choices.append((_("Perform a full image backup"),
                                            "imagebackup"))
                    choices.append((_("Update channel list only"), "channels"))
                    choices.append((_("Cancel"), ""))
                    upgrademessage = self.session.openWithCallback(
                        self.startActualUpgrade,
                        ChoiceBox,
                        title=message,
                        list=choices,
                        skin_name="SoftwareUpdateChoices")
                    upgrademessage.setTitle(_('Software update'))
                else:
                    upgrademessage = self.session.openWithCallback(
                        self.close,
                        MessageBox,
                        _("Nothing to upgrade"),
                        type=MessageBox.TYPE_INFO,
                        timeout=10,
                        close_on_any_key=True)
                    upgrademessage.setTitle(_('Software update'))
            elif self.channellist_only > 0:
                if self.channellist_only == 1:
                    self.setEndMessage(
                        _("Could not find installed channel list."))
                elif self.channellist_only == 2:
                    self.slider.setValue(2)
                    self.ipkg.startCmd(IpkgComponent.CMD_REMOVE,
                                       {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 3:
                    self.slider.setValue(3)
                    self.ipkg.startCmd(IpkgComponent.CMD_INSTALL,
                                       {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 4:
                    self.showUpdateCompletedMessage()
                    eDVBDB.getInstance().reloadBouquets()
                    eDVBDB.getInstance().reloadServicelist()
            elif self.error == 0:
                self.showUpdateCompletedMessage()
            else:
                self.activityTimer.stop()
                self.activityslider.setValue(0)
                error = _(
                    "Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s."
                ) % (getMachineBrand(), getMachineName(), getMachineBrand(),
                     getMachineName())
                if self.packages == 0:
                    error = _("No updates available. Please try again later.")
                if self.updating:
                    error = _(
                        "Update failed. Your %s %s does not have a working internet connection."
                    ) % (getMachineBrand(), getMachineName())
                self.status.setText(_("Error") + " - " + error)
        elif event == IpkgComponent.EVENT_LISTITEM:
            if 'enigma2-plugin-settings-' in param[
                    0] and self.channellist_only > 0:
                self.channellist_name = param[0]
                self.channellist_only = 2
        #print event, "-", param
        pass

    def setEndMessage(self, txt):
        self.slider.setValue(4)
        self.activityTimer.stop()
        self.activityslider.setValue(0)
        self.package.setText(txt)
        self.status.setText(self.oktext)

    def startActualUpgrade(self, answer):
        if not answer or not answer[1]:
            self.close()
            return

        if answer[1] == "menu":
            if config.softwareupdate.updateisunstable.value == '1':
                message = _("The current update may be unstable") + "\n" + _(
                    "Are you sure you want to update your %s %s ?") % (
                        getMachineBrand(), getMachineName()
                    ) + "\n(%s " % self.total_packages + _("Packages") + ")"
            elif config.softwareupdate.updateisunstable.value == '0':
                message = _("Do you want to update your %s %s ?") % (
                    getMachineBrand(), getMachineName()
                ) + "\n(%s " % self.total_packages + _("Packages") + ")"
            choices = [(_("View the changes"), "changes"),
                       (_("Upgrade and reboot system"), "cold")]
            if not self.SettingsBackupDone and not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
                choices.append((_(
                    "Perform a settings backup, making a backup before updating is strongly advised."
                ), "backup"))
            if not self.ImageBackupDone and not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                choices.append(
                    (_("Perform a full image backup"), "imagebackup"))
            choices.append((_("Update channel list only"), "channels"))
            choices.append((_("Cancel"), ""))
            upgrademessage = self.session.openWithCallback(
                self.startActualUpgrade,
                ChoiceBox,
                title=message,
                list=choices,
                skin_name="SoftwareUpdateChoices")
            upgrademessage.setTitle(_('Software update'))
        elif answer[1] == "changes":
            self.session.openWithCallback(self.startActualUpgrade,
                                          SoftwareUpdateChanges)
        elif answer[1] == "backup":
            self.doSettingsBackup()
        elif answer[1] == "imagebackup":
            self.doImageBackup()
        elif answer[1] == "channels":
            self.channellist_only = 1
            self.slider.setValue(1)
            self.ipkg.startCmd(IpkgComponent.CMD_LIST,
                               args={'installed_only': True})
        elif answer[1] == "cold":
            if (config.softwareupdate.autosettingsbackup.value
                    and config.backupmanager.backuplocation.value) or (
                        config.softwareupdate.autoimagebackup.value
                        and config.imagemanager.backuplocation.value):
                self.doAutoBackup()
            else:
                self.session.open(TryQuitMainloop, retvalue=42)
                self.close()

    def modificationCallback(self, res):
        self.ipkg.write(res and "N" or "Y")

    def doSettingsBackup(self):
        backup = None
        from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
        self.BackupFiles = BackupFiles(self.session, True)
        Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
        Components.Task.job_manager.in_background = False
        for job in Components.Task.job_manager.getPendingJobs():
            if job.name == dgettext('vix', 'Backup Manager'):
                break
        self.showJobView(job)

    def doImageBackup(self):
        backup = None
        from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup
        self.ImageBackup = ImageBackup(self.session, True)
        Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
        Components.Task.job_manager.in_background = False
        for job in Components.Task.job_manager.getPendingJobs():
            if job.name == dgettext('vix', 'Image Manager'):
                break
        self.showJobView(job)

    def doAutoBackup(self, val=False):
        self.autobackuprunning = True
        if config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value and not self.SettingsBackupDone:
            self.doSettingsBackup()
        elif config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value and not self.ImageBackupDone:
            self.doImageBackup()
        else:
            self.session.open(TryQuitMainloop, retvalue=42)
            self.close()

    def showJobView(self, job):
        if job.name == dgettext('vix', 'Image Manager'):
            self.ImageBackupDone = True
        elif job.name == dgettext('vix', 'Backup Manager'):
            self.SettingsBackupDone = True
        from Screens.TaskView import JobView
        Components.Task.job_manager.in_background = False
        if not self.autobackuprunning:
            self.session.openWithCallback(self.startActualUpgrade(
                ("menu", "menu")),
                                          JobView,
                                          job,
                                          cancelable=False,
                                          backgroundable=False,
                                          afterEventChangeable=False,
                                          afterEvent="close")
        else:
            self.session.openWithCallback(self.doAutoBackup,
                                          JobView,
                                          job,
                                          cancelable=False,
                                          backgroundable=False,
                                          afterEventChangeable=False,
                                          afterEvent="close")

    def exit(self):
        if not self.ipkg.isRunning():
            if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
                self.session.openWithCallback(
                    self.exitAnswer, MessageBox,
                    _("Upgrade finished.") + " " +
                    _("Do you want to reboot your %s %s") %
                    (getMachineBrand(), getMachineName()))
            else:
                self.close()
        else:
            if not self.updating:
                self.close()

    def exitAnswer(self, result):
        if result is not None and result:
            self.session.open(TryQuitMainloop, retvalue=2)
        self.close()
Esempio n. 26
0
    def populate(self):
        if isVTISkin:
            self["EnigmaVersion"] = StaticText(
                _("Version") + ": " + about.getEnigmaVersionString())
            self["ImageVersion"] = StaticText(
                _("Image") + ": " + about.getImageVersionString())

            self["TunerHeader"] = StaticText(_("Detected NIMs:"))

            fp_version = getFPVersion()
            if fp_version is None:
                fp_version = ""
            else:
                fp_version = _("Frontprocessor version: %d") % fp_version

            self["FPVersion"] = StaticText(fp_version)

            nims = nimmanager.nimList()
            self.tuner_list = []
            if len(nims) <= 4:
                for count in (0, 1, 2, 3, 4, 5, 6, 7):
                    if count < len(nims):
                        self["Tuner" + str(count)] = StaticText(nims[count])
                        self.tuner_list.append((nims[count] + "\n"))
                    else:
                        self["Tuner" + str(count)] = StaticText("")
            else:
                desc_list = []
                count = 0
                cur_idx = -1
                while count < len(nims):
                    data = nims[count].split(":")
                    idx = data[0].strip('Tuner').strip()
                    desc = data[1].strip()
                    if desc_list and desc_list[cur_idx]['desc'] == desc:
                        desc_list[cur_idx]['end'] = idx
                    else:
                        desc_list.append({
                            'desc': desc,
                            'start': idx,
                            'end': idx
                        })
                        cur_idx += 1
                    count += 1

                for count in (0, 1, 2, 3, 4, 5, 6, 7):
                    if count < len(desc_list):
                        if desc_list[count]['start'] == desc_list[count][
                                'end']:
                            text = "Tuner %s: %s" % (desc_list[count]['start'],
                                                     desc_list[count]['desc'])
                        else:
                            text = "Tuner %s-%s: %s" % (
                                desc_list[count]['start'],
                                desc_list[count]['end'],
                                desc_list[count]['desc'])
                    else:
                        text = ""

                    self["Tuner" + str(count)] = StaticText(text)
                    if text != "":
                        self.tuner_list.append(text + "\n")

            self["HDDHeader"] = StaticText(_("Detected HDD:"))
            hddlist = harddiskmanager.HDDList()
            hdd = hddlist and hddlist[0][1] or None
            if hdd is not None and hdd.model() != "":
                self["hddA"] = StaticText(
                    _("%s\n(%s, %d MB free)") %
                    (hdd.model(), hdd.capacity(), hdd.free()))
            else:
                self["hddA"] = StaticText(_("none"))

            self.enigma2_version = _(
                "Version") + ": " + about.getEnigmaVersionString()
            self.image_version = _(
                "Image") + ": " + about.getImageVersionString()
            cpu_info = parseLines("/proc/cpuinfo")
            cpu_name = "N/A"
            for line in cpu_info:
                if line.find('model') != -1:
                    cpu_name = line.split(':')
                    if len(cpu_name) >= 2:
                        cpu_name = cpu_name[1].strip()
                    break

            self.cpu = _("CPU") + ": " + cpu_name
            self.chipset = _("Chipset") + ": " + parseFile(
                "/proc/stb/info/chipset")
            self.tuner_header = _("Detected NIMs:")
            self.hdd_header = _("Detected HDD:")
            self.hdd_list = []
            if len(hddlist):
                for hddX in hddlist:
                    hdd = hddX[1]
                    if hdd.model() != "":
                        self.hdd_list.append(
                            (hdd.model() + "\n   %.2f GB - %.2f GB" %
                             (hdd.diskSize() / 1000.0, hdd.free() / 1000.0) +
                             " " + _("free") + "\n\n"))

            ifaces = iNetwork.getConfiguredAdapters()
            iface_list = []
            for iface in ifaces:
                iface_list.append(
                    (_("Interface") + " : " + iNetwork.getAdapterName(iface) +
                     " (" + iNetwork.getFriendlyAdapterName(iface) + ")\n"))
                iface_list.append(
                    (_("IP") + " : " +
                     parse_ipv4(iNetwork.getAdapterAttribute(iface, "ip")) +
                     "\n"))
                iface_list.append((_("Netmask") + " : " + parse_ipv4(
                    iNetwork.getAdapterAttribute(iface, "netmask")) + "\n"))
                iface_list.append((_("Gateway") + " : " + parse_ipv4(
                    iNetwork.getAdapterAttribute(iface, "gateway")) + "\n"))
                if iNetwork.getAdapterAttribute(iface, "dhcp"):
                    iface_list.append((_("DHCP") + " : " + _("Yes") + "\n"))
                else:
                    iface_list.append((_("DHCP") + " : " + _("No") + "\n"))
                iface_list.append(
                    (_("MAC") + " : " +
                     iNetwork.getAdapterAttribute(iface, "mac") + "\n"))
                iface_list.append(("\n"))

            my_txt = self.enigma2_version + "\n"
            my_txt += self.image_version + "\n"
            my_txt += "\n"
            my_txt += self.cpu + "\n"
            my_txt += self.chipset + "\n"
            my_txt += "\n"
            my_txt += self.tuner_header + "\n"
            for x in self.tuner_list:
                my_txt += "   " + x
            my_txt += "\n"
            my_txt += _("Network") + ":\n"
            for x in iface_list:
                my_txt += "   " + x
            my_txt += self.hdd_header + "\n"
            for x in self.hdd_list:
                my_txt += "   " + x
            my_txt += "\n"

            self["FullAbout"] = ScrollLabel(my_txt)
        else:
            self["lab1"] = StaticText(_("openATV"))
            self["lab2"] = StaticText(_("By openATV Image Team"))
            self["lab3"] = StaticText(_("Support at") + " www.opena.tv")
            model = None
            AboutText = getAboutText()[0]
            self["AboutScrollLabel"] = ScrollLabel(AboutText)
Esempio n. 27
0
    def __init__(self, session, title="", **kwargs):
        Screen.__init__(self, session)
        self.setTitle(_("Virtual keyboard"))
        self.keys_list = []
        self.shiftkeys_list = []
        self.lang = language.getLanguage()
        self.nextLang = None
        self.shiftMode = False
        self.selectedKey = 0
        self.smsChar = None
        self.sms = NumericalTextInput(self.smsOK)

        self.key_bg = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_bg.png"))
        self.key_sel = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_sel.png"))
        self.key_backspace = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_backspace.png"))
        self.key_all = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_all.png"))
        self.key_clr = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_clr.png"))
        self.key_esc = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_esc.png"))
        self.key_ok = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_ok.png"))
        self.key_shift = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_shift.png"))
        self.key_shift_sel = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_shift_sel.png"))
        self.key_space = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_space.png"))
        self.key_left = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_left.png"))
        self.key_right = LoadPixmap(path=resolveFilename(
            SCOPE_CURRENT_SKIN, "skin_default/vkey_right.png"))

        self.keyImages = {
            "BACKSPACE": self.key_backspace,
            "ALL": self.key_all,
            "EXIT": self.key_esc,
            "OK": self.key_ok,
            "SHIFT": self.key_shift,
            "SPACE": self.key_space,
            "LEFT": self.key_left,
            "RIGHT": self.key_right
        }
        self.keyImagesShift = {
            "BACKSPACE": self.key_backspace,
            "CLEAR": self.key_clr,
            "EXIT": self.key_esc,
            "OK": self.key_ok,
            "SHIFT": self.key_shift_sel,
            "SPACE": self.key_space,
            "LEFT": self.key_left,
            "RIGHT": self.key_right
        }

        self["country"] = StaticText("")
        self["header"] = Label(title)
        self["text"] = Input(currPos=len(
            kwargs.get("text", "").decode("utf-8", 'ignore')),
                             allMarked=False,
                             **kwargs)
        self["list"] = VirtualKeyBoardList([])

        self["actions"] = NumberActionMap(
            [
                "OkCancelActions", "WizardActions", "ColorActions",
                "KeyboardInputActions", "InputBoxActions", "InputAsciiActions"
            ], {
                "gotAsciiCode": self.keyGotAscii,
                "ok": self.okClicked,
                "cancel": self.exit,
                "left": self.left,
                "right": self.right,
                "up": self.up,
                "down": self.down,
                "red": self.exit,
                "green": self.ok,
                "yellow": self.switchLang,
                "blue": self.shiftClicked,
                "deleteBackward": self.backClicked,
                "deleteForward": self.forwardClicked,
                "back": self.exit,
                "pageUp": self.cursorRight,
                "pageDown": self.cursorLeft,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal,
                "0": self.keyNumberGlobal,
            }, -2)
        self.setLang()
        self.onExecBegin.append(self.setKeyboardModeAscii)
        self.onLayoutFinish.append(self.buildVirtualKeyBoard)
        self.onClose.append(self.__onClose)
Esempio n. 28
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.title = _("Weather Plugin")
		self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions", "EPGSelectActions"],
		{
			"back": self.close,
			"input_date_time": self.config,
			"right": self.nextItem,
			"left": self.previousItem,
			"info": self.showWebsite
		}, -1)

		self["statustext"] = StaticText()
		self["currenticon"] = WeatherIcon()
		self["caption"] = StaticText()
		self["currentTemp"] = StaticText()
		self["condition"] = StaticText()
		self["wind_condition"] = StaticText()
		self["humidity"] = StaticText()
		self["observationtime"] = StaticText()
		self["observationpoint"] = StaticText()
		self["feelsliketemp"] = StaticText()
		
		i = 1
		while i <= 5:
			self["weekday%s" % i] = StaticText()
			self["weekday%s_icon" %i] = WeatherIcon()
			self["weekday%s_temp" % i] = StaticText()
			i += 1
		del i
		

		self.weatherPluginEntryIndex = -1
		self.weatherPluginEntryCount = config.plugins.WeatherPlugin.entrycount.value
		if self.weatherPluginEntryCount >= 1:
			self.weatherPluginEntry = config.plugins.WeatherPlugin.Entry[0]
			self.weatherPluginEntryIndex = 1
		else:
			self.weatherPluginEntry = None


		self.webSite = ""
		
		self.weatherData = None
		self.onLayoutFinish.append(self.startRun)
		self.onClose.append(self.__onClose)
Esempio n. 29
0
	def __init__(self, session, what):
		global HDSKIN, sizeH
		self.session = session
		self.what = what
		self.firstrun = True
		self.webif_data = self.readXML(typ = self.what)
		entry_count = len( self.webif_data )
#		entry_count = len(self.readXML(typ = self.what))
		ysize = fhd((entry_count + 4) * 25)
		ypos = 10
		if esHD():
			ypos2 = 5
		else:
			ypos2 = ypos
		self.sizeLH = sizeH - 20
		self.skin = """<screen position="center,center" size="%d, %d" title="Client Info" >""" % (sizeH-40, ysize)
		button_width = int(sizeH / 4)
		for k, v in enumerate(["red", "green", "yellow", "blue"]):
			xpos = k * button_width
			if esHD():
				self.skin += """<ePixmap name="%s" position="%d,%d" size="53,38" pixmap="/usr/share/enigma2/skin_default/buttons/key_%s.png" zPosition="1" transparent="1" alphatest="on" />""" % (v, xpos, ypos, v)
				self.skin += """<widget source="key_%s" render="Label" position="%d,%d" size="%d,%d" font="RegularHD;16" zPosition="1" valign="center" transparent="1" />""" % (v, xpos + 40, ypos2, button_width, fhd(20))
			else:
				self.skin += """<ePixmap name="%s" position="%d,%d" size="35,25" pixmap="/usr/share/enigma2/skin_default/buttons/key_%s.png" zPosition="1" transparent="1" alphatest="on" />""" % (v, xpos, ypos, v)
				self.skin += """<widget source="key_%s" render="Label" position="%d,%d" size="%d,%d" font="Regular;16" zPosition="1" valign="center" transparent="1" />""" % (v, xpos + 40, ypos2, button_width, fhd(20))
		if esHD():
			self.skin +="""<ePixmap name="divh" position="0,56" size="%d,3" pixmap="/usr/share/enigma2/skin_default/div-h.png" transparent="1" alphatest="on" />""" % sizeH
			self.skin +="""<widget name="output" position="15,68" size="%d,%d" zPosition="1" scrollbarMode="showOnDemand" />""" % ( self.sizeLH, ysize)
#			self.skin +="""<widget name="path" zPosition="10" position="10,45" size="%d,%d" zPosition="1" scrollbarMode="showOnDemand" />""" % ( self.sizeLH, ysize)
			self.skin += """</screen>"""
		else:
			self.skin +="""<ePixmap name="divh" position="0,37" size="%d,2" pixmap="/usr/share/enigma2/skin_default/div-h.png" transparent="1" alphatest="on" />""" % sizeH
			self.skin +="""<widget name="output" position="10,45" size="%d,%d" zPosition="1" scrollbarMode="showOnDemand" />""" % ( self.sizeLH, ysize)
#			self.skin +="""<widget name="path" zPosition="10" position="10,45" size="%d,%d" zPosition="1" scrollbarMode="showOnDemand" />""" % ( self.sizeLH, ysize)
			self.skin += """</screen>"""
		Screen.__init__(self, session)
		self.mlist = oscMenuList([])
		self["output"] = self.mlist
#		self["path"] = Label()
		self.errmsg = ""
		self["key_red"] = StaticText(_("Close"))
		if self.what == "c":
			self["key_green"] = StaticText("")
			self["key_yellow"] = StaticText(_("Servers"))
			self["key_blue"] = StaticText("Log")
		elif self.what == "s":
			self["key_green"] = StaticText(_("Clients"))
			self["key_yellow"] = StaticText("")
			self["key_blue"] = StaticText("Log")
		elif self.what == "l":
			self["key_green"] = StaticText(_("Clients"))
			self["key_yellow"] = StaticText(_("Servers"))
			self["key_blue"] = StaticText("")
		else:
			self["key_green"] = StaticText(_("Clients"))
			self["key_yellow"] = StaticText(_("Servers"))
			self["key_blue"] = StaticText("Log")
		self.fieldSizes = []
		self.fs2 = {}
		if config.oscaminfo.autoupdate.value:
			self.loop = eTimer()
			self.loop.callback.append(self.showData)
			timeout = int(config.oscaminfo.intervall.value) * 1000
			self.loop.start(timeout, False)
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
					{
						"ok": self.showData,
						"cancel": self.exit,
						"red": self.exit,
						"green": self.key_green,
						"yellow": self.key_yellow,
						"blue": self.key_blue
					}, -1)
		self.onLayoutFinish.append(self.showData)
Esempio n. 30
0
	def __init__(self, session, text, type=TYPE_YESNO, timeout=0, close_on_any_key=False, default=True, enable_input=True, msgBoxID=None, picon=True, simple=False, wizard=False, list=None, skin_name=None, timeout_default=None, title=None, windowTitle=None, showYESNO=False):
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		if text:
			self.text = _(text)
		else:
			self.text = text
		if type in range(self.TYPE_MESSAGE + 1):
			self.type = type
		else:
			self.type = self.TYPE_MESSAGE
		self.timeout = int(timeout)
		self.close_on_any_key = close_on_any_key
		if enable_input:
			self["actions"] = HelpableActionMap(self, ["MsgBoxActions", "DirectionActions"], {
				"cancel": (self.cancel, _("Cancel the selection")),
				"ok": (self.ok, _("Accept the current selection")),
				"alwaysOK": (self.alwaysOK, _("Always select OK")),
				"up": (self.up, _("Move up a line")),
				"down": (self.down, _("Move down a line")),
				"left": (self.left, _("Move up a page")),
				"right": (self.right, _("Move down a page"))
				# These actions are *ONLY* defined on OpenPLi!
				# I don't believe thay add any functionality even for OpenPLi.
				# "upRepeated": (self.up, _("Move up a line repeatedly")),
				# "downRepeated": (self.down, _("Move down a line repeatedly")),
				# "leftRepeated": (self.left, _("Move up a page repeatedly")),
				# "rightRepeated": (self.right, _("Move down a page repeatedly"))
			}, prio=-1, description=_("MessageBox Functions"))
		self.msgBoxID = msgBoxID
		# These six lines can go with new skins that only use self["icon"]...
		self["QuestionPixmap"] = Pixmap()
		self["QuestionPixmap"].hide()
		self["InfoPixmap"] = Pixmap()
		self["InfoPixmap"].hide()
		self["ErrorPixmap"] = Pixmap()
		self["ErrorPixmap"].hide()
		self["icon"] = MultiPixmap()
		self["icon"].hide()
		self.picon = picon
		if picon:
			# These five lines can go with new skins that only use self["icon"]...
			if self.type == self.TYPE_YESNO:
				self["QuestionPixmap"].show()
			elif self.type == self.TYPE_INFO or self.type == self.TYPE_WARNING:
				self["InfoPixmap"].show()
			elif self.type == self.TYPE_ERROR:
				self["ErrorPixmap"].show()
			self["icon"].show()
		self.skinName = ["MessageBox"]
		if simple:
			self.skinName = ["MessageBoxSimple"]
		if wizard:
			self["rc"] = MultiPixmap()
			self["rc"].setPixmapNum(config.misc.rcused.value)
			self.skinName = ["MessageBoxWizard"]
		if not skin_name:
			skin_name = []
		if isinstance(skin_name, str):
			self.skinName = [skin_name] + self.skinName
		if not list:
			list = []
		if type == self.TYPE_YESNO or showYESNO:
			if list:
				self.list = list
			elif default:
				self.list = [(_("Yes"), True), (_("No"), False)]
			else:
				self.list = [(_("No"), False), (_("Yes"), True)]
		else:
			self.list = []
		self.timeout_default = timeout_default
		self.baseTitle = title or windowTitle or self.TYPE_PREFIX.get(self.type, None)
		self.activeTitle = None
		# DEBUG: This is a temporary patch to stop the VuRemote and GigaBlueRemote plugins from crashing!
		# If this code is accepted then the offending lines from the plugins can safely be removed.
		self.timerRunning = None  # DEBG: See note above!
		self["text"] = Label(self.text)
		self["Text"] = StaticText(self.text)  # What is self["Text"] for?
		self["selectedChoice"] = StaticText()
		self["list"] = MenuList(self.list)
		if self.list:
			self["selectedChoice"].setText(self.list[0][0])
		else:
			self["list"].hide()
		self["key_help"] = StaticText(_("HELP"))
		self.timer = eTimer()
		self.timer.callback.append(self.processTimer)
		if self.layoutFinished not in self.onLayoutFinish:
			self.onLayoutFinish.append(self.layoutFinished)
Esempio n. 31
0
	def __init__(self, session, tlist, menuTitle):
		Screen.__init__(self, session)
		self.skinName = 'Animmain'
		self.tlist = tlist
		ipage = 1
		list = []
		nopic = len(tlist)
		self.pos = []
		self.index = 0
		title = menuTitle
		self['title'] = Button(title)
		list = []
		tlist = []
		self['label1'] = StaticText()
		self['label2'] = StaticText()
		self['label3'] = StaticText()
		self['label4'] = StaticText()
		self['label5'] = StaticText()
		self['red'] = Button(_('Exit'))
		self['green'] = Button(_('Select'))
		self['yellow'] = Button(_('Config'))
		self['actions'] = NumberActionMap(['OkCancelActions',
		 'MenuActions',
		 'DirectionActions',
		 'NumberActions',
		 'ColorActions'], {'ok': self.okbuttonClick,
		 'cancel': self.closeNonRecursive,
		 'left': self.key_left,
		 'right': self.key_right,
		 'up': self.key_up,
		 'down': self.key_down,
		 'red': self.cancel,
		 'green': self.okbuttonClick,
		 'yellow': self.key_menu,
		 'menu': self.closeRecursive,
		 '1': self.keyNumberGlobal,
		 '2': self.keyNumberGlobal,
		 '3': self.keyNumberGlobal,
		 '4': self.keyNumberGlobal,
		 '5': self.keyNumberGlobal,
		 '6': self.keyNumberGlobal,
		 '7': self.keyNumberGlobal,
		 '8': self.keyNumberGlobal,
		 '9': self.keyNumberGlobal})
		nop = len(self.tlist)
		self.nop = nop
		nh = 1
		if nop == 1:
			nh = 1
		elif nop == 2:
			nh = 2
		elif nop == 3:
			nh = 2
		elif nop == 4:
			nh = 3
		elif nop == 5:
			nh = 3
		else:
			nh = int(float(nop) / 2)
		self.index = nh
		i = 0
		self.onShown.append(self.openTest)
Esempio n. 32
0
class UpdatePlugin(Screen):
	skin = """
		<screen name="UpdatePlugin" position="center,center" size="550,300">
			<widget name="activityslider" position="0,0" size="550,5"  />
			<widget name="slider" position="0,150" size="550,30"  />
			<widget source="package" render="Label" position="10,30" size="540,20" font="Regular;18" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
			<widget source="status" render="Label" position="10,180" size="540,100" font="Regular;20" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
		</screen>"""

	def __init__(self, session, *args):
		Screen.__init__(self, session)

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }

		self.setTitle(_("Software update"))
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None

		self.channellist_only = 0
		self.channellist_name = ''
		self.updating = False
		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)
		self.onClose.append(self.__close)

		self["actions"] = ActionMap(["WizardActions"], 
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)
		
		self.activity = 0 
		self.activityTimer = eTimer()
		self.activityTimer.callback.append(self.checkTraficLight)
		self.activityTimer.callback.append(self.doActivityTimer)
		self.activityTimer.start(100, True)

	def checkTraficLight(self):
	
		self.activityTimer.callback.remove(self.checkTraficLight)
		self.activityTimer.start(100, False)

		from urllib import urlopen
		import socket
		import os
		currentTimeoutDefault = socket.getdefaulttimeout()
		socket.setdefaulttimeout(3)
		message = ""
		picon = None
		default = True
		try:
			# TODO: Use Twisted's URL fetcher, urlopen is evil. And it can
			# run in parallel to the package update.
			if getBoxType() in urlopen("http://openpli.org/status").read().split(','):
				message = _("The current beta image might not be stable.\nFor more information see www.openpli.org.")
				picon = MessageBox.TYPE_ERROR
				default = False
		except:
			message = _("The status of the current beta image could not be checked because www.openpli.org can not be reached.")
			picon = MessageBox.TYPE_ERROR
			default = False
		socket.setdefaulttimeout(currentTimeoutDefault)
		if default:
			self.startActualUpdate(True)
		else:
			message += "\n" + _("Do you want to update your receiver?")
			self.session.openWithCallback(self.startActualUpdate, MessageBox, message, default = default, picon = picon)

	def startActualUpdate(self,answer):
		if answer:
			self.updating = True
			self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
		else:
			self.close()

	def doActivityTimer(self):
		self.activity += 1
		if self.activity == 100:
			self.activity = 0
		self.activityslider.setValue(self.activity)

	def showUpdateCompletedMessage(self):
		self.setEndMessage(ngettext("Update completed, %d package was installed.", "Update completed, %d packages were installed.", self.packages) % self.packages)

	def ipkgCallback(self, event, param):
		if event == IpkgComponent.EVENT_DOWNLOAD:
			self.status.setText(_("Downloading"))
		elif event == IpkgComponent.EVENT_UPGRADE:
			if self.sliderPackages.has_key(param):
				self.slider.setValue(self.sliderPackages[param])
			self.package.setText(param)
			self.status.setText(_("Upgrading") + ": %s/%s" % (self.packages, self.total_packages))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_INSTALL:
			self.package.setText(param)
			self.status.setText(_("Installing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_REMOVE:
			self.package.setText(param)
			self.status.setText(_("Removing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_CONFIGURING:
			self.package.setText(param)
			self.status.setText(_("Configuring"))
		elif event == IpkgComponent.EVENT_MODIFIED:
			if config.plugins.softwaremanager.overwriteConfigFiles.value in ("N", "Y"):
				self.ipkg.write(True and config.plugins.softwaremanager.overwriteConfigFiles.value)
			else:
				self.session.openWithCallback(
					self.modificationCallback,
					MessageBox,
					_("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?") % (param)
				)
		elif event == IpkgComponent.EVENT_ERROR:
			self.error += 1
		elif event == IpkgComponent.EVENT_DONE:
			if self.updating:
				self.updating = False
				self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
			elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
				self.total_packages = len(self.ipkg.getFetchedList())
				if self.total_packages:
					message = _("Do you want to update your receiver?") + "\n(" + (ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")"
					choices = [(_("Update and reboot (recommended)"), "cold"),
						(_("Update and ask to reboot"), "hot"),
						(_("Update channel list only"), "channels"),
						(_("Cancel"), "")]
					self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices)
				else:
					self.session.openWithCallback(self.close, MessageBox, _("No updates available"), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
			elif self.channellist_only > 0:
				if self.channellist_only == 1:
					self.setEndMessage(_("Could not find installed channel list."))
				elif self.channellist_only == 2:
					self.slider.setValue(2)
					self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {'package': self.channellist_name})
					self.channellist_only += 1
				elif self.channellist_only == 3:
					self.slider.setValue(3)
					self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': self.channellist_name})
					self.channellist_only += 1
				elif self.channellist_only == 4:
					self.showUpdateCompletedMessage()
					eDVBDB.getInstance().reloadBouquets()
					eDVBDB.getInstance().reloadServicelist()
			elif self.error == 0:
				self.showUpdateCompletedMessage()
			else:
				self.activityTimer.stop()
				self.activityslider.setValue(0)
				error = _("Your receiver might be unusable now. Please consult the manual for further assistance before rebooting your receiver.")
				if self.packages == 0:
					error = _("No updates available. Please try again later.")
				if self.updating:
					error = _("Update failed. Your receiver does not have a working internet connection.")
				self.status.setText(_("Error") +  " - " + error)
		elif event == IpkgComponent.EVENT_LISTITEM:
			if 'enigma2-plugin-settings-' in param[0] and self.channellist_only > 0:
				self.channellist_name = param[0]
				self.channellist_only = 2
		#print event, "-", param
		pass

	def setEndMessage(self, txt):
		self.slider.setValue(4)
		self.activityTimer.stop()
		self.activityslider.setValue(0)
		self.package.setText(txt)
		self.status.setText(self.oktext)

	def startActualUpgrade(self, answer):
		if not answer or not answer[1]:
			self.close()
			return
		if answer[1] == "cold":
			self.session.open(TryQuitMainloop,retvalue=42)
			self.close()
		elif answer[1] == "channels":
			self.channellist_only = 1
			self.slider.setValue(1)
			self.ipkg.startCmd(IpkgComponent.CMD_LIST, args = {'installed_only': True})
		else:
			self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False})

	def modificationCallback(self, res):
		self.ipkg.write(res and "N" or "Y")

	def exit(self):
		if not self.ipkg.isRunning():
			if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
				self.session.openWithCallback(self.exitAnswer, MessageBox, _("Update completed. Do you want to reboot your receiver?"))
			else:
				self.close()
		else:
			if not self.updating:
				self.close()

	def exitAnswer(self, result):
		if result is not None and result:
			self.session.open(TryQuitMainloop,retvalue=2)
		self.close()

	def __close(self):
		self.ipkg.removeCallback(self.ipkgCallback)
Esempio n. 33
0
	def __init__(self, session, tlist, menuTitle):
		Screen.__init__(self, session)
		self.skinName = 'Iconmain'
		self.tlist = tlist
		ipage = 1
		list = []
		nopic = len(self.tlist)
		self.pos = []
		self.ipage = 1
		self.index = 0
		title = menuTitle
		self['title'] = Button(title)
		self.icons = []
		self.indx = []
		n1 = len(tlist)
		self.picnum = n1
		list = []
		tlist = []
		self['label1'] = StaticText()
		self['label2'] = StaticText()
		self['label3'] = StaticText()
		self['label4'] = StaticText()
		self['label5'] = StaticText()
		self['label6'] = StaticText()
		self['label1s'] = StaticText()
		self['label2s'] = StaticText()
		self['label3s'] = StaticText()
		self['label4s'] = StaticText()
		self['label5s'] = StaticText()
		self['label6s'] = StaticText()
		self['pointer'] = Pixmap()
		self['pixmap1'] = Pixmap()
		self['pixmap2'] = Pixmap()
		self['pixmap3'] = Pixmap()
		self['pixmap4'] = Pixmap()
		self['pixmap5'] = Pixmap()
		self['pixmap6'] = Pixmap()
		self['red'] = Button(_('Exit'))
		self['green'] = Button(_('Select'))
		self['yellow'] = Button(_('Config'))
		self['actions'] = NumberActionMap(['OkCancelActions',
		 'MenuActions',
		 'DirectionActions',
		 'NumberActions',
		 'ColorActions'], {'ok': self.okbuttonClick,
		 'cancel': self.closeNonRecursive,
		 'left': self.key_left,
		 'right': self.key_right,
		 'up': self.key_up,
		 'down': self.key_down,
		 'red': self.cancel,
		 'green': self.okbuttonClick,
		 'yellow': self.key_menu,
		 'menu': self.closeRecursive,
		 '1': self.keyNumberGlobal,
		 '2': self.keyNumberGlobal,
		 '3': self.keyNumberGlobal,
		 '4': self.keyNumberGlobal,
		 '5': self.keyNumberGlobal,
		 '6': self.keyNumberGlobal,
		 '7': self.keyNumberGlobal,
		 '8': self.keyNumberGlobal,
		 '9': self.keyNumberGlobal})
		self.index = 0
		i = 0
		self.maxentry = 29
		self.istart = 0
		i = 0
		self.onShown.append(self.openTest)
Esempio n. 34
0
    def __init__(self,
                 session,
                 text,
                 type=TYPE_YESNO,
                 timeout=-1,
                 close_on_any_key=False,
                 default=True,
                 enable_input=True,
                 msgBoxID=None,
                 picon=None,
                 simple=False,
                 list=[],
                 timeout_default=None,
                 title=None):
        self.type = type
        Screen.__init__(self, session)
        self.setScreenPathMode(None)
        if simple:
            self.skinName = "MessageBoxSimple"

        self.msgBoxID = msgBoxID

        self["autoresize"] = Label("")  #do not remove, used for autoResize()
        self["text"] = Label(text)
        self["Text"] = StaticText(text)
        self["selectedChoice"] = StaticText()

        self.text = text
        self.close_on_any_key = close_on_any_key
        self.timeout_default = timeout_default

        self["ErrorPixmap"] = Pixmap()
        self["QuestionPixmap"] = Pixmap()
        self["InfoPixmap"] = Pixmap()
        self["WarningPixmap"] = Pixmap()
        self.timerRunning = False
        self.initTimeout(timeout)

        picon = picon or type
        if picon != self.TYPE_ERROR:
            self["ErrorPixmap"].hide()
        if picon != self.TYPE_YESNO:
            self["QuestionPixmap"].hide()
        if picon != self.TYPE_INFO:
            self["InfoPixmap"].hide()
        if picon != self.TYPE_WARNING:
            self["WarningPixmap"].hide()
        self.title = title or self.type < self.TYPE_MESSAGE and [
            _("Question"),
            _("Information"),
            _("Warning"),
            _("Error")
        ][self.type] or _("Message")
        if type == self.TYPE_YESNO:
            if list:
                self.list = list
            elif default:
                self.list = [(_("yes"), True), (_("no"), False)]
            else:
                self.list = [(_("no"), False), (_("yes"), True)]
        else:
            self.list = []

        self["list"] = MenuList(self.list)
        if self.list:
            self["selectedChoice"].setText(self.list[0][0])
        else:
            self["list"].hide()

        if enable_input:
            self["actions"] = ActionMap(
                ["MsgBoxActions", "DirectionActions"], {
                    "cancel": self.cancel,
                    "ok": self.ok,
                    "alwaysOK": self.alwaysOK,
                    "up": self.up,
                    "down": self.down,
                    "left": self.left,
                    "right": self.right,
                    "upRepeated": self.up,
                    "downRepeated": self.down,
                    "leftRepeated": self.left,
                    "rightRepeated": self.right
                }, -1)
        self.setTitle(self.title)
Esempio n. 35
0
    def __init__(self, session, feid, nr_of_ports, simple_tone,
                 simple_sat_change):
        self.skin = AutoDiseqc.skin
        Screen.__init__(self, session)

        self["statusbar"] = StaticText(" ")
        self["tunerstatusbar"] = StaticText(" ")

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=self.session)

        self["config"].list = self.list
        self["config"].l.setList(self.list)

        self["key_red"] = StaticText(_("Abort"))

        self.index = 0
        self.port_index = 0
        self.feid = feid
        self.nr_of_ports = nr_of_ports
        self.simple_tone = simple_tone
        self.simple_sat_change = simple_sat_change
        self.found_sats = []
        self.circular_setup = False
        sat_found = False
        for x in self.sat_frequencies:
            if x[self.SAT_TABLE_ORBPOS] == 360:
                sat_found = True
        if self.nr_of_ports == 1:
            if not sat_found:
                self.sat_frequencies += self.circular_sat_frequencies
        elif sat_found:
            self.sat_frequencies.remove(x)

        if not self.openFrontend():
            self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
            self.session.nav.stopService()
            if not self.openFrontend():
                if self.session.pipshown:
                    if hasattr(self.session, 'infobar'):
                        if self.session.infobar.servicelist and self.session.infobar.servicelist.dopipzap:
                            self.session.infobar.servicelist.togglePipzap()
                    if hasattr(self.session, 'pip'):
                        del self.session.pip
                    self.session.pipshown = False
                if not self.openFrontend():
                    self.frontend = None
                    self.raw_channel = None

        if self.raw_channel:
            self.raw_channel.receivedTsidOnid.get().append(self.gotTsidOnid)

        self["actions"] = ActionMap(["SetupActions"], {
            "cancel": self.keyCancel,
        }, -2)

        self.count = 0
        self.state = 0
        self.abort = False

        self.statusTimer = eTimer()
        self.statusTimer.callback.append(self.statusCallback)
        self.tunerStatusTimer = eTimer()
        self.tunerStatusTimer.callback.append(self.tunerStatusCallback)
        self.startStatusTimer()
        self.onClose.append(self.__onClose)
Esempio n. 36
0
	def __init__(self, session, eventName, callbackNeeded=False):
		Screen.__init__(self, session)

		for tag in config.plugins.imdb.ignore_tags.getValue().split(','):
			eventName = eventName.replace(tag,'')

		self.eventName = eventName

		self.callbackNeeded = callbackNeeded
		self.callbackData = ""
		self.callbackGenre = ""

		self.dictionary_init()

		self["poster"] = Pixmap()
		self.picload = ePicLoad()
		self.picload.PictureData.get().append(self.paintPosterPixmapCB)

		self["stars"] = ProgressBar()
		self["starsbg"] = Pixmap()
		self["stars"].hide()
		self["starsbg"].hide()
		self.ratingstars = -1

		self["title"] = StaticText(_("The Internet Movie Database"))
		# map new source -> old component
		def setText(txt):
			StaticText.setText(self["title"], txt)
			self["titellabel"].setText(txt)
		self["title"].setText = setText
		self["titellabel"] = Label()
		self["detailslabel"] = ScrollLabel("")
		self["castlabel"] = ScrollLabel("")
		self["extralabel"] = ScrollLabel("")
		self["statusbar"] = Label("")
		self["ratinglabel"] = Label("")
		self.resultlist = []
		self["menu"] = MenuList(self.resultlist)
		self["menu"].hide()

		self["key_red"] = Button(_("Exit"))
		self["key_green"] = Button("")
		self["key_yellow"] = Button("")
		self["key_blue"] = Button("")

		# 0 = multiple query selection menu page
		# 1 = movie info page
		# 2 = extra infos page
		self.Page = 0

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "MovieSelectionActions", "DirectionActions"],
		{
			"ok": self.showDetails,
			"cancel": self.exit,
			"down": self.pageDown,
			"up": self.pageUp,
			"red": self.exit,
			"green": self.showMenu,
			"yellow": self.showDetails,
			"blue": self.showExtras,
			"contextMenu": self.contextMenuPressed,
			"showEventInfo": self.showDetails
		}, -1)

		self.getIMDB()
Esempio n. 37
0
    def __init__(self, session, menu_path="", serviceref=None):
        Screen.__init__(self, session)
        self.menu_path = menu_path

        self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {
            "ok": self.close,
            "cancel": self.close,
            "red": self.close,
        }, -1)

        self["infolist"] = ServiceInfoList([])
        self["key_red"] = self["red"] = Label(_("Exit"))

        self.transponder_info = self.info = self.feinfo = None
        play_service = session.nav.getCurrentlyPlayingServiceReference()
        if serviceref and not play_service and play_service != serviceref:
            screentitle = _("Transponder Information")
            self.type = TYPE_TRANSPONDER_INFO
            self.skinName = "ServiceInfoSimple"
            self.transponder_info = eServiceCenter.getInstance().info(
                serviceref).getInfoObject(serviceref,
                                          iServiceInformation.sTransponderData)
            # info is a iStaticServiceInformation, not a iServiceInformation
        else:
            screentitle = _("Service")
            self.type = TYPE_SERVICE_INFO
            service = session.nav.getCurrentService()
            if service:
                self.transponder_info = None
                self.info = service.info()
                self.feinfo = service.frontendInfo()
                if self.feinfo and not self.feinfo.getAll(True):
                    self.feinfo = None
                    serviceref = play_service
                    self.transponder_info = serviceref and eServiceCenter.getInstance(
                    ).info(serviceref).getInfoObject(
                        serviceref, iServiceInformation.sTransponderData)
            if self.feinfo or self.transponder_info:
                self["actions2"] = ActionMap(
                    ["ColorActions"], {
                        "yellow": self.ShowServiceInformation,
                        "blue": self.ShowTransponderInformation
                    }, -1)
                self["key_yellow"] = self["yellow"] = Label(
                    _("Service & PIDs"))
                self["key_blue"] = self["blue"] = Label(
                    _("Tuner settings values"))
            else:
                self.skinName = "ServiceInfoSimple"

        if config.usage.show_menupath.value == 'large':
            self.menu_path += screentitle
            title = self.menu_path
            self["menu_path_compressed"] = StaticText("")
            self.menu_path += ' / '
        elif config.usage.show_menupath.value == 'small':
            title = screentitle
            condtext = ""
            if self.menu_path and not self.menu_path.endswith(' / '):
                condtext = self.menu_path + " >"
            elif self.menu_path:
                condtext = self.menu_path[:-3] + " >"
            self["menu_path_compressed"] = StaticText(condtext)
            self.menu_path += screentitle + ' / '
        else:
            title = screentitle
            self["menu_path_compressed"] = StaticText("")
        Screen.setTitle(self, title)

        tlist = []
        self.onShown.append(self.ShowServiceInformation)
Esempio n. 38
0
    def __init__(self, session):
        Screen.__init__(self, session)

        AboutText = _("Hardware: ") + about.getHardwareTypeString() + "\n"
        AboutText += _("CPU: ") + about.getCPUInfoString() + "\n"
        AboutText += _("Image: ") + about.getImageTypeString() + "\n"
        AboutText += _(
            "Kernel version: ") + about.getKernelVersionString() + "\n"

        EnigmaVersion = "Enigma: " + about.getEnigmaVersionString()
        self["EnigmaVersion"] = StaticText(EnigmaVersion)
        AboutText += EnigmaVersion + "\n"

        GStreamerVersion = "GStreamer: " + about.getGStreamerVersionString()
        self["GStreamerVersion"] = StaticText(GStreamerVersion)
        AboutText += GStreamerVersion + "\n"

        ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
        self["ImageVersion"] = StaticText(ImageVersion)
        AboutText += ImageVersion + "\n"

        AboutText += _("DVB drivers: ") + about.getDriverInstalledDate() + "\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        else:
            fp_version = _("Frontprocessor version: %d") % fp_version
            AboutText += fp_version + "\n"

        self["FPVersion"] = StaticText(fp_version)

        self["TunerHeader"] = StaticText(_("Detected NIMs:"))
        AboutText += "\n" + _("Detected NIMs:") + "\n"

        nims = nimmanager.nimList()
        for count in range(len(nims)):
            if count < 4:
                self["Tuner" + str(count)] = StaticText(nims[count])
            else:
                self["Tuner" + str(count)] = StaticText("")
            AboutText += nims[count] + "\n"

        self["HDDHeader"] = StaticText(_("Detected HDD:"))
        AboutText += "\n" + _("Detected HDD:") + "\n"

        hddlist = harddiskmanager.HDDList()
        hddinfo = ""
        if hddlist:
            for count in range(len(hddlist)):
                if hddinfo:
                    hddinfo += "\n"
                hdd = hddlist[count][1]
                if int(hdd.free()) > 1024:
                    hddinfo += "%s\n(%s, %d GB %s)" % (
                        hdd.model(), hdd.capacity(), hdd.free() / 1024,
                        _("free"))
                else:
                    hddinfo += "%s\n(%s, %d MB %s)" % (
                        hdd.model(), hdd.capacity(), hdd.free(), _("free"))
        else:
            hddinfo = _("none")
        self["hddA"] = StaticText(hddinfo)
        AboutText += hddinfo
        self["AboutScrollLabel"] = ScrollLabel(AboutText)
        self["key_green"] = Button(_("Translations"))
        self["key_red"] = Button(_("Latest Commits"))

        self["actions"] = ActionMap(
            ["ColorActions", "SetupActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "red": self.showCommits,
                "green": self.showTranslationInfo,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
Esempio n. 39
0
	def __init__(self, session, eventName, callbackNeeded=False, save=False, savepath=None, localpath=None):
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)

		for tag in config.plugins.imdb.ignore_tags.getValue().split(','):
			eventName = eventName.replace(tag,'')

		eventName = ' '.join(eventName.split()).strip()

		self.eventName = eventName

		self.callbackNeeded = callbackNeeded
		self.callbackData = ""
		self.callbackGenre = ""

		self.saving = save
		self.savingpath = savepath
		self.localpath = localpath
		self.fetchurl = None

		self.dictionary_init()

		self["poster"] = Pixmap()
		self.picload = ePicLoad()
		self.picload.PictureData.get().append(self.paintPosterPixmapCB)

		self["stars"] = ProgressBar()
		self["starsbg"] = Pixmap()
		self["stars"].hide()
		self["starsbg"].hide()
		self.ratingstars = -1

		self["title"] = StaticText(_("The Internet Movie Database"))
		# map new source -> old component
		def setText(txt):
			StaticText.setText(self["title"], txt)
			self["titellabel"].setText(txt)
		self["title"].setText = setText
		self["titellabel"] = Label()
		self["detailslabel"] = ScrollLabel("")
		self["castlabel"] = ScrollLabel("")
		self["extralabel"] = ScrollLabel("")
		self["statusbar"] = Label("")
		self["ratinglabel"] = Label("")
		self.resultlist = []
		self["menu"] = MenuList(self.resultlist)
		self["menu"].hide()

		self["key_red"] = Button(_("Exit"))
		self["key_green"] = Button("")
		self["key_yellow"] = Button("")
		self["key_blue"] = Button("")

		# 0 = multiple query selection menu page
		# 1 = movie info page
		# 2 = extra infos page
		self.Page = 0

		self["actionsOk"] = HelpableActionMap(self, "OkCancelActions",
		{
			"ok": (self.showDetails, _("Show movie and series basic details")),
			"cancel": (self.exit, _("Exit IMDb search")),
		}, -1)
		self["actionsColor"] = HelpableActionMap(self, "ColorActions",
		{
			"red": (self.exit, _("Exit IMDb search")),
			"green": (self.showMenu, _("Show list of matched movies an series")),
			"yellow": (self.showDetails, _("Show movie and series basic details")),
			"blue": (self.showExtras, _("Show movie and series extra details")),
		}, -1)
		self["actionsMovieSel"] = HelpableActionMap(self, "MovieSelectionActions",
		{
			"contextMenu": (self.contextMenuPressed, _("Menu")),
			"showEventInfo": (self.showDetails, _("Show movie and series basic details")),
		}, -1)
		self["actionsDir"] = HelpableActionMap(self, "DirectionActions",
		{
			"down": (self.pageDown, _("Page down")),
			"up": (self.pageUp, _("Page up")),
		}, -1)

		self.getIMDB()

		if self.localpath is not None:                                # otherwise the stars are not correctly shown if we call details directly
			self.onLayoutFinish.append(self._layoutFinished)
Esempio n. 40
0
    def __init__(self, session, autotimer, name, begin, end, disabled, sref,
                 afterEvent, justplay, dirname, tags):
        Screen.__init__(self, session)

        # Keep AutoTimer
        self.autotimer = autotimer

        # Initialize Buttons
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["key_yellow"] = StaticText()
        self["key_blue"] = StaticText()

        entries = []
        append = entries.append
        self["list"] = SelectionList()

        if disabled is not None:
            append(
                SelectionEntryComponent(
                    ': '.join((_("Enabled"), {
                        True: _("disable"),
                        False: _("enable")
                    }[bool(disabled)])), not disabled, 0, True))

        if name != "":
            append(
                SelectionEntryComponent(
                    _("Match title: %s") % (name), name, 1, True))
            append(SelectionEntryComponent(_("Exact match"), True, 8, True))

        if begin and end:
            begin = localtime(begin)
            end = localtime(end)
            append(
                SelectionEntryComponent(
                    _("Match Timespan: %02d:%02d - %02d:%02d") %
                    (begin[3], begin[4], end[3], end[4]),
                    ((begin[3], begin[4]), (end[3], end[4])), 2, True))
            append(
                SelectionEntryComponent(
                    _("Only on Weekday: %s") %
                    (weekdays[begin.tm_wday][1],
                     ),  # XXX: the lookup is dirty but works :P
                    str(begin.tm_wday),
                    9,
                    True))

        if sref:
            append(
                SelectionEntryComponent(
                    _("Only on Service: %s") % (sref.getServiceName().replace(
                        '\xc2\x86', '').replace('\xc2\x87', '')), str(sref), 3,
                    True))

        if afterEvent is not None:
            append(
                SelectionEntryComponent(
                    ': '.join((_("After event"), afterevent[afterEvent])),
                    afterEvent, 4, True))

        if justplay is not None:
            append(
                SelectionEntryComponent(
                    ': '.join((_("Timer type"), {
                        0: _("record"),
                        1: _("zap")
                    }[int(justplay)])), int(justplay), 5, True))

        if dirname is not None:
            append(
                SelectionEntryComponent(
                    ': '.join((_("Location"), dirname or "/hdd/movie/")),
                    dirname, 6, True))

        if tags:
            append(
                SelectionEntryComponent(
                    ': '.join((_("Tags"), ', '.join(tags))), tags, 7, True))

        self["list"].setList(entries)

        # Define Actions
        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions"], {
                "ok": self["list"].toggleSelection,
                "cancel": self.cancel,
                "red": self.cancel,
                "green": self.accept
            }, -1)

        self.onLayoutFinish.append(self.setCustomTitle)
Esempio n. 41
0
    def __init__(self, session, filelist, index, path):

        self.textcolor = config.pic.textcolor.value
        self.bgcolor = config.pic.bgcolor.value
        space = config.pic.framesize.value

        self.size_w = size_w = getDesktop(0).size().width()
        self.size_h = size_h = getDesktop(0).size().height()

        if config.pic.fullview_resolution.value and (size_w, size_h) != eval(
                config.pic.fullview_resolution.value):
            (size_w, size_h) = eval(config.pic.fullview_resolution.value)
            gMainDC.getInstance().setResolution(size_w, size_h)
            getDesktop(0).resize(eSize(size_w, size_h))

        self.skin = "<screen position=\"0,0\" size=\"" + str(
            size_w
        ) + "," + str(size_h) + "\" flags=\"wfNoBorder\" > \
			<eLabel position=\"0,0\" zPosition=\"0\" size=\"" + str(size_w) + "," + str(
            size_h
        ) + "\" backgroundColor=\"" + self.bgcolor + "\" /><widget name=\"pic\" position=\"" + str(
            space) + "," + str(space) + "\" size=\"" + str(
                size_w - (space * 2)) + "," + str(
                    size_h - (space * 2)
                ) + "\" zPosition=\"1\" alphatest=\"on\" /> \
			<widget name=\"point\" position=\"" + str(space + 5) + "," + str(
                    space + 2
                ) + "\" size=\"20,20\" zPosition=\"2\" pixmap=\"skin_default/icons/record.png\" alphatest=\"on\" /> \
			<widget name=\"play_icon\" position=\"" + str(space + 25) + "," + str(
                    space + 2
                ) + "\" size=\"20,20\" zPosition=\"2\" pixmap=\"skin_default/icons/ico_mp_play.png\"  alphatest=\"on\" /> \
			<widget source=\"file\" render=\"Label\" position=\"" + str(
                    space + 45
                ) + "," + str(space) + "\" size=\"" + str(
                    size_w - (space * 2) - 50
                ) + ",25\" font=\"Regular;20\" borderWidth=\"1\" borderColor=\"#000000\" halign=\"left\" foregroundColor=\"" + self.textcolor + "\" zPosition=\"2\" noWrap=\"1\" transparent=\"1\" /></screen>"

        Screen.__init__(self, session)

        self["actions"] = ActionMap(
            [
                "OkCancelActions", "ColorActions", "DirectionActions",
                "MovieSelectionActions", "MenuActions"
            ], {
                "ok": self.PlayPause,
                "cancel": self.Exit,
                "green": self.PlayPause,
                "yellow": self.PlayPause,
                "blue": self.nextPic,
                "red": self.prevPic,
                "left": self.prevPic,
                "right": self.nextPic,
                "showEventInfo": self.StartExif,
                "menu": self.KeyMenu,
            }, -1)

        self["point"] = Pixmap()
        self["pic"] = Pixmap()
        self["play_icon"] = Pixmap()
        self["file"] = StaticText(_("please wait, loading picture..."))

        self.old_index = 0
        self.filelist = []
        self.lastindex = index
        self.currPic = []
        self.shownow = True
        self.dirlistcount = 0

        for x in filelist:
            if len(filelist[0]) == 3:  #orig. filelist
                if x[0][1] == False:
                    self.filelist.append(path + x[0][0])
                else:
                    self.dirlistcount += 1
            elif len(filelist[0]) == 2:  #scanlist
                if x[0][1] == False:
                    self.filelist.append(x[0][0])
                else:
                    self.dirlistcount += 1
            else:  # thumbnaillist
                self.filelist.append(x[T_FULL])

        self.maxentry = len(self.filelist) - 1
        self.index = index - self.dirlistcount
        if self.index < 0:
            self.index = 0

        self.picload = ePicLoad()
        self.picload.PictureData.get().append(self.finish_decode)

        self.slideTimer = eTimer()
        self.slideTimer.callback.append(self.slidePic)

        if self.maxentry >= 0:
            self.onLayoutFinish.append(self.setPicloadConf)
Esempio n. 42
0
    def __init__(self, session):
        Screen.__init__(self, session)
        Screen.setTitle(self, _("OnDemand Configuration"))
        self.skinName = ["OnDemandScreenSetup", "Setup"]

        self.configlist = []
        ConfigListScreen.__init__(self, self.configlist)
        self.configlist.append(
            getConfigListEntry((_("Show in main menu")),
                               config.ondemand.ShowMainMenu))
        self.configlist.append(
            getConfigListEntry((_("Show in plugin browser")),
                               config.ondemand.ShowPluginBrowser))
        self.configlist.append(
            getConfigListEntry((_("Show in extensions")),
                               config.ondemand.ShowExtensions))
        self.configlist.append(
            getConfigListEntry((_("Show Thumbnails")),
                               config.ondemand.ShowImages))

        self.configlist.append(
            getConfigListEntry((_("Preferred Stream Quality")),
                               config.ondemand.PreferredQuality))

        #self.configlist.append(getConfigListEntry((_("BBC iPlayer")), config.ondemand.ShowBBCiPlayer))
        self.configlist.append(
            getConfigListEntry((_("ITV Player")),
                               config.ondemand.ShowITVPlayer))
        #self.configlist.append(getConfigListEntry((_("4OD Player")), config.ondemand.Show4ODPlayer))
        self.configlist.append(
            getConfigListEntry((_("3 Player")), config.ondemand.Show3Player))
        self.configlist.append(
            getConfigListEntry((_("ABC iView")),
                               config.ondemand.ShowiViewPlayer))
        self.configlist.append(
            getConfigListEntry((_("RTE Player")),
                               config.ondemand.ShowRTEPlayer))

        self.configlist.append(
            getConfigListEntry((_("iRadio Player")),
                               config.ondemand.ShowiRadioPlayer))
        self.configlist.append(
            getConfigListEntry((_("iRadio: Display WMA Streams")),
                               config.ondemand.ShowiRadioWMA))
        self.configlist.append(
            getConfigListEntry((_("iRadio: Display Favorite Thumbnails")),
                               config.ondemand.ShowFavoriteLogos))
        self.configlist.append(
            getConfigListEntry(
                (_("iRadio: Display Favorite Default Thumbnails")),
                config.ondemand.ShowFavoriteDefault))
        self.configlist.append(
            getConfigListEntry((_("iRadio: Display SHOUTcast Thumbnails")),
                               config.ondemand.ShowShoutcastLogos))
        self.configlist.append(
            getConfigListEntry(
                (_("iRadio: Display SHOUTcast Default Thumbnails")),
                config.ondemand.ShowShoutcastDefault))
        self.configlist.append(
            getConfigListEntry((_("iRadio: Display Tunein Thumbnails")),
                               config.ondemand.ShowTuneinLogos))
        self.configlist.append(
            getConfigListEntry(
                (_("iRadio: Display Tunein Default Thumbnails")),
                config.ondemand.ShowTuneinDefault))

        self.configlist.append(
            getConfigListEntry(
                (_("Primary DNS: To watch UK Streams outside the UK")),
                config.ondemand.PrimaryDNS))
        self.configlist.append(
            getConfigListEntry(
                (_("Secondary DNS: A backup DNS if the primary is down")),
                config.ondemand.SecondaryDNS))

        self["config"].setList(self.configlist)

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))

        self["description"] = Label()
        self['footnote'] = Label()
        self["HelpWindow"] = Pixmap()
        self["HelpWindow"].hide()
        self["VKeyIcon"] = Boolean(False)

        self["actions"] = ActionMap(
            ["SetupActions"], {
                "ok": self.keyOK,
                "cancel": self.keyCancel,
                "save": self.keyOK,
                "info": self.keyInfo
            }, -1)
Esempio n. 43
0
class UpdatePlugin(Screen):
	skin = """
		<screen name="UpdatePlugin" position="center,center" size="620,160" title="Software update">
			<widget name="activityslider" position="10,10" size="600,10"  borderWidth="2" borderColor="#cccccc"/>
			<widget source="package" render="Label" position="10,40" size="600,25" font="Regular;22" />
			<widget source="status" render="Label" position="10,70" size="600,45" font="Regular;22" />
			<widget name="slider" position="10,140" size="600,12" borderWidth="2" borderColor="#cccccc" />
		</screen>"""

	def __init__(self, session, args = None):
		Screen.__init__(self, session)

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }

		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Verifying your internet connection..."))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.modified_packages = []

		self.activity = 0
		self.activityTimer = eTimer()
		self.activityTimer_conn = self.activityTimer.timeout.connect(self.doActivityTimer)

		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)

		self.updating = False
		self.rebootRequired = False
		self.device_name = iSoftwareTools.hardware_info.device_name

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)

		self.checkNetwork()
		self.onClose.append(self.cleanup)

	def cleanup(self):
		iSoftwareTools.cleanupSoftwareTools()

	def checkNetwork(self):
		if eNetworkManager.getInstance().online():
			self.updating = True
			self.activityTimer.start(100, False)
			self.package.setText(_("Package list update"))
			self.status.setText(_("Upgrading Dreambox... Please wait"))
			self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
		else:
			self.package.setText(_("Your network is not working. Please try again."))
			self.status.setText(self.oktext)

	def doActivityTimer(self):
		self.activity += 1
		if self.activity == 100:
			self.activity = 0
		self.activityslider.setValue(self.activity)

	def ipkgCallback(self, event, param):
		if event == IpkgComponent.EVENT_DOWNLOAD:
			self.status.setText(_("Downloading"))
		elif event == IpkgComponent.EVENT_UPGRADE:
			if self.sliderPackages.has_key(param):
				self.slider.setValue(self.sliderPackages[param])
			self.package.setText(param)
			self.status.setText(_("Upgrading"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_INSTALL:
			self.package.setText(param)
			self.status.setText(_("Installing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_REMOVE:
			self.package.setText(param)
			self.status.setText(_("Removing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_CONFIGURING:
			self.package.setText(param)
			self.status.setText(_("Configuring"))
		elif event == IpkgComponent.EVENT_ERROR:
			self.error += 1
		elif event == IpkgComponent.EVENT_DONE:
			if self.updating:
				iSoftwareTools.listUpgradable(self.listUpgradableCB)
			elif self.error == 0:
				self.slider.setValue(4)
				self.activityTimer.stop()
				self.activityslider.setValue(0)
				self.package.setText(_("Done - Installed or upgraded %d packages") % self.packages)
				self.status.setText(self.oktext)
			else:
				self.activityTimer.stop()
				self.activityslider.setValue(0)
				error = _("your dreambox might be unusable now. Please consult the manual for further assistance before rebooting your dreambox.")
				if self.packages == 0:
					error = _("No packages were upgraded yet. So you can check your network and try again.")
				if self.updating:
					error = _("Your dreambox isn't connected to the internet properly. Please check it and try again.")
				self.status.setText(_("Error") +  " - " + error)
		#print event, "-", param
		pass

	def listUpgradableCB(self, res):
		if iSoftwareTools.upgradeAvailable is False:
			self.updating = False
			self.slider.setValue(4)
			self.activityTimer.stop()
			self.activityslider.setValue(0)
			self.package.setText(_("Done - No updates available."))
			self.status.setText(self.oktext)
		else:
			self.updating = False
			upgrade_args = {'use_maintainer' : True, 'test_only': False}
			if config.plugins.softwaremanager.overwriteConfigFiles.value == 'N':
				upgrade_args = {'use_maintainer' : False, 'test_only': False}
			self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = upgrade_args)

	def exit(self):
		if not self.ipkg.isRunning():
			if self.packages != 0 and self.error == 0:
				self.session.openWithCallback(self.exitReboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"))
			else:
				self.close()
		else:
			if not self.updating:
				self.close()

	def exitReboot(self, result):
		if result:
			quitMainloop(2)
		self.close()

	def exitRestart(self, result):
		if result:
			quitMainloop(3)
		self.close()
Esempio n. 44
0
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		ProtectedScreen.__init__(self)
		screentitle = _("Software Update")
		self.menu_path = args[0]
		if config.usage.show_menupath.value == 'large':
			self.menu_path += screentitle
			self.title = self.menu_path
			self.menu_path_compressed = ""
			self.menu_path += ' / '
		elif config.usage.show_menupath.value == 'small':
			self.title = screentitle
			condtext = ""
			if self.menu_path and not self.menu_path.endswith(' / '):
				condtext = self.menu_path + " >"
			elif self.menu_path:
				condtext = self.menu_path[:-3] + " >"
			self.menu_path_compressed = condtext
			self.menu_path += screentitle + ' / '
		else:
			self.title = screentitle
			self.menu_path_compressed = ""
		self["menu_path_compressed"] = StaticText(self.menu_path_compressed)
		Screen.setTitle(self, self.title)

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)
		self['actions'].csel = self
		self["actions"].setEnabled(False)

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self['tl_off'] = Pixmap()
		self['tl_red'] = Pixmap()
		self['tl_yellow'] = Pixmap()
		self['tl_green'] = Pixmap()
		self['feedStatusMSG'] = Label()

		self.channellist_only = 0
		self.channellist_name = ''
		self.SettingsBackupDone = False
		self.ImageBackupDone = False
		self.autobackuprunning = False
		self.updating = False

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None
		self.onFirstExecBegin.append(self.checkNetworkState)
Esempio n. 45
0
class UpdatePlugin(Screen, ProtectedScreen):

    def __init__(self, session, *args):
        Screen.__init__(self, session)
        ProtectedScreen.__init__(self)
        Screen.setTitle(self, _('Software Update'))
        self.sliderPackages = {'ini-dvb-modules': 1,
         'enigma2': 2,
         'tuxbox-image-info': 3}
        self.slider = Slider(0, 4)
        self['slider'] = self.slider
        self.activityslider = Slider(0, 100)
        self['activityslider'] = self.activityslider
        self.status = StaticText(_('Please wait...'))
        self['status'] = self.status
        self.package = StaticText(_('Package list update'))
        self['package'] = self.package
        self.oktext = _('Press OK on your remote control to continue.')
        self['tl_off'] = Pixmap()
        self['tl_red'] = Pixmap()
        self['tl_yellow'] = Pixmap()
        self['tl_green'] = Pixmap()
        self['feedStatusMSG'] = Label()
        self.channellist_only = 0
        self.channellist_name = ''
        self.SettingsBackupDone = False
        self.ImageBackupDone = False
        self.autobackuprunning = False
        self.packages = 0
        self.error = 0
        self.processed_packages = []
        self.total_packages = None
        self.onFirstExecBegin.append(self.checkNetworkState)

    def checkNetworkState(self):
        self.trafficLight = feedsstatuscheck.getFeedsBool()
        status_msgs = {'stable': _('Feeds status:   Stable'),
         'unstable': _('Feeds status:   Unstable'),
         'updating': _('Feeds status:   Updating'),
         '-2': _('ERROR:   No network found'),
         '404': _('ERROR:   No internet found'),
         'inprogress': _('ERROR: Check is already running in background'),
         'unknown': _('No connection')}
        self['tl_red'].hide()
        self['tl_yellow'].hide()
        self['tl_green'].hide()
        self['tl_off'].hide()
        if self.trafficLight:
            self['feedStatusMSG'].setText(status_msgs[str(self.trafficLight)])
        if self.trafficLight == 'stable':
            self['tl_green'].show()
        elif self.trafficLight == 'unstable':
            self['tl_red'].show()
        elif self.trafficLight == 'updating':
            self['tl_yellow'].show()
        else:
            self['tl_off'].show()
        if self.trafficLight not in ('stable', 'unstable'):
            self.session.openWithCallback(self.close, MessageBox, feedsstatuscheck.getFeedsErrorMessage(), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
        elif config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value or config.softwareupdate.updateisunstable.value == '0':
            self.startCheck()
        else:
            self.session.openWithCallback(self.close, MessageBox, _('Sorry feeds seem to be in an unstable state, if you wish to use them please enable \'Allow unstable (experimental) updates\' in "Software update settings".'), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)

    def startCheck(self):
        self.activity = 0
        self.activityTimer = eTimer()
        self.activityTimer.callback.append(self.doActivityTimer)
        self.ipkg = IpkgComponent()
        self.ipkg.addCallback(self.ipkgCallback)
        self.updating = False
        self['actions'] = ActionMap(['WizardActions'], {'ok': self.exit,
         'back': self.exit}, -1)
        self.updating = True
        self.activityTimer.start(100, False)
        self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)

    def isProtected(self):
        return config.ParentalControl.setuppinactive.value and (not config.ParentalControl.config_sections.main_menu.value and not config.ParentalControl.config_sections.configuration.value or hasattr(self.session, 'infobar') and self.session.infobar is None) and config.ParentalControl.config_sections.software_update.value

    def doActivityTimer(self):
        self.activity += 1
        if self.activity == 100:
            self.activity = 0
        self.activityslider.setValue(self.activity)

    def showUpdateCompletedMessage(self):
        self.setEndMessage(ngettext('Update completed, %d package was installed.', 'Update completed, %d packages were installed.', self.packages) % self.packages)

    def ipkgCallback(self, event, param):
        global ocram
        if event == IpkgComponent.EVENT_DOWNLOAD:
            self.status.setText(_('Downloading'))
        elif event == IpkgComponent.EVENT_UPGRADE:
            if self.sliderPackages.has_key(param):
                self.slider.setValue(self.sliderPackages[param])
            self.package.setText(param)
            self.status.setText(_('Upgrading') + ': %s/%s' % (self.packages, self.total_packages))
            if param not in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_INSTALL:
            self.package.setText(param)
            self.status.setText(_('Installing'))
            if param not in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_REMOVE:
            self.package.setText(param)
            self.status.setText(_('Removing'))
            if param not in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_CONFIGURING:
            self.package.setText(param)
            self.status.setText(_('Configuring'))
        elif event == IpkgComponent.EVENT_MODIFIED:
            if config.plugins.softwaremanager.overwriteConfigFiles.value in ('N', 'Y'):
                self.ipkg.write(True and config.plugins.softwaremanager.overwriteConfigFiles.value)
            else:
                self.session.openWithCallback(self.modificationCallback, MessageBox, _('A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?') % param)
        elif event == IpkgComponent.EVENT_ERROR:
            self.error += 1
        elif event == IpkgComponent.EVENT_DONE:
            if self.updating:
                self.updating = False
                self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
            elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
                self.total_packages = None
                self.total_packages = len(self.ipkg.getFetchedList())
                message = _('Do you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(' + ngettext('%s updated package available', '%s updated packages available', self.total_packages) % self.total_packages + ')'
                if self.total_packages > 150:
                    message += ' ' + _('Reflash recommended!')
                if self.total_packages:
                    for package_tmp in self.ipkg.getFetchedList():
                        if package_tmp[0].startswith('enigma2-plugin-picons-tv-ocram'):
                            ocram = ocram + '[ocram-picons] ' + package_tmp[0].split('enigma2-plugin-picons-tv-ocram.')[1] + 'updated ' + package_tmp[2] + '\n'
                        elif package_tmp[0].startswith('enigma2-plugin-settings-ocram'):
                            ocram = ocram + '[ocram-settings] ' + package_tmp[0].split('enigma2-plugin-picons-tv-ocram.')[1] + 'updated ' + package_tmp[2] + '\n'

                    config.softwareupdate.updatefound.setValue(True)
                    choices = [(_('View the changes'), 'changes'), (_('Update and ask to reboot'), 'hot'), (_('Upgrade and reboot system'), 'cold')]
                    if path.exists('/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/BackupManager.pyo'):
                        if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
                            choices.append((_('Perform a settings backup,') + '\n\t' + _('making a backup before updating') + '\n\t' + _('is strongly advised.'), 'backup'))
                        if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                            choices.append((_('Perform a full image backup'), 'imagebackup'))
                    choices.append((_('Update channel list only'), 'channels'))
                    choices.append((_('Cancel'), ''))
                    upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name='SoftwareUpdateChoices', var=self.trafficLight)
                    upgrademessage.setTitle(_('Software update'))
                else:
                    upgrademessage = self.session.openWithCallback(self.close, MessageBox, _('Nothing to upgrade'), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
                    upgrademessage.setTitle(_('Software update'))
            elif self.channellist_only > 0:
                if self.channellist_only == 1:
                    self.setEndMessage(_('Could not find installed channel list.'))
                elif self.channellist_only == 2:
                    self.slider.setValue(2)
                    self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 3:
                    self.slider.setValue(3)
                    self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 4:
                    self.showUpdateCompletedMessage()
                    eDVBDB.getInstance().reloadBouquets()
                    eDVBDB.getInstance().reloadServicelist()
            elif self.error == 0:
                self.showUpdateCompletedMessage()
            else:
                self.activityTimer.stop()
                self.activityslider.setValue(0)
                error = _('Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s.') % (getMachineBrand(),
                 getMachineName(),
                 getMachineBrand(),
                 getMachineName())
                if self.packages == 0:
                    error = _('A background update check is in progress,\nplease wait a few minutes and try again.')
                if self.updating:
                    error = _('Update failed. Your %s %s does not have a working internet connection.') % (getMachineBrand(), getMachineName())
                self.status.setText(_('Error') + ' - ' + error)
        elif event == IpkgComponent.EVENT_LISTITEM:
            if 'enigma2-plugin-settings-' in param[0] and self.channellist_only > 0:
                self.channellist_name = param[0]
                self.channellist_only = 2

    def setEndMessage(self, txt):
        self.slider.setValue(4)
        self.activityTimer.stop()
        self.activityslider.setValue(0)
        self.package.setText(txt)
        self.status.setText(self.oktext)

    def startActualUpgrade(self, answer):
        if not answer or not answer[1]:
            self.close()
            return
        if answer[1] == 'menu':
            message = _('Do you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(%s ' % self.total_packages + _('Packages') + ')'
            choices = [(_('View the changes'), 'changes'), (_('Update and ask to reboot'), 'hot'), (_('Upgrade and reboot system'), 'cold')]
            choices.append((_('Update channel list only'), 'channels'))
            choices.append((_('Cancel'), ''))
            upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name='SoftwareUpdateChoices', var=self.trafficLight)
            upgrademessage.setTitle(_('Software update'))
        elif answer[1] == 'changes':
            from Plugins.Extensions.EGAMINews.plugin import EGAMIMainNews
            self.session.openWithCallback(self.startActualUpgrade, EGAMIMainNews)
        elif answer[1] == 'backup':
            self.doSettingsBackup()
        elif answer[1] == 'imagebackup':
            self.doImageBackup()
        elif answer[1] == 'channels':
            self.channellist_only = 1
            self.slider.setValue(1)
            self.ipkg.startCmd(IpkgComponent.CMD_LIST, args={'installed_only': True})
        elif answer[1] == 'cold':
            self.session.open(TryQuitMainloop, retvalue=42)
            self.close()
        else:
            self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args={'test_only': False})

    def modificationCallback(self, res):
        self.ipkg.write(res and 'N' or 'Y')

    def doSettingsBackup(self):
        backup = None
        from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
        self.BackupFiles = BackupFiles(self.session, True)
        Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
        Components.Task.job_manager.in_background = False
        for job in Components.Task.job_manager.getPendingJobs():
            if job.name == dgettext('vix', 'Backup Manager'):
                break

        self.showJobView(job)

    def doImageBackup(self):
        backup = None
        from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup
        self.ImageBackup = ImageBackup(self.session, True)
        Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
        Components.Task.job_manager.in_background = False
        for job in Components.Task.job_manager.getPendingJobs():
            if job.name == dgettext('vix', 'Image Manager'):
                break

        self.showJobView(job)

    def doAutoBackup(self, val = False):
        self.autobackuprunning = True
        if config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value and not self.SettingsBackupDone:
            self.doSettingsBackup()
        elif config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value and not self.ImageBackupDone:
            self.doImageBackup()
        else:
            self.session.open(TryQuitMainloop, retvalue=42)
            self.close()

    def showJobView(self, job):
        if job.name == dgettext('vix', 'Image Manager'):
            self.ImageBackupDone = True
        elif job.name == dgettext('vix', 'Backup Manager'):
            self.SettingsBackupDone = True
        from Screens.TaskView import JobView
        Components.Task.job_manager.in_background = False
        if not self.autobackuprunning:
            self.session.openWithCallback(self.startActualUpgrade(('menu', 'menu')), JobView, job, cancelable=False, backgroundable=False, afterEventChangeable=False, afterEvent='close')
        else:
            self.session.openWithCallback(self.doAutoBackup, JobView, job, cancelable=False, backgroundable=False, afterEventChangeable=False, afterEvent='close')

    def exit(self):
        if not self.ipkg.isRunning():
            if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
                self.session.openWithCallback(self.exitAnswer, MessageBox, _('Upgrade finished.') + ' ' + _('Do you want to reboot your %s %s') % (getMachineBrand(), getMachineName()))
            else:
                self.close()
        elif not self.updating:
            self.close()

    def exitAnswer(self, result):
        if result is not None and result:
            self.session.open(TryQuitMainloop, retvalue=2)
        self.close()
Esempio n. 46
0
		def setText(txt):
			StaticText.setText(self["title"], txt)
			self["titellabel"].setText(txt)
Esempio n. 47
0
    def __init__(self, session, piclist, lastindex, path):

        self.textcolor = config.pic.textcolor.value
        self.color = config.pic.bgcolor.value
        textsize = 20
        self.spaceX = 35
        self.picX = 190
        self.spaceY = 30
        self.picY = 200

        size_w = getDesktop(0).size().width()
        size_h = getDesktop(0).size().height()
        self.thumbsX = size_w / (self.spaceX + self.picX)  # thumbnails in X
        self.thumbsY = size_h / (self.spaceY + self.picY)  # thumbnails in Y
        self.thumbsC = self.thumbsX * self.thumbsY  # all thumbnails

        self.positionlist = []
        skincontent = ""

        posX = -1
        for x in range(self.thumbsC):
            posY = x / self.thumbsX
            posX += 1
            if posX >= self.thumbsX:
                posX = 0

            absX = self.spaceX + (posX * (self.spaceX + self.picX))
            absY = self.spaceY + (posY * (self.spaceY + self.picY))
            self.positionlist.append((absX, absY))
            skincontent += "<widget source=\"label" + str(
                x
            ) + "\" render=\"Label\" position=\"" + str(absX + 5) + "," + str(
                absY + self.picY - textsize
            ) + "\" size=\"" + str(self.picX - 10) + "," + str(
                textsize
            ) + "\" font=\"Regular;14\" zPosition=\"2\" transparent=\"1\" noWrap=\"1\" foregroundColor=\"" + self.textcolor + "\" />"
            skincontent += "<widget name=\"thumb" + str(
                x) + "\" position=\"" + str(absX + 5) + "," + str(
                    absY + 5
                ) + "\" size=\"" + str(self.picX - 10) + "," + str(
                    self.picY - (textsize * 2)
                ) + "\" zPosition=\"2\" transparent=\"1\" alphatest=\"on\" />"

        # Screen, backgroundlabel and MovingPixmap
        self.skin = "<screen position=\"0,0\" size=\"" + str(
            size_w
        ) + "," + str(size_h) + "\" flags=\"wfNoBorder\" > \
			<eLabel position=\"0,0\" zPosition=\"0\" size=\"" + str(size_w) + "," + str(
            size_h
        ) + "\" backgroundColor=\"" + self.color + "\" /><widget name=\"frame\" position=\"35,30\" size=\"190,200\" pixmap=\"pic_frame.png\" zPosition=\"1\" alphatest=\"on\" />" + skincontent + "</screen>"

        Screen.__init__(self, session)

        self["actions"] = ActionMap(
            [
                "OkCancelActions", "ColorActions", "DirectionActions",
                "MovieSelectionActions"
            ], {
                "cancel": self.Exit,
                "ok": self.KeyOk,
                "left": self.key_left,
                "right": self.key_right,
                "up": self.key_up,
                "down": self.key_down,
                "showEventInfo": self.StartExif,
            }, -1)

        self["frame"] = MovingPixmap()
        for x in range(self.thumbsC):
            self["label" + str(x)] = StaticText()
            self["thumb" + str(x)] = Pixmap()

        self.Thumbnaillist = []
        self.filelist = []
        self.currPage = -1
        self.dirlistcount = 0
        self.path = path

        index = 0
        framePos = 0
        Page = 0
        for x in piclist:
            if x[0][1] == False:
                self.filelist.append(
                    (index, framePos, Page, x[0][0], path + x[0][0]))
                index += 1
                framePos += 1
                if framePos > (self.thumbsC - 1):
                    framePos = 0
                    Page += 1
            else:
                self.dirlistcount += 1

        self.maxentry = len(self.filelist) - 1
        self.index = lastindex - self.dirlistcount
        if self.index < 0:
            self.index = 0

        self.picload = ePicLoad()
        self.picload.PictureData.get().append(self.showPic)

        self.onLayoutFinish.append(self.setPicloadConf)

        self.ThumbTimer = eTimer()
        self.ThumbTimer.callback.append(self.showPic)
Esempio n. 48
0
	def __init__(self, session, parent):
		self.parentmenu = parent
		Screen.__init__(self, session)
		self["key_blue"] = StaticText("")
		self["menu"] = List([])
		self["menu"].enableWrapAround = True
		self.showNumericHelp = False
		self.createMenuList()

		# for the skin: first try a menu_<menuID>, then Menu
		self.skinName = [ ]
		if self.menuID is not None:
			if config.usage.menutype.value == 'horzanim' and skin.domScreens.has_key("Animmain"):
				self.skinName.append('Animmain')
			elif config.usage.menutype.value == 'horzicon' and skin.domScreens.has_key("Iconmain"):
				self.skinName.append('Iconmain')
			else:
				self.skinName.append('menu_' + self.menuID)
		self.skinName.append("Menu")
		ProtectedScreen.__init__(self)
		self["actions"] = NumberActionMap(["OkCancelActions", "MenuActions", "NumberActions", "HelpActions", "ColorActions"],
			{
				"ok": self.okbuttonClick,
				"cancel": self.closeNonRecursive,
				"menu": self.closeRecursive,
				"0": self.keyNumberGlobal,
				"1": self.keyNumberGlobal,
				"2": self.keyNumberGlobal,
				"3": self.keyNumberGlobal,
				"4": self.keyNumberGlobal,
				"5": self.keyNumberGlobal,
				"6": self.keyNumberGlobal,
				"7": self.keyNumberGlobal,
				"8": self.keyNumberGlobal,
				"9": self.keyNumberGlobal,
				"displayHelp": self.showHelp,
				"blue": self.keyBlue,
			})
		title = parent.get("title", "").encode("UTF-8") or None
		title = title and _(title) or _(parent.get("text", "").encode("UTF-8"))
		title = self.__class__.__name__ == "MenuSort" and _("Menusort (%s)") % title or title
		if title is None:
			title = _(parent.get('text', '').encode('UTF-8'))
		else:
			t_history.reset()
		self["title"] = StaticText(title)
		self.setScreenPathMode(True)
		self.setTitle(title)
		self.menu_title = title
		self['thistory'] = StaticText(t_history.thistory)
		history_len = len(t_history.thistory)
		self['title0'] = StaticText('')
		self['title1'] = StaticText('')
		self['title2'] = StaticText('')
		if history_len < 13:
			self['title0'] = StaticText(title)
		elif history_len < 21:
			self['title0'] = StaticText('')
			self['title1'] = StaticText(title)
		else:
			self['title0'] = StaticText('')
			self['title1'] = StaticText('')
			self['title2'] = StaticText(title)
		if t_history.thistory == '':
			t_history.thistory = str(title) + ' > '
		else:
			t_history.thistory = t_history.thistory + str(title) + ' > '
		if config.usage.menutype.value == 'horzanim' and skin.domScreens.has_key("Animmain"):
			self['label1'] = StaticText()
			self['label2'] = StaticText()
			self['label3'] = StaticText()
			self['label4'] = StaticText()
			self['label5'] = StaticText()
			self.onShown.append(self.openTestA)
		elif config.usage.menutype.value == 'horzicon' and skin.domScreens.has_key("Iconmain"):
			self['label1'] = StaticText()
			self['label2'] = StaticText()
			self['label3'] = StaticText()
			self['label4'] = StaticText()
			self['label5'] = StaticText()
			self['label6'] = StaticText()
			self['label1s'] = StaticText()
			self['label2s'] = StaticText()
			self['label3s'] = StaticText()
			self['label4s'] = StaticText()
			self['label5s'] = StaticText()
			self['label6s'] = StaticText()
			self['pointer'] = Pixmap()
			self['pixmap1'] = Pixmap()
			self['pixmap2'] = Pixmap()
			self['pixmap3'] = Pixmap()
			self['pixmap4'] = Pixmap()
			self['pixmap5'] = Pixmap()
			self['pixmap6'] = Pixmap()
			self.onShown.append(self.openTestB)

		self.number = 0
		self.nextNumberTimer = eTimer()
		self.nextNumberTimer.callback.append(self.okbuttonClick)
		if len(self.list) == 1:
			self.onExecBegin.append(self.__onExecBegin)
Esempio n. 49
0
    def __init__(self,
                 session,
                 title="",
                 list=[],
                 keys=None,
                 selection=0,
                 skin_name=[],
                 reorderConfig="",
                 windowTitle=None):
        Screen.__init__(self, session)

        if isinstance(skin_name, str):
            skin_name = [skin_name]
        self.skinName = skin_name + ["ChoiceBox"]

        self.reorderConfig = reorderConfig
        self["text"] = Label(title)
        self.list = []
        self.summarylist = []
        if keys is None:
            self.__keys = [
                "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red",
                "green", "yellow", "blue"
            ] + (len(list) - 14) * [""]
        else:
            self.__keys = keys + (len(list) - len(keys)) * [""]

        self.keymap = {}
        pos = 0
        if self.reorderConfig:
            self.config_type = eval("config.misc.pluginlist." +
                                    self.reorderConfig)
            if self.config_type.value:
                prev_list = zip(list, self.__keys)
                new_list = []
                for x in self.config_type.value.split(","):
                    for entry in prev_list:
                        if entry[0][0] == x:
                            new_list.append(entry)
                            prev_list.remove(entry)
                list = zip(*(new_list + prev_list))
                list, self.__keys = list[0], list[1]
                number = 1
                new_keys = []
                for x in self.__keys:
                    if (not x or x.isdigit()) and number <= 10:
                        new_keys.append(str(number % 10))
                        number += 1
                    else:
                        new_keys.append(not x.isdigit() and x or "")
                self.__keys = new_keys
        for x in list:
            strpos = str(self.__keys[pos])
            self.list.append(ChoiceEntryComponent(key=strpos, text=x))
            if self.__keys[pos] != "":
                self.keymap[self.__keys[pos]] = list[pos]
            self.summarylist.append((self.__keys[pos], x[0]))
            pos += 1
        self["list"] = ChoiceList(list=self.list, selection=selection)
        self["summary_list"] = StaticText()
        self["summary_selection"] = StaticText()
        self.updateSummary(selection)

        self["actions"] = NumberActionMap(
            [
                "WizardActions", "InputActions", "ColorActions",
                "DirectionActions", "MenuActions"
            ], {
                "ok": self.go,
                "back": self.cancel,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal,
                "0": self.keyNumberGlobal,
                "red": self.keyRed,
                "green": self.keyGreen,
                "yellow": self.keyYellow,
                "blue": self.keyBlue,
                "up": self.up,
                "down": self.down,
                "moveUp": self.additionalMoveUp,
                "moveDown": self.additionalMoveDown,
                "menu": self.setDefaultChoiceList
            }, -1)
        self.setTitle(windowTitle or _("Select"))
Esempio n. 50
0
    def __init__(self,
                 session,
                 eventName,
                 callbackNeeded=False,
                 save=False,
                 savepath=None,
                 localpath=None):
        Screen.__init__(self, session)
        self.setTitle(_("The Internet Movie Database"))

        for tag in config.plugins.imdb.ignore_tags.getValue().split(','):
            eventName = eventName.replace(tag, '')

        self.eventName = eventName

        self.callbackNeeded = callbackNeeded
        self.callbackData = ""
        self.callbackGenre = ""

        self.saving = save
        self.savingpath = savepath
        self.localpath = localpath
        self.fetchurl = None

        self.dictionary_init()

        self["poster"] = Pixmap()
        self.picload = ePicLoad()
        self.picload.PictureData.get().append(self.paintPosterPixmapCB)

        self["stars"] = ProgressBar()
        self["starsbg"] = Pixmap()
        self["stars"].hide()
        self["starsbg"].hide()
        self.ratingstars = -1

        self["title"] = StaticText(_("The Internet Movie Database"))

        def setText(txt):
            StaticText.setText(self["title"], txt)
            self["titellabel"].setText(txt)

        self["title"].setText = setText
        self["titellabel"] = Label()
        self["detailslabel"] = ScrollLabel("")
        self["castlabel"] = ScrollLabel("")
        self["extralabel"] = ScrollLabel("")
        self["statusbar"] = Label("")
        self["ratinglabel"] = Label("")
        self.resultlist = []
        self["menu"] = MenuList(self.resultlist)
        self["menu"].hide()

        self["key_red"] = Button(_("Exit"))
        self["key_green"] = Button("")
        self["key_yellow"] = Button("")
        self["key_blue"] = Button("")

        self.Page = 0

        self["actions"] = ActionMap(
            [
                "OkCancelActions", "ColorActions", "MovieSelectionActions",
                "DirectionActions"
            ], {
                "ok": self.showDetails,
                "cancel": self.exit,
                "down": self.pageDown,
                "up": self.pageUp,
                "red": self.exit,
                "green": self.showMenu,
                "yellow": self.showDetails,
                "blue": self.showExtras,
                "contextMenu": self.contextMenuPressed,
                "showEventInfo": self.showDetails
            }, -1)

        self.getIMDB()

        if self.localpath is not None:
            self.onLayoutFinish.append(self._layoutFinished)
Esempio n. 51
0
class UpdatePlugin(Screen):
	skin = """
		<screen name="UpdatePlugin" position="center,center" size="550,300">
			<widget name="activityslider" position="0,0" size="550,5"  />
			<widget name="slider" position="0,150" size="550,30"  />
			<widget source="package" render="Label" position="10,30" size="540,20" font="Regular;18" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
			<widget source="status" render="Label" position="10,180" size="540,100" font="Regular;20" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
		</screen>"""
		
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Software Update"))

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }

		self.setTitle(_("Software update"))
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self.channellist_only = 0
		self.channellist_name = ''
		self.SettingsBackupDone = False
		self.ImageBackupDone = False
		self.autobackuprunning = False

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None
		self.checkNetworkState()

	def checkNetworkState(self):
		cmd1 = "opkg update"
		self.CheckConsole = Console()
		self.CheckConsole.ePopen(cmd1, self.checkNetworkStateFinished)

	def checkNetworkStateFinished(self, result, retval,extra_args=None):
		if 'bad address' in result:
			self.session.openWithCallback(self.close, MessageBox, _("Your %s %s is not connected to the internet, please check your network settings and try again.") % (getMachineBrand(), getMachineName()), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
		elif ('wget returned 1' or 'wget returned 255' or '404 Not Found') in result:
			self.session.openWithCallback(self.close, MessageBox, _("Sorry feeds are down for maintenance, please try again later."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
		elif 'Collected errors' in result:
			self.session.openWithCallback(self.close, MessageBox, _("A background update check is in progress, please wait a few minutes and try again."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
		else:
			self.startCheck()

	def startCheck(self):
		self.activity = 0
		self.activityTimer = eTimer()
		self.activityTimer.callback.append(self.doActivityTimer)

		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)
		self.onClose.append(self.__close)

		self.updating = False

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)

		self.updating = True
		self.activityTimer.start(100, False)
		self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)

	def doActivityTimer(self):
		self.activity += 1
		if self.activity == 100:
			self.activity = 0
		self.activityslider.setValue(self.activity)

	def showUpdateCompletedMessage(self):
		self.setEndMessage(ngettext("Update completed, %d package was installed.", "Update completed, %d packages were installed.", self.packages) % self.packages)

	def ipkgCallback(self, event, param):
		if event == IpkgComponent.EVENT_DOWNLOAD:
			self.status.setText(_("Downloading"))
		elif event == IpkgComponent.EVENT_UPGRADE:
			if self.sliderPackages.has_key(param):
				self.slider.setValue(self.sliderPackages[param])
			self.package.setText(param)
			self.status.setText(_("Upgrading") + ": %s/%s" % (self.packages, self.total_packages))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_INSTALL:
			self.package.setText(param)
			self.status.setText(_("Installing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_REMOVE:
			self.package.setText(param)
			self.status.setText(_("Removing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_CONFIGURING:
			self.package.setText(param)
			self.status.setText(_("Configuring"))
		elif event == IpkgComponent.EVENT_MODIFIED:
			if config.plugins.softwaremanager.overwriteConfigFiles.value in ("N", "Y"):
				self.ipkg.write(True and config.plugins.softwaremanager.overwriteConfigFiles.value)
			else:
				self.session.openWithCallback(
					self.modificationCallback,
					MessageBox,
					_("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?") % (param)
				)
		elif event == IpkgComponent.EVENT_ERROR:
			self.error += 1
		elif event == IpkgComponent.EVENT_DONE:
			if self.updating:
				self.updating = False
				self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
			elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
				self.total_packages = len(self.ipkg.getFetchedList())
				if self.total_packages:
					message = _("Do you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(" + (ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")"
					choices = [(_("Update and reboot (recommended)"), "cold"),
						(_("Update and ask to reboot"), "hot"),
						(_("Update channel list only"), "channels"),
						(_("Cancel"), "")]
					self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices)
				else:
					self.session.openWithCallback(self.close, MessageBox, _("No updates available"), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
			elif self.channellist_only > 0:
				if self.channellist_only == 1:
					self.setEndMessage(_("Could not find installed channel list."))
				elif self.channellist_only == 2:
					self.slider.setValue(2)
					self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {'package': self.channellist_name})
					self.channellist_only += 1
				elif self.channellist_only == 3:
					self.slider.setValue(3)
					self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': self.channellist_name})
					self.channellist_only += 1
				elif self.channellist_only == 4:
					self.showUpdateCompletedMessage()
					eDVBDB.getInstance().reloadBouquets()
					eDVBDB.getInstance().reloadServicelist()
			elif self.error == 0:
				self.showUpdateCompletedMessage()
			else:
				self.activityTimer.stop()
				self.activityslider.setValue(0)
				error = _("Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s.") % (getMachineBrand(), getMachineName(), getMachineBrand(), getMachineName())
				if self.packages == 0:
					error = _("No updates available. Please try again later.")
				if self.updating:
					error = _("Update failed. Your %s %s does not have a working internet connection.") % (getMachineBrand(), getMachineName())
				self.status.setText(_("Error") +  " - " + error)
		elif event == IpkgComponent.EVENT_LISTITEM:
			if 'enigma2-plugin-settings-' in param[0] and self.channellist_only > 0:
				self.channellist_name = param[0]
				self.channellist_only = 2
		#print event, "-", param
		pass

	def setEndMessage(self, txt):
		self.slider.setValue(4)
		self.activityTimer.stop()
		self.activityslider.setValue(0)
		self.package.setText(txt)
		self.status.setText(self.oktext)

	def startActualUpgrade(self, answer):
		if not answer or not answer[1]:
			self.close()
			return
		if answer[1] == "cold":
			self.session.open(TryQuitMainloop,retvalue=42)
			self.close()
		elif answer[1] == "channels":
			self.channellist_only = 1
			self.slider.setValue(1)
			self.ipkg.startCmd(IpkgComponent.CMD_LIST, args = {'installed_only': True})
		else:
			self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False})

	def modificationCallback(self, res):
		self.ipkg.write(res and "N" or "Y")

	def exit(self):
		if not self.ipkg.isRunning():
			if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
				self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your %s %s") % (getMachineBrand(), getMachineName()))
			else:
				self.close()
		else:
			if not self.updating:
				self.close()

	def exitAnswer(self, result):
		if result is not None and result:
			self.session.open(TryQuitMainloop,retvalue=2)
		self.close()

	def __close(self):
		self.ipkg.removeCallback(self.ipkgCallback)
Esempio n. 52
0
    def __init__(self,
                 session,
                 zapFunc,
                 startBouquet,
                 startRef,
                 bouquets,
                 timeFocus=-1):
        UserDefinedButtons.__init__(self, config.epgselection.multi,
                                    epgActions, okActions)
        EPGSelectionBase.__init__(self, session, config.epgselection.multi,
                                  startBouquet, startRef, bouquets)
        EPGBouquetSelection.__init__(self, False)
        EPGServiceNumberSelection.__init__(self)
        EPGServiceZap.__init__(self, zapFunc)

        self.skinName = ["MultiEPG", "EPGSelectionMulti"]
        self.askTime = timeFocus

        self["now_button"] = Pixmap()
        self["next_button"] = Pixmap()
        self["more_button"] = Pixmap()
        self["now_button_sel"] = Pixmap()
        self["next_button_sel"] = Pixmap()
        self["more_button_sel"] = Pixmap()
        self["now_text"] = Label()
        self["next_text"] = Label()
        self["more_text"] = Label()
        self["date"] = Label()
        self["key_text"] = StaticText(_("TEXT"))

        helpDescription = _("EPG Commands")
        self["epgcursoractions"] = HelpableActionMap(
            self,
            "DirectionActions", {
                "left": (self.leftPressed, _("Go to previous event")),
                "right": (self.rightPressed, _("Go to next event")),
                "up": (self.moveUp, _("Go to previous channel")),
                "down": (self.moveDown, _("Go to next channel"))
            },
            prio=-1,
            description=helpDescription)
        self["epgactions"] = HelpableActionMap(
            self,
            "EPGSelectActions", {
                "nextService": (self.nextPage, _("Move down a page")),
                "prevService": (self.prevPage, _("Move up a page")),
                "nextBouquet": (self.nextBouquet, _("Go to next bouquet")),
                "prevBouquet": (self.prevBouquet, _("Go to previous bouquet")),
                "input_date_time":
                (self.enterDateTime, _("Go to specific data/time")),
                "epg":
                self.helpKeyAction("epg"),
                "epglong":
                self.helpKeyAction("epglong"),
                "info":
                self.helpKeyAction("info"),
                "infolong":
                self.helpKeyAction("infolong"),
                "tv": (self.toggleBouquetList,
                       _("Toggle between bouquet/epg lists")),
                "timer": (self.openTimerList, _("Show timer list")),
                "timerlong":
                (self.openAutoTimerList, _("Show autotimer list")),
                "back": (self.goToCurrentTimeOrServiceOrTop,
                         _("Go to current time, then the start service")),
                "menu": (self.createSetup, _("Setup menu"))
            },
            prio=-1,
            description=helpDescription)

        self["list"] = EPGListMulti(session,
                                    config.epgselection.multi,
                                    selChangedCB=self.onSelectionChanged)
Esempio n. 53
0
class UpdatePlugin(Screen):
	skin = """
		<screen name="UpdatePlugin" position="center,center" size="550,200" title="Software update" >
			<widget name="activityslider" position="0,0" size="550,5"  />
			<widget name="slider" position="0,150" size="550,30"  />
			<widget source="package" render="Label" position="10,30" size="540,20" font="Regular;18" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
			<widget source="status" render="Label" position="10,60" size="540,45" font="Regular;20" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
		</screen>"""
		
	def __init__(self, session, args = None):
		Screen.__init__(self, session)
		
		self.sliderPackages = { "Settop Box-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
		
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Upgrading Settop Box... Please wait"))
		self["status"] = self.status
		self.package = StaticText()
		self["package"] = self.package
		
		self.packages = 0
		self.error = 0
		
		self.activity = 0
		self.activityTimer = eTimer()
		self.activityTimer.callback.append(self.doActivityTimer)

		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)

		self.firsttime = True
		self.onShown.append(self.confirmUpdate)

	def confirmUpdate(self):
		if self.firsttime:
			self.firsttime = False
			self.session.openWithCallback(self.confirmationResult, MessageBox, _("Do you want to upgrade?"))

	def confirmationResult(self, result):
		if not result:
			self.close()
		else:
			self.activityTimer.start(100, False)
			self.updating = True
			self.package.setText(_("Package list update"))
			self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)

	def doActivityTimer(self):
		self.activity += 1
		if self.activity == 100:
			self.activity = 0
		self.activityslider.setValue(self.activity)
		
	def ipkgCallback(self, event, param):
		if event == IpkgComponent.EVENT_DOWNLOAD:
			self.status.setText(_("Downloading"))
		elif event == IpkgComponent.EVENT_UPGRADE:
			if self.sliderPackages.has_key(param):
				self.slider.setValue(self.sliderPackages[param])
			self.package.setText(param)
			self.status.setText(_("Upgrading"))
			self.packages += 1
		elif event == IpkgComponent.EVENT_INSTALL:
			self.package.setText(param)
			self.status.setText(_("Installing"))
			self.packages += 1
		elif event == IpkgComponent.EVENT_CONFIGURING:
			self.package.setText(param)
			self.status.setText(_("Configuring"))
		elif event == IpkgComponent.EVENT_MODIFIED:
			self.session.openWithCallback(
				self.modificationCallback,
				MessageBox,
				_("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
			)
		elif event == IpkgComponent.EVENT_ERROR:
			self.error += 1
		elif event == IpkgComponent.EVENT_DONE:
			if self.updating:
				self.updating = False
				self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False})
			elif self.error == 0:
				self.slider.setValue(4)
				
				self.activityTimer.stop()
				self.activityslider.setValue(0)
				
				self.package.setText("")
				self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages)
			else:
				self.activityTimer.stop()
				self.activityslider.setValue(0)
				error = _("your Settop Box might be unusable now. Please consult the manual for further assistance before rebooting your Settop Box.")
				if self.packages == 0:
					error = _("No packages were upgraded yet. So you can check your network and try again.")
				if self.updating:
					error = _("Your Settop Box isn't connected to the internet properly. Please check it and try again.")
				self.status.setText(_("Error") +  " - " + error)
		#print event, "-", param
		pass

	def modificationCallback(self, res):
		self.ipkg.write(res and "N" or "Y")

	def exit(self):
		if not self.ipkg.isRunning():
			if self.packages != 0 and self.error == 0:
				self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished. Do you want to reboot your Settop Box?"))
			else:
				self.close()
			
	def exitAnswer(self, result):
		if result is not None and result:
			quitMainloop(2)
		self.close()
Esempio n. 54
0
 def __init__(self, session, parent):
     Screen.__init__(self, session, parent=parent)
     self["entry"] = StaticText("")
     self.onShow.append(self.addWatcher)
     self.onHide.append(self.removeWatcher)
Esempio n. 55
0
class UpdatePlugin(Screen, ProtectedScreen):
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		ProtectedScreen.__init__(self)
		screentitle = _("Software Update")
		self.menu_path = args[0]
		if config.usage.show_menupath.value == 'large':
			self.menu_path += screentitle
			self.title = self.menu_path
			self.menu_path_compressed = ""
			self.menu_path += ' / '
		elif config.usage.show_menupath.value == 'small':
			self.title = screentitle
			condtext = ""
			if self.menu_path and not self.menu_path.endswith(' / '):
				condtext = self.menu_path + " >"
			elif self.menu_path:
				condtext = self.menu_path[:-3] + " >"
			self.menu_path_compressed = condtext
			self.menu_path += screentitle + ' / '
		else:
			self.title = screentitle
			self.menu_path_compressed = ""
		self["menu_path_compressed"] = StaticText(self.menu_path_compressed)
		Screen.setTitle(self, self.title)

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)
		self['actions'].csel = self
		self["actions"].setEnabled(False)

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self['tl_off'] = Pixmap()
		self['tl_red'] = Pixmap()
		self['tl_yellow'] = Pixmap()
		self['tl_green'] = Pixmap()
		self['feedStatusMSG'] = Label()

		self.channellist_only = 0
		self.channellist_name = ''
		self.SettingsBackupDone = False
		self.ImageBackupDone = False
		self.autobackuprunning = False
		self.updating = False

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None
		self.onFirstExecBegin.append(self.checkNetworkState)

	def checkNetworkState(self):
		self['tl_red'].hide()
		self['tl_yellow'].hide()
		self['tl_green'].hide()
		self['tl_off'].hide()
		self.trafficLight = feedsstatuscheck.getFeedsBool() 
		if self.trafficLight in feedsstatuscheck.feed_status_msgs:
			status_text = feedsstatuscheck.feed_status_msgs[self.trafficLight]
		else:
			status_text = _('Feeds status: Unexpected')
		if self.trafficLight:
			self['feedStatusMSG'].setText(status_text)
		if self.trafficLight == 'stable':
			self['tl_green'].show()
		elif self.trafficLight == 'unstable':
			self['tl_red'].show()
		elif self.trafficLight == 'updating':
			self['tl_yellow'].show()
		else:
			self['tl_off'].show()
		if (getImageType() != 'release' and self.trafficLight != 'unknown') or (getImageType() == 'release' and self.trafficLight not in ('stable', 'unstable')):
			self.session.openWithCallback(self.close, MessageBox, feedsstatuscheck.getFeedsErrorMessage(), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
		else:
			if getImageType() != 'release' or (config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value) or config.softwareupdate.updateisunstable.value == '0':
				self.startCheck()
			else:
				self.session.openWithCallback(self.close, MessageBox, _("Sorry the feeds seem to be in an unstable state, if you wish to use them please enable 'Allow unstable (experimental) updates' in \"Software update settings\"."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)

	def startCheck(self):
		self.updating = True
		self.activity = 0
		self.activityTimer = eTimer()
		self.activityTimer.callback.append(self.doActivityTimer)

		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)

		self.activityTimer.start(100, False)
		self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)

	def isProtected(self):
		return config.ParentalControl.setuppinactive.value and\
			(not config.ParentalControl.config_sections.main_menu.value and not config.ParentalControl.config_sections.configuration.value  or hasattr(self.session, 'infobar') and self.session.infobar is None) and\
			config.ParentalControl.config_sections.software_update.value

	def doActivityTimer(self):
		self.activity += 1
		if self.activity == 100:
			self.activity = 0
		self.activityslider.setValue(self.activity)

	def showUpdateCompletedMessage(self):
		self.setEndMessage(ngettext("Update completed, %d package was installed.", "Update completed, %d packages were installed.", self.packages) % self.packages)

	def ipkgCallback(self, event, param):
		if event == IpkgComponent.EVENT_DOWNLOAD:
			self.status.setText(_("Downloading"))
		elif event == IpkgComponent.EVENT_UPGRADE:
			if self.sliderPackages.has_key(param):
				self.slider.setValue(self.sliderPackages[param])
			self.package.setText(param)
			self.status.setText(_("Upgrading") + ": %s/%s" % (self.packages, self.total_packages))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_INSTALL:
			self.package.setText(param)
			self.status.setText(_("Installing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_REMOVE:
			self.package.setText(param)
			self.status.setText(_("Removing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event == IpkgComponent.EVENT_CONFIGURING:
			self.package.setText(param)
			self.status.setText(_("Configuring"))
		elif event == IpkgComponent.EVENT_MODIFIED:
			if config.plugins.softwaremanager.overwriteConfigFiles.value in ("N", "Y"):
				self.ipkg.write(True and config.plugins.softwaremanager.overwriteConfigFiles.value)
			else:
				self["actions"].setEnabled(True)
				self.session.openWithCallback(
					self.modificationCallback,
					MessageBox,
					_("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?") % param
				)
		elif event == IpkgComponent.EVENT_ERROR:
			self.error += 1
			self.updating = False
		elif event == IpkgComponent.EVENT_DONE:
			if self.updating:
				self.updating = False
				self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
			elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
				self.total_packages = None
				if getImageType() != 'release' or (config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value):
					self.total_packages = len(self.ipkg.getFetchedList())
					message = _("The current update may be unstable") + "\n" + _("Are you sure you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(" + (ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")"
				elif config.softwareupdate.updateisunstable.value == '0':
					self.total_packages = len(self.ipkg.getFetchedList())
					message = _("Do you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(" + (ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")"
				if self.total_packages > 150:
					message += " " + _("Reflash recommended!")
				if self.total_packages:
					global ocram
					ocram = ''
					for package_tmp in self.ipkg.getFetchedList():
						if package_tmp[0].startswith('enigma2-plugin-picons-snp'):
							ocram = ocram + '[ocram-picons] ' + package_tmp[0].split('enigma2-plugin-picons-snp-')[1].replace('.',' ') + ' updated ' + package_tmp[2].replace('--',' ') + '\n'
						elif package_tmp[0].startswith('enigma2-plugin-picons-srp'):
							ocram = ocram + '[ocram-picons] ' + package_tmp[0].split('enigma2-plugin-picons-srp-')[1].replace('.',' ') + ' updated ' + package_tmp[2].replace('--',' ') + '\n'
					config.softwareupdate.updatefound.setValue(True)
					choices = [(_("View the changes"), "changes"),
						(_("Upgrade and reboot system"), "cold")]
					if path.exists("/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/BackupManager.pyo"):
						if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
							choices.append((_("Perform a settings backup,") + '\n\t' + _("making a backup before updating") + '\n\t' +_("is strongly advised."), "backup"))
						if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
							choices.append((_("Perform a full image backup"), "imagebackup"))
					choices.append((_("Update channel list only"), "channels"))
					choices.append((_("Cancel"), ""))
					self["actions"].setEnabled(True)
					upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name = "SoftwareUpdateChoices", var=self.trafficLight, menu_path=self.menu_path_compressed)
					upgrademessage.setTitle(self.title)
				else:
					self["actions"].setEnabled(True)
					upgrademessage = self.session.openWithCallback(self.close, MessageBox, _("Nothing to upgrade"), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
					upgrademessage.setTitle(_('Software update'))
			elif self.channellist_only > 0:
				if self.channellist_only == 1:
					self.setEndMessage(_("Could not find installed channel list."))
				elif self.channellist_only == 2:
					self.slider.setValue(2)
					self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {'package': self.channellist_name})
					self.channellist_only += 1
				elif self.channellist_only == 3:
					self.slider.setValue(3)
					self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': self.channellist_name})
					self.channellist_only += 1
				elif self.channellist_only == 4:
					self.showUpdateCompletedMessage()
					eDVBDB.getInstance().reloadBouquets()
					eDVBDB.getInstance().reloadServicelist()
			elif self.error == 0:
				self.showUpdateCompletedMessage()
			else:
				self.activityTimer.stop()
				self.activityslider.setValue(0)
				error = _("Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s.") % (getMachineBrand(), getMachineName(), getMachineBrand(), getMachineName())
				if self.packages == 0:
					error = _("A background update check is in progress,\nplease wait a few minutes and try again.")
				if self.updating:
					error = _("Update failed. Your %s %s does not have a working internet connection.") % (getMachineBrand(), getMachineName())
				self.status.setText(_("Error") +  " - " + error)
				self["actions"].setEnabled(True)
		elif event == IpkgComponent.EVENT_LISTITEM:
			if 'enigma2-plugin-settings-' in param[0] and self.channellist_only > 0:
				self.channellist_name = param[0]
				self.channellist_only = 2
		#print event, "-", param
		pass

	def setEndMessage(self, txt):
		self.slider.setValue(4)
		self.activityTimer.stop()
		self.activityslider.setValue(0)
		self.package.setText(txt)
		self.status.setText(self.oktext)

	def startActualUpgrade(self, answer):
		if not answer or not answer[1]:
			self.close()
			return

		if answer[1] == "menu":
			if config.softwareupdate.updateisunstable.value == '1':
				message = _("The current update may be unstable") + "\n" + _("Are you sure you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(%s " % self.total_packages + _("Packages") + ")"
			elif config.softwareupdate.updateisunstable.value == '0':
				message = _("Do you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(%s " % self.total_packages + _("Packages") + ")"
			choices = [(_("View the changes"), "changes"),
				(_("Upgrade and reboot system"), "cold")]
			if not self.SettingsBackupDone and not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
				choices.append((_("Perform a settings backup, making a backup before updating is strongly advised."), "backup"))
			if not self.ImageBackupDone and not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
				choices.append((_("Perform a full image backup"), "imagebackup"))
			choices.append((_("Update channel list only"), "channels"))
			choices.append((_("Cancel"), ""))
			self["actions"].setEnabled(True)
			upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name="SoftwareUpdateChoices", var=self.trafficLight, menu_path=self.menu_path_compressed)
			upgrademessage.setTitle(self.title)
		elif answer[1] == "changes":
			self.session.openWithCallback(self.startActualUpgrade,SoftwareUpdateChanges, self.menu_path)
		elif answer[1] == "backup":
			self.doSettingsBackup()
		elif answer[1] == "imagebackup":
			self.doImageBackup()
		elif answer[1] == "channels":
			self.channellist_only = 1
			self.slider.setValue(1)
			self.ipkg.startCmd(IpkgComponent.CMD_LIST, args = {'installed_only': True})
		elif answer[1] == "cold":
			if (config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value) or (config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value):
				self.doAutoBackup()
			else:
				self.session.open(TryQuitMainloop,retvalue=42)
				self.close()

	def modificationCallback(self, res):
		self.ipkg.write(res and "N" or "Y")

	def doSettingsBackup(self):
		backup = None
		from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
		self.BackupFiles = BackupFiles(self.session, True)
		Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
		Components.Task.job_manager.in_background = False
		for job in Components.Task.job_manager.getPendingJobs():
			if job.name == dgettext('vix', 'Backup Manager'):
				break
		self.showJobView(job)

	def doImageBackup(self):
		backup = None
		from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup
		self.ImageBackup = ImageBackup(self.session, True)
		Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
		Components.Task.job_manager.in_background = False
		for job in Components.Task.job_manager.getPendingJobs():
			if job.name == dgettext('vix', 'Image Manager'):
				break
		self.showJobView(job)

	def doAutoBackup(self, val = False):
		self.autobackuprunning = True
		if config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value and not self.SettingsBackupDone:
			self.doSettingsBackup()
		elif config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value and not self.ImageBackupDone:
			self.doImageBackup()
		else:
			self.session.open(TryQuitMainloop,retvalue=42)
			self.close()

	def showJobView(self, job):
		if job.name == dgettext('vix', 'Image Manager'):
			self.ImageBackupDone = True
		elif job.name == dgettext('vix', 'Backup Manager'):
			self.SettingsBackupDone = True
		from Screens.TaskView import JobView
		Components.Task.job_manager.in_background = False
		if not self.autobackuprunning:
			self.session.openWithCallback(self.startActualUpgrade(("menu", "menu")), JobView, job,  cancelable = False, backgroundable = False, afterEventChangeable = False, afterEvent="close")
		else:
			self.session.openWithCallback(self.doAutoBackup, JobView, job,  cancelable = False, backgroundable = False, afterEventChangeable = False, afterEvent="close")

	def exit(self):
		if not self.ipkg.isRunning():
			if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
				self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your %s %s") % (getMachineBrand(), getMachineName()))
			else:
				self.close()
		else:
			if not self.updating:
				self.close()

	def exitAnswer(self, result):
		if result is not None and result:
			self.session.open(TryQuitMainloop, retvalue=2)
		self.close()
Esempio n. 56
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.setTitle(_("About"))
        hddsplit = skin.parameters.get("AboutHddSplit", 0)

        procmodel = getBoxProc()

        AboutText = _("Hardware: ") + about.getHardwareTypeString() + "\n"
        if procmodel != about.getHardwareTypeString():
            AboutText += _("Proc model: ") + procmodel + "\n"
        if fileExists("/proc/stb/info/sn"):
            hwserial = open("/proc/stb/info/sn", "r").read().strip()
            AboutText += _("Hardware serial: ") + hwserial + "\n"

        AboutText += _("Brand: ") + about.getHardwareBrand() + "\n"

        cpu = about.getCPUInfoString()
        AboutText += _("CPU: ") + cpu + "\n"
        AboutText += _("CPU brand: ") + about.getCPUBrand() + "\n"
        AboutText += _("CPU architecture: ") + about.getCPUArch() + "\n"
        if boxbranding.getImageFPU() != "":
            AboutText += _("FPU: ") + boxbranding.getImageFPU() + "\n"
        AboutText += _(
            "Image architecture: ") + boxbranding.getImageArch() + "\n"

        if boxbranding.getImageArch() == "aarch64":
            if boxbranding.getHaveMultiLib() == "True":
                AboutText += _("MultiLib: ") + _("Yes") + "\n"
            else:
                AboutText += _("MultiLib: ") + _("No") + "\n"

        AboutText += _("Flash type: ") + about.getFlashType() + "\n"

        AboutText += "\n" + _("Image: ") + about.getImageTypeString() + "\n"
        AboutText += _("Feed URL: ") + boxbranding.getFeedsUrl() + "\n"

        AboutText += _(
            "Open Vision version: ") + about.getVisionVersion() + "\n"
        AboutText += _(
            "Open Vision revision: ") + about.getVisionRevision() + "\n"
        AboutText += _("Open Vision module: ") + about.getVisionModule() + "\n"

        AboutText += _("Build date: ") + about.getBuildDateString() + "\n"
        AboutText += _("Last update: ") + about.getUpdateDateString() + "\n"

        # [WanWizard] Removed until we find a reliable way to determine the installation date
        # AboutText += _("Installed: ") + about.getFlashDateString() + "\n"

        EnigmaVersion = about.getEnigmaVersionString()
        EnigmaVersion = EnigmaVersion.rsplit("-", EnigmaVersion.count("-") - 2)
        if len(EnigmaVersion) == 3:
            EnigmaVersion = EnigmaVersion[0] + " (" + EnigmaVersion[
                2] + "-" + EnigmaVersion[1] + ")"
        else:
            EnigmaVersion = EnigmaVersion[0] + " (" + EnigmaVersion[1] + ")"
        EnigmaVersion = _("Enigma version: ") + EnigmaVersion
        self["EnigmaVersion"] = StaticText(EnigmaVersion)
        AboutText += "\n" + EnigmaVersion + "\n"
        AboutText += _(
            "Enigma (re)starts: %d\n") % config.misc.startCounter.value
        AboutText += _("Enigma debug level: %d\n") % eGetEnigmaDebugLvl()

        AboutText += "\n" + _(
            "Kernel version: ") + about.getKernelVersionString() + "\n"

        AboutText += _(
            "DVB driver version: ") + about.getDriverInstalledDate() + "\n"
        AboutText += _("DVB API: ") + about.getDVBAPI() + "\n"
        if fileExists("/usr/bin/dvb-fe-tool"):
            import time
            try:
                cmd = 'dvb-fe-tool > /tmp/dvbfetool.txt'
                res = Console().ePopen(cmd)
                time.sleep(0.1)
            except:
                pass
        if fileExists("/tmp/dvbfetool.txt"):
            if fileHas("/tmp/dvbfetool.txt", "DVBC") or fileHas(
                    "/tmp/dvbfetool.txt", "DVB-C"):
                AboutText += _("DVB-C: ") + _("Yes") + "\n"
            else:
                AboutText += _("DVB-C: ") + _("No") + "\n"
            if fileHas("/tmp/dvbfetool.txt", "DVBS") or fileHas(
                    "/tmp/dvbfetool.txt", "DVB-S"):
                AboutText += _("DVB-S: ") + _("Yes") + "\n"
            else:
                AboutText += _("DVB-S: ") + _("No") + "\n"
            if fileHas("/tmp/dvbfetool.txt", "DVBT") or fileHas(
                    "/tmp/dvbfetool.txt", "DVB-T"):
                AboutText += _("DVB-T: ") + _("Yes") + "\n"
            else:
                AboutText += _("DVB-T: ") + _("No") + "\n"
            if fileHas("/tmp/dvbfetool.txt", "MULTISTREAM"):
                AboutText += _("Multistream: ") + _("Yes") + "\n"
            else:
                AboutText += _("Multistream: ") + _("No") + "\n"
            if fileHas("/tmp/dvbfetool.txt", "ANNEX_A") or fileHas(
                    "/tmp/dvbfetool.txt", "ANNEX-A"):
                AboutText += _("ANNEX-A: ") + _("Yes") + "\n"
            else:
                AboutText += _("ANNEX-A: ") + _("No") + "\n"
            if fileHas("/tmp/dvbfetool.txt", "ANNEX_B") or fileHas(
                    "/tmp/dvbfetool.txt", "ANNEX-B"):
                AboutText += _("ANNEX-B: ") + _("Yes") + "\n"
            else:
                AboutText += _("ANNEX-B: ") + _("No") + "\n"
            if fileHas("/tmp/dvbfetool.txt", "ANNEX_C") or fileHas(
                    "/tmp/dvbfetool.txt", "ANNEX-C"):
                AboutText += _("ANNEX-C: ") + _("Yes") + "\n"
            else:
                AboutText += _("ANNEX-C: ") + _("No") + "\n"

        GStreamerVersion = _("GStreamer version: "
                             ) + about.getGStreamerVersionString(cpu).replace(
                                 "GStreamer", "")
        self["GStreamerVersion"] = StaticText(GStreamerVersion)
        AboutText += "\n" + GStreamerVersion + "\n"

        FFmpegVersion = _("FFmpeg version: ") + about.getFFmpegVersionString()
        self["FFmpegVersion"] = StaticText(FFmpegVersion)
        AboutText += FFmpegVersion + "\n"

        AboutText += _(
            "Python version: ") + about.getPythonVersionString() + "\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        else:
            fp_version = _("Frontprocessor version: %s") % fp_version
            AboutText += fp_version + "\n"

        self["FPVersion"] = StaticText(fp_version)

        if boxbranding.getHaveTranscoding() != "":
            AboutText += _("Transcoding: ") + _("Yes") + "\n"
        else:
            AboutText += _("Transcoding: ") + _("No") + "\n"

        if boxbranding.getHaveMultiTranscoding() != "":
            AboutText += _("MultiTranscoding: ") + _("Yes") + "\n"
        else:
            AboutText += _("MultiTranscoding: ") + _("No") + "\n"

        AboutText += _('Skin & Resolution: %s (%sx%s)\n') % (
            config.skin.primary_skin.value.split('/')[0],
            getDesktop(0).size().width(), getDesktop(0).size().height())

        self["TunerHeader"] = StaticText(_("Detected NIMs:"))
        AboutText += "\n" + _("Detected NIMs:") + "\n"

        nims = nimmanager.nimListCompressed()
        for count in range(len(nims)):
            if count < 4:
                self["Tuner" + str(count)] = StaticText(nims[count])
            else:
                self["Tuner" + str(count)] = StaticText("")
            AboutText += nims[count] + "\n"

        self["HDDHeader"] = StaticText(_("Detected HDD:"))
        AboutText += "\n" + _("Detected HDD:") + "\n"

        hddlist = harddiskmanager.HDDList()
        hddinfo = ""
        if hddlist:
            formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s\n(%s, %.1f %sB %s)"
            for count in range(len(hddlist)):
                if hddinfo:
                    hddinfo += "\n"
                hdd = hddlist[count][1]
                if int(hdd.free()) > 1024:
                    hddinfo += formatstring % (hdd.model(), hdd.capacity(),
                                               hdd.free() / 1024.0, "G",
                                               _("free"))
                else:
                    hddinfo += formatstring % (hdd.model(), hdd.capacity(),
                                               hdd.free(), "M", _("free"))
        else:
            hddinfo = _("none")
        self["hddA"] = StaticText(hddinfo)
        AboutText += hddinfo + "\n\n" + _("Network Info:")
        for x in about.GetIPsFromNetworkInterfaces():
            AboutText += "\n" + x[0] + ": " + x[1]

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
        self["key_green"] = Button(_("Translations"))
        self["key_red"] = Button(_("Latest Commits"))
        self["key_yellow"] = Button(_("Troubleshoot"))
        self["key_blue"] = Button(_("Memory Info"))

        self["actions"] = ActionMap(
            ["ColorActions", "SetupActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "red": self.showCommits,
                "green": self.showTranslationInfo,
                "blue": self.showMemoryInfo,
                "yellow": self.showTroubleshoot,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
Esempio n. 57
0
	def __init__(self, session, eventName, callbackNeeded=False, save=False, savepath=None, localpath=None):
		Screen.__init__(self, session)
		self.setTitle(_("The Internet Movie Database"))

		for tag in config.plugins.imdb.ignore_tags.getValue().split(','):
			eventName = eventName.replace(tag,'')

		self.eventName = eventName

		self.callbackNeeded = callbackNeeded
		self.callbackData = ""
		self.callbackGenre = ""

		self.saving = save
		self.savingpath = savepath
		self.localpath = localpath
		self.fetchurl = None

		self.dictionary_init()

		self["poster"] = Pixmap()
		self.picload = ePicLoad()
		self.picload.PictureData.get().append(self.paintPosterPixmapCB)

		self["stars"] = ProgressBar()
		self["starsbg"] = Pixmap()
		self["stars"].hide()
		self["starsbg"].hide()
		self.ratingstars = -1

		self["title"] = StaticText(_("The Internet Movie Database"))
		def setText(txt):
			StaticText.setText(self["title"], txt)
			self["titellabel"].setText(txt)
		self["title"].setText = setText
		self["titellabel"] = Label()
		self["detailslabel"] = ScrollLabel("")
		self["castlabel"] = ScrollLabel("")
		self["extralabel"] = ScrollLabel("")
		self["statusbar"] = Label("")
		self["ratinglabel"] = Label("")
		self.resultlist = []
		self["menu"] = MenuList(self.resultlist)
		self["menu"].hide()

		self["key_red"] = Button(_("Exit"))
		self["key_green"] = Button("")
		self["key_yellow"] = Button("")
		self["key_blue"] = Button("")

		self.Page = 0

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "MovieSelectionActions", "DirectionActions"],
		{
			"ok": self.showDetails,
			"cancel": self.exit,
			"down": self.pageDown,
			"up": self.pageUp,
			"red": self.exit,
			"green": self.showMenu,
			"yellow": self.showDetails,
			"blue": self.showExtras,
			"contextMenu": self.contextMenuPressed,
			"showEventInfo": self.showDetails
		}, -1)

		self.getIMDB()

		if self.localpath is not None:
			self.onLayoutFinish.append(self._layoutFinished)
Esempio n. 58
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.setTitle(_("Network"))
		self.skinName = ["SystemNetworkInfo", "WlanStatus"]
		self["LabelBSSID"] = StaticText()
		self["LabelESSID"] = StaticText()
		self["LabelQuality"] = StaticText()
		self["LabelSignal"] = StaticText()
		self["LabelBitrate"] = StaticText()
		self["LabelEnc"] = StaticText()
		self["BSSID"] = StaticText()
		self["ESSID"] = StaticText()
		self["quality"] = StaticText()
		self["signal"] = StaticText()
		self["bitrate"] = StaticText()
		self["enc"] = StaticText()

		self["IFtext"] = StaticText()
		self["IF"] = StaticText()
		self["Statustext"] = StaticText()
		self["statuspic"] = MultiPixmap()
		self["statuspic"].setPixmapNum(1)
		self["statuspic"].show()
		self["devicepic"] = MultiPixmap()

		self["AboutScrollLabel"] = ScrollLabel()

		self.iface = None
		self.createscreen()
		self.iStatus = None

		if iNetwork.isWirelessInterface(self.iface):
			try:
				from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus

				self.iStatus = iStatus
			except:
				pass
			self.resetList()
			self.onClose.append(self.cleanup)

		self["key_red"] = StaticText(_("Close"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"],
									{
										"cancel": self.close,
										"ok": self.close,
										"up": self["AboutScrollLabel"].pageUp,
										"down": self["AboutScrollLabel"].pageDown
									})
		self.onLayoutFinish.append(self.updateStatusbar)
class UpdatePlugin(Screen, ProtectedScreen):
	skin = """
		<screen name="UpdatePlugin" position="center,center" size="550,300">
			<widget name="activityslider" position="0,0" size="550,5"  />
			<widget name="slider" position="0,150" size="550,30"  />
			<widget source="package" render="Label" position="10,30" size="540,20" font="Regular;18" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
			<widget source="status" render="Label" position="10,180" size="540,100" font="Regular;20" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
		</screen>"""

	def __init__(self, session, *args):
		Screen.__init__(self, session)
		ProtectedScreen.__init__(self)

		self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }

		self.setTitle(_("Software update"))
		self.slider = Slider(0, 4)
		self["slider"] = self.slider
		self.activityslider = Slider(0, 100)
		self["activityslider"] = self.activityslider
		self.status = StaticText(_("Please wait..."))
		self["status"] = self.status
		self.package = StaticText(_("Package list update"))
		self["package"] = self.package
		self.oktext = _("Press OK on your remote control to continue.")

		self.packages = 0
		self.error = 0
		self.processed_packages = []
		self.total_packages = None

		self.channellist_only = 0
		self.channellist_name = ''
		self.updating = False
		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)
		self.onClose.append(self.__close)

		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.exit,
			"back": self.exit
		}, -1)

		self.activity = 0
		self.activityTimer = eTimer()
		self.activityTimer.callback.append(self.checkTraficLight1)
		self.activityTimer.callback.append(self.doActivityTimer)
		self.activityTimer.start(20, True)

	def checkTraficLight1(self):
		self.activityTimer.callback.remove(self.checkTraficLight1)
		self.activityTimer.start(100, False)
		self.showDisclaimer()

	def isProtected(self):
		return config.ParentalControl.setuppinactive.value and\
			(not config.ParentalControl.config_sections.main_menu.value and not config.ParentalControl.config_sections.configuration.value  or hasattr(self.session, 'infobar') and self.session.infobar is None) and\
			config.ParentalControl.config_sections.software_update.value

	def checkTraficLight(self):

		self.activityTimer.callback.remove(self.checkTraficLight)
		self.activityTimer.start(100, False)

		currentTimeoutDefault = socket.getdefaulttimeout()
		socket.setdefaulttimeout(3)
		message = ""
		picon = None
		default = True
		try:
			# TODO: Use Twisted's URL fetcher, urlopen is evil. And it can
			# run in parallel to the package update.
			status = urlopen("http://openpli.org/status/").read().split('!', 1)
			if getBoxType() in status[0].split(','):
				message = len(status) > 1 and status[1] or _("The current beta image might not be stable.\nFor more information see %s.") % ("www.openpli.org")
				picon = MessageBox.TYPE_ERROR
				default = False
		except:
			message = _("The status of the current beta image could not be checked because %s can not be reached.") % ("www.openpli.org")
			picon = MessageBox.TYPE_ERROR
			default = False
		socket.setdefaulttimeout(currentTimeoutDefault)
		if default:
			self.showDisclaimer()
		else:
			message += "\n" + _("Do you want to update your receiver?")
			self.session.openWithCallback(self.startActualUpdate, MessageBox, message, default = default, picon = picon)

	def showDisclaimer(self, justShow=False):
		if config.usage.show_update_disclaimer.value or justShow:
			message = _("The OpenPLi team would like to point out that upgrading to the latest nightly build comes not only with the latest features, but also with some risks. After the update, it is possible that your device no longer works as expected. We recommend you create backups with Autobackup or Backupsuite. This allows you to quickly and easily restore your device to its previous state, should you experience any problems. If you encounter a 'bug', please report the issue on www.openpli.org.\n\nDo you understand this?")
			list = not justShow and [(_("no"), False), (_("yes"), True), (_("yes") + " " + _("and never show this message again"), "never")] or []
			self.session.openWithCallback(boundFunction(self.disclaimerCallback, justShow), MessageBox, message, list=list)
		else:
			self.startActualUpdate(True)

	def disclaimerCallback(self, justShow, answer):
		if answer == "never":
			config.usage.show_update_disclaimer.value = False
			config.usage.show_update_disclaimer.save()
		if justShow and answer:
			self.ipkgCallback(IpkgComponent.EVENT_DONE, None)
		else:
			self.startActualUpdate(answer)

	def getLatestImageTimestamp(self):
		# TODO: Impement own sh4 timestamp
		return ""
		
		currentTimeoutDefault = socket.getdefaulttimeout()
		socket.setdefaulttimeout(3)
		latestImageTimestamp = ""
		try:
			# TODO: Use Twisted's URL fetcher, urlopen is evil. And it can
			# run in parallel to the package update.
			latestImageTimestamp = re.findall('<dd>(.*?)</dd>', urlopen("http://openpli.org/download/"+getBoxType()+"/").read())[0][:16]
			latestImageTimestamp = time.strftime(_("%d-%b-%Y %-H:%M"), time.strptime(latestImageTimestamp, "%Y/%m/%d %H:%M"))
		except:
			pass
		socket.setdefaulttimeout(currentTimeoutDefault)
		return latestImageTimestamp

	def startActualUpdate(self,answer):
		if answer:
			self.updating = True
			self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
		else:
			self.close()

	def doActivityTimer(self):
		self.activity += 1
		if self.activity == 100:
			self.activity = 0
		self.activityslider.setValue(self.activity)

	def showUpdateCompletedMessage(self):
		self.setEndMessage(ngettext("Update completed, %d package was installed.", "Update completed, %d packages were installed.", self.packages) % self.packages)

	def ipkgCallback(self, event, param):
		if event is IpkgComponent.EVENT_DOWNLOAD:
			self.status.setText(_("Downloading"))
		elif event is IpkgComponent.EVENT_UPGRADE:
			if self.sliderPackages.has_key(param):
				self.slider.setValue(self.sliderPackages[param])
			self.package.setText(param)
			self.status.setText(_("Upgrading") + ": %s/%s" % (self.packages, self.total_packages))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event is IpkgComponent.EVENT_INSTALL:
			self.package.setText(param)
			self.status.setText(_("Installing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event is IpkgComponent.EVENT_REMOVE:
			self.package.setText(param)
			self.status.setText(_("Removing"))
			if not param in self.processed_packages:
				self.processed_packages.append(param)
				self.packages += 1
		elif event is IpkgComponent.EVENT_CONFIGURING:
			self.package.setText(param)
			self.status.setText(_("Configuring"))
		elif event is IpkgComponent.EVENT_MODIFIED:
			if config.plugins.softwaremanager.overwriteConfigFiles.value in ("N", "Y"):
				self.ipkg.write(True and config.plugins.softwaremanager.overwriteConfigFiles.value)
			else:
				self.session.openWithCallback(
					self.modificationCallback,
					MessageBox,
					_("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?") % (param)
				)
		elif event is IpkgComponent.EVENT_ERROR:
			self.error += 1
		elif event is IpkgComponent.EVENT_DONE:
			if self.updating:
				self.updating = False
				self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
			elif self.ipkg.currentCommand is IpkgComponent.CMD_UPGRADE_LIST and self.error == 0:
				self.total_packages = len(self.ipkg.getFetchedList())
				if self.total_packages:
					latestImageTimestamp = self.getLatestImageTimestamp()
					if latestImageTimestamp:
						message = _("Do you want to update your receiver to %s?") % self.getLatestImageTimestamp() + "\n"
					else:
						message = _("Do you want to update your receiver?") + "\n"
					message += "(" + (ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")"
					if self.total_packages > 150:
						message += " " + _("Reflash recommended!")
					choices = [(_("Update and reboot (recommended)"), "cold"),
						(_("Update and ask to reboot"), "hot"),
						(_("Update channel list only"), "channels"),
						(_("Show updated packages"), "showlist")]
				else:
					message = _("No updates available")
					choices = []
				if fileExists("/hdd/ipkgupgrade.log"):
					choices.append((_("Show latest upgrade log"), "log"))
				choices.append((_("Show latest commits"), "commits"))
				if not config.usage.show_update_disclaimer.value:
					choices.append((_("Show disclaimer"), "disclaimer"))
				choices.append((_("Cancel"), ""))
				self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices)
			elif self.channellist_only > 0:
				if self.channellist_only == 1:
					self.setEndMessage(_("Could not find installed channel list."))
				elif self.channellist_only == 2:
					self.slider.setValue(2)
					self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {'package': self.channellist_name})
					self.channellist_only += 1
				elif self.channellist_only == 3:
					self.slider.setValue(3)
					self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': self.channellist_name})
					self.channellist_only += 1
				elif self.channellist_only == 4:
					self.showUpdateCompletedMessage()
					eDVBDB.getInstance().reloadBouquets()
					eDVBDB.getInstance().reloadServicelist()
			elif self.error == 0:
				self.showUpdateCompletedMessage()
			else:
				self.activityTimer.stop()
				self.activityslider.setValue(0)
				error = _("Your receiver might be unusable now. Please consult the manual for further assistance before rebooting your receiver.")
				if self.packages == 0:
					error = _("No updates available. Please try again later.")
				if self.updating:
					error = _("Update failed. Your receiver does not have a working internet connection.")
				self.status.setText(_("Error") +  " - " + error)
		elif event is IpkgComponent.EVENT_LISTITEM:
			if 'enigma2-plugin-settings-' in param[0] and self.channellist_only > 0:
				self.channellist_name = param[0]
				self.channellist_only = 2
		#print event, "-", param
		pass

	def setEndMessage(self, txt):
		self.slider.setValue(4)
		self.activityTimer.stop()
		self.activityslider.setValue(0)
		self.package.setText(txt)
		self.status.setText(self.oktext)

	def startActualUpgrade(self, answer):
		if not answer or not answer[1]:
			self.close()
			return
		if answer[1] == "cold":
			self.session.open(TryQuitMainloop,retvalue=42)
			self.close()
		elif answer[1] == "channels":
			self.channellist_only = 1
			self.slider.setValue(1)
			self.ipkg.startCmd(IpkgComponent.CMD_LIST, args = {'installed_only': True})
		elif answer[1] == "commits":
			self.session.openWithCallback(boundFunction(self.ipkgCallback, IpkgComponent.EVENT_DONE, None), CommitInfo)
		elif answer[1] == "disclaimer":
			self.showDisclaimer(justShow=True)
		elif answer[1] == "showlist":
			text = ""
			for i in [x[0] for x in sorted(self.ipkg.getFetchedList(), key=lambda d: d[0])]:
				text = text and text + "\n" + i or i
			self.session.openWithCallback(boundFunction(self.ipkgCallback, IpkgComponent.EVENT_DONE, None), TextBox, text, _("Packages to update"))
		elif answer[1] == "log":
			text = ""
			for i in open("/hdd/ipkgupgrade.log", "r").readlines():
				text += i
			self.session.openWithCallback(boundFunction(self.ipkgCallback, IpkgComponent.EVENT_DONE, None), TextBox, text, _("Packages to update"))
		else:
			self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False})

	def modificationCallback(self, res):
		self.ipkg.write(res and "N" or "Y")

	def exit(self):
		if not self.ipkg.isRunning():
			if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
				self.session.openWithCallback(self.exitAnswer, MessageBox, _("Update completed. Do you want to reboot your receiver?"))
			else:
				self.close()
		else:
			if not self.updating:
				self.close()

	def exitAnswer(self, result):
		if result is not None and result:
			self.session.open(TryQuitMainloop,retvalue=2)
		self.close()

	def __close(self):
		self.ipkg.removeCallback(self.ipkgCallback)
Esempio n. 60
0
	def populate(self):
		self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
		self["lab2"] = StaticText(_("By Team ViX"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.world-of-satellite.com")

		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if about.getChipSetString() != _("unavailable"):
			if SystemInfo["HasHiSi"]:
				AboutText += _("Chipset:\tHiSilicon %s\n") % about.getChipSetString().upper()
			elif about.getIsBroadcom():
				AboutText += _("Chipset:\tBroadcom %s\n") % about.getChipSetString().upper()
			else:
				AboutText += _("Chipset:\t%s\n") % about.getChipSetString().upper()

		AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(), about.getCPUSpeedString(), about.getCpuCoresString())
		imageSubBuild = ""
		if getImageType() != 'release':
			imageSubBuild = ".%s" % getImageDevBuild()
		AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(), getImageBuild(), imageSubBuild, getImageType().title())

		if SystemInfo["HasH9SD"]:
			if "rootfstype=ext4" in open('/sys/firmware/devicetree/base/chosen/bootargs', 'r').read():
				part = "        - SD card in use for Image root \n"
			else:
				part = "        - eMMC slot in use for Image root \n"
			AboutText += _("%s") % part

		if SystemInfo["canMultiBoot"]:
			slot = image = GetCurrentImage()
			part = "eMMC slot %s" % slot
			bootmode = ""
			if SystemInfo["canMode12"]:
				bootmode = "bootmode = %s" % GetCurrentImageMode()
			print "[About] HasHiSi = %s, slot = %s" % (SystemInfo["HasHiSi"], slot)
			if SystemInfo["HasHiSi"] and "sda" in SystemInfo["canMultiBoot"][slot]['root']:
				if slot > 4:
					image -= 4
				else:
					image -= 1
				part = "SDcard slot %s (%s) " % (image, SystemInfo["canMultiBoot"][slot]['root'])
			AboutText += _("Image Slot:\t%s") % "STARTUP_" + str(slot) + "  " + part + " " + bootmode + "\n"

		if getMachineName() in ('ET8500') and path.exists('/proc/mtd'):
			self.dualboot = self.dualBoot()
			if self.dualboot:
				AboutText += _("ET8500 Multiboot: Installed\n")

		skinWidth = getDesktop(0).size().width()
		skinHeight = getDesktop(0).size().height()

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s\n") % driversdate
		AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()
		AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ", "")
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
		AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Last update:\t%s\n") % getEnigmaVersionString()
		AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
		uptime = about.getBoxUptime()
		if uptime:
			AboutText += _("Uptime:\t%s\n") % uptime
		e2uptime = about.getEnigmaUptime()
		if e2uptime:
			AboutText += _("Enigma2 uptime:\t%s\n") % e2uptime
		AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _("  (%s x %s)") % (skinWidth, skinHeight) + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			with open('/proc/stb/sensors/temp0/value', 'r') as f:
				tempinfo = f.read()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			with open('/proc/stb/fp/temp_sensor', 'r') as f:
				tempinfo = f.read()
		elif path.exists('/proc/stb/sensors/temp/value'):
			with open('/proc/stb/sensors/temp/value', 'r') as f:
				tempinfo = f.read()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temp:\t%s") % tempinfo.replace('\n', '').replace(' ', '') + mark + "C\n"

		tempinfo = ""
		if path.exists('/proc/stb/fp/temp_sensor_avs'):
			with open('/proc/stb/fp/temp_sensor_avs', 'r') as f:
				tempinfo = f.read()
		elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
			try:
				with open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') as f:
					tempinfo = f.read()
					tempinfo = tempinfo[:-4]
			except:
				tempinfo = ""
		elif path.exists('/proc/hisi/msp/pm_cpu'):
			try:
				tempinfo = search('temperature = (\d+) degree', open("/proc/hisi/msp/pm_cpu").read()).group(1)
			except:
				tempinfo = ""
		if tempinfo and int(tempinfo) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("Processor temp:\t%s") % tempinfo.replace('\n', '').replace(' ', '') + mark + "C\n"
		AboutLcdText = AboutText.replace('\t', ' ')

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("FP version:\t%s") % fp_version
			AboutText += fp_version + "\n"

		bootloader = ""
		if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
				f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
				bootloader = f.readline().replace('\x00', '').replace('\n', '')
				f.close()
				AboutText += _("Bootloader:\t%s\n") % (bootloader)

		self["AboutScrollLabel"] = ScrollLabel(AboutText)