From 910368fc87dda4b38ad90331188a24e75a691ed9 Mon Sep 17 00:00:00 2001 From: 9and3r <9and3r@gmail.com> Date: Tue, 29 Jul 2014 14:48:13 +0200 Subject: [PATCH] New font used for icons --- mopidy_touchscreen/.idea/workspace.xml | 497 +------- mopidy_touchscreen/fonts/icomoon/Read Me.txt | 5 + .../fonts/icomoon/demo-files/demo.css | 152 +++ .../fonts/icomoon/demo-files/demo.js | 30 + mopidy_touchscreen/fonts/icomoon/demo.html | 585 +++++++++ .../fonts/icomoon/fonts/icomoon.ttf | Bin 0 -> 6412 bytes .../fonts/icomoon/selection.json | 1071 +++++++++++++++++ mopidy_touchscreen/fonts/icomoon/style.css | 151 +++ mopidy_touchscreen/list_view.py | 2 +- mopidy_touchscreen/main_screen.py | 14 +- mopidy_touchscreen/menu_screen.py | 18 + mopidy_touchscreen/playlist_screen.py | 1 + mopidy_touchscreen/screen_manager.py | 101 +- mopidy_touchscreen/screen_objects.py | 4 + mopidy_touchscreen/touch_manager.py | 8 +- mopidy_touchscreen/tracklist.py | 7 +- 16 files changed, 2142 insertions(+), 504 deletions(-) create mode 100644 mopidy_touchscreen/fonts/icomoon/Read Me.txt create mode 100644 mopidy_touchscreen/fonts/icomoon/demo-files/demo.css create mode 100644 mopidy_touchscreen/fonts/icomoon/demo-files/demo.js create mode 100644 mopidy_touchscreen/fonts/icomoon/demo.html create mode 100644 mopidy_touchscreen/fonts/icomoon/fonts/icomoon.ttf create mode 100644 mopidy_touchscreen/fonts/icomoon/selection.json create mode 100644 mopidy_touchscreen/fonts/icomoon/style.css create mode 100644 mopidy_touchscreen/menu_screen.py diff --git a/mopidy_touchscreen/.idea/workspace.xml b/mopidy_touchscreen/.idea/workspace.xml index 96d8847..ff3b213 100644 --- a/mopidy_touchscreen/.idea/workspace.xml +++ b/mopidy_touchscreen/.idea/workspace.xml @@ -1,7 +1,7 @@ - + - - - - - - - - - - - + - - + + @@ -48,38 +38,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -95,19 +55,11 @@ @@ -167,17 +119,9 @@ - - - - - - - + - - - - - + @@ -327,9 +251,9 @@ - - 1405618199088 - 1405618199088 + + 1406578790451 + 1406578790451 @@ -338,22 +262,22 @@ - + - - + + - - - + + + + - - + @@ -373,414 +297,97 @@ - - + - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - + - - + + - + - - - + + - + - - - + + - + - - - + + - + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mopidy_touchscreen/fonts/icomoon/Read Me.txt b/mopidy_touchscreen/fonts/icomoon/Read Me.txt new file mode 100644 index 0000000..cd97d24 --- /dev/null +++ b/mopidy_touchscreen/fonts/icomoon/Read Me.txt @@ -0,0 +1,5 @@ +Open *demo.html* to see a list of all the glyphs in your font along with their codes/ligatures. + +You won't need any of the files located under the *demo-files* directory when including the generated font in your own projects. + +You can import *selection.json* back to the IcoMoon app using the *Import Icons* button (or via Main Menu > Manage Projects) to retrieve your icon selection. diff --git a/mopidy_touchscreen/fonts/icomoon/demo-files/demo.css b/mopidy_touchscreen/fonts/icomoon/demo-files/demo.css new file mode 100644 index 0000000..b2c3efe --- /dev/null +++ b/mopidy_touchscreen/fonts/icomoon/demo-files/demo.css @@ -0,0 +1,152 @@ +body { + padding: 0; + margin: 0; + font-family: sans-serif; + font-size: 1em; + line-height: 1.5; + color: #555; + background: #fff; +} +h1 { + font-size: 1.5em; + font-weight: normal; +} +small { + font-size: .66666667em; +} +a { + color: #e74c3c; + text-decoration: none; +} +a:hover, a:focus { + box-shadow: 0 1px #e74c3c; +} +.bshadow0, input { + box-shadow: inset 0 -2px #e7e7e7; +} +input:hover { + box-shadow: inset 0 -2px #ccc; +} +input, fieldset { + font-size: 1em; + margin: 0; + padding: 0; + border: 0; +} +input { + color: inherit; + line-height: 1.5; + height: 1.5em; + padding: .25em 0; +} +input:focus { + outline: none; + box-shadow: inset 0 -2px #449fdb; +} +.glyph { + font-size: 16px; + width: 15em; + padding-bottom: 1em; + margin-right: 4em; + margin-bottom: 1em; + float: left; + overflow: hidden; +} +.liga { + width: 80%; + width: calc(100% - 2.5em); +} +.talign-right { + text-align: right; +} +.talign-center { + text-align: center; +} +.bgc1 { + background: #f1f1f1; +} +.fgc1 { + color: #999; +} +.fgc0 { + color: #000; +} +p { + margin-top: 1em; + margin-bottom: 1em; +} +.mvm { + margin-top: .75em; + margin-bottom: .75em; +} +.mtn { + margin-top: 0; +} +.mtl, .mal { + margin-top: 1.5em; +} +.mbl, .mal { + margin-bottom: 1.5em; +} +.mal, .mhl { + margin-left: 1.5em; + margin-right: 1.5em; +} +.mhmm { + margin-left: 1em; + margin-right: 1em; +} +.mls { + margin-left: .25em; +} +.ptl { + padding-top: 1.5em; +} +.pbs, .pvs { + padding-bottom: .25em; +} +.pvs, .pts { + padding-top: .25em; +} +.clearfix { + zoom: 1; +} +.unit { + float: left; +} +.unitRight { + float: right; +} +.size1of2 { + width: 50%; +} +.size1of1 { + width: 100%; +} +.clearfix:before, .clearfix:after { + content: " "; + display: table; +} +.clearfix:after { + clear: both; +} +.hidden-true { + display: none; +} +.textbox0 { + width: 3em; + background: #f1f1f1; + padding: .25em .5em; + line-height: 1.5; + height: 1.5em; +} +#testDrive { + padding-top: 24px; + line-height: 1.5; +} +.fs0 { + font-size: 16px; +} +.fs1 { + font-size: 32px; +} diff --git a/mopidy_touchscreen/fonts/icomoon/demo-files/demo.js b/mopidy_touchscreen/fonts/icomoon/demo-files/demo.js new file mode 100644 index 0000000..e72f449 --- /dev/null +++ b/mopidy_touchscreen/fonts/icomoon/demo-files/demo.js @@ -0,0 +1,30 @@ +if (!('boxShadow' in document.body.style)) { + document.body.setAttribute('class', 'noBoxShadow'); +} + +document.body.addEventListener("click", function(e) { + var target = e.target; + if (target.tagName === "INPUT" && + target.getAttribute('class').indexOf('liga') === -1) { + target.select(); + } +}); + +(function() { + var fontSize = document.getElementById('fontSize'), + testDrive = document.getElementById('testDrive'), + testText = document.getElementById('testText'); + function updateTest() { + testDrive.innerHTML = testText.value || String.fromCharCode(160); + if (window.icomoonLiga) { + window.icomoonLiga(testDrive); + } + } + function updateSize() { + testDrive.style.fontSize = fontSize.value + 'px'; + } + fontSize.addEventListener('change', updateSize, false); + testText.addEventListener('input', updateTest, false); + testText.addEventListener('change', updateTest, false); + updateSize(); +}()); diff --git a/mopidy_touchscreen/fonts/icomoon/demo.html b/mopidy_touchscreen/fonts/icomoon/demo.html new file mode 100644 index 0000000..255435b --- /dev/null +++ b/mopidy_touchscreen/fonts/icomoon/demo.html @@ -0,0 +1,585 @@ + + + + + IcoMoon Demo + + + + + +
+

Font Name: icomoon (Glyphs: 42)

+
+
+

Grid Size: 16

+
+
+ icon-music +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-headphones +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-connection +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-book +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-books +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-file +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-folder +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-folder-open +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-cabinet +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-spinner +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-cog +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-switch +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-list +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-list2 +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-numbered-list +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-menu +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-spam +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-close +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-checkmark +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-minus +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-plus +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-play +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-pause +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-stop +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-backward +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-forward +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-first +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-last +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-previous +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-next +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-eject +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-volume-high +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-volume-medium +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-volume-low +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-volume-mute +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-volume-mute2 +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-volume-increase +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-volume-decrease +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-loop +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-loop2 +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-loop3 +
+
+ + +
+
+ liga: + +
+
+
+
+ icon-shuffle +
+
+ + +
+
+ liga: + +
+
+
+ + +
+

Font Test Drive

+ + + +
  +
+
+ +
+

Generated by IcoMoon

+
+ + + + \ No newline at end of file diff --git a/mopidy_touchscreen/fonts/icomoon/fonts/icomoon.ttf b/mopidy_touchscreen/fonts/icomoon/fonts/icomoon.ttf new file mode 100644 index 0000000000000000000000000000000000000000..84331474ce4bc1a75b4f5825c7c96b52dcde7e28 GIT binary patch literal 6412 zcmcIoU2Gf25#G5w-tkEB$fI~XlGe{rlt@#uXj>F@juX>|B2Mhsft@t2+lMrie_|)F zV-*j z9VJS#lN3dd+}qjN*_oZ4-I>`FB!q~Iwvff1yTH7O(mHc#d8Kgjmu(?v z4DDm*m!DffokIHp>gf54*Pgs~;%{F-8~9A;!nx(M^sR6IN{B3I#L@*IlqaNbpnVwa z=?j;xTs_%Q#?iir_UjifpIN^C;+301*wbi#@zV0u710ncq5Uy+>rZ;xV0XH_C!sH(HS#iNTsQo)L3jv^@Rz^ZfMq4l-Z$HdZKFE)rmCMYGPz0 z(%XiicB_BG9Jdk)Yux0TBw70Yfe*H#D9UrkiiGnp#JIr9yVgQ>Kix}>(yXMGW~};t zX{p|rD$mj!xr;T-(vYkSW@yNM)i7kOCJ*M#lSZ>*HG!&06;v%rQ4}ea@+)$JI>5De zKJa*>@%RHfB}J8GRgrWvXDFJc$`TQk4m?_`J$j%7P?A+mQ;eLc4=CTdMLoj*7CFp- z8I5GKR!mD6$*4J5$Y^gvMnsOpN8&1TVQwlKKw&y>Ynj5N8BH1qEoNo2BiIXA3F&$2 zimaFy$HiG8X4no;hBelpNuA3k+{}b*?;WCWLjpOp;<^dR%gmG}6Sb&i=M#y%ZAEK| z$by=>#2rsFj4X=LZqv$eg2!rt0!dY*1%%G1Tv{8;nQ(Q^6dq2}0psyJQFWaf75 zvh7{F<}$yI=y6Sp>ybg-jT%;>rW>(HBxdNfgk?mh>{4!IBv-QM(_^Et*yvb#{-=5- zHx}MM#1+V^BhZ!<>vee5SBZ$3+oa-z*MxX%Qf{f{DFQ zFPbGPT1D#iS7T-(8cmon+SBhQ>~t)awiDEL`dxDRJ?ivZ+{r}Lj+wbcz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`?AT3EJq(90v`4uIqEGix4mhz8CA@WM(&B%M|PIXCrNd3I} zwE7kGo9e6T&(+_lx3yQJ`=c*KSEKLi)B0oj6}_w9ieVr5D^(LOa;|}gr?K@h#E--E zB-|nfR+0ce7~*BX(;=(?J{iIhe48{vScP|82;mqa!5JY7L}Or>X8;F0132IrzyZ$y z4tNHzim~^EV*{Q~f$wE;3FWeQ26@pr@vL}GJmt3>u@~R2_n 80: + self.screen_objects_manager.get_touch_object("mute").set_text(u"\ue61f", False) + elif volume > 50: + self.screen_objects_manager.get_touch_object("mute").set_text(u"\ue620", False) + elif volume > 20: + self.screen_objects_manager.get_touch_object("mute").set_text(u"\ue621", False) + else: + logger.error("sartu naiz") + self.screen_objects_manager.get_touch_object("mute").set_text(u"\ue622", False) self.screen_objects_manager.get_touch_object("volume").set_value(volume) def playback_state_changed(self, old_state, new_state): if new_state == mopidy.core.PlaybackState.PLAYING: - self.screen_objects_manager.get_touch_object("pause_play").set_text(" ll", True) + self.screen_objects_manager.get_touch_object("pause_play").set_text(u"\ue616", False) else: - self.screen_objects_manager.get_touch_object("pause_play").set_text(u" \u25B8", True) + self.screen_objects_manager.get_touch_object("pause_play").set_text(u"\ue615", False) def mute_changed(self, mute): - self.screen_objects_manager.get_touch_object("mute").set_active(mute) + self.screen_objects_manager.get_touch_object("mute").set_active(not mute) + if mute: + self.screen_objects_manager.get_touch_object("mute").set_text(u"\ue623", False) + else: + self.volume_changed(self.core.playback.volume.get()) def tracklist_changed(self): self.screens[1].tracklist_changed() def options_changed(self): self.screen_objects_manager.get_touch_object("random").set_active(self.core.tracklist.random.get()) - repeat = self.core.tracklist.repeat.get() - single = self.core.tracklist.single.get() - repeat_button = self.screen_objects_manager.get_touch_object("repeat") - repeat_button.set_active(repeat) - if single: - repeat_button.set_text(u"\u27F21", True) - else: - repeat_button.set_text(u"\u27F2", True) - - def change_repeat_single(self): - repeat = self.core.tracklist.repeat.get() - single = self.core.tracklist.single.get() - if single: - if repeat: - repeat = False - single = False - else: - repeat = True - single = False - else: - if repeat: - # repeat = True - single = True - else: - # repeat = False - single = True - self.core.tracklist.set_repeat(repeat) - self.core.tracklist.set_single(single) - self.options_changed() + self.screen_objects_manager.get_touch_object("repeat").set_active(self.core.tracklist.repeat.get()) + self.screen_objects_manager.get_touch_object("single").set_active(self.core.tracklist.single.get()) def change_screen(self, new_screen): self.screen_objects_manager.get_touch_object("menu_"+str(self.current_screen)).set_active(False) diff --git a/mopidy_touchscreen/screen_objects.py b/mopidy_touchscreen/screen_objects.py index b91c47b..bd8364e 100644 --- a/mopidy_touchscreen/screen_objects.py +++ b/mopidy_touchscreen/screen_objects.py @@ -149,6 +149,10 @@ class TouchAndTextItem(TouchObject, TextItem): def update(self): TextItem.update(self) + def set_text(self, text, change_size): + TextItem.set_text(self, text, change_size) + self.active_box = self.font.render(text, True, self.active_color) + def render(self, surface): if self.fit_horizontal: pass diff --git a/mopidy_touchscreen/touch_manager.py b/mopidy_touchscreen/touch_manager.py index c531e8a..1778e5b 100644 --- a/mopidy_touchscreen/touch_manager.py +++ b/mopidy_touchscreen/touch_manager.py @@ -14,12 +14,13 @@ class TouchManager(): left = 2 right = 3 - def __init__(self,size): + def __init__(self, size): self.down_pos = (0, 0) self.up_pos = (0, 0) self.screen_size = size self.max_move_margin = self.screen_size[1] / 6 self.min_swipe_move = self.screen_size[1] / 3 + self.down_button = -1 def event(self, event): if event.type == pygame.MOUSEBUTTONUP: @@ -31,14 +32,17 @@ class TouchManager(): touch_event = TouchEvent(TouchManager.swipe, self.down_pos, self.up_pos, True) touch_event.direction = TouchManager.down return touch_event - else: + elif event.button == 1 and self.down_button == 1: return self.mouse_up(event) + else: + return None elif event.type == pygame.MOUSEBUTTONDOWN: self.mouse_down(event) return None def mouse_down(self, event): self.down_pos = event.pos + self.down_button = event.button def mouse_up(self, event): self.up_pos = event.pos diff --git a/mopidy_touchscreen/tracklist.py b/mopidy_touchscreen/tracklist.py index d7e7ba4..a5eae91 100644 --- a/mopidy_touchscreen/tracklist.py +++ b/mopidy_touchscreen/tracklist.py @@ -7,8 +7,9 @@ class Tracklist(): self.size = size self.base_size = base_size self.manager = manager - self.list_view = ListView((0,self.base_size),(self.size[0],self.size[1]-2*self.base_size), self.base_size, manager.fonts) + self.list_view = ListView((0, self.base_size),(self.size[0],self.size[1]-2*self.base_size), self.base_size, manager.fonts) self.tracks = [] + self.tracks_strings = [] self.update_list() def update(self, screen): @@ -25,7 +26,9 @@ class Tracklist(): self.list_view.set_list(self.tracks_strings) def touch_event(self, touch_event): - self.list_view.touch_event(touch_event) + pos = self.list_view.touch_event(touch_event) + if pos is not None: + self.manager.core.playback.change_track(self.tracks[pos], on_error_step=1) def track_started(self, track): self.list_view.set_selected([self.manager.core.tracklist.index(track).get()]) \ No newline at end of file