def parse(self, jstr, b): self.start_char = jstr.bar.start_char self.prev_char = jstr.bar.prev_char self.next_char = jstr.bar.next_char self.cur_char = jstr.bar.cur_char self.end_char = jstr.bar.end_char if b == UP_BAR: bar = jstr.upBar else: bar = jstr.downBar for line in bar: layout = [line.left_size, line.centr_size, line.right_size] div = line.divider lw = CustomLabel(align=u'<', divider=div) for w in line.left: c = w.color.split(':') lw.addLable( "", ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])), w.data) cw = CustomLabel(align=u'^', divider=div) for w in line.centr: c = w.color.split(':') cw.addLable( "", ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])), w.data) rw = CustomLabel(align=u'>', divider=div) for w in line.right: c = w.color.split(':') rw.addLable( "", ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])), w.data) self.layouts.append(layout) self.lables.append(lw) self.lables.append(cw) self.lables.append(rw)
def __init__(self, screen, text, buttons, config, has_shadow=False, win=""): self._buttons = buttons width = screen.width // 2 self._message = text height = 17 self.win = win # Construct the Frame self._data = {"message": self._message} super(InfoDialog, self).__init__(screen, height, width, self._data, has_shadow=has_shadow, is_modal=True) # Build up the message box layout = Layout([100], fill_frame=True) self.add_layout(layout) #TITLE _h = height - 4 if self._message != "": layout.add_widget(Label(self._message)) layout.add_widget(Divider()) _h -= 2 c = config.dialog.color.split(':') tcolor = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) self.text = TextView(_h, tcolor, name="info") self.text._w = screen.width // 2 self.text._h = _h layout.add_widget(self.text) layout.add_widget(Divider()) self.setText() layoutBtns = Layout([1 for _ in buttons]) self.add_layout(layoutBtns) for i, button in enumerate(buttons): func = partial(self._destroy, i) layoutBtns.add_widget(Button(button, func), i) self.fix()
def __init__(self, screen, upBar, downBar, config): super(ArtistInfoFrame, self).__init__(screen, screen.height, screen.width, has_border=False, name="ArtistInfo", bg=getColor(config.bg_color)) self.upBar = upBar self.downBar = downBar self.dup = 0 self.ddown = 0 self.artist = "" dh = 0 i = 0 for l in upBar.layouts: _l = Layout([l[0], l[1], l[2]]) self.add_layout(_l) _l.add_widget(upBar.lables[i], 0) _l.add_widget(upBar.lables[i + 1], 1) _l.add_widget(upBar.lables[i + 2], 2) i += 3 dh += 1 self.dup += 1 layout = Layout([1], fill_frame=True) self.add_layout(layout) i = 0 for l in downBar.layouts: _l = Layout([l[0], l[1], l[2]]) self.add_layout(_l) _l.add_widget(downBar.lables[i], 0) _l.add_widget(downBar.lables[i + 1], 1) _l.add_widget(downBar.lables[i + 2], 2) i += 3 dh += 1 self.ddown += 1 c = config.artist_info.color.split(':') tcolor = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) self.text = TextView(self.screen.height - self.dup - self.ddown, tcolor, name="bio") layout.add_widget(self.text) self.fix()
def __init__(self, screen, text, buttons, addList=[], playlistLists=[], needNewPlaylist=True, needListAdd=True, needListPlaylists=True, needPlayCb=True, presenter=None, on_close=None, has_shadow=False, win=""): self.presenter = presenter self._buttons = buttons self._on_close = on_close width = screen.width // 2 self._message = text height = 17 self.win = win # Construct the Frame self._data = {"message": self._message} super(AddMusicDialog, self).__init__(screen, height, width, self._data, has_shadow=has_shadow, is_modal=True) # Build up the message box layout = Layout([100], fill_frame=True) self.add_layout(layout) #TITLE if self._message != "": layout.add_widget(Label(self._message)) layout.add_widget(Divider()) self.playCb = None self.newPlaylist = None self.listPlaylists = None self.listAdd = None self.playlistLists = playlistLists self.addList = addList if needNewPlaylist: layoutText = Layout([1, 1], fill_frame=False) self.add_layout(layoutText) c = presenter.config.dialog.color.split(':') tcolor = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) self.newPlaylist = CustomText(tcolor, label="New playlist:", name="CreatePlaylist", validator="^[a-zA-Z]") self.newPlaylist.value = "" layoutText.add_widget(self.newPlaylist, 0) if win == "MainPlaylist": layoutText.add_widget( Button( "Add", on_click=self._addNewPlaylistAndSaveMainPlaylistBtn), 1) elif win == "Browser": layoutText.add_widget( Button("Add", on_click=self._addNewPlaylistAndSaveSongBtn), 1) elif win == "Medialib": layoutText.add_widget( Button("Add", on_click=self._addNewPlaylistAndSaveSongBtn), 1) elif win == "MedialibAlbum": layoutText.add_widget( Button( "Add", on_click=self._addNewPlaylistAndSaveMainPlaylistBtn), 1) elif win == "Search": layoutText.add_widget( Button("Add", on_click=self._addNewPlaylistAndSaveSongBtn), 1) layoutText.add_widget(Divider(), 0) layoutText.add_widget(Divider(), 1) if needListPlaylists: layoutAdd = Layout([1], fill_frame=False) self.add_layout(layoutAdd) self.listPlaylists = ListBox(5, playlistLists, on_change=self._on_change_playlist) self.listPlaylists.value = 0 layoutAdd.add_widget(self.listPlaylists) layoutAdd.add_widget(Divider()) if needListAdd: layoutAdd = Layout([1], fill_frame=False) self.add_layout(layoutAdd) self.listAdd = ListBox(5, addList) self.listAdd.value = 0 layoutAdd.add_widget(self.listAdd) layoutAdd.add_widget(Divider()) if needPlayCb: layoutAdd = Layout([1], fill_frame=False) self.add_layout(layoutAdd) self.playCb = CheckBox("", label="Play?", name="Need Play") layoutAdd.add_widget(self.playCb) layoutAdd.add_widget(Divider()) layoutBtns = Layout([1 for _ in buttons]) self.add_layout(layoutBtns) for i, button in enumerate(buttons): func = partial(self._destroy, i) layoutBtns.add_widget(Button(button, func), i) self.fix()
def __init__(self, screen, upBar, downBar, config): super(EqualizerFrame, self).__init__( screen, screen.height, screen.width, has_border=False, name="Equalizer") self.upBar = upBar self.downBar = downBar self.dup = 0 self.ddown = 0 self.eqIsBass = False self.eqIsEcho = False self.eqIsChorus = False self.eqIsReverb = False self.eqIsFlange = False self.eqBass = [6, 5, 4] dh = 0 i = 0 for l in upBar.layouts: _l = Layout([l[0],l[1],l[2]]) self.add_layout(_l) _l.add_widget(upBar.lables[i], 0) _l.add_widget(upBar.lables[i+1], 1) _l.add_widget(upBar.lables[i+2], 2) i+=3 dh+=1 self.dup += 1 layout = Layout([1, 0.5], fill_frame=True) self.add_layout(layout) self.ch_less = config.equalizer.bar_less self.ch_more = config.equalizer.bar_more c = config.equalizer.color.split(':') self.color = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) c = config.equalizer.color_choice.split(':') self.color_choice = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) lEq = CustomLabel(align=u'<') lEq.addLable("Equalizer",self.color,"%Equalizer") layout.add_widget(lEq) self.eqLevels = [80, 170, 310, 600, 1000, 3000, 6000, 10000, 12000, 14000] self.eqLevelsParam = [0, 0, 0 ,0, 0, 0, 0, 0, 0, 0] self.eqBars = [] self.eqSpeedParam = 0 # 80 170 310 600 1000 3000 6000 10000 12000 14000 Hz # " -15 0 15" self.listEqBar = CustomMultiColumnListBox( 11, ["<100%"], [self.color], [self.color_choice], [], titles=[" -15 0 15"], name="eqBar") self.listEqBar.choiceCh = '' self.listEqBar.itemCh = '' layout.add_widget(self.listEqBar, 0) lEqSpeed = CustomLabel(align=u'<') lEqSpeed.addLable("Speed",self.color,"%Speed") layout.add_widget(lEqSpeed, 0) self.listEqSpeed = CustomMultiColumnListBox( 2, ["<100%"], [self.color], [self.color], [], titles=[" 25 0 400"], name="eqSpeed") self.listEqSpeed.choiceCh = '' self.listEqSpeed.itemCh = '' layout.add_widget(self.listEqSpeed, 0) #self.setEqSpeedParam() lEqPreset = CustomLabel(align=u'<') lEqPreset.addLable("Presets",self.color,"") layout.add_widget(lEqPreset, 1) self.eqPresets = [] self.eqPresets.append(CustomCheckBox("Custom", self.color, name="CustomPreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Default", self.color, name="DefaultPreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Rock", self.color, name="RockPreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Rap", self.color, name="RapPreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Grunge", self.color, name="GrungePreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Metal", self.color, name="MetalPreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Techno", self.color, name="TechnoPreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Pop", self.color, name="PopPreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Classic", self.color, name="ClassicPreset", on_change=self.__onChangePreset)) self.eqPresets.append(CustomCheckBox("Voice", self.color, name="VoicePreset", on_change=self.__onChangePreset)) for e in self.eqPresets: layout.add_widget(e, 1) self.eqPresets[1].value = True lEqEffects = CustomLabel(align=u'<') lEqEffects.addLable("Effects",self.color,"") layout.add_widget(lEqEffects, 1) self.eqBass = CustomCheckBox("BASS", self.color, name="BassPreset", on_change=self.__onChangeBass) layout.add_widget(self.eqBass, 1) self.eqEcho = CustomCheckBox("Echo", self.color, name="EchoPreset", on_change=self.__onChangeEcho) layout.add_widget(self.eqEcho, 1) self.eqFlange = CustomCheckBox("Flange", self.color, name="FlangePreset", on_change=self.__onChangeFlange) layout.add_widget(self.eqFlange, 1) self.eqChorus = CustomCheckBox("Chorus", self.color, name="ChorusPreset", on_change=self.__onChangeChorus) layout.add_widget(self.eqChorus, 1) self.eqReverb = CustomCheckBox("Reverb", self.color, name="ReverbPreset", on_change=self.__onChangeReverb) layout.add_widget(self.eqReverb, 1) i = 0 for l in downBar.layouts: _l = Layout([l[0],l[1],l[2]]) self.add_layout(_l) _l.add_widget(downBar.lables[i], 0) _l.add_widget(downBar.lables[i+1], 1) _l.add_widget(downBar.lables[i+2], 2) i+=3 dh+=1 self.ddown += 1 self.fix()
def __init__(self, screen, upBar, downBar, config): super(MainPlaylistFrame, self).__init__(screen, screen.height, screen.width, has_border=False, name="MainPlaylist", bg=getColor(config.bg_color)) self.upBar = upBar self.downBar = downBar i = 0 for l in upBar.layouts: _l = Layout([l[0], l[1], l[2]]) self.add_layout(_l) _l.add_widget(upBar.lables[i], 0) _l.add_widget(upBar.lables[i + 1], 1) _l.add_widget(upBar.lables[i + 2], 2) i += 3 layout = Layout([1], fill_frame=True) self.add_layout(layout) csize = [] colors = [] ccolors = [] pcolors = [] data = [] titles = [] for itm in config.main_playlist.columns: data.append(itm.data) csize.append(itm.width) c = itm.color.split(':') colors.append( ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2]))) c = itm.choice_color.split(':') ccolors.append( ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2]))) c = itm.play_color.split(':') pcolors.append( ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2]))) if config.main_playlist.title: titles.append(itm.title) self.table = CustomMainPlaylistBox(Widget.FILL_FRAME, csize, colors, ccolors, pcolors, data, [], titles, name="main_playlist", on_select=self._play) self.table.choiceCh = config.main_playlist.choice_char self.table.itemCh = config.main_playlist.item_char self.table.playCh = config.main_playlist.play_char layout.add_widget(self.table) i = 0 for l in downBar.layouts: _l = Layout([l[0], l[1], l[2]]) self.add_layout(_l) _l.add_widget(downBar.lables[i], 0) _l.add_widget(downBar.lables[i + 1], 1) _l.add_widget(downBar.lables[i + 2], 2) i += 3 self.fix()
def __init__(self, screen, text, url, fname, buttons, presenter=None, on_close=None, has_shadow=False, win=""): self.fname = fname self.url = url self.presenter = presenter self._buttons = buttons self._on_close = on_close width = screen.width // 2 self._message = text height = 17 self.win = win # Construct the Frame self._data = {"message": self._message} super(DownloadDialog, self).__init__( screen, height, width, self._data, has_shadow=has_shadow, is_modal=True) # Build up the message box layout = Layout([100], fill_frame=True) self.add_layout(layout) #TITLE if self._message != "": layout.add_widget(Label(self._message)) layout.add_widget(Divider()) self.browser = CustomFileBrowser(Widget.FILL_FRAME, presenter.config.root_dir, presenter.config, name="save_dir", formats=[]) layout.add_widget(self.browser) layout.add_widget(Divider()) c = presenter.config.dialog.color.split(':') tcolor = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) self.fileName = CustomText(tcolor, label="File name:", name="file_name", validator="^[a-zA-Z0-9_]") self.fileName.value = self.fname + ".mp3" layout.add_widget(self.fileName) layout.add_widget(Divider()) self.playCb = CheckBox("", label="Play?", name="need_play") self.addCurCb = CheckBox("", label="Add to current playlist?", name="need_play", on_change=self._change_addCurCb) self.playCb.disabled = True layout.add_widget(self.addCurCb) layout.add_widget(self.playCb) layout.add_widget(Divider()) layoutBtns = Layout([1 for _ in buttons]) self.add_layout(layoutBtns) for i, button in enumerate(buttons): func = partial(self._destroy, i) layoutBtns.add_widget(Button(button, func), i) self.fix()
def __init__(self, screen, upBar, downBar, config): super(MedialibFrame, self).__init__(screen, screen.height, screen.width, has_border=False, name="Medialib", bg=getColor(config.bg_color)) self.curPlaylist = [] self.upBar = upBar self.downBar = downBar i = 0 for l in upBar.layouts: _l = Layout([l[0], l[1], l[2]]) self.add_layout(_l) _l.add_widget(upBar.lables[i], 0) _l.add_widget(upBar.lables[i + 1], 1) _l.add_widget(upBar.lables[i + 2], 2) i += 3 layout = Layout([1, 1, 1], fill_frame=True) self.add_layout(layout) c = config.medialib.color.split(':') self.color = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) c = config.medialib.color_choice.split(':') self.color_choice = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) c = config.medialib.color_not_focus.split(':') self.color_not_focus = ColorTheme(getColor(c[0]), getAttr(c[1]), getColor(c[2])) titleArtist = config.medialib.title_artist titleAlbum = config.medialib.title_album titleSong = config.medialib.title_song self.listArtists = CustomMultiColumnListBox( Widget.FILL_FRAME, ["<100%"], [self.color], [self.color_choice], [], titles=[titleArtist], name="Artists", on_change=self._on_change_artist) self.listArtists.choiceCh = config.main_playlist.choice_char self.listArtists.itemCh = config.main_playlist.item_char layout.add_widget(self.listArtists, 0) self.listAlbums = CustomMultiColumnListBox( Widget.FILL_FRAME, ["<100%"], [self.color], [self.color_not_focus], [], titles=[titleAlbum], name="Albums", on_change=self._on_change_album, on_select=self.openAlbum) self.listAlbums.choiceCh = config.main_playlist.choice_char self.listAlbums.itemCh = config.main_playlist.item_char layout.add_widget(self.listAlbums, 1) self.listSongs = CustomMultiColumnListBox(Widget.FILL_FRAME, ["<100%"], [self.color], [self.color_not_focus], [], titles=[titleSong], name="Songs", on_select=self.addSong) self.listSongs.choiceCh = config.main_playlist.choice_char self.listSongs.itemCh = config.main_playlist.item_char layout.add_widget(self.listSongs, 2) i = 0 for l in downBar.layouts: _l = Layout([l[0], l[1], l[2]]) self.add_layout(_l) _l.add_widget(downBar.lables[i], 0) _l.add_widget(downBar.lables[i + 1], 1) _l.add_widget(downBar.lables[i + 2], 2) i += 3 self.fix()