From 05d46567a4b426550cbebef8dc4bc082ec93c8bc Mon Sep 17 00:00:00 2001 From: Daniel Sheeler Date: Fri, 26 Jun 2020 18:50:55 -0500 Subject: [PATCH] Fix channel property update bugs --- channel.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/channel.py b/channel.py index 464c6e6..b163edf 100644 --- a/channel.py +++ b/channel.py @@ -342,8 +342,7 @@ class Channel(Gtk.VBox, SerializedObject): def set_color(self, color): self.color = color - set_background_color(self.label_name_event_box, self.channel.name + 'label', - self.color.to_string()) + set_background_color(self.label_name_event_box, self.channel.name.replace(" ", "") + 'label', self.color.to_string()) class InputChannel(Channel): post_fader_output_channel = None @@ -962,7 +961,7 @@ class OutputChannelPropertiesDialog(ChannelPropertiesDialog): self.channel.display_solo_buttons = self.display_solo_buttons.get_active() self.channel.set_color(self.color_chooser_button.get_rgba()) for inputchannel in self.app.channels: - inputchannel.update_control_group(self) + inputchannel.update_control_group(self.channel) @@ -1016,15 +1015,25 @@ class ControlGroup(Gtk.Alignment): self.hbox = hbox self.vbox.pack_start(hbox, True, True, button_padding) + css = b""" .control_group { + min-width: 0px; padding: 0px;} """ + + css_provider = Gtk.CssProvider() + css_provider.load_from_data(css) + context = Gtk.StyleContext() + screen = Gdk.Screen.get_default() + context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + self.label = Gtk.Label(output_channel.channel.name) - hbox.pack_start(self.label, False, False, button_padding) - mute_name = "%s_mute" % output_channel.channel.name + label_context = self.label.get_style_context() + label_context.add_class('control_group') + + self.hbox.pack_start(self.label, False, False, button_padding) mute = Gtk.ToggleButton() mute.set_label("M") mute.set_name("mute") mute.connect("toggled", self.on_mute_toggled) self.mute = mute - hbox.pack_start(mute, True, True, button_padding) solo = Gtk.ToggleButton() solo.set_name("solo") solo.set_label("S") @@ -1032,21 +1041,22 @@ class ControlGroup(Gtk.Alignment): self.solo = solo if self.output_channel.display_solo_buttons: - hbox.pack_start(solo, True, True, button_padding) + hbox.pack_end(solo, False, False, button_padding) + hbox.pack_end(mute, False, False, button_padding) def update(self): if self.output_channel.display_solo_buttons: if not self.solo in self.hbox.get_children(): - self.hbox.pack_start(self.solo, True, True, 0) + self.hbox.pack_end(self.solo, False, False, button_padding) + self.hbox.reorder_child(self.mute, -1) self.solo.show() else: if self.solo in self.hbox.get_children(): self.hbox.remove(self.solo) - set_background_color(self.vbox, self.output_channel.channel.name, - self.output_channel.color.to_string()) - self.label.set_text(self.output_channel.channel.name) + set_background_color(self.vbox, self.output_channel.channel.name.replace(" ", ""), self.output_channel.color.to_string()) + def on_mute_toggled(self, button): self.output_channel.channel.set_muted(self.input_channel.channel, button.get_active()) -- 2.39.2