From patchwork Wed Aug 8 15:56:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DD7E139A for ; Sun, 12 Aug 2018 06:03:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61AED284C7 for ; Sun, 12 Aug 2018 06:03:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 554772962E; Sun, 12 Aug 2018 06:03:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D530284C7 for ; Sun, 12 Aug 2018 06:03:49 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E5E21267692; Sun, 12 Aug 2018 08:03:44 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7A9612678C4; Wed, 8 Aug 2018 17:56:45 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id 92B102673A0; Wed, 8 Aug 2018 17:56:42 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id f9271f3c; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:29 +0200 Message-Id: <20180808155637.5592-2-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH - hwmixvolume 1/9] hwmixvolume: replace PyGTK with gobject-introspection X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This doesn’t work yet, we require Gtk 3.0 rather than 2.0 and the API changed quite a lot. Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/hwmixvolume b/hwmixvolume/hwmixvolume index ef80bc8..28ce776 100755 --- a/hwmixvolume/hwmixvolume +++ b/hwmixvolume/hwmixvolume @@ -15,7 +15,10 @@ # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -import gobject, gtk +import gi +gi.require_version('GLib', '2.0') +gi.require_version('Gtk', '3.0') +from gi.repository import GLib, Gtk from pyalsa import alsacard, alsahcontrol INTF_PCM = alsahcontrol.interface_id['PCM'] @@ -57,16 +60,16 @@ class Stream: value = alsahcontrol.Value(self.element) value.read() values = value.get_tuple(TYPE_INTEGER, info.count) - self.label = gtk.Label(self.get_label(info)) + self.label = Gtk.Label(self.get_label(info)) self.label.set_single_line_mode(True) self.parent.scales_vbox.pack_start(self.label, expand=False) for i in range(info.count): - adj = gtk.Adjustment(value=values[i], + adj = Gtk.Adjustment(value=values[i], lower=info.min, upper=info.max, step_incr=1, page_incr=(info.max-info.min+1)/8) adj.connect('value-changed', self.update_ctl_from_scale, i) - scale = gtk.HScale(adj) + scale = Gtk.HScale(adj) scale.set_draw_value(False) self.parent.scales_vbox.pack_start(scale, expand=False) self.scales.append(scale) @@ -157,7 +160,7 @@ class Stream: f.close() return cmdline.replace('\x00', ' ').strip() -class MixerWindow(gtk.Window): +class MixerWindow(Gtk.Window): card_numbers = alsacard.card_list() current_card = -1 hcontrol = None @@ -167,21 +170,21 @@ class MixerWindow(gtk.Window): hctl_sources = [] def __init__(self): - gtk.Window.__init__(self) - self.connect('destroy', lambda w: gtk.main_quit()) + Gtk.Window.__init__(self) + self.connect('destroy', lambda w: Gtk.main_quit()) self.set_title("Hardware Mixer Volumes") - vbox = gtk.VBox() + vbox = Gtk.VBox() self.add(vbox) - hbox = gtk.HBox() + hbox = Gtk.HBox() vbox.pack_start(hbox, expand=False) - label = gtk.Label("_Sound Card: ") + label = Gtk.Label("_Sound Card: ") label.set_use_underline(True) hbox.pack_start(label, expand=False) - combo = gtk.combo_box_new_text() + combo = Gtk.combo_box_new_text() for i in self.card_numbers: str = "%d: %s" % (i, alsacard.card_get_name(i)) combo.append_text(str) @@ -191,23 +194,23 @@ class MixerWindow(gtk.Window): hbox.pack_start(combo) label.set_mnemonic_widget(combo) - self.lock_check = gtk.CheckButton(label="_Lock Channels") + self.lock_check = Gtk.CheckButton(label="_Lock Channels") self.lock_check.set_active(True) vbox.pack_start(self.lock_check, expand=False) - scrollwin = gtk.ScrolledWindow() - scrollwin.set_policy(hscrollbar_policy=gtk.POLICY_NEVER, vscrollbar_policy=gtk.POLICY_AUTOMATIC) - scrollwin.set_shadow_type(gtk.SHADOW_NONE) + scrollwin = Gtk.ScrolledWindow() + scrollwin.set_policy(hscrollbar_policy=Gtk.POLICY_NEVER, vscrollbar_policy=Gtk.POLICY_AUTOMATIC) + scrollwin.set_shadow_type(Gtk.SHADOW_NONE) vbox.pack_start(scrollwin) - self.scales_vbox = gtk.VBox() + self.scales_vbox = Gtk.VBox() scrollwin.add_with_viewport(self.scales_vbox) - label = gtk.Label() + label = Gtk.Label() label.set_single_line_mode(True) line_height = label.size_request()[1] label.destroy() - scale = gtk.HScale() + scale = Gtk.HScale() scale.set_draw_value(False) line_height += scale.size_request()[1] scale.destroy() @@ -223,7 +226,7 @@ class MixerWindow(gtk.Window): def change_card(self, cardnum): for s in self.hctl_sources: - gobject.source_remove(s) + GLib.source_remove(s) self.hctl_sources = [] self.hcontrol = self.open_hcontrol_for_card(cardnum) @@ -249,7 +252,7 @@ class MixerWindow(gtk.Window): self.streams.append(stream) for fd,condition in self.hcontrol.poll_fds: - self.hctl_sources.append(gobject.io_add_watch(fd, condition, self.hctl_io_callback)) + self.hctl_sources.append(GLib.io_add_watch(fd, condition, self.hctl_io_callback)) self.update_msg_label() @@ -267,7 +270,7 @@ class MixerWindow(gtk.Window): else: msg = "This card does not have stream controls." if not has_msg: - self.msg_label = gtk.Label(msg) + self.msg_label = Gtk.Label(msg) self.scales_vbox.pack_start(self.msg_label) self.scales_vbox.show_all() elif self.msg_label.get_text() != msg: @@ -280,9 +283,9 @@ class MixerWindow(gtk.Window): mode=alsahcontrol.open_mode['NONBLOCK']) except: # TODO: alsa error msg - dlg = gtk.MessageDialog(self, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, + dlg = Gtk.MessageDialog(self, + Gtk.DIALOG_MODAL | Gtk.DIALOG_DESTROY_WITH_PARENT, + Gtk.MESSAGE_ERROR, Gtk.BUTTONS_OK, "Cannot open sound card control device.") dlg.run() dlg.destroy() @@ -304,7 +307,7 @@ class MixerWindow(gtk.Window): def main(): MixerWindow() - gtk.main() + Gtk.main() main() From patchwork Wed Aug 8 15:56:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E65F8157B for ; Sun, 12 Aug 2018 06:03:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5621284C7 for ; Sun, 12 Aug 2018 06:03:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C87E32962E; Sun, 12 Aug 2018 06:03:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B126284C7 for ; Sun, 12 Aug 2018 06:03:56 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9DDD82676C7; Sun, 12 Aug 2018 08:03:49 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8E22D2678DA; Wed, 8 Aug 2018 17:56:47 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id 9AF6D26786A; Wed, 8 Aug 2018 17:56:44 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id 80018c4e; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:30 +0200 Message-Id: <20180808155637.5592-3-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] =?utf-8?q?=5BPATCH_-_hwmixvolume_2/9=5D_hwmixvolume=3A?= =?utf-8?q?_switch_to_GTK+=C2=A03=2E0?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/hwmixvolume b/hwmixvolume/hwmixvolume index 28ce776..039ca17 100755 --- a/hwmixvolume/hwmixvolume +++ b/hwmixvolume/hwmixvolume @@ -62,7 +62,7 @@ class Stream: values = value.get_tuple(TYPE_INTEGER, info.count) self.label = Gtk.Label(self.get_label(info)) self.label.set_single_line_mode(True) - self.parent.scales_vbox.pack_start(self.label, expand=False) + self.parent.scales_vbox.add(self.label) for i in range(info.count): adj = Gtk.Adjustment(value=values[i], lower=info.min, upper=info.max, @@ -71,7 +71,7 @@ class Stream: adj.connect('value-changed', self.update_ctl_from_scale, i) scale = Gtk.HScale(adj) scale.set_draw_value(False) - self.parent.scales_vbox.pack_start(scale, expand=False) + self.parent.scales_vbox.add(scale) self.scales.append(scale) self.adjustments.append(adj) self.parent.scales_vbox.show_all() @@ -174,45 +174,48 @@ class MixerWindow(Gtk.Window): self.connect('destroy', lambda w: Gtk.main_quit()) self.set_title("Hardware Mixer Volumes") - vbox = Gtk.VBox() + vbox = Gtk.Grid() + vbox.set_orientation(Gtk.Orientation.VERTICAL) self.add(vbox) - hbox = Gtk.HBox() - vbox.pack_start(hbox, expand=False) + hbox = Gtk.Grid() + vbox.add(hbox) - label = Gtk.Label("_Sound Card: ") - label.set_use_underline(True) - hbox.pack_start(label, expand=False) + label = Gtk.Label.new_with_mnemonic("_Sound Card: ") + hbox.add(label) - combo = Gtk.combo_box_new_text() + combo = Gtk.ComboBoxText() + combo.set_hexpand(True) for i in self.card_numbers: str = "%d: %s" % (i, alsacard.card_get_name(i)) combo.append_text(str) if len(self.card_numbers) > 0: combo.set_active(0) combo.connect('changed', lambda c: self.change_card(self.card_numbers[combo.get_active()])) - hbox.pack_start(combo) + hbox.add(combo) label.set_mnemonic_widget(combo) - self.lock_check = Gtk.CheckButton(label="_Lock Channels") + self.lock_check = Gtk.CheckButton.new_with_mnemonic(label="_Lock Channels") self.lock_check.set_active(True) - vbox.pack_start(self.lock_check, expand=False) + vbox.add(self.lock_check) scrollwin = Gtk.ScrolledWindow() - scrollwin.set_policy(hscrollbar_policy=Gtk.POLICY_NEVER, vscrollbar_policy=Gtk.POLICY_AUTOMATIC) - scrollwin.set_shadow_type(Gtk.SHADOW_NONE) - vbox.pack_start(scrollwin) + scrollwin.set_policy(hscrollbar_policy=Gtk.PolicyType.NEVER, vscrollbar_policy=Gtk.PolicyType.AUTOMATIC) + scrollwin.set_shadow_type(Gtk.ShadowType.NONE) + scrollwin.set_vexpand(True) + vbox.add(scrollwin) - self.scales_vbox = Gtk.VBox() + self.scales_vbox = Gtk.Grid() + self.scales_vbox.set_orientation(Gtk.Orientation.VERTICAL) scrollwin.add_with_viewport(self.scales_vbox) label = Gtk.Label() label.set_single_line_mode(True) - line_height = label.size_request()[1] + line_height = label.size_request().height label.destroy() scale = Gtk.HScale() scale.set_draw_value(False) - line_height += scale.size_request()[1] + line_height += scale.size_request().height scale.destroy() # always have space for at least four sliders scrollwin.set_size_request(width=-1, height=line_height*4+4) @@ -252,7 +255,7 @@ class MixerWindow(Gtk.Window): self.streams.append(stream) for fd,condition in self.hcontrol.poll_fds: - self.hctl_sources.append(GLib.io_add_watch(fd, condition, self.hctl_io_callback)) + self.hctl_sources.append(GLib.io_add_watch(fd, 0, GLib.IOCondition(condition), self.hctl_io_callback)) self.update_msg_label() @@ -271,7 +274,8 @@ class MixerWindow(Gtk.Window): msg = "This card does not have stream controls." if not has_msg: self.msg_label = Gtk.Label(msg) - self.scales_vbox.pack_start(self.msg_label) + self.msg_label.set_vexpand(True) + self.scales_vbox.add(self.msg_label) self.scales_vbox.show_all() elif self.msg_label.get_text() != msg: self.msg_label.set_text(msg) @@ -284,8 +288,8 @@ class MixerWindow(Gtk.Window): except: # TODO: alsa error msg dlg = Gtk.MessageDialog(self, - Gtk.DIALOG_MODAL | Gtk.DIALOG_DESTROY_WITH_PARENT, - Gtk.MESSAGE_ERROR, Gtk.BUTTONS_OK, + Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, + Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, "Cannot open sound card control device.") dlg.run() dlg.destroy() From patchwork Wed Aug 8 15:56:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7A2A157B for ; Sun, 12 Aug 2018 06:04:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A50A1284C7 for ; Sun, 12 Aug 2018 06:04:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 990032962E; Sun, 12 Aug 2018 06:04:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 282BE284C7 for ; Sun, 12 Aug 2018 06:04:06 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E9F0A2676E0; Sun, 12 Aug 2018 08:03:50 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6B1E92678E1; Wed, 8 Aug 2018 17:56:48 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id C53052678C4; Wed, 8 Aug 2018 17:56:44 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id 4a2b0182; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:31 +0200 Message-Id: <20180808155637.5592-4-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH - hwmixvolume 3/9] hwmixvolume: use four spaces instead of one tab for indent X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/hwmixvolume b/hwmixvolume/hwmixvolume index 039ca17..267228c 100755 --- a/hwmixvolume/hwmixvolume +++ b/hwmixvolume/hwmixvolume @@ -29,289 +29,289 @@ EVENT_INFO = alsahcontrol.event_mask['INFO'] EVENT_REMOVE = alsahcontrol.event_mask_remove class Stream: - def __init__(self, element, parent): - self.element = element - self.element.set_callback(self) - self.parent = parent - self.label = None - self.scales = [] - self.adjustments = [] - self.callback(self.element, EVENT_INFO) - - def destroy(self): - self.deactivate() - - def callback(self, e, mask): - if mask == EVENT_REMOVE: - self.deactivate() - elif (mask & EVENT_INFO) != 0: - info = alsahcontrol.Info(self.element) - if info.is_inactive: - self.deactivate() - else: - self.activate() - elif (mask & EVENT_VALUE) != 0: - self.update_scales_from_ctl() - - def activate(self): - if self.label: - return - info = alsahcontrol.Info(self.element) - value = alsahcontrol.Value(self.element) - value.read() - values = value.get_tuple(TYPE_INTEGER, info.count) - self.label = Gtk.Label(self.get_label(info)) - self.label.set_single_line_mode(True) - self.parent.scales_vbox.add(self.label) - for i in range(info.count): - adj = Gtk.Adjustment(value=values[i], - lower=info.min, upper=info.max, - step_incr=1, - page_incr=(info.max-info.min+1)/8) - adj.connect('value-changed', self.update_ctl_from_scale, i) - scale = Gtk.HScale(adj) - scale.set_draw_value(False) - self.parent.scales_vbox.add(scale) - self.scales.append(scale) - self.adjustments.append(adj) - self.parent.scales_vbox.show_all() - self.parent.update_msg_label() - - def deactivate(self): - if not self.label: - return - self.label.destroy() - for s in self.scales: - s.destroy() - self.label = None - self.scales = [] - self.adjustments = [] - self.parent.update_msg_label() - - def update_scales_from_ctl(self): - if not self.label: - return - count = len(self.adjustments) - value = alsahcontrol.Value(self.element) - value.read() - values = value.get_tuple(TYPE_INTEGER, count) - for i in range(count): - self.adjustments[i].set_value(values[i]) - - def update_ctl_from_scale(self, adj, index): - scale_value = adj.get_value() - value_to_set = int(round(adj.get_value())) - count = len(self.adjustments) - value = alsahcontrol.Value(self.element) - if self.parent.lock_check.get_active(): - values = [value_to_set for i in range(count)] - else: - value.read() - values = value.get_array(TYPE_INTEGER, count) - values[index] = value_to_set - value.set_array(TYPE_INTEGER, values) - value.write() - if value_to_set != scale_value: - adj.set_value(value_to_set) - - def get_label(self, info): - pid = self.get_pid(info) - if pid: - cmdline = self.get_pid_cmdline(pid) - if cmdline: - return cmdline - else: - return "PID %d" % pid - else: - name = info.name - if name[-7:] == " Volume": - name = name[:-7] - if name[-9:] == " Playback": - name = name[:-9] - return name - - def get_pid(self, info): - card = self.parent.current_card - device = info.device - subdevice = info.subdevice - if subdevice == 0: - subdevice = info.index - filename = "/proc/asound/card%d/pcm%dp/sub%d/status" % (card, device, subdevice) - try: - f = open(filename, "r") - except IOError: - return None - try: - for line in f.readlines(): - if line[:9] == "owner_pid": - return int(line.split(':')[1].strip()) - finally: - f.close() - return None - - def get_pid_cmdline(self, pid): - try: - f = open("/proc/%d/cmdline" % pid, "r") - except IOError: - return None - try: - cmdline = f.read() - finally: - f.close() - return cmdline.replace('\x00', ' ').strip() + def __init__(self, element, parent): + self.element = element + self.element.set_callback(self) + self.parent = parent + self.label = None + self.scales = [] + self.adjustments = [] + self.callback(self.element, EVENT_INFO) + + def destroy(self): + self.deactivate() + + def callback(self, e, mask): + if mask == EVENT_REMOVE: + self.deactivate() + elif (mask & EVENT_INFO) != 0: + info = alsahcontrol.Info(self.element) + if info.is_inactive: + self.deactivate() + else: + self.activate() + elif (mask & EVENT_VALUE) != 0: + self.update_scales_from_ctl() + + def activate(self): + if self.label: + return + info = alsahcontrol.Info(self.element) + value = alsahcontrol.Value(self.element) + value.read() + values = value.get_tuple(TYPE_INTEGER, info.count) + self.label = Gtk.Label(self.get_label(info)) + self.label.set_single_line_mode(True) + self.parent.scales_vbox.add(self.label) + for i in range(info.count): + adj = Gtk.Adjustment(value=values[i], + lower=info.min, upper=info.max, + step_incr=1, + page_incr=(info.max-info.min+1)/8) + adj.connect('value-changed', self.update_ctl_from_scale, i) + scale = Gtk.HScale(adj) + scale.set_draw_value(False) + self.parent.scales_vbox.add(scale) + self.scales.append(scale) + self.adjustments.append(adj) + self.parent.scales_vbox.show_all() + self.parent.update_msg_label() + + def deactivate(self): + if not self.label: + return + self.label.destroy() + for s in self.scales: + s.destroy() + self.label = None + self.scales = [] + self.adjustments = [] + self.parent.update_msg_label() + + def update_scales_from_ctl(self): + if not self.label: + return + count = len(self.adjustments) + value = alsahcontrol.Value(self.element) + value.read() + values = value.get_tuple(TYPE_INTEGER, count) + for i in range(count): + self.adjustments[i].set_value(values[i]) + + def update_ctl_from_scale(self, adj, index): + scale_value = adj.get_value() + value_to_set = int(round(adj.get_value())) + count = len(self.adjustments) + value = alsahcontrol.Value(self.element) + if self.parent.lock_check.get_active(): + values = [value_to_set for i in range(count)] + else: + value.read() + values = value.get_array(TYPE_INTEGER, count) + values[index] = value_to_set + value.set_array(TYPE_INTEGER, values) + value.write() + if value_to_set != scale_value: + adj.set_value(value_to_set) + + def get_label(self, info): + pid = self.get_pid(info) + if pid: + cmdline = self.get_pid_cmdline(pid) + if cmdline: + return cmdline + else: + return "PID %d" % pid + else: + name = info.name + if name[-7:] == " Volume": + name = name[:-7] + if name[-9:] == " Playback": + name = name[:-9] + return name + + def get_pid(self, info): + card = self.parent.current_card + device = info.device + subdevice = info.subdevice + if subdevice == 0: + subdevice = info.index + filename = "/proc/asound/card%d/pcm%dp/sub%d/status" % (card, device, subdevice) + try: + f = open(filename, "r") + except IOError: + return None + try: + for line in f.readlines(): + if line[:9] == "owner_pid": + return int(line.split(':')[1].strip()) + finally: + f.close() + return None + + def get_pid_cmdline(self, pid): + try: + f = open("/proc/%d/cmdline" % pid, "r") + except IOError: + return None + try: + cmdline = f.read() + finally: + f.close() + return cmdline.replace('\x00', ' ').strip() class MixerWindow(Gtk.Window): - card_numbers = alsacard.card_list() - current_card = -1 - hcontrol = None - scales_vbox = None - msg_label = None - streams = [] - hctl_sources = [] - - def __init__(self): - Gtk.Window.__init__(self) - self.connect('destroy', lambda w: Gtk.main_quit()) - self.set_title("Hardware Mixer Volumes") - - vbox = Gtk.Grid() - vbox.set_orientation(Gtk.Orientation.VERTICAL) - self.add(vbox) - - hbox = Gtk.Grid() - vbox.add(hbox) - - label = Gtk.Label.new_with_mnemonic("_Sound Card: ") - hbox.add(label) - - combo = Gtk.ComboBoxText() - combo.set_hexpand(True) - for i in self.card_numbers: - str = "%d: %s" % (i, alsacard.card_get_name(i)) - combo.append_text(str) - if len(self.card_numbers) > 0: - combo.set_active(0) - combo.connect('changed', lambda c: self.change_card(self.card_numbers[combo.get_active()])) - hbox.add(combo) - label.set_mnemonic_widget(combo) - - self.lock_check = Gtk.CheckButton.new_with_mnemonic(label="_Lock Channels") - self.lock_check.set_active(True) - vbox.add(self.lock_check) - - scrollwin = Gtk.ScrolledWindow() - scrollwin.set_policy(hscrollbar_policy=Gtk.PolicyType.NEVER, vscrollbar_policy=Gtk.PolicyType.AUTOMATIC) - scrollwin.set_shadow_type(Gtk.ShadowType.NONE) - scrollwin.set_vexpand(True) - vbox.add(scrollwin) - - self.scales_vbox = Gtk.Grid() - self.scales_vbox.set_orientation(Gtk.Orientation.VERTICAL) - scrollwin.add_with_viewport(self.scales_vbox) - - label = Gtk.Label() - label.set_single_line_mode(True) - line_height = label.size_request().height - label.destroy() - scale = Gtk.HScale() - scale.set_draw_value(False) - line_height += scale.size_request().height - scale.destroy() - # always have space for at least four sliders - scrollwin.set_size_request(width=-1, height=line_height*4+4) - - # TODO: select the default card or the first card with stream controls - if len(self.card_numbers) > 0: - self.change_card(self.card_numbers[0]) - self.update_msg_label() - - self.show_all() - - def change_card(self, cardnum): - for s in self.hctl_sources: - GLib.source_remove(s) - self.hctl_sources = [] - - self.hcontrol = self.open_hcontrol_for_card(cardnum) - - for s in self.streams: - s.destroy() - self.streams = [] - - self.current_card = cardnum - - if not self.hcontrol: - self.update_msg_label() - return - - for id in self.hcontrol.list(): - if not self.is_stream_elem(id): - continue - elem = alsahcontrol.Element(self.hcontrol, id[0]) - info = alsahcontrol.Info(elem) - if not self.is_stream_info(info): - continue - stream = Stream(elem, self) - self.streams.append(stream) - - for fd,condition in self.hcontrol.poll_fds: - self.hctl_sources.append(GLib.io_add_watch(fd, 0, GLib.IOCondition(condition), self.hctl_io_callback)) - - self.update_msg_label() - - self.scales_vbox.show_all() - - def update_msg_label(self): - needs_msg = len(self.scales_vbox.get_children()) < 2 - has_msg = self.msg_label - if has_msg and not needs_msg: - self.msg_label.destroy() - self.msg_label = None - elif needs_msg: - if len(self.streams) > 0: - msg = "There are no open streams." - else: - msg = "This card does not have stream controls." - if not has_msg: - self.msg_label = Gtk.Label(msg) - self.msg_label.set_vexpand(True) - self.scales_vbox.add(self.msg_label) - self.scales_vbox.show_all() - elif self.msg_label.get_text() != msg: - self.msg_label.set_text(msg) - - def open_hcontrol_for_card(self, cardnum): - devname = "hw:CARD=" + str(cardnum) - try: - hc = alsahcontrol.HControl(name=devname, - mode=alsahcontrol.open_mode['NONBLOCK']) - except: - # TODO: alsa error msg - dlg = Gtk.MessageDialog(self, - Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, - Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, - "Cannot open sound card control device.") - dlg.run() - dlg.destroy() - return None - return hc - - def is_stream_elem(self, id): - return ((id[1] == INTF_PCM and - id[4] in ("PCM Playback Volume", "EMU10K1 PCM Volume")) or - (id[1] == INTF_MIXER and - id[4] == "VIA DXS Playback Volume")) - - def is_stream_info(self, info): - return info.is_readable and info.is_writable and info.type == TYPE_INTEGER - - def hctl_io_callback(self, source, condition): - self.hcontrol.handle_events() - return True + card_numbers = alsacard.card_list() + current_card = -1 + hcontrol = None + scales_vbox = None + msg_label = None + streams = [] + hctl_sources = [] + + def __init__(self): + Gtk.Window.__init__(self) + self.connect('destroy', lambda w: Gtk.main_quit()) + self.set_title("Hardware Mixer Volumes") + + vbox = Gtk.Grid() + vbox.set_orientation(Gtk.Orientation.VERTICAL) + self.add(vbox) + + hbox = Gtk.Grid() + vbox.add(hbox) + + label = Gtk.Label.new_with_mnemonic("_Sound Card: ") + hbox.add(label) + + combo = Gtk.ComboBoxText() + combo.set_hexpand(True) + for i in self.card_numbers: + str = "%d: %s" % (i, alsacard.card_get_name(i)) + combo.append_text(str) + if len(self.card_numbers) > 0: + combo.set_active(0) + combo.connect('changed', lambda c: self.change_card(self.card_numbers[combo.get_active()])) + hbox.add(combo) + label.set_mnemonic_widget(combo) + + self.lock_check = Gtk.CheckButton.new_with_mnemonic(label="_Lock Channels") + self.lock_check.set_active(True) + vbox.add(self.lock_check) + + scrollwin = Gtk.ScrolledWindow() + scrollwin.set_policy(hscrollbar_policy=Gtk.PolicyType.NEVER, vscrollbar_policy=Gtk.PolicyType.AUTOMATIC) + scrollwin.set_shadow_type(Gtk.ShadowType.NONE) + scrollwin.set_vexpand(True) + vbox.add(scrollwin) + + self.scales_vbox = Gtk.Grid() + self.scales_vbox.set_orientation(Gtk.Orientation.VERTICAL) + scrollwin.add_with_viewport(self.scales_vbox) + + label = Gtk.Label() + label.set_single_line_mode(True) + line_height = label.size_request().height + label.destroy() + scale = Gtk.HScale() + scale.set_draw_value(False) + line_height += scale.size_request().height + scale.destroy() + # always have space for at least four sliders + scrollwin.set_size_request(width=-1, height=line_height*4+4) + + # TODO: select the default card or the first card with stream controls + if len(self.card_numbers) > 0: + self.change_card(self.card_numbers[0]) + self.update_msg_label() + + self.show_all() + + def change_card(self, cardnum): + for s in self.hctl_sources: + GLib.source_remove(s) + self.hctl_sources = [] + + self.hcontrol = self.open_hcontrol_for_card(cardnum) + + for s in self.streams: + s.destroy() + self.streams = [] + + self.current_card = cardnum + + if not self.hcontrol: + self.update_msg_label() + return + + for id in self.hcontrol.list(): + if not self.is_stream_elem(id): + continue + elem = alsahcontrol.Element(self.hcontrol, id[0]) + info = alsahcontrol.Info(elem) + if not self.is_stream_info(info): + continue + stream = Stream(elem, self) + self.streams.append(stream) + + for fd,condition in self.hcontrol.poll_fds: + self.hctl_sources.append(GLib.io_add_watch(fd, 0, GLib.IOCondition(condition), self.hctl_io_callback)) + + self.update_msg_label() + + self.scales_vbox.show_all() + + def update_msg_label(self): + needs_msg = len(self.scales_vbox.get_children()) < 2 + has_msg = self.msg_label + if has_msg and not needs_msg: + self.msg_label.destroy() + self.msg_label = None + elif needs_msg: + if len(self.streams) > 0: + msg = "There are no open streams." + else: + msg = "This card does not have stream controls." + if not has_msg: + self.msg_label = Gtk.Label(msg) + self.msg_label.set_vexpand(True) + self.scales_vbox.add(self.msg_label) + self.scales_vbox.show_all() + elif self.msg_label.get_text() != msg: + self.msg_label.set_text(msg) + + def open_hcontrol_for_card(self, cardnum): + devname = "hw:CARD=" + str(cardnum) + try: + hc = alsahcontrol.HControl(name=devname, + mode=alsahcontrol.open_mode['NONBLOCK']) + except: + # TODO: alsa error msg + dlg = Gtk.MessageDialog(self, + Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, + Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, + "Cannot open sound card control device.") + dlg.run() + dlg.destroy() + return None + return hc + + def is_stream_elem(self, id): + return ((id[1] == INTF_PCM and + id[4] in ("PCM Playback Volume", "EMU10K1 PCM Volume")) or + (id[1] == INTF_MIXER and + id[4] == "VIA DXS Playback Volume")) + + def is_stream_info(self, info): + return info.is_readable and info.is_writable and info.type == TYPE_INTEGER + + def hctl_io_callback(self, source, condition): + self.hcontrol.handle_events() + return True def main(): - MixerWindow() - Gtk.main() + MixerWindow() + Gtk.main() main() From patchwork Wed Aug 8 15:56:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BB04139A for ; Sun, 12 Aug 2018 06:04:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48FC5284C7 for ; Sun, 12 Aug 2018 06:04:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D4EF2962E; Sun, 12 Aug 2018 06:04:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC8C0284C7 for ; Sun, 12 Aug 2018 06:04:16 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4923D2676D8; Sun, 12 Aug 2018 08:03:52 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A7CD62678DB; Wed, 8 Aug 2018 17:56:49 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id E036726786A; Wed, 8 Aug 2018 17:56:46 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id 43e42dc5; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:32 +0200 Message-Id: <20180808155637.5592-5-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH - hwmixvolume 4/9] hwmixvolume: use a with context to open files X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/hwmixvolume b/hwmixvolume/hwmixvolume index 267228c..e82f32d 100755 --- a/hwmixvolume/hwmixvolume +++ b/hwmixvolume/hwmixvolume @@ -138,26 +138,20 @@ class Stream: subdevice = info.index filename = "/proc/asound/card%d/pcm%dp/sub%d/status" % (card, device, subdevice) try: - f = open(filename, "r") + with open(filename, "r") as f: + for line in f.readlines(): + if line[:9] == "owner_pid": + return int(line.split(':')[1].strip()) except IOError: return None - try: - for line in f.readlines(): - if line[:9] == "owner_pid": - return int(line.split(':')[1].strip()) - finally: - f.close() return None def get_pid_cmdline(self, pid): try: - f = open("/proc/%d/cmdline" % pid, "r") + with open("/proc/%d/cmdline" % pid, "r") as f: + cmdline = f.read() except IOError: return None - try: - cmdline = f.read() - finally: - f.close() return cmdline.replace('\x00', ' ').strip() class MixerWindow(Gtk.Window): From patchwork Wed Aug 8 15:56:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2A16157B for ; Sun, 12 Aug 2018 06:04:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E05F0284C7 for ; Sun, 12 Aug 2018 06:04:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D31D22962E; Sun, 12 Aug 2018 06:04:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6294F284C7 for ; Sun, 12 Aug 2018 06:04:25 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9FF2C2677AE; Sun, 12 Aug 2018 08:03:53 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E78202678DB; Wed, 8 Aug 2018 17:56:49 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id 0F23A2678DA; Wed, 8 Aug 2018 17:56:47 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id e7a5a10e; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:33 +0200 Message-Id: <20180808155637.5592-6-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH - hwmixvolume 5/9] hwmixvolume: replace deprecated Gtk.HScale with Gtk.Scale X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/hwmixvolume b/hwmixvolume/hwmixvolume index e82f32d..af0c1e0 100755 --- a/hwmixvolume/hwmixvolume +++ b/hwmixvolume/hwmixvolume @@ -69,7 +69,7 @@ class Stream: step_incr=1, page_incr=(info.max-info.min+1)/8) adj.connect('value-changed', self.update_ctl_from_scale, i) - scale = Gtk.HScale(adj) + scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj) scale.set_draw_value(False) self.parent.scales_vbox.add(scale) self.scales.append(scale) @@ -207,7 +207,7 @@ class MixerWindow(Gtk.Window): label.set_single_line_mode(True) line_height = label.size_request().height label.destroy() - scale = Gtk.HScale() + scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL) scale.set_draw_value(False) line_height += scale.size_request().height scale.destroy() From patchwork Wed Aug 8 15:56:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563615 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42BA5139A for ; Sun, 12 Aug 2018 06:04:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32CF8284C7 for ; Sun, 12 Aug 2018 06:04:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276F52974F; Sun, 12 Aug 2018 06:04:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43BDD284C7 for ; Sun, 12 Aug 2018 06:04:33 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DFF3F26780B; Sun, 12 Aug 2018 08:03:54 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D9C082678E2; Wed, 8 Aug 2018 17:56:51 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id 262E02678DF; Wed, 8 Aug 2018 17:56:49 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id 1c1ab1bb; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:34 +0200 Message-Id: <20180808155637.5592-7-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH - hwmixvolume 6/9] hwmixvolume: fix deprecation warnings given by G_ENABLE_DIAGNOSTIC=1 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/hwmixvolume b/hwmixvolume/hwmixvolume index af0c1e0..ec2d05d 100755 --- a/hwmixvolume/hwmixvolume +++ b/hwmixvolume/hwmixvolume @@ -60,7 +60,7 @@ class Stream: value = alsahcontrol.Value(self.element) value.read() values = value.get_tuple(TYPE_INTEGER, info.count) - self.label = Gtk.Label(self.get_label(info)) + self.label = Gtk.Label.new(self.get_label(info)) self.label.set_single_line_mode(True) self.parent.scales_vbox.add(self.label) for i in range(info.count): @@ -201,15 +201,15 @@ class MixerWindow(Gtk.Window): self.scales_vbox = Gtk.Grid() self.scales_vbox.set_orientation(Gtk.Orientation.VERTICAL) - scrollwin.add_with_viewport(self.scales_vbox) + scrollwin.add(self.scales_vbox) label = Gtk.Label() label.set_single_line_mode(True) - line_height = label.size_request().height + line_height = max(label.get_size_request().height, 0) label.destroy() scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL) scale.set_draw_value(False) - line_height += scale.size_request().height + line_height += max(scale.get_size_request().height, 0) scale.destroy() # always have space for at least four sliders scrollwin.set_size_request(width=-1, height=line_height*4+4) @@ -267,7 +267,7 @@ class MixerWindow(Gtk.Window): else: msg = "This card does not have stream controls." if not has_msg: - self.msg_label = Gtk.Label(msg) + self.msg_label = Gtk.Label.new(msg) self.msg_label.set_vexpand(True) self.scales_vbox.add(self.msg_label) self.scales_vbox.show_all() From patchwork Wed Aug 8 15:56:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 007D2157B for ; Sun, 12 Aug 2018 06:04:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E40AA284C7 for ; Sun, 12 Aug 2018 06:04:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D891C2974F; Sun, 12 Aug 2018 06:04:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71BCC284C7 for ; Sun, 12 Aug 2018 06:04:40 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4AF612676B4; Sun, 12 Aug 2018 08:03:56 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1DFF82678E3; Wed, 8 Aug 2018 17:56:52 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id 494462678E1; Wed, 8 Aug 2018 17:56:49 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id 302bc459; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:35 +0200 Message-Id: <20180808155637.5592-8-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH - hwmixvolume 7/9] hwmixvolume: switch the shebang to python, as it is now compatible with both 2 and 3 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/hwmixvolume b/hwmixvolume/hwmixvolume index ec2d05d..7b90613 100755 --- a/hwmixvolume/hwmixvolume +++ b/hwmixvolume/hwmixvolume @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python # hwmixvolume - ALSA hardware mixer volume control applet # Copyright (c) 2009-2010 Clemens Ladisch From patchwork Wed Aug 8 15:56:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563619 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C10C0157B for ; Sun, 12 Aug 2018 06:04:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0464284C7 for ; Sun, 12 Aug 2018 06:04:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A49782974F; Sun, 12 Aug 2018 06:04:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4767D284C7 for ; Sun, 12 Aug 2018 06:04:47 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 97CCA2676A2; Sun, 12 Aug 2018 08:03:57 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3B8312678E3; Wed, 8 Aug 2018 17:56:54 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id 604262678E1; Wed, 8 Aug 2018 17:56:51 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id cb337672; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:36 +0200 Message-Id: <20180808155637.5592-9-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH - hwmixvolume 8/9] hwmixvolume: add my copyright X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/hwmixvolume b/hwmixvolume/hwmixvolume index 7b90613..c34904e 100755 --- a/hwmixvolume/hwmixvolume +++ b/hwmixvolume/hwmixvolume @@ -2,6 +2,7 @@ # hwmixvolume - ALSA hardware mixer volume control applet # Copyright (c) 2009-2010 Clemens Ladisch +# Copyright (c) 2018 Emmanuel Gil Peyrot # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above From patchwork Wed Aug 8 15:56:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 10563621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A81101515 for ; Sun, 12 Aug 2018 06:05:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98977284C7 for ; Sun, 12 Aug 2018 06:05:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B4552974F; Sun, 12 Aug 2018 06:05:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2349A284C7 for ; Sun, 12 Aug 2018 06:05:04 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 61486267822; Sun, 12 Aug 2018 08:04:00 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 56D112678EB; Wed, 8 Aug 2018 17:56:54 +0200 (CEST) Received: from jabberfr.org (jabberfr.org [62.210.214.37]) by alsa0.perex.cz (Postfix) with ESMTP id 8D09F2678E5; Wed, 8 Aug 2018 17:56:51 +0200 (CEST) Received: from localhost (jabberfr.org [local]) by jabberfr.org (OpenSMTPD) with ESMTPA id 137319d6; Wed, 8 Aug 2018 15:56:39 +0000 (UTC) From: Emmanuel Gil Peyrot To: patch@alsa-project.org Date: Wed, 8 Aug 2018 17:56:37 +0200 Message-Id: <20180808155637.5592-10-linkmauve@jabberfr.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808155637.5592-1-linkmauve@jabberfr.org> References: <20180808155637.5592-1-linkmauve@jabberfr.org> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 12 Aug 2018 08:03:43 +0200 Cc: Emmanuel Gil Peyrot , Emmanuel Gil Peyrot , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH - hwmixvolume 9/9] hwmixvolume: mention the new dependencies in the README X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emmanuel Gil Peyrot diff --git a/hwmixvolume/README b/hwmixvolume/README index 9884ec2..db1b874 100644 --- a/hwmixvolume/README +++ b/hwmixvolume/README @@ -8,7 +8,8 @@ that use hardware mixing, i.e., those based on the following chips: * Yamaha DS-1 (YMF-724/740/744/754) (driver: snd-ymfpci) -This tool requires Python, pygtk, and alsa-pyton 1.0.22 or later. +This tool requires Python, PyGObject, GTK+ 3.0 or later, and alsa-pyton 1.0.22 +or later. It is recommended to use at least Linux kernel 2.6.32 or alsa-driver 1.0.22; otherwise, the name of the program that is using a stream cannot be shown.