Made the UI better for describing what's happening in settings
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from typing import List, Tuple
|
from typing import List, Tuple, Optional
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
@@ -14,6 +14,7 @@ class EditFormDialog(Gtk.Dialog):
|
|||||||
text_fields: List[Tuple[str, str, bool]] = []
|
text_fields: List[Tuple[str, str, bool]] = []
|
||||||
boolean_fields: List[Tuple[str, str]] = []
|
boolean_fields: List[Tuple[str, str]] = []
|
||||||
numeric_fields: List[NumericFieldDescription] = []
|
numeric_fields: List[NumericFieldDescription] = []
|
||||||
|
extra_label: Optional[str] = None
|
||||||
extra_buttons: List[Gtk.Button] = []
|
extra_buttons: List[Gtk.Button] = []
|
||||||
|
|
||||||
def get_object_name(self, obj):
|
def get_object_name(self, obj):
|
||||||
@@ -104,6 +105,12 @@ class EditFormDialog(Gtk.Dialog):
|
|||||||
content_grid.attach(spin_button, 1, i, 1, 1)
|
content_grid.attach(spin_button, 1, i, 1, 1)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
if self.extra_label:
|
||||||
|
label_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
|
label_box.add(self.extra_label)
|
||||||
|
content_grid.attach(label_box, 0, i, 2, 1)
|
||||||
|
i += 1
|
||||||
|
|
||||||
button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
for button, response_id in self.extra_buttons:
|
for button, response_id in self.extra_buttons:
|
||||||
if response_id is None:
|
if response_id is None:
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk
|
||||||
|
|
||||||
from .common.edit_form_dialog import EditFormDialog
|
from .common.edit_form_dialog import EditFormDialog
|
||||||
|
|
||||||
@@ -9,8 +10,7 @@ class SettingsDialog(EditFormDialog):
|
|||||||
initial_size = (450, 250)
|
initial_size = (450, 250)
|
||||||
text_fields = [
|
text_fields = [
|
||||||
(
|
(
|
||||||
'Port Number (for streaming to Chromecasts on the local network, '
|
'Port Number (for streaming to Chromecasts on the LAN) *',
|
||||||
'will take effect on restart)',
|
|
||||||
'port_number',
|
'port_number',
|
||||||
False,
|
False,
|
||||||
),
|
),
|
||||||
@@ -23,7 +23,7 @@ class SettingsDialog(EditFormDialog):
|
|||||||
'song_play_notification',
|
'song_play_notification',
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'Serve locally cached files over the LAN to Chromecast devices.',
|
'Serve locally cached files over the LAN to Chromecast devices. *',
|
||||||
'serve_over_lan',
|
'serve_over_lan',
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@@ -41,6 +41,11 @@ class SettingsDialog(EditFormDialog):
|
|||||||
5,
|
5,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
extra_label = Gtk.Label(
|
||||||
|
label='<i>* Will be appplied after restarting Sublime Music</i>',
|
||||||
|
justify=Gtk.Justification.LEFT,
|
||||||
|
use_markup=True,
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
Reference in New Issue
Block a user