Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
lollypop
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
29
Issues
29
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
World
lollypop
Commits
a50dc3c0
Commit
a50dc3c0
authored
Nov 07, 2019
by
Cédric Bellegarde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework SearchView bottom buttons. Fix
#2094
parent
2fb85169
Pipeline
#129562
passed with stage
in 9 minutes and 48 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
253 deletions
+28
-253
data/application.css
data/application.css
+22
-14
lollypop/pop_tracks.py
lollypop/pop_tracks.py
+0
-219
lollypop/view_albums_box.py
lollypop/view_albums_box.py
+1
-18
lollypop/view_search.py
lollypop/view_search.py
+5
-2
No files found.
data/application.css
View file @
a50dc3c0
...
...
@@ -530,21 +530,25 @@ flowboxchild:selected {
opacity
:
0.5
;
}
.menu-button
:checked
{
background-color
:
@
theme_selected_bg_color
;
}
.menu-button
:hover
{
color
:
inherit
;
border-color
:
alpha
(
@
theme_fg_color
,
0.1
);
opacity
:
1
;
}
.
vertical-menu
-button
{
opacity
:
0.
9
;
.
light
-button
{
opacity
:
0.
8
;
box-shadow
:
none
;
min-height
:
24px
;
min-width
:
24px
;
padding-left
:
4px
;
padding-right
:
4px
;
padding-top
:
4px
;
padding-bottom
:
4px
;
min-height
:
32px
;
padding-left
:
10px
;
padding-right
:
10px
;
padding-top
:
0px
;
padding-bottom
:
0px
;
background-image
:
none
;
border-style
:
solid
;
border-image-source
:
none
;
...
...
@@ -552,17 +556,21 @@ flowboxchild:selected {
border-top-width
:
1px
;
border-left-width
:
1px
;
border-right-width
:
1px
;
border-color
:
transparent
;
border-color
:
alpha
(
@
theme_fg_color
,
0.1
)
;
color
:
inherit
;
}
.
vertical-menu
-button
:disabled
{
opacity
:
0.
4
;
.
light
-button
:disabled
{
opacity
:
0.
5
;
}
.vertical-menu-button
:hover
{
color
:
inherit
;
border-color
:
alpha
(
@
theme_fg_color
,
0.1
);
.light-button
:checked
{
background-color
:
@
theme_selected_bg_color
;
color
:
@
theme_selected_fg_color
;
}
.light-button
:hover
{
border-color
:
alpha
(
@
theme_fg_color
,
0.2
);
opacity
:
1
;
}
...
...
lollypop/pop_tracks.py
deleted
100644 → 0
View file @
2fb85169
# Copyright (c) 2014-2018 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
gi.repository
import
Gtk
,
GLib
from
gettext
import
gettext
as
_
from
lollypop.view_tracks
import
TracksView
from
lollypop.define
import
App
,
ViewType
,
ArtSize
,
ArtBehaviour
from
lollypop.define
import
MARGIN_SMALL
,
Size
from
lollypop.utils
import
emit_signal
from
lollypop.widgets_utils
import
Popover
from
lollypop.helper_size_allocation
import
SizeAllocationHelper
from
lollypop.controller_view
import
ViewController
,
ViewControllerType
class
TracksPopover
(
Popover
,
ViewController
,
SizeAllocationHelper
):
"""
A popover with tracks
"""
def
__init__
(
self
,
album
):
"""
Init popover
@param album as Album
@param width as int
"""
Popover
.
__init__
(
self
)
ViewController
.
__init__
(
self
,
ViewControllerType
.
ALBUM
)
SizeAllocationHelper
.
__init__
(
self
)
self
.
_album
=
album
window_width
=
App
().
window
.
get_allocated_width
()
wanted_width
=
min
(
Size
.
NORMAL
,
window_width
*
0.5
)
wanted_height
=
Size
.
MINI
view_type
=
ViewType
.
ALBUM
if
wanted_width
>
Size
.
MEDIUM
:
view_type
|=
ViewType
.
TWO_COLUMNS
else
:
view_type
|=
ViewType
.
SINGLE_COLUMN
self
.
__tracks_view
=
TracksView
(
album
,
view_type
)
self
.
__tracks_view
.
show
()
self
.
__tracks_view
.
connect
(
"populated"
,
self
.
__on_tracks_populated
)
self
.
__tracks_view
.
populate
()
self
.
__scrolled
=
Gtk
.
ScrolledWindow
()
self
.
__scrolled
.
add
(
self
.
__tracks_view
)
self
.
__scrolled
.
set_property
(
"width-request"
,
wanted_width
)
self
.
__scrolled
.
set_property
(
"height-request"
,
wanted_height
)
self
.
__scrolled
.
show
()
grid
=
Gtk
.
Grid
()
grid
.
set_column_spacing
(
MARGIN_SMALL
)
grid
.
show
()
overlay
=
Gtk
.
Overlay
()
overlay
.
set_property
(
"width-request"
,
ArtSize
.
SMALL
)
overlay
.
show
()
self
.
__artwork
=
Gtk
.
Image
()
self
.
__artwork
.
show
()
overlay
.
get_style_context
().
add_class
(
"black"
)
overlay
.
add
(
self
.
__artwork
)
# Play button
play_button
=
Gtk
.
Button
.
new_from_icon_name
(
"media-playback-start-symbolic"
,
Gtk
.
IconSize
.
DND
)
play_button
.
set_property
(
"has-tooltip"
,
True
)
play_button
.
set_tooltip_text
(
_
(
"Play"
))
play_button
.
set_property
(
"valign"
,
Gtk
.
Align
.
START
)
play_button
.
set_property
(
"halign"
,
Gtk
.
Align
.
CENTER
)
play_button
.
set_margin_top
(
MARGIN_SMALL
)
play_button
.
connect
(
"clicked"
,
self
.
__on_play_clicked
)
play_button
.
show
()
play_button
.
get_style_context
().
add_class
(
"vertical-menu-button"
)
play_button
.
get_style_context
().
add_class
(
"black-transparent"
)
overlay
.
add_overlay
(
play_button
)
# Linked grid
linked_grid
=
Gtk
.
Grid
()
linked_grid
.
set_orientation
(
Gtk
.
Orientation
.
VERTICAL
)
linked_grid
.
show
()
linked_grid
.
set_property
(
"valign"
,
Gtk
.
Align
.
END
)
linked_grid
.
set_property
(
"halign"
,
Gtk
.
Align
.
CENTER
)
linked_grid
.
get_style_context
().
add_class
(
"linked"
)
linked_grid
.
set_margin_bottom
(
MARGIN_SMALL
)
overlay
.
add_overlay
(
linked_grid
)
# Action button
self
.
__action_button
=
Gtk
.
Button
.
new
()
self
.
__action_button
.
set_property
(
"has-tooltip"
,
True
)
self
.
__action_button
.
connect
(
"clicked"
,
self
.
__on_action_clicked
)
self
.
__action_button
.
set_image
(
Gtk
.
Image
())
self
.
__show_append
(
self
.
_album
.
id
not
in
App
().
player
.
album_ids
)
self
.
__action_button
.
show
()
linked_grid
.
add
(
self
.
__action_button
)
self
.
__action_button
.
get_style_context
().
add_class
(
"vertical-menu-button"
)
self
.
__action_button
.
get_style_context
().
add_class
(
"black-transparent"
)
grid
.
add
(
overlay
)
grid
.
add
(
self
.
__scrolled
)
self
.
add
(
grid
)
#######################
# PROTECTED #
#######################
def
_handle_width_allocate
(
self
,
allocation
):
"""
Update artwork
@param allocation as Gtk.Allocation
"""
if
SizeAllocationHelper
.
_handle_width_allocate
(
self
,
allocation
):
App
().
art_helper
.
set_album_artwork
(
self
.
_album
,
ArtSize
.
SMALL
,
self
.
__scrolled
.
get_allocated_height
(),
self
.
__artwork
.
get_scale_factor
(),
ArtBehaviour
.
BLUR_MAX
|
ArtBehaviour
.
CACHE
|
ArtBehaviour
.
ROUNDED_BORDER
|
ArtBehaviour
.
LIGHTER
,
self
.
__on_album_artwork
)
def
_on_current_changed
(
self
,
player
):
"""
Update view
@param player as Player
"""
self
.
__tracks_view
.
set_playing_indicator
()
self
.
__show_append
(
self
.
_album
.
id
not
in
App
().
player
.
album_ids
)
def
_on_duration_changed
(
self
,
player
,
track_id
):
"""
Update track duration
@param player as Player
@param track_id as int
"""
self
.
__tracks_view
.
update_duration
(
track_id
)
#######################
# PRIVATE #
#######################
def
__show_append
(
self
,
append
):
"""
Show append button if append, else remove button
"""
if
append
:
self
.
__action_button
.
get_image
().
set_from_icon_name
(
"list-add-symbolic"
,
Gtk
.
IconSize
.
DND
)
self
.
__action_button
.
set_tooltip_text
(
_
(
"Add to current playlist"
))
else
:
self
.
__action_button
.
get_image
().
set_from_icon_name
(
"list-remove-symbolic"
,
Gtk
.
IconSize
.
DND
)
self
.
__action_button
.
set_tooltip_text
(
_
(
"Remove from current playlist"
))
def
__on_play_clicked
(
self
,
button
):
"""
Play album
@param button as Gtk.Button
"""
App
().
player
.
play_album
(
self
.
_album
)
self
.
__show_append
(
False
)
def
__on_action_clicked
(
self
,
button
):
"""
Append album to current list if not present
Remove it if present
@param button as Gtk.Button
"""
if
self
.
_album
.
id
in
App
().
player
.
album_ids
:
if
App
().
player
.
current_track
.
album
.
id
==
self
.
_album
.
id
:
# If not last album, skip it
if
len
(
App
().
player
.
albums
)
>
1
:
App
().
player
.
skip_album
()
App
().
player
.
remove_album_by_id
(
self
.
_album
.
id
)
# remove it and stop playback by going to next track
else
:
App
().
player
.
remove_album_by_id
(
self
.
_album
.
id
)
App
().
player
.
stop
()
else
:
App
().
player
.
remove_album_by_id
(
self
.
_album
.
id
)
self
.
__show_append
(
True
)
else
:
if
App
().
player
.
is_playing
and
not
App
().
player
.
albums
:
App
().
player
.
play_album
(
self
.
_album
)
else
:
App
().
player
.
add_album
(
self
.
_album
)
self
.
__show_append
(
False
)
def
__on_play_all_clicked
(
self
,
button
):
"""
Play album with context
@param button as Gtk.Button
"""
self
.
__show_append
(
False
)
if
App
().
player
.
is_party
:
App
().
lookup_action
(
"party"
).
change_state
(
GLib
.
Variant
(
"b"
,
False
))
emit_signal
(
self
,
"play-all-from"
)
def
__on_album_artwork
(
self
,
surface
):
"""
Set album artwork
@param surface as str
"""
if
surface
is
not
None
:
self
.
__artwork
.
set_from_surface
(
surface
)
def
__on_tracks_populated
(
self
,
view
):
"""
Tracks populated
@param view as TracksView
"""
if
not
self
.
__tracks_view
.
is_populated
:
self
.
__tracks_view
.
populate
()
lollypop/view_albums_box.py
View file @
a50dc3c0
...
...
@@ -10,7 +10,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
gi.repository
import
GLib
,
G
dk
,
G
tk
,
Gio
,
Pango
from
gi.repository
import
GLib
,
Gtk
,
Gio
,
Pango
from
gettext
import
gettext
as
_
from
random
import
shuffle
...
...
@@ -179,23 +179,6 @@ class AlbumsBoxView(FlowBoxView, ViewController, SignalsHelper):
"""
App
().
window
.
container
.
show_view
([
Type
.
ALBUM
],
child
.
data
)
def
_on_primary_press_gesture
(
self
,
x
,
y
,
event
):
"""
Popup tracks menu at position
@param x as int
@param y as int
@param event as Gdk.Event
"""
child
=
self
.
_box
.
get_child_at_pos
(
x
,
y
)
if
child
is
None
or
child
.
artwork
is
None
:
return
if
event
.
state
&
Gdk
.
ModifierType
.
CONTROL_MASK
:
from
lollypop.pop_tracks
import
TracksPopover
popover
=
TracksPopover
(
child
.
data
)
popover
.
set_relative_to
(
child
.
artwork
)
popover
.
set_position
(
Gtk
.
PositionType
.
BOTTOM
)
popover
.
popup
()
def
_on_tertiary_press_gesture
(
self
,
x
,
y
,
event
):
"""
Play albums
...
...
lollypop/view_search.py
View file @
a50dc3c0
...
...
@@ -16,7 +16,7 @@ from gettext import gettext as _
from
urllib.parse
import
urlparse
from
lollypop.define
import
App
,
StorageType
from
lollypop.define
import
Size
,
ViewType
from
lollypop.define
import
Size
,
ViewType
,
MARGIN_SMALL
from
lollypop.view_albums_list
import
AlbumsListView
from
lollypop.search
import
Search
from
lollypop.utils
import
get_network_available
,
get_youtube_dl
...
...
@@ -48,12 +48,14 @@ class SearchView(View, Gtk.Bin, SignalsHelper):
self
.
__cancellable
=
Gio
.
Cancellable
()
self
.
__bottom_buttons
=
Gtk
.
Grid
()
self
.
__bottom_buttons
.
show
()
self
.
__bottom_buttons
.
get_style_context
().
add_class
(
"linked"
)
self
.
__bottom_buttons
.
set_property
(
"halign"
,
Gtk
.
Align
.
CENTER
)
self
.
__bottom_buttons
.
set_margin_bottom
(
MARGIN_SMALL
)
self
.
__bottom_buttons
.
get_style_context
().
add_class
(
"linked"
)
self
.
__local_button
=
Gtk
.
RadioButton
.
new
()
self
.
__local_button
.
show
()
self
.
__local_button
.
set_property
(
"draw-indicator"
,
False
)
self
.
__local_button
.
set_name
(
"local"
)
self
.
__local_button
.
get_style_context
().
add_class
(
"light-button"
)
image
=
Gtk
.
Image
.
new_from_icon_name
(
"computer-symbolic"
,
Gtk
.
IconSize
.
BUTTON
)
image
.
show
()
...
...
@@ -63,6 +65,7 @@ class SearchView(View, Gtk.Bin, SignalsHelper):
web_button
.
show
()
web_button
.
set_property
(
"draw-indicator"
,
False
)
web_button
.
set_name
(
"web"
)
web_button
.
get_style_context
().
add_class
(
"light-button"
)
image
=
Gtk
.
Image
.
new_from_icon_name
(
"goa-panel-symbolic"
,
Gtk
.
IconSize
.
BUTTON
)
image
.
show
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment