generated from itdominator/Python-With-Gtk-Template
Bug fix for master sink, cleanup
This commit is contained in:
parent
572041a2a3
commit
c8d6a6b563
|
@ -26,6 +26,9 @@ class SinkInputList(Gtk.ScrolledWindow):
|
||||||
|
|
||||||
|
|
||||||
def _setup_styling(self):
|
def _setup_styling(self):
|
||||||
|
ctx = self.get_style_context()
|
||||||
|
ctx.add_class("sink-list-container")
|
||||||
|
|
||||||
self.set_vexpand(True)
|
self.set_vexpand(True)
|
||||||
self.set_overlay_scrolling(False)
|
self.set_overlay_scrolling(False)
|
||||||
self.set_margin_top(20)
|
self.set_margin_top(20)
|
||||||
|
@ -40,8 +43,8 @@ class SinkInputList(Gtk.ScrolledWindow):
|
||||||
event_system.subscribe("handle_cng_sync_input", self._handle_cng_sync_input)
|
event_system.subscribe("handle_cng_sync_input", self._handle_cng_sync_input)
|
||||||
|
|
||||||
def _load_widgets(self):
|
def _load_widgets(self):
|
||||||
viewport = Gtk.Viewport()
|
viewport = Gtk.Viewport()
|
||||||
box = Gtk.Box()
|
box = Gtk.Box()
|
||||||
self._box = box
|
self._box = box
|
||||||
self._vadjust = self.get_vadjustment()
|
self._vadjust = self.get_vadjustment()
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,13 @@ class AudioSink(Gtk.Box):
|
||||||
def __init__(self, pulse, sink):
|
def __init__(self, pulse, sink):
|
||||||
super(AudioSink, self).__init__()
|
super(AudioSink, self).__init__()
|
||||||
|
|
||||||
self._scale = None
|
self._scale = None
|
||||||
self._mute_btn = None
|
self._mute_btn = None
|
||||||
self.pulse = pulse
|
self.pulse = pulse
|
||||||
self.sink = sink
|
self.sink = sink
|
||||||
self.min_range = 0
|
self.min_range = 0
|
||||||
self.max_range = 150
|
self.max_range = 150
|
||||||
self.muted = False
|
self.muted = False
|
||||||
self.block_update = False
|
self.block_update = False
|
||||||
|
|
||||||
self._setup_styling()
|
self._setup_styling()
|
||||||
|
@ -35,17 +35,19 @@ class AudioSink(Gtk.Box):
|
||||||
self.set_orientation(Gtk.Orientation.VERTICAL)
|
self.set_orientation(Gtk.Orientation.VERTICAL)
|
||||||
self.set_margin_top(10)
|
self.set_margin_top(10)
|
||||||
self.set_margin_bottom(10)
|
self.set_margin_bottom(10)
|
||||||
|
self.set_margin_left(10)
|
||||||
|
self.set_margin_right(10)
|
||||||
|
|
||||||
def _setup_signals(self):
|
def _setup_signals(self):
|
||||||
...
|
...
|
||||||
|
|
||||||
def _load_widgets(self):
|
def _load_widgets(self):
|
||||||
current_lvl = self.sink.volume.values[0] * 100
|
current_lvl = self.sink.volume.values[0] * 100
|
||||||
box = Gtk.Box()
|
box = Gtk.Box()
|
||||||
label = Gtk.Label()
|
label = Gtk.Label()
|
||||||
scale = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, self.min_range, self.max_range, 1)
|
scale = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, self.min_range, self.max_range, 1)
|
||||||
mute_btn = Gtk.Button()
|
mute_btn = Gtk.Button()
|
||||||
self.muted = False if self.sink.mute == 0 else True
|
self.muted = False if self.sink.mute == 0 else True
|
||||||
|
|
||||||
# logger.debug(f"{self.sink.proplist}")
|
# logger.debug(f"{self.sink.proplist}")
|
||||||
try:
|
try:
|
||||||
|
@ -55,7 +57,7 @@ class AudioSink(Gtk.Box):
|
||||||
|
|
||||||
label.set_text(name)
|
label.set_text(name)
|
||||||
label.set_xalign(0.0)
|
label.set_xalign(0.0)
|
||||||
scale.add_mark(0.0, Gtk.PositionType.BOTTOM, "Silence")
|
scale.add_mark(0.0, Gtk.PositionType.BOTTOM, "Silence")
|
||||||
scale.add_mark(50.0, Gtk.PositionType.BOTTOM, "50%")
|
scale.add_mark(50.0, Gtk.PositionType.BOTTOM, "50%")
|
||||||
scale.add_mark(100.0, Gtk.PositionType.BOTTOM, "100%")
|
scale.add_mark(100.0, Gtk.PositionType.BOTTOM, "100%")
|
||||||
scale.set_value(current_lvl)
|
scale.set_value(current_lvl)
|
||||||
|
@ -77,10 +79,8 @@ class AudioSink(Gtk.Box):
|
||||||
box.add(mute_btn)
|
box.add(mute_btn)
|
||||||
self.add(box)
|
self.add(box)
|
||||||
|
|
||||||
|
|
||||||
def set_volume(self, range):
|
def set_volume(self, range):
|
||||||
if self.block_update:
|
if self.block_update: return
|
||||||
return
|
|
||||||
|
|
||||||
value = range.get_value() / 100
|
value = range.get_value() / 100
|
||||||
sink_vol_info = self.sink.volume
|
sink_vol_info = self.sink.volume
|
||||||
|
@ -90,7 +90,10 @@ class AudioSink(Gtk.Box):
|
||||||
new_level.append(value)
|
new_level.append(value)
|
||||||
|
|
||||||
sink_vol_info.values = new_level
|
sink_vol_info.values = new_level
|
||||||
self.pulse.sink_input_volume_set(self.sink.index, sink_vol_info)
|
try:
|
||||||
|
self.pulse.sink_input_volume_set(self.sink.index, sink_vol_info)
|
||||||
|
except Exception as e:
|
||||||
|
self.pulse.sink_volume_set(self.sink.index, sink_vol_info)
|
||||||
|
|
||||||
def toggle_mute(self, widget = None, eve = None):
|
def toggle_mute(self, widget = None, eve = None):
|
||||||
self.muted = not self.muted
|
self.muted = not self.muted
|
||||||
|
@ -98,10 +101,7 @@ class AudioSink(Gtk.Box):
|
||||||
self.pulse.sink_input_mute(self.sink.index, mute=self.muted)
|
self.pulse.sink_input_mute(self.sink.index, mute=self.muted)
|
||||||
|
|
||||||
def set_mute_image(self, mute_btn):
|
def set_mute_image(self, mute_btn):
|
||||||
if self.muted:
|
mute_btn.set_image( Gtk.Image.new_from_icon_name( "gtk-disconnect" if self.muted else "gtk-connect" , 3) )
|
||||||
mute_btn.set_image( Gtk.Image.new_from_icon_name("gtk-disconnect", 3) )
|
|
||||||
else:
|
|
||||||
mute_btn.set_image( Gtk.Image.new_from_icon_name("gtk-connect", 3) )
|
|
||||||
|
|
||||||
def do_update(self):
|
def do_update(self):
|
||||||
self.block_update = True
|
self.block_update = True
|
||||||
|
|
|
@ -1,86 +1,13 @@
|
||||||
/* Set fm to have transparent window */
|
|
||||||
box,
|
|
||||||
iconview,
|
|
||||||
notebook,
|
|
||||||
paned,
|
|
||||||
stack,
|
|
||||||
scrolledwindow,
|
|
||||||
treeview.view,
|
|
||||||
.content-view,
|
|
||||||
.view {
|
|
||||||
background: rgba(19, 21, 25, 0.14);
|
|
||||||
color: rgba(255, 255, 255, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
notebook > header > tabs > tab:checked {
|
|
||||||
/* Neon Blue 00e8ff */
|
|
||||||
background-color: rgba(0, 232, 255, 0.2);
|
|
||||||
/* Dark Bergundy */
|
|
||||||
/* background-color: rgba(116, 0, 0, 0.25); */
|
|
||||||
|
|
||||||
color: rgba(255, 255, 255, 0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
#message_view {
|
|
||||||
font: 16px "Monospace";
|
|
||||||
}
|
|
||||||
|
|
||||||
.view:selected,
|
|
||||||
.view:selected:hover {
|
|
||||||
box-shadow: inset 0 0 0 9999px rgba(21, 158, 167, 0.34);
|
|
||||||
color: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert-border {
|
|
||||||
border: 2px solid rgba(116, 0, 0, 0.64);
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-border {
|
|
||||||
border: 2px solid rgba(136, 204, 39, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.notebook-selected-focus {
|
|
||||||
/* Neon Blue 00e8ff border */
|
|
||||||
border: 2px solid rgba(0, 232, 255, 0.34);
|
|
||||||
/* Dark Bergundy */
|
|
||||||
/* border: 2px solid rgba(116, 0, 0, 0.64); */
|
|
||||||
}
|
|
||||||
|
|
||||||
.notebook-unselected-focus {
|
|
||||||
/* Neon Blue 00e8ff border */
|
|
||||||
/* border: 2px solid rgba(0, 232, 255, 0.25); */
|
|
||||||
/* Dark Bergundy */
|
|
||||||
/* border: 2px solid rgba(116, 0, 0, 0.64); */
|
|
||||||
/* Snow White */
|
|
||||||
border: 2px solid rgba(255, 255, 255, 0.24);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* * {
|
/* * {
|
||||||
background: rgba(0, 0, 0, 0.14);
|
background: rgba(0, 0, 0, 0.14);
|
||||||
color: rgba(255, 255, 255, 1);
|
color: rgba(255, 255, 255, 1);
|
||||||
} */
|
} */
|
||||||
|
|
||||||
/* * selection {
|
.sink-list-container {
|
||||||
background-color: rgba(116, 0, 0, 0.65);
|
/* Neon Blue 00e8ff border */
|
||||||
color: rgba(255, 255, 255, 0.5);
|
/* border: 2px solid rgba(0, 232, 255, 0.25); */
|
||||||
} */
|
/* Dark Bergundy */
|
||||||
|
/* border: 2px solid rgba(116, 0, 0, 0.64); */
|
||||||
/* Rubberband coloring */
|
/* Snow White */
|
||||||
/* .rubberband,
|
border: 2px solid rgba(255, 255, 255, 0.34);
|
||||||
rubberband,
|
|
||||||
flowbox rubberband,
|
|
||||||
treeview.view rubberband,
|
|
||||||
.content-view rubberband,
|
|
||||||
.content-view .rubberband,
|
|
||||||
XfdesktopIconView.view .rubberband {
|
|
||||||
border: 1px solid #6c6c6c;
|
|
||||||
background-color: rgba(21, 158, 167, 0.57);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XfdesktopIconView.view:active {
|
|
||||||
background-color: rgba(172, 102, 21, 1);
|
|
||||||
} */
|
|
||||||
|
|
Loading…
Reference in New Issue