Example #1
0
 def get_times(self, prayer):# If User Sets Clock Format 12hr or 24hr Return It As He Likes!
     if self.prayertimes.options.clock_format == '12h':
         #print ("DEBUG: using 12h format @", (str(datetime.datetime.now())))
         return self.timeto12(prayer).replace('AM', _('AM')).replace('PM', _('PM'))
     if self.prayertimes.options.clock_format == '24h':
         #print ("DEBUG: using 24h format @", (str(datetime.datetime.now())))
         return self.timeto24(prayer)
Example #2
0
	def __init__(self, qibladirection, country, city):
		Gtk.Box.__init__(self)

		self.mainbox = Gtk.Box()
		self.mainbox.set_orientation(Gtk.Orientation.VERTICAL)

		qibla = self.set_compass(qibladirection)
		qibla.props.valign = Gtk.Align.START

		## Make the top label
		qiblatitle = Gtk.Label(label=_("Qibla direction :"), margin_left=20, margin_right=20)
		qiblatitle.props.halign = Gtk.Align.START
		self.mainbox.pack_start(qiblatitle, False, False, 12)

		## Set the compass image
		self.mainbox.pack_start(qibla, False, True, 0)

		## Set the country and city
		vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
		qiblalabel = Gtk.Label(label=_("Country : %s") % country)
		qiblalabel.props.halign = Gtk.Align.CENTER
		qiblalabel.props.valign = Gtk.Align.CENTER
		vbox.pack_start(qiblalabel, True,True, 0)

		qiblalabel = Gtk.Label(label=_("City : %s") % city)
		qiblalabel.props.halign = Gtk.Align.CENTER
		qiblalabel.props.valign = Gtk.Align.CENTER
		vbox.pack_start(qiblalabel, True, True, 0)

		## Add it all in the end
		self.mainbox.pack_start(vbox, False, False, 12)
		self.pack_start(self.mainbox, True, True, 0)
Example #3
0
    def keyYellow(self):
        if self.NumberOfScreens >= 1:
            self.currentScreenID += 1
            if self.currentScreenID >= self.NumberOfScreens:
                self.currentScreenID = 0
            while self.root[self.currentScreenID].tag != 'screen':
                self.currentScreenID += 1
                
            try:
                self.myScreenName = self.root[self.currentScreenID].attrib['name']
            except:
                self.myScreenName = _('UnknownName')
            myTitle=_("UserSkin %s - Edit %s screen (1/%d)") %  (UserSkinInfo,self.myScreenName,self.NumberOfScreens)
            print myTitle
            
            self.setTitle(myTitle)
            self["menu"].setIndex(0)
        #try:
            #self["Title"]=StaticText(myTitle)
        #except:
        #    pass
            self.createWidgetsList()

        if self.NumberOfChilds != self.NumberOfScreens:
            iindex = 0
            for child in self.root.findall('*'):
                if child.tag == screen:
                    break
                iindex+= 1
            self.currentScreenID = iindex
Example #4
0
def Plugins(**kwargs):
    return [
        PluginDescriptor(name=_("AtileHD Setup"),
                         description=_("Personalize your Skin"),
                         where=PluginDescriptor.WHERE_MENU,
                         fnc=menu)
    ]
    def keyYellow(self):
        if self.NumberOfScreens >= 1:
            self.currentScreenID += 1
            if self.currentScreenID >= self.NumberOfScreens:
                self.currentScreenID = 0
            while self.root[self.currentScreenID].tag != 'screen':
                self.currentScreenID += 1

            try:
                self.myScreenName = self.root[
                    self.currentScreenID].attrib['name']
            except:
                self.myScreenName = _('UnknownName')
            myTitle = _("UserSkin %s - Edit %s screen (1/%d)") % (
                UserSkinInfo, self.myScreenName, self.NumberOfScreens)
            print myTitle

            self.setTitle(myTitle)
            self["menu"].setIndex(0)
            #try:
            #self["Title"]=StaticText(myTitle)
            #except:
            #    pass
            self.createWidgetsList()

        if self.NumberOfChilds != self.NumberOfScreens:
            iindex = 0
            for child in self.root.findall('*'):
                if child.tag == screen:
                    break
                iindex += 1
            self.currentScreenID = iindex
Example #6
0
    def __init__(self, qibladirection, country, city):
        Gtk.Box.__init__(self)

        self.mainbox = Gtk.Box()
        self.mainbox.set_orientation(Gtk.Orientation.VERTICAL)

        qibla = self.set_compass(qibladirection)
        qibla.props.valign = Gtk.Align.START

        ## Make the top label
        qiblatitle = Gtk.Label(label=_("Qibla direction :"),
                               margin_left=20,
                               margin_right=20)
        qiblatitle.props.halign = Gtk.Align.START
        self.mainbox.pack_start(qiblatitle, False, False, 12)

        ## Set the compass image
        self.mainbox.pack_start(qibla, False, True, 0)

        ## Set the country and city
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
        qiblalabel = Gtk.Label(label=_("Country : %s") % country)
        qiblalabel.props.halign = Gtk.Align.CENTER
        qiblalabel.props.valign = Gtk.Align.CENTER
        vbox.pack_start(qiblalabel, True, True, 0)

        qiblalabel = Gtk.Label(label=_("City : %s") % city)
        qiblalabel.props.halign = Gtk.Align.CENTER
        qiblalabel.props.valign = Gtk.Align.CENTER
        vbox.pack_start(qiblalabel, True, True, 0)

        ## Add it all in the end
        self.mainbox.pack_start(vbox, False, False, 12)
        self.pack_start(self.mainbox, True, True, 0)
Example #7
0
	def restartGUI(self):
	  
		def restartGUIcb(answer):
			if answer is True:
				self.session.open(TryQuitMainloop, 3)
			else:
				self.close()

		def restartNotOKcb(answer):
			if answer is True:
				self.session.open(TryQuitMainloop, 3)
			else:
				user_skin_file=resolveFilename(SCOPE_CONFIG, 'skin_user' + self.currentSkin + '.xml')
				if path.exists(user_skin_file):
					remove(user_skin_file)
				self.close()

		myMessage = ''
		if self.LackOfFile != '':
			printDEBUG("missing components: %s" % self.LackOfFile)
			myMessage += _("Missing components found: %s\n\n") % self.LackOfFile
			myMessage += _("Skin will NOT work properly and GS expected!!!\n\n")
			myMessage += _("Are you sure you want to use it?")
			restartbox = self.session.openWithCallback(restartNotOKcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
		else:
			myMessage += _("Restart GUI now?")
			restartbox = self.session.openWithCallback(restartGUIcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
		restartbox.setTitle(_("Message"))
Example #8
0
	def setInfo(self):
		selection = self["filelist"].getSelection()
		if selection is None:
			return
		elif selection[1] == True: # isDir
			self["key_green"].setText("")
			self.EditScreen = False
			self["key_yellow"].setText("")
			self.DeleteScreen = False
			self["PreviewPicture"].hide()
			self["key_blue"].setText("")
		else:
			self["key_green"].setText(_("Edit"))
			self.EditScreen = True
			if path.exists(self.UserSkin_Selections_dir + self.filelist.getFilename()):
				self["key_yellow"].setText("")
				self.DeleteScreen = False
			else:
				self["key_yellow"].setText(_("Delete"))
				self.DeleteScreen = True

			self.PreviewTimer.start(100,False)
			if self.filelist.getFilename().lower().find('infobar') != -1:
				self["key_blue"].setText(_("Preview"))
			else:
				self["key_blue"].setText("")
Example #9
0
	def get_hijri_date(self):
		wd = datetime.datetime.now().strftime("%A")
		calc = HijriCal(self.silaty.prayertimes.options.hijrical_adjustment)
		h_months = ['Muharram ', 'Safar', 'Rabi al Awwal', 'Rabi al Akhira', 'Jumada al Ula', 'Jumada al Akhira', 'Rajab', "Sha'ban", 'Ramadan', 'Shawwal', "Dhu al Qa'da", 'Dhu al Hijja']
		h_year,  h_month,  h_day,  h_week_day = calc.today
		h_date = '%i %s %i' % ( h_day,  _(h_months[int(h_month-1)]),  h_year)
		return (_('%s, %s') % (_(wd), h_date))
Example #10
0
	def update_compass(self, qibladirection, country, city):
		## The only way to update so far is to remove the whole thing and create it again
		self.remove(self.mainbox)

		self.mainbox = Gtk.Box()
		self.mainbox.set_orientation(Gtk.Orientation.VERTICAL)

		qibla = self.set_compass(qibladirection)
		qibla.props.valign = Gtk.Align.START

		## Make the top label
		qiblatitle = Gtk.Label(label=_("Qibla direction :"), margin_left=20, margin_right=20)
		qiblatitle.props.halign = Gtk.Align.START
		self.mainbox.pack_start(qiblatitle, False, False, 12)

		## Set the compass image
		self.mainbox.pack_start(qibla, False, True, 0)

		## Set the country and city
		vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
		qiblalabel = Gtk.Label(label=_("Country : %s") % country)
		qiblalabel.props.halign = Gtk.Align.CENTER
		qiblalabel.props.valign = Gtk.Align.CENTER
		vbox.pack_start(qiblalabel, True,True, 0)

		qiblalabel = Gtk.Label(label=_("City : %s") % city)
		qiblalabel.props.halign = Gtk.Align.CENTER
		qiblalabel.props.valign = Gtk.Align.CENTER
		vbox.pack_start(qiblalabel, True, True, 0)

		## Add it all in the end
		self.mainbox.pack_start(vbox, False, False, 12)
		self.pack_start(self.mainbox, True, True, 0)
		self.show_all()
Example #11
0
 def openSelected(self):
     selected = str(self["list"].getCurrent()[2])
     if selected == 'about':
         from about import UserSkin_About
         self.session.openWithCallback(self.refresh,UserSkin_About)
         return
     elif selected == 'config':
         from skinconfig import UserSkin_Config
         self.session.openWithCallback(self.quit,UserSkin_Config)
         return
     elif selected == 'LCDskin':
         from Plugins.Extensions.MiniTVUserSkinMaker.miniTVskinner import miniTVskinnerInitiator
         self.runLCDskin(retDict = None, initRun = True)
         return
     elif selected == 'LCDskinInstall':
         from myComponents import UserSkinconsole
         runlist = []
         runlist.append( ('opkg update') )
         runlist.append( ('opkg install enigma2-plugin-extensions--j00zeks-minitvuserskinmaker') )
         self.session.openWithCallback(self.refresh, UserSkinconsole, title = _("Installing  miniTV skin creator"), cmdlist = runlist)
         self.refresh()
         return
     elif selected == 'ListScreens':
         from ScreensLister import ScreensLister
         self.session.openWithCallback(self.doNothing,ScreensLister)
         return
     elif selected == 'getaddons':
         from myComponents import myMenu
         self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Getaddons', MenuTitle = _("Download addons"))
         return
     elif selected == 'delete_addons':
         from myComponents import myMenu
         self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Deleteaddons', MenuTitle = _("Delete addons"))
         return
     elif selected == 'getcomponents':
         from myComponents import myMenu
         self.session.openWithCallback(self.rebootQuestion, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Getcomponents', MenuTitle = _("Download additional Components/plugins"))
         return
     elif selected == 'importskin':
         from myComponents import myMenu
         self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sImportSkinScripts' % PluginPath, MenuFile = '_Skins2Import', MenuTitle = _("Import foreign skin"))
         return
     elif selected == 'getskin':
         def goUpdate(ret):
             if ret is True:
                 from myComponents import UserSkinconsole
                 runlist = []
                 runlist.append( ('chmod 755 %sscripts/SkinUpdate.sh' % PluginPath) )
                 runlist.append( ('%sscripts/SkinUpdate.sh %s' % (PluginPath,SkinPath)) )
                 self.session.openWithCallback(self.rebootQuestion, UserSkinconsole, title = _("Updating skin"), cmdlist = runlist)
             return
             
         self.session.openWithCallback(goUpdate, MessageBox,_("Do you want to update skin?"),  type = MessageBox.TYPE_YESNO, timeout = 10, default = False)
         return
     elif selected == 'history':
         from myComponents import UserSkinconsole
         self.session.openWithCallback(self.refresh, UserSkinconsole, title = _("History of changes"), cmdlist = [ '%sscripts/SkinHistory.sh %s' % (PluginPath,SkinPath) ])
         return
Example #12
0
	def refresh(self):
		# update hijri date
		self.hytoday, self.hmtoday, self.hdtoday = self.hijrical.goto_gregorian_day(self.gytoday, (self.gmtoday+1), self.gdtoday)
		# update hijri title label
		now_wd = datetime.datetime.now().strftime("%A")
		h_date = '%i %s %i' % (self.hdtoday, _(self.hmonths[int(self.hmtoday-1)]), self.hytoday)
		self.parent.titlestack.get_child_by_name("Hijri").set_label(_('%s, %s') % (_(now_wd), h_date))
		# update calendar
		gday   = (self.refdate).strftime("%d")
		gmonth = (self.refdate).strftime("%B")
		gyear  = (self.refdate).strftime("%Y")
		if self.state == CalendarState.Gregorian:
			# Get the size of this month
			hyear, hmonth, hday = self.hijrical.goto_gregorian_day(int(gyear), (self.gmonths.index(gmonth)+1), int(gday))
			refwd = self.weekdays.index(self.refdate.strftime("%A"))
			calendarindex = -(refwd+(((6-refwd)+int(self.refdate.strftime("%d")))//7)*7)
		else:
			hyear, hmonth, hday = self.hijrical.goto_gregorian_day(int(gyear), (self.gmonths.index(gmonth)+1), int(gday))
			refwd = self.weekdays.index(self.refdate.strftime("%A"))
			calendarindex = -(refwd+(((6-refwd)+hday)//7)*7)
		for row in range(0, 6):
			for column in range(0, 7):
				newgday = int((self.refdate + timedelta(days=(calendarindex))).strftime("%d"))
				newgmonth = self.gmonths.index((self.refdate + timedelta(days=(calendarindex))).strftime("%B"))
				newgyear = int((self.refdate + timedelta(days=(calendarindex))).strftime("%Y"))
				newhyear, newhmonth, newhday = self.hijrical.goto_gregorian_day(newgyear, newgmonth+1, newgday)

				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next = newgday
				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next = newhday

				if (column == 0) or (column == 6):
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.LGrey
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.LGrey
				else:
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.White
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.White

				if newgmonth != self.gmonths.index(self.refdate.strftime("%B")):
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.DGrey

				if newhmonth != hmonth:
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.DGrey

				if (newgday == self.gdtoday and newgmonth == self.gmtoday and newgyear == self.gytoday):
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.Blue

				if (newhday == self.hdtoday and newhmonth == self.hmtoday and newhyear == self.hytoday):
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.Blue

				newgbackground = self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background
				newhbackground = self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background

				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day = newgday
				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_background = newgbackground
				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day = newhday
				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_background = newhbackground

				calendarindex += 1
Example #13
0
 def restartGUI(self):
     myMessage = ''
     if self.LackOfFile != '':
         printDEBUG("missing components: %s" % self.LackOfFile)
         myMessage += _("Missing components found: %s\n\n") % self.LackOfFile
         myMessage += _("Skin will NOT work properly!!!\n\n")
     myMessage += _("Restart necessary, restart GUI now?")
     restartbox = self.session.openWithCallback(self.restartGUIcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
     restartbox.setTitle(_("Message"))
Example #14
0
def Plugins(**kwargs):
    return [
        PluginDescriptor(
            name=_("UserSkin Setup"),
            description=_("Personalize your Skin"),
            where=PluginDescriptor.WHERE_MENU,
            fnc=menu,
        )
    ]
Example #15
0
 def __init__(self, session):
     Screen.__init__(self, session)
     self.setup_title = _("UserSkinMenu")
     Screen.setTitle(self, self.setup_title)
     self["list"] = List()
     self["setupActions"] = ActionMap(
         ["SetupActions", "MenuActions"], {"cancel": self.quit, "ok": self.openSelected, "menu": self.quit}, -2
     )
     self.setTitle(_("UserSkin menu %s") % UserSkinInfo)
     self.createsetup()
Example #16
0
	def secs_to_hrtime(self, secs):
		# Transform Seconds into Hours and Minutes
		hours = secs//3600
		minutes = (secs//60)%60
		minutes += 1 # correct minutes (to avoid values like "0min")
		if minutes == 60:
			hours += 1
			return _("%s Hours") % str(hours)
		elif hours == 0:
			return _("%s Minutes") % str(minutes)
		else:
			return _("%s Hours and %s Minutes") % (str(hours), str(minutes))
Example #17
0
 def __init__(self, session):
     Screen.__init__(self, session)
     self.setup_title = _("AtileHDMenu")
     Screen.setTitle(self, self.setup_title)
     self["list"] = List()
     self["setupActions"] = ActionMap(["SetupActions", "MenuActions"], {
         "cancel": self.quit,
         "ok": self.openSelected,
         "menu": self.quit,
     }, -2)
     self.setTitle(_("AtileHD menu %s") % AtileHDInfo)
     self.createsetup()
    def createWidgetsList(self):
        menu_list = []
        f_list = []
        for child in self.root[self.currentScreenID].findall('*'):
            childTitle = ''
            childDescr = ' '
            childTYPE = child.tag
            if childTYPE.lower() == 'widget':
                pic = self.widget_png
                if 'render' in child.attrib:
                    childTitle = _(child.attrib['render'])
                if 'name' in child.attrib and child.attrib['name'] == 'list':
                    if 'serviceNameFont' in child.attrib and 'serviceNumberFont' in child.attrib:
                        childTitle = _('ChannelList')
                    else:
                        childTitle = _('List')
            elif childTYPE.lower() == 'elabel':
                pic = self.elabel_png
                childDescr += _('Paint a square. ')
            elif childTYPE.lower() == 'epixmap':
                pic = self.epixmap_png
                childDescr += _('Display a picture. ')

            elif childTYPE.lower() == 'label':
                pic = self.label_png

            elif childTYPE.lower() == 'pixmap':
                pic = self.pixmap_png

            else:
                pic = None
            if 'text' in child.attrib:
                childDescr += _('Display %s. ') % child.attrib['text']
            if 'render' in child.attrib and 'source' in child.attrib:
                childDescr += _(
                    'Controlled through %s. ') % child.attrib['source']
            if 'name' in child.attrib:
                childDescr += _('Controlled by script or plugin. ')
            f_list.append(
                (child, "%s %s" % (childTYPE, childTitle), childDescr, pic))
        if len(f_list) == 0:
            f_list.append(("dummy", _("No widgets found"), '', None))
            self.blockActions = True
        if self.blockActions == True:
            self['key_blue'].setText('')
        for entry in f_list:
            menu_list.append((entry[0], entry[1], entry[2], entry[3]))
        #print menu_list
        try:
            self["menu"].UpdateList(menu_list)
        except:
            print "Update asser error :("  #workarround to have it working on openpliPC
            myIndex = self["menu"].getIndex(
            )  #as an effect, index is cleared so we need to store it first
            self["menu"].setList(menu_list)
            self["menu"].setIndex(myIndex)  #and restore
        self.selectionChanged()
 def keyExit(self):
     if self.EditedScreen == True:
         self.session.openWithCallback(self.keyExitRet,
                                       ChoiceBox,
                                       title=_("Exit options"),
                                       list=[
                                           (_("Exit without saving"),
                                            "exit"),
                                           (_("Save as & Exit"), "saveas"),
                                           (_("Save & Exit"), "save"),
                                       ])
     else:
         self.close()
Example #20
0
 def __init__(self, text, width=None, base_text=None, **kwds):
     #-# Translation live update preparation
     # base_text: to be used each time a widget takes a formated string
     #            defaults to 'text'.
     Widget.__init__(self, **kwds)
     #-# Translation live update preparation
     self.fixed_width = width
     self.base_text = base_text or text
     self.previous_translation = _(text, doNotTranslate=kwds.get('doNotTranslate', False))
     #-#
     self._text = _(text, doNotTranslate=kwds.get('doNotTranslate', False))
     #-#
     self.calc_size()
Example #21
0
	def secs_to_nrtime(self, secs):
		# Transform Seconds into Hours and Minutes
		# Using the same standard in iPray
		hours = secs//3600
		minutes = (secs//60)%60
		minutes += 1 # correct minutes (to avoid values like "0min")
		if minutes == 60:
			hours += 1
			return _("%shr") % str(hours)
		elif hours == 0:
			return _("%smin") % str(minutes)
		else:
			return _("%shr %smin") % (str(hours), str(minutes))
Example #22
0
 def __init__(self, text, width=None, base_text=None, **kwds):
     #-# Translation live update preparation
     # base_text: to be used each time a widget takes a formated string
     #            defaults to 'text'.
     Widget.__init__(self, **kwds)
     #-# Translation live update preparation
     self.fixed_width = width
     self.base_text = base_text or text
     self.previous_translation = _(text, doNotTranslate=kwds.get('doNotTranslate', False))
     #-#
     self._text = _(text, doNotTranslate=kwds.get('doNotTranslate', False))
     #-#
     self.calc_size()
def __(txt):
    if txt.find('_(') == -1:
        txt = _(txt)
    else:
        index = 0
        while txt.find('_(') != -1:
            tmptxt = substring_2_translate(txt)
            translated_tmptxt = _(tmptxt)
            txt = txt.replace('_(' + tmptxt + ')', translated_tmptxt)
            index += 1
            if index == 10:
                break

    return txt
Example #24
0
	def set_title(self):
		# Set the Date in the Title
		now_time = datetime.datetime.now().strftime("%H:%M")
		now_wd = datetime.datetime.now().strftime("%A")
		g_day = datetime.datetime.now().strftime("%d")
		g_month = datetime.datetime.now().strftime("%B")
		g_year = datetime.datetime.now().strftime("%Y")
		g_date = '%s %s %s' % (g_day, _(g_month), g_year)
		calc = HijriCal(self.parent.prayertimes.options.hijrical_adjustment)
		h_months = ['Muharram', 'Safar', 'Rabi al Awwal', 'Rabi al Akhira', 'Jumada al Ula', 'Jumada al Akhira', 'Rajab',  "Sha'ban",  'Ramadan',  'Shawwal',  "Dhu al Qa'da", 'Dhu al Hijja']
		h_year, h_month, h_day, h_week_day = calc.today
		h_date = '%i %s %i' % (h_day, _(h_months[int(h_month-1)]), h_year)

		self.titlelabel.set_label(_('%s - %s, %s / %s') % (now_time, _(now_wd), h_date, g_date))
Example #25
0
	def set_title(self):
		# Set the Date in the Title
		now_time = datetime.datetime.now().strftime("%H:%M")
		now_wd = datetime.datetime.now().strftime("%A")
		g_day = datetime.datetime.now().strftime("%d")
		g_month = datetime.datetime.now().strftime("%B")
		g_year = datetime.datetime.now().strftime("%Y")
		g_date = '%s %s %s' % (g_day, _(g_month), g_year)
		calc = HijriCal(self.parent.prayertimes.options.hijrical_adjustment)
		h_months = ['Muharram', 'Safar', 'Rabi al Awwal', 'Rabi al Akhira', 'Jumada al Ula', 'Jumada al Akhira', 'Rajab',  "Sha'ban",  'Ramadan',  'Shawwal',  "Dhu al Qa'da", 'Dhu al Hijja']
		h_year, h_month, h_day, h_week_day = calc.today
		h_date = '%i %s %i' % (h_day, _(h_months[int(h_month-1)]), h_year)

		self.titlelabel.set_label(_('%s - %s, %s / %s') % (now_time, _(now_wd), h_date, g_date))
Example #26
0
def __(txt):
    if txt.find('_(') == -1:
        txt = _(txt)
    else:
        index = 0
        while txt.find('_(') != -1:
            tmptxt = substring_2_translate(txt)
            translated_tmptxt = _(tmptxt)
            txt = txt.replace('_(' + tmptxt + ')', translated_tmptxt)
            index += 1
            if index == 10:
                break

    return txt
Example #27
0
 def createWidgetsList(self):
     menu_list = []
     f_list = []
     for child in self.root[self.currentScreenID].findall('*'):
         childTitle = ''
         childDescr = ' '
         childTYPE = child.tag
         if childTYPE.lower() == 'widget':
             pic = self.widget_png
             if 'render' in child.attrib:
               childTitle = _(child.attrib['render'])
             if 'name' in child.attrib and child.attrib['name'] == 'list':
                 if 'serviceNameFont' in child.attrib and 'serviceNumberFont' in child.attrib:
                     childTitle = _('ChannelList')
                 else:
                     childTitle = _('List')
         elif childTYPE.lower() == 'elabel':
             pic = self.elabel_png
             childDescr += _('Paint a square. ')
         elif childTYPE.lower() == 'epixmap':
             pic = self.epixmap_png
             childDescr += _('Display a picture. ')
             
         elif childTYPE.lower() == 'label':
             pic = self.label_png
             
         elif childTYPE.lower() == 'pixmap':
             pic = self.pixmap_png
             
         else:
             pic = None
         if 'text' in child.attrib:
             childDescr += _('Display %s. ') % child.attrib['text']
         if 'render' in child.attrib and 'source' in child.attrib:
             childDescr += _('Controlled through %s. ') % child.attrib['source']
         if 'name' in child.attrib:
             childDescr += _('Controlled by script or plugin. ')
         f_list.append((child, "%s %s" % (childTYPE, childTitle), childDescr, pic))
     if len(f_list) == 0:
         f_list.append(("dummy", _("No widgets found"), '', None))
         self.blockActions=True
     if self.blockActions == True:
         self['key_blue'].setText('')
     for entry in f_list:
         menu_list.append((entry[0], entry[1], entry[2], entry[3]))
     #print menu_list
     try:
         self["menu"].UpdateList(menu_list)
     except:
         print "Update asser error :(" #workarround to have it working on openpliPC
         myIndex=self["menu"].getIndex() #as an effect, index is cleared so we need to store it first
         self["menu"].setList(menu_list)
         self["menu"].setIndex(myIndex) #and restore
     self.selectionChanged()
Example #28
0
    def createsetup(self):
        skinHistory = None
        skinUpdate = None
        skinAddOns = None
        skinComponents = None
        if pathExists("%s%s" % (SkinPath, 'skin.config')):
            with open("%s%s" % (SkinPath, 'skin.config'), 'r') as cf:
                cfg = cf.read()
            if cfg.find("history=") > 0:
                skinHistory = True
            if cfg.find("skinurl=") > 0:
                skinUpdate = True
            if cfg.find("addons=") > 0:
                skinAddOns = True
            if cfg.find("components=") > 0:
                skinComponents = True
        l = [(self.buildListEntry(_("Skin personalization"), "config.png",
                                  'config'))]

        #if pathExists(resolveFilename(SCOPE_SKIN, 'display')) or pathExists(resolveFilename(SCOPE_SKIN, 'vfd_skin/skin_vfd_UserSkin.xml')):
        #    l.append(self.buildListEntry(_("LCD skin settings"), "lcd.png",'LCDskin')),

        if skinUpdate:
            l.append(
                self.buildListEntry(_("Update main skin"), "skin.png",
                                    'getskin')),

        l.append(
            self.buildListEntry(_("Update plugin"), "download.png",
                                'getplugin')),

        if skinAddOns:
            l.append(
                self.buildListEntry(_("Download addons"), "addon.png",
                                    'getaddons'))

        (self.buildListEntry(_("Delete addons"), "remove.png",
                             'delete_addons')),

        if skinComponents:
            l.append(
                self.buildListEntry(
                    _("Download additional Components/plugins"), "plugin.png",
                    'getcomponents'))

        if skinHistory:
            l.append(
                self.buildListEntry(_("History of changes"), "history.png",
                                    'history')),
        l.append(
            self.buildListEntry(_("Import foreign skin"), "import.png",
                                'importskin')),
        l.append(self.buildListEntry(_("About"), "about.png", 'about')),
        self["list"].list = l
Example #29
0
    def createsetup(self):
        skinHistory, skinUpdate, skinAddOns, skinComponents = readSkinConfig()
        l = [(self.buildListEntry(_("Skin personalization"), "config.png",
                                  'config'))]

        if 0:
            if pathExists(
                    resolveFilename(SCOPE_PLUGINS,
                                    'Extensions/MiniTVUserSkinMaker')):
                l.append(
                    self.buildListEntry(_("miniTV skin creator"), "lcd.png",
                                        'LCDskin'))
            else:
                try:
                    from enigma import getDesktop
                    if getDesktop(1).size().width() > 132:
                        l.append(
                            self.buildListEntry(
                                _("Install miniTV skin creator"), "lcd.png",
                                'LCDskinInstall'))
                    else:
                        l.append(
                            self.buildListEntry(
                                _("LCD/VFD too small to use miniTV skin creator"
                                  ), "lcd.png", 'fakeParam'))
                except Exception:
                    pass

        if skinUpdate:
            l.append(
                self.buildListEntry(_("Update main skin"), "skin.png",
                                    'getskin')),
        if skinAddOns:
            l.append(
                self.buildListEntry(_("Download addons"), "addon.png",
                                    'getaddons'))

        #l.append(self.buildListEntry(_("Delete addons"), "remove.png",'delete_addons')),

        if skinComponents:
            l.append(
                self.buildListEntry(
                    _("Download additional Components/plugins"), "plugin.png",
                    'getcomponents'))

        #l.append(self.buildListEntry(_("List loaded screens"), "import.png",'ListScreens')),

        if skinHistory:
            l.append(
                self.buildListEntry(_("History of changes"), "history.png",
                                    'history')),
        #l.append(self.buildListEntry(_("Import foreign skin"), "import.png",'importskin')),
        l.append(self.buildListEntry(_("About"), "about.png", 'about')),
        self["list"].list = l
Example #30
0
 def _add_page(self, title, page, idx=None):
     page.tab_title = _(title)
     page.anchor = 'ltrb'
     if idx is not None:
         self.pages.insert(idx, page)
     else:
         self.pages.append(page)
Example #31
0
def convert_file_for_web(source_path, result_path, footer, glossary_renderer, increase_headline_level):

    with codecs.open(source_path, 'r', 'utf-8') as source:
        with codecs.open(result_path, 'w', 'utf-8') as target:
            lw = LineWriter(target, source.newlines)
            for line in source:
                L = line.strip()
                if not L:
                    lw.mark_empty_line()
                elif L == GLOSSARY_MARKER:
                    glossary_renderer.render(lw.write)
                elif L in SLIDE_MARKERS:
                    # omit line, do not change empty line marker!
                    pass
                elif L.startswith('#'):
                    if L.endswith(_(u'(…)')):
                        pass  # omit slides with continued headlines
                    else:
                        if increase_headline_level:
                            lw.write(increase_headline_level(L))
                        else:
                            lw.write(line)
                elif line.lstrip().startswith("!["):
                    # fix image
                    pos = L.find('(')
                    lw.write(IMG_TEMPLATE.format(L[pos + 1:]))
                else:
                    lw.write(line)
            if footer:
                target.write(footer)
Example #32
0
	def keyBlue(self):
		selection = self["filelist"].getSelection()
		if selection is None or selection[1] == True: # isDir
			return
		if path.exists(self.filelist.getCurrentDirectory() + '/' + self.filelist.getFilename()):
			import xml.etree.cElementTree as ET
			root = ET.parse(self.filelist.getCurrentDirectory() + '/' + self.filelist.getFilename()).getroot()
			NumberOfScreens = len(root.findall('screen'))
			if NumberOfScreens == 1:
				self.keyBlueRet( ('First screen',1) )
			elif NumberOfScreens > 1:
				from Screens.ChoiceBox import ChoiceBox
				NumberOfChilds = len(root.findall('*'))
				currentScreenID = 0
				childID = 0
				screensList = []
				while childID < NumberOfChilds:
					if root[childID].tag == 'screen':
						try: 
							currentScreenID += 1
							screensList.append((root[childID].attrib['name'], currentScreenID))
						except Exception, e:
							printDEBUG("Exception:" + str(e))
					childID += 1
				if len(screensList) > 0:
					self.session.openWithCallback(self.keyBlueRet, ChoiceBox, title = _("Select screen:"), list = screensList)
Example #33
0
    def __init__(self,
                 title,
                 items,
                 scrolling=False,
                 scroll_items=30,
                 scroll_page=5,
                 handler=None,
                 **kwds):
        self.handler = handler
        self.title = _(title, doNotTranslate=kwds.get('doNotTranslate', False))
        self.items = items
        self._items = [
            MenuItem(*item, doNotTranslate=kwds.get('doNotTranslate', False))
            for item in items
        ]
        self.scrolling = scrolling and len(self._items) > scroll_items
        self.scroll_items = scroll_items
        self.scroll_page = scroll_page

        if __builtins__.get("mcenf_tab_to_next"):
            self._selected_item_index = 0
            self._hilited = self._items[self._selected_item_index]

        Dialog.__init__(self, **kwds)

        self.root = self.get_root()
        self.calc_size()
Example #34
0
 def setPreviewFont(self, myIndex):
     if not 'font' in self.root[self.currentScreenID][myIndex].attrib:
         self["PreviewFont"].setText('')
         return
     #### Now we know we have font, so we can preview it :)
     myfont = self.root[self.currentScreenID][myIndex].attrib['font']
     #print myfont
     try:
         self["PreviewFont"].instance.setFont(gFont(myfont.split(';')[0], int(myfont.split(';')[1])))
     except:
         printDEBUG("Missing font '%s' definition in skin.xml" % self.root[self.currentScreenID][myIndex].attrib['font'])
     if 'text' in self.root[self.currentScreenID][myIndex].attrib:
         self["PreviewFont"].setText('%s' % self.root[self.currentScreenID][myIndex].attrib['text'])
     else:
         self["PreviewFont"].setText(_('Sample Text'))
     if 'foregroundColor' in self.root[self.currentScreenID][myIndex].attrib:
         try:
             self["PreviewFont"].instance.setForegroundColor(parseColor(self.root[self.currentScreenID][myIndex].attrib['foregroundColor']))            
         except:
             printDEBUG("Missing color '%s' definition in skin.xml" % self.root[self.currentScreenID][myIndex].attrib['foregroundColor'])
     else:
         self["PreviewFont"].instance.setForegroundColor(parseColor("#00ffffff"))            
     if 'backgroundColor' in self.root[self.currentScreenID][myIndex].attrib:
         try:
             self["PreviewFont"].instance.setBackgroundColor(parseColor(self.root[self.currentScreenID][myIndex].attrib['backgroundColor']))            
         except:
             printDEBUG("Missing color '%s' definition in skin.xml" % self.root[self.currentScreenID][myIndex].attrib['backgroundColor'])
 def reloadLIST(self):
     #czyścimy listę w ten dziwny sposób, aby GUI działało, bo nie zmienimy objektów ;)
     while len(self.list) > 0:
         del self.myList[-1]
         del self.list[-1]
     if path.exists(self.MenuFile) is True:
         self["list"].hide()
         with open (self.MenuFile, "r") as myMenufile:
             for MenuItem in myMenufile:
                 MenuItem = MenuItem.rstrip('\n') 
                 if not MenuItem or MenuItem[0] == '#': #omijamy komentarze
                     continue
                 #interesują nas tylko pozycje menu
                 if MenuItem[0:5] == "ITEM|":
                     #teraz bierzemy pod uwage tylko te linie co mają odpowiednią ilość |
                     #print MenuItem
                     skladniki = MenuItem.replace("ITEM|","").split('|')
                     if len(skladniki) == 3:
                         (NazwaOpcji, TypOpcji, SkryptOpcji) = skladniki
                         if NazwaOpcji != "":
                             NazwaOpcji = _(NazwaOpcji)
                         self.myList.append( (NazwaOpcji, TypOpcji, self.SkryptOpcjiWithFullPAth(SkryptOpcji)) )
                         self.list.append( NazwaOpcji )
             myMenufile.close()
         myIdx = self["list"].getSelectionIndex()
         if myIdx > len(self.list) -1:
             self["list"].moveToIndex(len(self.list) -1)
         self["list"].show()
    def doExportAction(self, what):

        printDEBUG('doExportAction')

        def SaveWidget(WidgetFile=None):
            if WidgetFile is not None:
                if not WidgetFile.endswith('.xml'):
                    WidgetFile += '.xml'
                WidgetPathName = path.dirname(self.ScreenFile).replace(
                    'allScreens', 'allWidgets')
                if not path.exists(WidgetPathName):
                    mkdir(WidgetPathName)
                printDEBUG("Writing %s/%s" % (WidgetPathName, WidgetFile))
                with open("%s/%s" % (WidgetPathName, WidgetFile), "w") as f:
                    f.write(ET.tostring(self.root[0][self["menu"].getIndex()]))

        myText = self.root[0][what].tag
        if 'name' in self.root[0][what].attrib:
            myText += '_' + self.root[0][what].attrib['name']
        if 'text' in self.root[0][what].attrib:
            myText += '_' + self.root[0][what].attrib['text']
        if 'render' in self.root[0][what].attrib:
            myText += '_' + self.root[0][what].attrib['render']
        if 'source' in self.root[0][what].attrib:
            myText += '_' + self.root[0][what].attrib['source']

        from Screens.VirtualKeyBoard import VirtualKeyBoard
        self.session.openWithCallback(SaveWidget,
                                      VirtualKeyBoard,
                                      title=(_("Enter filename")),
                                      text=myText.replace('.', '-'))
 def keyExitRetSaveAs(self):
     from Screens.VirtualKeyBoard import VirtualKeyBoard
     self.session.openWithCallback(
         self.keyExitRetSaveAsHasName,
         VirtualKeyBoard,
         title=(_("Enter filename")),
         text=path.basename(self.ScreenFile.replace('.xml', '_new.xml')))
Example #38
0
 def setPreviewFont(self, myIndex):
     if not 'font' in self.root[self.currentScreenID][myIndex].attrib:
         self["PreviewFont"].setText('')
         return
     #### Now we know we have font, so we can preview it :)
     myfont = self.root[self.currentScreenID][myIndex].attrib['font']
     #print myfont
     try:
         self["PreviewFont"].instance.setFont(gFont(myfont.split(';')[0], int(myfont.split(';')[1])))
     except:
         printDEBUG("Missing font '%s' definition in skin.xml" % self.root[self.currentScreenID][myIndex].attrib['font'])
     if 'text' in self.root[self.currentScreenID][myIndex].attrib:
         self["PreviewFont"].setText('%s' % self.root[self.currentScreenID][myIndex].attrib['text'])
     else:
         self["PreviewFont"].setText(_('Sample Text'))
     if 'foregroundColor' in self.root[self.currentScreenID][myIndex].attrib:
         try:
             self["PreviewFont"].instance.setForegroundColor(parseColor(self.root[self.currentScreenID][myIndex].attrib['foregroundColor']))            
         except:
             printDEBUG("Missing color '%s' definition in skin.xml" % self.root[self.currentScreenID][myIndex].attrib['foregroundColor'])
     else:
         self["PreviewFont"].instance.setForegroundColor(parseColor("#00ffffff"))            
     if 'backgroundColor' in self.root[self.currentScreenID][myIndex].attrib:
         try:
             self["PreviewFont"].instance.setBackgroundColor(parseColor(self.root[self.currentScreenID][myIndex].attrib['backgroundColor']))            
         except:
             printDEBUG("Missing color '%s' definition in skin.xml" % self.root[self.currentScreenID][myIndex].attrib['backgroundColor'])
Example #39
0
    def doExportAction(self, what):
      
        printDEBUG('doExportAction')
        
        def SaveWidget(WidgetFile = None):
            if WidgetFile is not None:
                if not WidgetFile.endswith('.xml'):
                    WidgetFile += '.xml'
                WidgetPathName = path.dirname(self.ScreenFile).replace('allScreens','allWidgets')
                if not path.exists(WidgetPathName):
                    mkdir(WidgetPathName)
                printDEBUG("Writing %s/%s" % (WidgetPathName,WidgetFile))
                with open("%s/%s" % (WidgetPathName, WidgetFile), "w") as f:
                    f.write(ET.tostring(self.root[0][self["menu"].getIndex()]))

        myText=self.root[0][what].tag
        if 'name' in self.root[0][what].attrib:
            myText += '_' + self.root[0][what].attrib['name']
        if 'text' in self.root[0][what].attrib:
            myText += '_' + self.root[0][what].attrib['text']
        if 'render' in self.root[0][what].attrib:
            myText += '_' + self.root[0][what].attrib['render']
        if 'source' in self.root[0][what].attrib:
            myText += '_' + self.root[0][what].attrib['source']

        from Screens.VirtualKeyBoard import VirtualKeyBoard
        self.session.openWithCallback(SaveWidget, VirtualKeyBoard, title=(_("Enter filename")), text = myText.replace('.','-'))
Example #40
0
 def _add_page(self, title, page, idx=None):
     page.tab_title = _(title)
     page.anchor = 'ltrb'
     if idx is not None:
         self.pages.insert(idx, page)
     else:
         self.pages.append(page)
Example #41
0
 def reloadLIST(self):
     #czyścimy listę w ten dziwny sposób, aby GUI działało, bo nie zmienimy objektów ;)
     while len(self.list) > 0:
         del self.myList[-1]
         del self.list[-1]
     if path.exists(self.MenuFile) is True:
         self["list"].hide()
         with open(self.MenuFile, "r") as myMenufile:
             for MenuItem in myMenufile:
                 MenuItem = MenuItem.rstrip('\n')
                 if not MenuItem or MenuItem[0] == '#':  #omijamy komentarze
                     continue
                 #interesują nas tylko pozycje menu
                 if MenuItem[0:5] == "ITEM|":
                     #teraz bierzemy pod uwage tylko te linie co mają odpowiednią ilość |
                     #print MenuItem
                     skladniki = MenuItem.replace("ITEM|", "").split('|')
                     if len(skladniki) == 3:
                         (NazwaOpcji, TypOpcji, SkryptOpcji) = skladniki
                         if NazwaOpcji != "":
                             NazwaOpcji = _(NazwaOpcji)
                         self.myList.append(
                             (NazwaOpcji, TypOpcji,
                              self.SkryptOpcjiWithFullPAth(SkryptOpcji)))
                         self.list.append(NazwaOpcji)
             myMenufile.close()
         myIdx = self["list"].getSelectionIndex()
         if myIdx > len(self.list) - 1:
             self["list"].moveToIndex(len(self.list) - 1)
         self["list"].show()
Example #42
0
def wrapped_label(text, wrap_width, **kwds):
    # paras = text.split("\n")
    text = _(text)
    kwds['doNotTranslate'] = True
    paras = text.split("\n\n")
    text = "\n".join([textwrap.fill(para, wrap_width) for para in paras])
    return Label(text, **kwds)
Example #43
0
def doCall(method, *args, **kwargs):
    log = rhnLog.initLog()
    cfg = config.initUp2dateConfig()
    ret = None

    attempt_count = 1
    attempts = cfg["networkRetries"] or 5

    while 1:
        failure = 0
        ret = None
        try:
            ret = apply(method, args, kwargs)
        except KeyboardInterrupt:
            raise rhnErrors.CommunicationError(_(
                "Connection aborted by the user"))
        # if we get a socket error, keep tryingx2
        except (socket.error, socket.sslerror), e:
            log.log_me("A socket error occurred: %s, attempt #%s" % (
                e, attempt_count))
            if attempt_count >= attempts:
                if len(e.args) > 1:
                    raise rhnErrors.CommunicationError(e.args[1])
                else:
                    raise rhnErrors.CommunicationError(e.args[0])
            else:
                failure = 1
        except httplib.IncompleteRead:
            print "httplib.IncompleteRead"
            raise rhnErrors.CommunicationError("httplib.IncompleteRead")
Example #44
0
def menu(menuid, **kwargs):
    for line in open("/etc/enigma2/settings"):
        if "config.skin.primary_skin=AtileHD/skin.xml" in line:
            if menuid == "mainmenu":
                return [(_("Setup -") + " " + CurrentSkinName, main,
                         "AtileHD_Menu", 40)]
    return []
Example #45
0
 def keyBlueEnd(self, ret):
     if ret:
         self.currAction = ret[1]
     else:
         self.currAction = self.doNothing
         
     if self.currAction == self.doNothing:
         self['key_green'].setText('')
     #saving
     elif self.currAction == self.doSaveAs:
         self.keyExitRetSaveAs()
         return
     elif self.currAction == self.doSave:
         self.keyExitRetSave()
         return
     elif self.currAction == self.PermanentPreview1:
         self.setWigetPixMapPictureInScale(myIndex = self["menu"].getIndex(), myWidget = "WigetPixMapPictureInScale1", myWidgetFile = 'permanentwidget1.png' )
         return
     elif self.currAction == self.PermanentPreview2:
         self.setWigetPixMapPictureInScale(myIndex = self["menu"].getIndex(), myWidget = "WigetPixMapPictureInScale2", myWidgetFile = 'permanentwidget2.png' )
         return
     elif self.currAction == self.Preview2Background:
         fileName = self.ScreenFile.replace('allScreens/','allPreviews/preview_').replace('.xml','.png')
         if path.exists(fileName):
             self["SkinPicture"].instance.setScale(1)
             self["SkinPicture"].instance.setPixmapFromFile(fileName)
             self["SkinPicture"].show()
         if path.isfile( self.getPicFileNameWithPath('tvpreview.png') ):
             self["ScreenPixMapPictureInScale"].instance.setScale(1)
             self["ScreenPixMapPictureInScale"].instance.setPixmap(LoadPixmap(path=self.getPicFileNameWithPath('tvpreview.png')) )
             self["ScreenPixMapPictureInScale"].show()
         return
     #manipulation
     elif self.currAction == self.doDelete:
         self['key_green'].setText(_('Delete'))
     elif self.currAction == self.doExport:
         self['key_green'].setText(_('Export'))
     elif self.currAction == self.doImport:
         self['key_green'].setText(_('Import'))
     elif self.currAction == self.resizeFont:
         self['key_green'].setText(_('Change font size'))
     elif self.currAction == self.moveHorizontally:
         self['key_green'].setText(_('Move left/right'))
     elif self.currAction == self.moveVertically:
         self['key_green'].setText(_('Move Up/Down'))
     elif self.currAction == self.resizeHorizontally:
         self['key_green'].setText(_('Resize left/right'))
     elif self.currAction == self.resizeVertically:
         self['key_green'].setText(_('Resize Up/Down'))
     elif self.currAction == self.AdvancedAttribEdit:
         self['key_green'].setText(_('Advanced attributes edit'))
     return
Example #46
0
 def keyBlueEnd(self, ret):
     if ret:
         self.currAction = ret[1]
     else:
         self.currAction = self.doNothing
         
     if self.currAction == self.doNothing:
         self['key_green'].setText('')
     #saving
     elif self.currAction == self.doSaveAs:
         self.keyExitRetSaveAs()
         return
     elif self.currAction == self.doSave:
         self.keyExitRetSave()
         return
     elif self.currAction == self.PermanentPreview1:
         self.setWigetPixMapPictureInScale(myIndex = self["menu"].getIndex(), myWidget = "WigetPixMapPictureInScale1", myWidgetFile = 'permanentwidget1.png' )
         return
     elif self.currAction == self.PermanentPreview2:
         self.setWigetPixMapPictureInScale(myIndex = self["menu"].getIndex(), myWidget = "WigetPixMapPictureInScale2", myWidgetFile = 'permanentwidget2.png' )
         return
     elif self.currAction == self.Preview2Background:
         fileName = self.ScreenFile.replace('allScreens/','allPreviews/preview_').replace('.xml','.png')
         if path.exists(fileName):
             self["SkinPicture"].instance.setScale(1)
             self["SkinPicture"].instance.setPixmapFromFile(fileName)
             self["SkinPicture"].show()
         if path.isfile( self.getPicFileNameWithPath('tvpreview.png') ):
             self["ScreenPixMapPictureInScale"].instance.setScale(1)
             self["ScreenPixMapPictureInScale"].instance.setPixmap(LoadPixmap(path=self.getPicFileNameWithPath('tvpreview.png')) )
             self["ScreenPixMapPictureInScale"].show()
         return
     #manipulation
     elif self.currAction == self.doDelete:
         self['key_green'].setText(_('Delete'))
     elif self.currAction == self.doExport:
         self['key_green'].setText(_('Export'))
     elif self.currAction == self.doImport:
         self['key_green'].setText(_('Import'))
     elif self.currAction == self.resizeFont:
         self['key_green'].setText(_('Change font size'))
     elif self.currAction == self.moveHorizontally:
         self['key_green'].setText(_('Move left/right'))
     elif self.currAction == self.moveVertically:
         self['key_green'].setText(_('Move Up/Down'))
     elif self.currAction == self.resizeHorizontally:
         self['key_green'].setText(_('Resize left/right'))
     elif self.currAction == self.resizeVertically:
         self['key_green'].setText(_('Resize Up/Down'))
     elif self.currAction == self.AdvancedAttribEdit:
         self['key_green'].setText(_('Advanced attributes edit'))
     return
Example #47
0
    def changeDir(self, directory, select = None):
        self.list = []

        # if we are just entering from the list of mount points:
        if self.current_directory is None:
            self.current_mountpoint = None
            
        self.current_directory = directory
        directories = []
        files = []        

        if directory is None:
            files = [ ]
            directories = [ ]
        else:
            if fileExists(directory):
                try:
                    files = listdir(directory)
                except:
                    files = []
                files.sort(key=lambda s: s.lower())
                #files.sort()
                tmpfiles = files[:]
                for x in tmpfiles:
                    if os_path.isdir(os_path.join(directory,x) ):
                        directories.append(os_path.join(directory,x) + "/")
                        files.remove(x)

        if directory is not None and self.showDirectories:
            #to resolve issues wit "/" at the end
            if ( (directory != self.rootDirectory and directory[:-1] != self.rootDirectory and directory != self.rootDirectory[:-1]) and not
                    (self.inhibitMounts and self.getMountpoint(directory) in self.inhibitMounts) ):
                self.list.append(FileEntryComponent(name = _("Parent Category"), absolute = '/'.join(directory.split('/')[:-2]) + '/', isDir = True, goBack = True, DimText0 = self.DimText0, DimText1=self.DimText1, DimPIC=self.DimPIC))

        if self.showDirectories:
            for x in directories:
                if not (self.inhibitMounts and self.getMountpoint(x) in self.inhibitMounts) and not self.inParentDirs(x, self.inhibitDirs):
                    name = x.split('/')[-2]
                    self.list.append(FileEntryComponent(name = name, absolute = x, isDir = True, DimText0 = self.DimText0, DimText1=self.DimText1, DimPIC=self.DimPIC))

        if self.showFiles:
            for x in files:
                path = directory + x
                name = x

                if name.startswith('skin_') and name.endswith('.xml'):
                    name = name[5:-4]
                    self.list.append(FileEntryComponent(name = name, absolute = x , isDir = False, DimText0 = self.DimText0, DimText1=self.DimText1, DimPIC=self.DimPIC))

        self.l.setList(self.list)

        if select is not None:
            i = 0
            self.moveToIndex(0)
            for x in self.list:
                p = x[0][0]
                if p == select:
                    self.moveToIndex(i)
                i += 1
Example #48
0
 def selectionChanged(self):
     print "> self.selectionChanged"
     sel = self["menu"].getCurrent()
     self.setPicture(sel[0])
     #print sel
     if sel[3] == self.enabled_pic:
         #self["key_green"].setText("")
         #self.EditScreen = False
         self["key_green"].setText(_("Edit"))
         self.EditScreen = True
         self["key_yellow"].setText("")
         self.DeleteScreen = False
     elif sel[3] == self.disabled_pic:
         self["key_green"].setText(_("Edit"))
         self.EditScreen = True
         self["key_yellow"].setText(_("Delete"))
         self.DeleteScreen = True
Example #49
0
 def translateName(name):
     import re
     wordsList=['Channel[ ]*Selections','Channel[ ]*Selection','Infobars','Infobar','_no_']
     for word in wordsList:
         name = re.sub(word , _(word), name, flags=re.I)
     name = re.sub('(\_|\-|\.|\+)',' ', name, flags=re.I) #cleaning
     name = re.sub('(  [ ]*)',' ', name, flags=re.I) #merge multiple (2+) spaces into one
     return name
Example #50
0
 def __init__(self, session):
     Screen.__init__(self, session)
     #self.setup_title = _("ScreensLister")
     #Screen.setTitle(self, self.setup_title)
     self["list"] = List()
     self["setupActions"] = ActionMap(["SetupActions", "MenuActions"],
     {
         "cancel": self.quit,
         "ok": self.openSelected,
         "menu": self.quit,
     }, -2)
     self.setTitle(_("Loaded screens %s") % UserSkinInfo)
     self["list"].list = []
     self['ScreenName'] = Label(_("Screen"))
     self['ScreenSource'] = Label(_("Source"))
     self['FooterText'] = Label(_("NOTE: System uses definition from plugin when screen is not listed above."))
     self.onLayoutFinish.append(self.createsetup)
Example #51
0
 def ok(self):
     path = self.pathname
     if os.path.exists(path):
         answer = ask(_("Replace existing '%s'?") % os.path.basename(path))
         if answer != "OK":
             return
     #FileDialog.ok(self)
     self.dismiss(True)
Example #52
0
 def ok(self):
     path = self.pathname
     if os.path.exists(path):
         answer = ask(_("Replace existing '%s'?") % os.path.basename(path))
         if answer != "OK":
             return
     # FileDialog.ok(self)
     self.dismiss(True)
Example #53
0
 def update_prayers(self, recalculate_prayer_times=True):
     print("DEBUG: updating prayer times @", (str(datetime.datetime.now())))
     # Re-calculate prayer times first
     if recalculate_prayer_times:
         self.prayertimes.calculate(False)
     # Update prayer times
     i = 0
     for prayer in self.homebox.prayers:
         if prayer.name == _('Fajr'):
             self.homebox.prayers[i].time = self.get_times(
                 self.prayertimes.fajr_time())
         elif prayer.name == _('Shuruk'):
             self.homebox.prayers[i].time = self.get_times(
                 self.prayertimes.shrouk_time())
         elif prayer.name == _('Dhuhr'):
             self.homebox.prayers[i].time = self.get_times(
                 self.prayertimes.zuhr_time())
         elif prayer.name == _('Asr'):
             self.homebox.prayers[i].time = self.get_times(
                 self.prayertimes.asr_time())
         elif prayer.name == _('Maghrib'):
             self.homebox.prayers[i].time = self.get_times(
                 self.prayertimes.maghrib_time())
         elif prayer.name == _('Isha'):
             self.homebox.prayers[i].time = self.get_times(
                 self.prayertimes.isha_time())
         i += 1
     nextprayer = self.prayertimes.next_prayer()
     self.homebox.emit("prayers-updated", _(nextprayer))