M melon/playlist/__init__.py => melon/playlist/__init__.py +2 -2
@@ 272,7 272,7 @@ class LocalPlaylistScreen(Adw.NavigationPage):
self.edit_diag.toolbar_view.add_bottom_bar(bottom_bar)
self.edit_diag.set_widget(page)
- self.edit_diag.show()
+ self.edit_diag.show(self)
def save_details(self):
self.playlist.title = self.input_title.get_text()
@@ 323,7 323,7 @@ class LocalPlaylistScreen(Adw.NavigationPage):
bottom_bar.append(btn_confirm)
self.dlt_diag.toolbar_view.add_bottom_bar(bottom_bar)
- self.dlt_diag.show()
+ self.dlt_diag.show(self)
def delete(self):
# make sure that this widget does not receive an update notification
M melon/playlist/pick.py => melon/playlist/pick.py +1 -1
@@ 25,7 25,7 @@ class PlaylistPickerDialog(SimpleDialog):
def open_creator(self, video):
diag = PlaylistCreatorDialog(video)
self.hide()
- diag.show()
+ diag.show(self)
def display(self, video):
page = Adw.PreferencesPage()
M melon/widgets/preferencerow.py => melon/widgets/preferencerow.py +2 -3
@@ 207,7 207,7 @@ class MultiRow(Adw.PreferencesRow):
bottom_bar.append(btn_confirm)
diag.toolbar_view.add_bottom_bar(bottom_bar)
- diag.show()
+ diag.show(self)
def confirm_delete(self, w, item: str, counter: int):
diag = SimpleDialog()
@@ 249,8 249,7 @@ class MultiRow(Adw.PreferencesRow):
bottom_bar.append(btn_cancel)
bottom_bar.append(btn_confirm)
diag.toolbar_view.add_bottom_bar(bottom_bar)
- diag.show()
- pass
+ diag.show(self)
def move_up(self, _, item: str, counter: int):
val = self.values.pop(counter)
M melon/widgets/simpledialog.py => melon/widgets/simpledialog.py +6 -13
@@ 5,29 5,22 @@ gi.require_version("Adw", "1")
from gi.repository import Gtk, Adw, Gio, GLib
-class SimpleDialog(Adw.Window):
+class SimpleDialog(Adw.Dialog):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.toolbar_view = Adw.ToolbarView()
self.header_bar = Adw.HeaderBar()
- self.title = Adw.WindowTitle()
- self.header_bar.set_title_widget(self.title)
self.toolbar_view.add_top_bar(self.header_bar)
- self.set_content(self.toolbar_view)
- # this is a dialog and thus the main window should not be usable
- # when the dialog is opened
- self.set_modal(True)
-
- def set_title(self, text):
- self.title.set_title(text)
+ self.set_child(self.toolbar_view)
+ self.set_follows_content_size(True)
def set_widget(self, child, padding=12):
self.toolbar_view.set_content(child)
child.set_margin_end(padding)
child.set_margin_start(padding)
- def show(self):
- self.set_visible(True)
+ def show(self, parent=None):
+ self.present(parent)
def hide(self):
- self.set_visible(False)
+ self.close()
M melon/window.py => melon/window.py +2 -3
@@ 17,7 17,6 @@ from melon.settings import SettingsScreen
from melon.importer import ImporterScreen
from melon.player import PlayerScreen
from melon.player.playlist import PlaylistPlayerScreen
-from melon.widgets.simpledialog import SimpleDialog
from melon.playlist import LocalPlaylistScreen
from melon.playlist.pick import PlaylistPickerDialog
from melon.playlist.create import PlaylistCreatorDialog
@@ 58,7 57,7 @@ class MainWindow(Adw.ApplicationWindow):
servers = get_servers_list()
video = (server_id, video_id)
diag = PlaylistPickerDialog(video)
- diag.show()
+ diag.show(self)
def open_playlist_creator(self, action, prefs):
act = action.get_name()
@@ 71,7 70,7 @@ class MainWindow(Adw.ApplicationWindow):
video = (server_id, video_id)
# create basic dialog
diag = PlaylistCreatorDialog(video)
- diag.show()
+ diag.show(self)
def open_local_playlist_viewer(self, action, prefs):
self.view.push(LocalPlaylistScreen(prefs.unpack()))