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
91fb588f
Commit
91fb588f
authored
Dec 27, 2018
by
Cédric Bellegarde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix merge
parent
beb778c0
Pipeline
#48023
failed with stage
in 7 minutes and 59 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
352 deletions
+31
-352
data/PlaylistEditWidget.ui
data/PlaylistEditWidget.ui
+0
-120
data/SmartPlaylistView.ui
data/SmartPlaylistView.ui
+11
-3
data/lollypop.gresource.xml
data/lollypop.gresource.xml
+0
-1
lollypop/view_playlist_smart.py
lollypop/view_playlist_smart.py
+19
-42
lollypop/widgets_playlist_edit.py
lollypop/widgets_playlist_edit.py
+0
-185
run.sh
run.sh
+1
-1
No files found.
data/PlaylistEditWidget.ui
deleted
100644 → 0
View file @
beb778c0
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires
lib=
"gtk+"
version=
"3.12"
/>
<object
class=
"GtkGrid"
id=
"widget"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"margin_bottom"
>
5
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"column_homogeneous"
>
True
</property>
<child>
<object
class=
"GtkInfoBar"
id=
"infobar"
>
<property
name=
"app_paintable"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"message_type"
>
question
</property>
<property
name=
"show_close_button"
>
True
</property>
<signal
name=
"response"
handler=
"_on_response"
swapped=
"no"
/>
<child
internal-child=
"action_area"
>
<object
class=
"GtkButtonBox"
id=
"infobar-action_area"
>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"spacing"
>
6
</property>
<property
name=
"layout_style"
>
end
</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child
internal-child=
"content_area"
>
<object
class=
"GtkBox"
id=
"infobar-content_area"
>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"halign"
>
start
</property>
<property
name=
"spacing"
>
16
</property>
<child>
<object
class=
"GtkButton"
id=
"button1"
>
<property
name=
"label"
translatable=
"yes"
>
Confirm
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
True
</property>
<property
name=
"halign"
>
start
</property>
<signal
name=
"clicked"
handler=
"_on_delete_confirm"
swapped=
"no"
/>
</object>
<packing>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkLabel"
id=
"infobarlabel"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label"
>
label
</property>
<property
name=
"ellipsize"
>
end
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"top_attach"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkTreeView"
id=
"view"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"hexpand"
>
True
</property>
<property
name=
"vexpand"
>
True
</property>
<property
name=
"headers_visible"
>
False
</property>
<property
name=
"enable_search"
>
False
</property>
<property
name=
"search_column"
>
1
</property>
<property
name=
"hover_selection"
>
True
</property>
<property
name=
"show_expanders"
>
False
</property>
<property
name=
"rubber_banding"
>
True
</property>
<property
name=
"activate_on_single_click"
>
True
</property>
<child
internal-child=
"selection"
>
<object
class=
"GtkTreeSelection"
id=
"treeview-selection4"
>
<property
name=
"mode"
>
multiple
</property>
<signal
name=
"changed"
handler=
"_on_selection_changed"
swapped=
"no"
/>
</object>
</child>
</object>
<packing>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"top_attach"
>
1
</property>
</packing>
</child>
<style>
<class
name=
"borders"
/>
</style>
</object>
</interface>
data/SmartPlaylistView.ui
View file @
91fb588f
...
@@ -38,6 +38,8 @@
...
@@ -38,6 +38,8 @@
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"orientation"
>
vertical
</property>
<child>
<child>
<object
class=
"GtkListBox"
id=
"listbox"
>
<object
class=
"GtkListBox"
id=
"listbox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"sensitive"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"selection_mode"
>
none
</property>
<property
name=
"selection_mode"
>
none
</property>
<style>
<style>
...
@@ -52,6 +54,8 @@
...
@@ -52,6 +54,8 @@
</child>
</child>
<child>
<child>
<object
class=
"GtkButton"
id=
"add_rule_button"
>
<object
class=
"GtkButton"
id=
"add_rule_button"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"sensitive"
>
False
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
True
</property>
<property
name=
"receives_default"
>
True
</property>
<property
name=
"halign"
>
center
</property>
<property
name=
"halign"
>
center
</property>
...
@@ -79,6 +83,8 @@
...
@@ -79,6 +83,8 @@
</child>
</child>
<child>
<child>
<object
class=
"GtkBox"
id=
"bottom_box"
>
<object
class=
"GtkBox"
id=
"bottom_box"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"sensitive"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"spacing"
>
2
</property>
<property
name=
"spacing"
>
2
</property>
<child>
<child>
...
@@ -170,13 +176,13 @@
...
@@ -170,13 +176,13 @@
</packing>
</packing>
</child>
</child>
<child>
<child>
<object
class=
"GtkBox"
id=
"top_box"
>
<object
class=
"GtkBox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"spacing"
>
2
</property>
<property
name=
"spacing"
>
2
</property>
<child>
<child>
<object
class=
"GtkCheckButton"
id=
"match_toggle"
>
<object
class=
"GtkCheckButton"
id=
"match_toggle"
>
<property
name=
"label"
translatable=
"yes"
>
Smart playlist
</property>
<property
name=
"label"
translatable=
"yes"
>
Match music for
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"receives_default"
>
False
</property>
<property
name=
"receives_default"
>
False
</property>
...
@@ -190,7 +196,9 @@
...
@@ -190,7 +196,9 @@
</packing>
</packing>
</child>
</child>
<child>
<child>
<object
class=
"GtkBox"
id=
"sub_top_box"
>
<object
class=
"GtkBox"
id=
"up_box"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"sensitive"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<child>
<child>
<object
class=
"GtkComboBoxText"
id=
"operand_combobox"
>
<object
class=
"GtkComboBoxText"
id=
"operand_combobox"
>
...
...
data/lollypop.gresource.xml
View file @
91fb588f
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
LyricsView.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
LyricsView.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
MiniPlayer.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
MiniPlayer.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
NextPopover.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
NextPopover.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
PlaylistEditWidget.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
PlaylistPopover.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
PlaylistPopover.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
PlaylistView.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
PlaylistView.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
QueuePopover.ui
</file>
<file
compressed=
"true"
preprocess=
"xml-stripblanks"
>
QueuePopover.ui
</file>
...
...
lollypop/view_playlist_smart.py
View file @
91fb588f
...
@@ -12,13 +12,11 @@
...
@@ -12,13 +12,11 @@
from
gi.repository
import
Gtk
from
gi.repository
import
Gtk
from
gettext
import
gettext
as
_
from
lollypop.widgets_playlist_smart
import
SmartPlaylistRow
from
lollypop.widgets_playlist_smart
import
SmartPlaylistRow
from
lollypop.widgets_playlist_edit
import
PlaylistEditWidget
from
lollypop.view
import
View
from
lollypop.view
import
View
from
lollypop.logger
import
Logger
from
lollypop.logger
import
Logger
from
lollypop.define
import
App
,
Sizing
from
lollypop.define
import
App
class
SmartPlaylistView
(
View
):
class
SmartPlaylistView
(
View
):
...
@@ -39,15 +37,8 @@ class SmartPlaylistView(View):
...
@@ -39,15 +37,8 @@ class SmartPlaylistView(View):
builder
.
add_from_resource
(
"/org/gnome/Lollypop/SmartPlaylistView.ui"
)
builder
.
add_from_resource
(
"/org/gnome/Lollypop/SmartPlaylistView.ui"
)
builder
.
connect_signals
(
self
)
builder
.
connect_signals
(
self
)
widget
=
builder
.
get_object
(
"widget"
)
widget
=
builder
.
get_object
(
"widget"
)
grid
=
Gtk
.
Grid
()
self
.
connect
(
"size-allocate"
,
self
.
__on_size_allocate
,
widget
)
grid
.
set_orientation
(
Gtk
.
Orientation
.
VERTICAL
)
self
.
_viewport
.
add
(
widget
)
grid
.
show
()
grid
.
add
(
widget
)
self
.
__playlist_editor
=
PlaylistEditWidget
(
playlist_id
)
self
.
__playlist_editor
.
set_property
(
"halign"
,
Gtk
.
Align
.
CENTER
)
grid
.
add
(
self
.
__playlist_editor
)
self
.
connect
(
"size-allocate"
,
self
.
__on_size_allocate
)
self
.
_viewport
.
add
(
grid
)
self
.
__listbox
=
builder
.
get_object
(
"listbox"
)
self
.
__listbox
=
builder
.
get_object
(
"listbox"
)
self
.
_scrolled
.
set_property
(
"expand"
,
True
)
self
.
_scrolled
.
set_property
(
"expand"
,
True
)
self
.
__match_toggle
=
builder
.
get_object
(
"match_toggle"
)
self
.
__match_toggle
=
builder
.
get_object
(
"match_toggle"
)
...
@@ -55,14 +46,10 @@ class SmartPlaylistView(View):
...
@@ -55,14 +46,10 @@ class SmartPlaylistView(View):
self
.
__select_combobox
=
builder
.
get_object
(
"select_combobox"
)
self
.
__select_combobox
=
builder
.
get_object
(
"select_combobox"
)
self
.
__limit_spin
=
builder
.
get_object
(
"limit_spin"
)
self
.
__limit_spin
=
builder
.
get_object
(
"limit_spin"
)
self
.
__add_rule_button
=
builder
.
get_object
(
"add_rule_button"
)
self
.
__add_rule_button
=
builder
.
get_object
(
"add_rule_button"
)
self
.
__top_box
=
builder
.
get_object
(
"top_box"
)
self
.
__up_box
=
builder
.
get_object
(
"up_box"
)
self
.
__sub_top_box
=
builder
.
get_object
(
"sub_top_box"
)
self
.
__bottom_box
=
builder
.
get_object
(
"bottom_box"
)
self
.
__bottom_box
=
builder
.
get_object
(
"bottom_box"
)
if
App
().
playlists
.
get_smart
(
playlist_id
):
if
App
().
playlists
.
get_smart
(
playlist_id
):
self
.
__match_toggle
.
set_active
(
True
)
self
.
__match_toggle
.
set_active
(
True
)
else
:
self
.
__playlist_editor
.
populate
()
self
.
__playlist_editor
.
show
()
self
.
add
(
self
.
_scrolled
)
self
.
add
(
self
.
_scrolled
)
def
populate
(
self
):
def
populate
(
self
):
...
@@ -95,7 +82,7 @@ class SmartPlaylistView(View):
...
@@ -95,7 +82,7 @@ class SmartPlaylistView(View):
limit
=
int
(
split_limit
[
1
].
split
(
" "
)[
1
])
limit
=
int
(
split_limit
[
1
].
split
(
" "
)[
1
])
self
.
__limit_spin
.
set_value
(
limit
)
self
.
__limit_spin
.
set_value
(
limit
)
except
Exception
as
e
:
except
Exception
as
e
:
Logger
.
warning
(
"SmartPlaylistView::populate: %s"
,
e
)
Logger
.
warning
(
"SmartPlaylistView::populate: %s"
,
e
)
try
:
try
:
split_order
=
sql
.
split
(
"ORDER BY"
)
split_order
=
sql
.
split
(
"ORDER BY"
)
split_spaces
=
split_order
[
1
].
split
(
" "
)
split_spaces
=
split_order
[
1
].
split
(
" "
)
...
@@ -107,8 +94,8 @@ class SmartPlaylistView(View):
...
@@ -107,8 +94,8 @@ class SmartPlaylistView(View):
orderby
+=
" %s"
%
split_spaces
[
2
]
orderby
+=
" %s"
%
split_spaces
[
2
]
self
.
__select_combobox
.
set_active_id
(
orderby
)
self
.
__select_combobox
.
set_active_id
(
orderby
)
except
Exception
as
e
:
except
Exception
as
e
:
self
.
__select_combobox
.
set_active
(
0
)
self
.
__select_combobox
.
set_active
(
0
)
Logger
.
warning
(
"SmartPlaylistView::populate: %s"
,
e
)
Logger
.
warning
(
"SmartPlaylistView::populate: %s"
,
e
)
#######################
#######################
# PROTECTED #
# PROTECTED #
...
@@ -206,20 +193,15 @@ class SmartPlaylistView(View):
...
@@ -206,20 +193,15 @@ class SmartPlaylistView(View):
"""
"""
App
().
playlists
.
set_smart
(
self
.
__playlist_id
,
button
.
get_active
())
App
().
playlists
.
set_smart
(
self
.
__playlist_id
,
button
.
get_active
())
if
button
.
get_active
():
if
button
.
get_active
():
button
.
set_label
(
_
(
"Match music for "
))
self
.
__up_box
.
set_sensitive
(
True
)
self
.
__sub_top_box
.
show
()
self
.
__bottom_box
.
set_sensitive
(
True
)
self
.
__bottom_box
.
show
()
self
.
__add_rule_button
.
set_sensitive
(
True
)
self
.
__add_rule_button
.
show
()
self
.
__listbox
.
set_sensitive
(
True
)
self
.
__listbox
.
show
()
self
.
__playlist_editor
.
hide
()
else
:
else
:
button
.
set_label
(
_
(
"Smart playlist"
))
self
.
__up_box
.
set_sensitive
(
False
)
self
.
__sub_top_box
.
hide
()
self
.
__bottom_box
.
set_sensitive
(
False
)
self
.
__bottom_box
.
hide
()
self
.
__add_rule_button
.
set_sensitive
(
False
)
self
.
__add_rule_button
.
hide
()
self
.
__listbox
.
set_sensitive
(
False
)
self
.
__listbox
.
hide
()
self
.
__playlist_editor
.
populate
()
self
.
__playlist_editor
.
show
()
def
_on_map
(
self
,
widget
):
def
_on_map
(
self
,
widget
):
"""
"""
...
@@ -241,17 +223,12 @@ class SmartPlaylistView(View):
...
@@ -241,17 +223,12 @@ class SmartPlaylistView(View):
widget
.
show
()
widget
.
show
()
self
.
__listbox
.
add
(
widget
)
self
.
__listbox
.
add
(
widget
)
def
__on_size_allocate
(
self
,
widget
,
allocation
):
def
__on_size_allocate
(
self
,
widget
,
allocation
,
child_widget
):
"""
"""
Set child widget size
Set child widget size
@param widget as Gtk.Widget
@param widget as Gtk.Widget
@param allocation as Gtk.Allocation
@param allocation as Gtk.Allocation
@param child_widget as Gtk.Widget
"""
"""
if
allocation
.
width
<
Sizing
.
BIG
:
width
=
max
(
400
,
allocation
.
width
/
2
)
self
.
__top_box
.
set_orientation
(
Gtk
.
Orientation
.
VERTICAL
)
child_widget
.
set_size_request
(
width
,
-
1
)
self
.
__bottom_box
.
set_orientation
(
Gtk
.
Orientation
.
VERTICAL
)
else
:
self
.
__top_box
.
set_orientation
(
Gtk
.
Orientation
.
HORIZONTAL
)
self
.
__bottom_box
.
set_orientation
(
Gtk
.
Orientation
.
HORIZONTAL
)
width
=
max
(
Sizing
.
SMALL
-
100
,
allocation
.
width
/
2
)
self
.
__playlist_editor
.
set_size_request
(
width
,
-
1
)
lollypop/widgets_playlist_edit.py
deleted
100644 → 0
View file @
beb778c0
# 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
,
Pango
from
threading
import
Thread
from
gettext
import
gettext
as
_
from
lollypop.define
import
App
,
Type
from
lollypop.cellrenderer
import
CellRendererAlbum
from
lollypop.objects
import
Track
class
PlaylistEditWidget
(
Gtk
.
Bin
):
"""
Widget playlists editor
"""
def
__init__
(
self
,
playlist_id
):
"""
Init widget
@param playlist id as int
"""
Gtk
.
Bin
.
__init__
(
self
)
self
.
__playlist_id
=
playlist_id
builder
=
Gtk
.
Builder
()
builder
.
add_from_resource
(
"/org/gnome/Lollypop/PlaylistEditWidget.ui"
)
builder
.
connect_signals
(
self
)
self
.
__infobar
=
builder
.
get_object
(
"infobar"
)
self
.
__infobar_label
=
builder
.
get_object
(
"infobarlabel"
)
self
.
__view
=
builder
.
get_object
(
"view"
)
self
.
__model
=
Gtk
.
ListStore
(
int
,
str
,
str
,
int
)
self
.
__view
.
set_model
(
self
.
__model
)
# 3 COLUMNS NEEDED
renderer0
=
CellRendererAlbum
()
column0
=
Gtk
.
TreeViewColumn
(
"pixbuf1"
,
renderer0
,
album
=
0
)
renderer1
=
Gtk
.
CellRendererText
()
renderer1
.
set_property
(
"ellipsize-set"
,
True
)
renderer1
.
set_property
(
"ellipsize"
,
Pango
.
EllipsizeMode
.
END
)
column1
=
Gtk
.
TreeViewColumn
(
"text1"
,
renderer1
,
markup
=
1
)
column1
.
set_sizing
(
Gtk
.
TreeViewColumnSizing
.
FIXED
)
column1
.
set_expand
(
True
)
renderer2
=
Gtk
.
CellRendererPixbuf
()
column2
=
Gtk
.
TreeViewColumn
(
"delete"
,
renderer2
)
column2
.
add_attribute
(
renderer2
,
"icon-name"
,
2
)
column2
.
set_sizing
(
Gtk
.
TreeViewColumnSizing
.
FIXED
)
column2
.
set_property
(
"fixed_width"
,
50
)
self
.
__view
.
append_column
(
column0
)
self
.
__view
.
append_column
(
column1
)
self
.
__view
.
append_column
(
column2
)
self
.
add
(
builder
.
get_object
(
"widget"
))
def
populate
(
self
):
"""
populate view if needed
"""
if
len
(
self
.
__model
)
==
0
:
t
=
Thread
(
target
=
self
.
__append_tracks
)
t
.
daemon
=
True
t
.
start
()
#######################
# PROTECTED #
#######################
def
_on_response
(
self
,
infobar
,
response_id
):
"""
Hide infobar
@param widget as Gtk.Infobar
@param reponse id as int
"""
if
response_id
==
Gtk
.
ResponseType
.
CLOSE
:
self
.
__infobar
.
hide
()
self
.
__view
.
grab_focus
()
self
.
__view
.
get_selection
().
unselect_all
()
def
_on_row_activated
(
self
,
view
,
path
,
column
):
"""
Delete playlist
@param TreeView, TreePath, TreeViewColumn
"""
iterator
=
self
.
__model
.
get_iter
(
path
)
if
iterator
:
if
column
.
get_title
()
==
"delete"
:
self
.
__show_infobar
(
path
)
else
:
self
.
__infobar
.
hide
()
def
_on_selection_changed
(
self
,
selection
):
"""
On selection changed, show infobar
@param selection as Gtk.TreeSelection
"""
count
=
selection
.
count_selected_rows
()
if
count
>
0
:
self
.
__infobar_label
.
set_markup
(
_
(
"Remove ?"
))
self
.
__infobar
.
show
()
# GTK 3.20 https://bugzilla.gnome.org/show_bug.cgi?id=710888
self
.
__infobar
.
queue_resize
()
else
:
self
.
__infobar
.
hide
()
def
_on_delete_confirm
(
self
,
button
):
"""
Delete tracks after confirmation
@param button as Gtk.Button
"""
selection
=
self
.
__view
.
get_selection
()
selected
=
selection
.
get_selected_rows
()[
1
]
rows
=
[]
for
item
in
selected
:
rows
.
append
(
Gtk
.
TreeRowReference
.
new
(
self
.
__model
,
item
))
tracks
=
[]
for
row
in
rows
:
iterator
=
self
.
__model
.
get_iter
(
row
.
get_path
())
track
=
Track
(
self
.
__model
.
get_value
(
iterator
,
3
))
tracks
.
append
(
track
)
if
self
.
__playlist_id
==
Type
.
LOVED
and
App
().
lastfm
is
not
None
:
if
track
.
album
.
artist_id
==
Type
.
COMPILATIONS
:
artist_name
=
", "
.
join
(
track
.
artists
)
else
:
artist_name
=
", "
.
join
(
track
.
album
.
artists
)
t
=
Thread
(
target
=
App
().
lastfm
.
unlove
,
args
=
(
artist_name
,
track
.
name
))
t
.
daemon
=
True
t
.
start
()
self
.
__model
.
remove
(
iterator
)
App
().
playlists
.
remove_tracks
(
self
.
__playlist_id
,
tracks
)
self
.
__infobar
.
hide
()
self
.
__unselectall
()
#######################
# PRIVATE #
#######################
def
__unselectall
(
self
):
"""
Unselect all in view
"""
self
.
__view
.
get_selection
().
unselect_all
()
self
.
__view
.
grab_focus
()
def
__append_tracks
(
self
):
"""
Append tracks
"""
track_ids
=
App
().
playlists
.
get_track_ids
(
self
.
__playlist_id
)
GLib
.
idle_add
(
self
.
__append_track
,
track_ids
)
def
__append_track
(
self
,
track_ids
):
"""
Append track while tracks not empty
@param track_ids as [track_id as int]
"""
if
track_ids
:
track
=
Track
(
track_ids
.
pop
(
0
))
if
track
.
album
.
artist_ids
[
0
]
==
Type
.
COMPILATIONS
:
artists
=
", "
.
join
(
track
.
artists
)
else
:
artists
=
", "
.
join
(
track
.
album
.
artists
)
self
.
__model
.
append
([
track
.
album
.
id
,
"<b>%s</b>
\n
%s"
%
(
GLib
.
markup_escape_text
(
artists
),
GLib
.
markup_escape_text
(
track
.
name
)),
"user-trash-symbolic"
,
track
.
id
])
GLib
.
idle_add
(
self
.
__append_track
,
track_ids
)
run.sh
View file @
91fb588f
ninja
-C
build
install
>
/dev/null
ninja
-C
build
install
echo
"Running lollypop"
echo
"Running lollypop"
lollypop
-e
lollypop
-e
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