def __init__(self, **kwargs): self.bgColor = kwargs.pop('bgColor', (0, 0, 0, 0)) self.color = kwargs.pop('color', (1, 0, 0, 0)) self.highlightColor = kwargs.pop('highlightColor', (0, 1, 0, 0)) self.source = kwargs.pop('source', None) super(VolumeIndicator, self).__init__(**kwargs) #All these caluclation are experimental, for this scenario it worked, #nothing else has been tested. self.size_hint = (None, None) self.size = (160, 20) self.value = 0 sizeImage = (20, 20) sizePadding = (2, 0) gap0 = 10 barHeight = 16 barHeight1 = 12 borderWidth = int((barHeight - barHeight1) / 2) posLabel0 = (sizePadding[0] + sizeImage[0] + gap0, int((sizeImage[1] - barHeight) / 2)) widthLabel0 = self.size[0] - sizeImage[0] - 2 * sizePadding[0] - gap0 sizeLabel0 = (widthLabel0, barHeight) posLabel1 = (posLabel0[0] + borderWidth, posLabel0[1] + borderWidth) sizeLabel1 = (sizeLabel0[0] - 2 * borderWidth, sizeLabel0[1] - 2 * borderWidth) self.image = ImageBg(background_color=self.bgColor, size_hint=(None, None), size=sizeImage, imgSrc="atlas://resources/img/pi-player/mute", pos=sizePadding) self.label0 = SelectLabelBg( background_color=self.color, size_hint=(None, None), size=sizeLabel0, pos=posLabel0, ) self.label1 = SelectLabelBg(background_color=self.highlightColor, size_hint=(None, None), size=(0, 12), pos=(32, 4)) self.max = 126 self.add_widget(self.image) self.add_widget(self.label0) self.add_widget(self.label1) self.bind(value=self._changeValue)
def __init__(self, **kwargs): self.contentColor = kwargs.pop('contentColor', (1, 1, 1, 1)) self.textColor = kwargs.pop('textColor', (1, 1, 1, 1)) self.headerColor = kwargs.pop('headerColor', (1, 1, 1, 1)) self.headerHeight = kwargs.pop('headerHeight', 50) self.contentHeight = kwargs.pop('contentHeight', 100) self.headerText = kwargs.pop('headerText', "No header text") self.text = kwargs.pop('text', "No content text") self.borderHeight = kwargs.pop('borderHeight', 2) self.sidebarWidth = kwargs.pop('sidebarWidth', 40) self.buttonDesc = kwargs.pop('buttonDesc', None) self.dId = kwargs.pop('dId', -1) super(Dialog, self).__init__() self.cols = 1 if self.buttonDesc is not None: self.rows = 4 else: self.rows = 3 self.headerContent = SelectLabelBg( background_color=self.headerColor, text=self.headerText, size_hint_y=None, height=self.headerHeight, color=self.textColor, valign="middle", halign="left", padding=[20, 0] ) self.add_widget(self.headerContent) self.content = SelectLabelBg( background_color=self.contentColor, text=self.text, color=self.textColor, halign="justify", valign="top", size_hint_y=None, height=self.contentHeight, padding=[20, 0] ) self.add_widget(self.content) if self.buttonDesc is not None: self.btn = DialogButtons( buttonDesc=self.buttonDesc, bgColor=self.contentColor, size_hint_y=None, height=40, id=self.id ) self.add_widget(self.btn) self.height = self.headerHeight + self.contentHeight
def __init__(self, **kwargs): self.line_color = kwargs.pop('line_color', (1, 0, 0, 1)) self.color = kwargs.pop('color', (1, 1, 1, 1)) self.text = kwargs.pop('text', "No Name defined") self.label_width = kwargs.pop('label_width', 250) self.line_height = kwargs.pop('line_height', 5) self.font_size = kwargs.pop('font_size', 5) self.bar_width = kwargs.pop('bar_width', 25) self.bar_pos = kwargs.pop('bar_pos', "right") super(PlaylistViewHeader, self).__init__(**kwargs) self.rows = 1 self.label = Label(text=self.text, size_hint_x=None, width=self.label_width, font_size=self.font_size) line_width = (self.label_width - 2 * self.spacing[0]) / 2 self.line0 = SelectLabelBg( background_color=self.line_color, size_hint=(None, None), width=line_width, height=self.line_height, margin=(22, 0, 0, 0), ) self.line1 = SelectLabelBg( background_color=self.line_color, size_hint=(None, None), width=line_width, height=self.line_height, ) self.bar = SelectLabelBg( background_color=self.line_color, size_hint=(None, None), width=self.bar_width, height=self.height / 2 + self.line_height / 2, ) if self.bar_pos == "right": self.add_widget(self.line0) self.add_widget(self.label) self.add_widget(self.line1) self.add_widget(self.bar) else: self.add_widget(self.bar) self.add_widget(self.line0) self.add_widget(self.label) self.add_widget(self.line1) self.bind(size=self._changeSize)
def __init__(self, **kwargs): includes.changeFooterColor = self.changeFooterColor super(IshaGui, self).__init__(**kwargs) self.screens = IshaPiScreens() self.footer = SelectLabelBg( background_color=includes.colors['black'], size_hint_y=None, height=includes.styles['pListIndiactorHeight']) self.screens.size_hint_y = None self.screens.height = Window.height - self.footer.height self.add_widget(self.screens) self.add_widget(self.footer) self.bind(height=self.resize)
def __init__(self, **kwargs): self.defContent = Label( text="Please specify content in PlaylistFileView") self.content = kwargs.pop('content', self.defContent) self.bar_pos = kwargs.pop('bar_pos', 'right') self.line_color = kwargs.pop('line_color', (1, 0, 0, 1)) self.bar_width = kwargs.pop('bar_width', 25) super(PlaylistFileContent, self).__init__(**kwargs) self.rows = 1 self.bar = SelectLabelBg( background_color=self.line_color, size_hint_x=None, width=self.bar_width, ) if self.bar_pos == 'right': self.add_widget(self.content) self.add_widget(self.bar) else: self.add_widget(self.bar) self.add_widget(self.content)
def __init__(self, **kwargs): self.widgets = [] self.isVisible = False super(MenuOSD, self).__init__() self.btnPrevious = SelectButton( source="atlas://resources/img/pi-player/previous", size_hint_y=None, size_hint_x=None, height=50, width=50, enaColor=includes.styles['enaColor0'], background_color=includes.styles['defaultBg'], id=str(3) ) self.btnPrevious.opacity = 0 self.btnNext = SelectButton( source="atlas://resources/img/pi-player/next", size_hint_y=None, size_hint_x=None, height=50, width=50, enaColor=includes.styles['enaColor0'], background_color=includes.styles['defaultBg'], id=str(0) ) self.btnNext.opacity = 0 srcPlayPause = self._getPlayPauseSource() self.btnPlayPause = SelectButton( source=srcPlayPause, size_hint_y=None, size_hint_x=None, height=50, width=50, enaColor=includes.styles['enaColor0'], background_color=includes.styles['defaultBg'], id=str(2) ) self.btnPlayPause.opacity = 0 self.btnStop = SelectButton( source="atlas://resources/img/pi-player/stop", size_hint_y=None, size_hint_x=None, height=50, width=50, enaColor=includes.styles['enaColor0'], background_color=includes.styles['defaultBg'], id=str(3) ) self.btnStop.opacity = 0 self.runtime = TimeSelect( text="00:00:00", id=str(3), height=50, width=120, size_hint=(None, None) ) self.runtime.opacity = 0 self.timeDivider = SelectLabelBg( #text="|", width=3, height=50, size_hint=(None, None), background_color=includes.colors['oldblue'], size_hint_x=None, ) self.timeDivider.opacity = 0 self.totaltime = TimeSelect( text='{}'.format("11:22:33"), id=str(3), height=50, width=120, size_hint=(None, None), padding=[8,0,0,0] ) self.totaltime.opacity = 0 self.gap0 = SelectLabelBg( size_hint_y=None, size_hint_x=None, height=50, width=10, #background_color=(1,0,1,0.5) ) self.gap0.opacity = 0 self.gap = SelectLabelBg( size_hint_y=None, size_hint_x=None, height=50, #background_color=(0,1,1,0.5), width=10 ) self.gap.opacity = 0 self.volumeTmp = VolumeIndicator( bgColor=includes.styles['defaultBg'], color = includes.colors['imcLigthGray'], highlightColor = includes.styles['enaColor0'], ) self.volumeTmp.value = self._getVolume() #This grid layout is needed to aligh the VolumeIndicator as current implementation #has fixed dimensions ant this woild lool odd, just a work arround to position #the indicator nicely self.volume = GridLayout( rows=1, size_hint=(None, None), width=160, height=50, padding=[0, 15, 0 , 0], ) self.volume.add_widget(self.volumeTmp) #add a colored 5px indicator bar at the bottom of the OSD to show status self.colorIndicator = SelectLabelBg( # height=50,#includes.styles['pListIndiactorHeight'], # size_hint_y=None, size_hint_x=None, width=Window.width, background_color=includes.colors['black'], id="-1", text="" ) self._addAllWidgets() self.height = 50 + 5 self.size_hint_y = None self.bind(size=self.changeSize) self.isVisible = False #Thread and queue handling self.ctrlQueue = queue.Queue() self.thread = threading.Thread(target=self._osdguiManager) self.thread.setDaemon(True) self.thread.start() self.wId = 0 self.osdCtrl = OsdController() #self.btnPlay.onEnter = self.onEnterPlay self.btnPlayPause.onEnter = self.onEnterPlayPause self.btnPrevious.onEnter = self.onEnterPrevious self.btnNext.onEnter = self.onEnterNext self.btnStop.onEnter = self.onEnterStop self.runtime.onEnter = self.onEnterTimeselect #Server setup to control GUI elements on the OSD such as the volume indicator self.serverTr = threading.Thread(target=self._keyHandler) self.serverTr.setDaemon(True) self.serverTr.start() self.ipc = Ipc()
def __init__(self, **kwargs): self.itemHeight = 75 super(MenuSettings, self).__init__(**kwargs) self.cols = 1 # # Audio / Video settings # def _updateMusicAutoplay(): includes.config['music']['autoplay'] = str(self.musicAutoplay.getValue()).lower() self.musicAutoplay = SelectSpinnerBool( size_hint_x=None, width=250, size_hint_y=None, height=self.itemHeight, text="Autostart Music", trueHandler=_updateMusicAutoplay, falseHandler=_updateMusicAutoplay, ) self.musicAutoplay.setValue(includes.config['music']['autoplay'] == 'true') self.widgets.append(self.musicAutoplay) # # video auto play # def _updateVideoAutoplay(): includes.config['video']['autoplay'] = str(self.videoAutoplay.getValue()).lower() self.videoAutoplay = SelectSpinnerBool( size_hint_x=None, width=250, size_hint_y=None, height=self.itemHeight, text="Autostart Video", trueHandler=_updateVideoAutoplay, falseHandler=_updateVideoAutoplay, ) self.videoAutoplay.setValue(includes.config['video']['autoplay'] == 'true') self.widgets.append(self.videoAutoplay) # # HDMI Audio / Analog audio selector # def _setAudioOutAnalog(): os.system("amixer cset numid=3 1") def _setAudioOutHdmi(): os.system("amixer cset numid=3 2") def _setAudioOutAuto(): os.system("amixer cset numid=3 0") self.hdmiAudioOut = SelectSpinner( size_hint_x=None, width=250, size_hint_y=None, height=self.itemHeight, text="Audio Output" ) self.hdmiAudioOut.add("Analog", _setAudioOutAnalog) #Default value self.hdmiAudioOut.add("HDMI", _setAudioOutHdmi) self.hdmiAudioOut.add("Auto", _setAudioOutAuto) self.hdmiAudioOut.switch(str(includes.config['settings']['audioSource'])) self.widgets.append(self.hdmiAudioOut) # # HDMI Resolution # def _changeHdmiResHD(): os.system("DISPLAY=:0 xrandr -s 1920x1080") def _changeHdmiResVGA(): os.system("DISPLAY=:0 xrandr -s 1280x1024") self.hdmiResolution = SelectSpinner( size_hint_x=None, width=250, size_hint_y=None, height=self.itemHeight, text="HDMI Resolution" ) self.hdmiResolution.add("1920x1080", _changeHdmiResHD) #0 self.hdmiResolution.add("1280x1024", _changeHdmiResVGA) #1 self.hdmiResolution.switch(str(includes.config['settings']['hdmiResolution'])) self.hdmiResolution.executeHandler() self.widgets.append(self.hdmiResolution) # # HDMI Bost setting # self.hdmiBoost = SelectSpinner( size_hint_x=None, width=250, size_hint_y=None, height=self.itemHeight, text="HDMI Bost" ) for i in range(12): self.hdmiBoost.add(str(i), None) #Default value self.hdmiBoost.switch(str(includes.config['settings']['hdmiBoost'])) self.widgets.append(self.hdmiBoost) # # Sliders # self.stimeStart = 5 self.stimeEnd = 16 def _updateSaverTime(): val = self.stimeStart + self.sliderSaver.getCurrent() includes.config['settings']['screensaverTime'] = val self.sliderSaver = SelectSpinner( size_hint_x=None, width=250, size_hint_y=None, height=self.itemHeight, text="Screensaver Time" ) for i in range(self.stimeStart, self.stimeEnd): self.sliderSaver.add(str(i), _updateSaverTime) self.sliderSaver.switch(str(includes.config['settings']['screensaverTime'])) self.widgets.append(self.sliderSaver) # # OSD Time # def _updateOsdTime(): val = self.stimeStart + self.sliderSaver.getCurrent() includes.config['settings']['screensaverTime'] = val self.osdTime = SelectSpinner( size_hint_x=None, width=250, size_hint_y=None, height=self.itemHeight, text="OSD Time" ) for i in range(self.stimeStart, self.stimeEnd): self.osdTime.add(str(i), _updateOsdTime) self.osdTime.switch(str(includes.config['settings']['osdTime'])) self.widgets.append(self.osdTime) # # Player selection # def _setPlayerVlc(): includes.playerCore.setPlayer('vlc') def _setPlayerMpv(): includes.playerCore.setPlayer('mpv') self.playerSelection = SelectSpinner( size_hint_x=None, width=250, size_hint_y=None, height=self.itemHeight, text="Player Selection" ) self.playerSelection.add("vlc", _setPlayerVlc) self.playerSelection.add("mpv", _setPlayerMpv) self.playerSelection.switch(includes.config['settings']['player']) self.widgets.append(self.playerSelection) # # Store button # def _saveLeft(self): return True self.btnSave = SelectLabel( text="Save Settings", # background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], size_hint_y=None, size_hint_x=None, height=200, width=200, ) self.btnSave.enter = self._saveSettings self.btnSave.left = _saveLeft # self.btnSave = SelectButton( # text="Save", # size_hint=(None, None), # enaColor=includes.styles['enaColor0'], # id="-1", # font_size=includes.styles['fontSize'] # ) # # self.btnSave.enter = self._saveSettings # self.btnSave.size_hint_y = None # self.btnSave.height = 50 self.widgets.append(self.btnSave) #Headers self.headVideoAudio = SelectLabelBg( text="Video/Audio Settings", background_color=includes.colors['gray'], size_hint_y=None, height=35 ) self.headSystemSettings = SelectLabelBg( text="System Settings", background_color=includes.colors['gray'], size_hint_y=None, height=35 ) self.headSettingsCtrl = SelectLabelBg( text="Settings Controls", background_color=includes.colors['gray'], size_hint_y=None, height=35, ) for item in self.widgets: # if item == self.musicAutoplay: # self.add_widget(self.headVideoAudio) # # if item == self.sliderSaver:#first slider # self.add_widget(self.headSystemSettings) # # if item == self.btnSave: # self.add_widget(self.headSettingsCtrl) self.add_widget(item) self.wId = 0
def __init__(self, **kwargs): super(TimeSelect, self).__init__(**kwargs) numWidth = 16 colWidth = 8 numheight = self.height self.widgets = [] self.wId = -1 selWidget = None self.hour0 = SelectLabelBg( background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], text=self.text[0], size_hint=(None, None), height=numheight, width=numWidth) self.hour1 = SelectLabelBg( background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], text=self.text[1], size_hint=(None, None), height=numheight, width=numWidth) self.colon0 = SelectLabelBg( background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], text=":", size_hint=(None, None), height=numheight, width=colWidth) self.min0 = SelectLabelBg( background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], text=self.text[3], size_hint=(None, None), height=numheight, width=numWidth) self.min1 = SelectLabelBg( background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], text=self.text[4], size_hint=(None, None), height=numheight, width=numWidth) self.colon1 = SelectLabelBg( background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], text=":", size_hint=(None, None), height=numheight, width=colWidth) self.sec0 = SelectLabelBg( background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], text=self.text[6], size_hint=(None, None), height=numheight, width=numWidth) self.sec1 = SelectLabelBg( background_color=includes.styles['defaultBg'], enaColor=includes.styles['defaultEnaColor'], text=self.text[7], size_hint=(None, None), height=numheight, width=numWidth) self.widgets.append(self.hour0) self.widgets.append(self.hour1) self.widgets.append(self.min0) self.widgets.append(self.min1) self.widgets.append(self.sec0) self.widgets.append(self.sec1) self.add_widget(self.hour0) self.add_widget(self.hour1) self.add_widget(self.colon0) self.add_widget(self.min0) self.add_widget(self.min1) self.add_widget(self.colon1) self.add_widget(self.sec0) self.add_widget(self.sec1) self.bind(text=self._changeText)