Alexei Sorokin 2018-02-26 10:01:28 +00:00 committed by Git OBS Bridge
parent bb8fb62b98
commit 68f3cb795e
5 changed files with 184 additions and 119 deletions

View File

@ -1,6 +1,15 @@
--- a/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py --- a/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py
+++ b/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py +++ b/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py
@@ -21,279 +21,281 @@ presetdir1 = configdir + "/presets" @@ -10,7 +10,7 @@
import pygtk
pygtk.require('2.0')
-import gtk, gobject
+import gtk as Gtk
import os
configdir = os.getenv('HOME') + "/.pulse"
@@ -21,288 +21,290 @@ presetdir1 = configdir + "/presets"
presetdir2 = "/usr/share/pulseaudio-equalizer/presets" presetdir2 = "/usr/share/pulseaudio-equalizer/presets"
def GetSettings(): def GetSettings():
@ -525,12 +534,28 @@
- global preset - global preset
+ global preset + global preset
global presets global presets
dialog = gtk.FileChooserDialog("Choose preset to remove...", - dialog = gtk.FileChooserDialog("Choose preset to remove...",
+ dialog = Gtk.FileChooserDialog("Choose preset to remove...",
None, None,
@@ -311,39 +313,39 @@ class Equalizer: - gtk.FILE_CHOOSER_ACTION_OPEN,
- (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
- gtk.STOCK_OK, gtk.RESPONSE_OK))
- dialog.set_default_response(gtk.RESPONSE_OK)
+ Gtk.FILE_CHOOSER_ACTION_OPEN,
+ (Gtk.STOCK_CANCEL, Gtk.RESPONSE_CANCEL,
+ Gtk.STOCK_OK, Gtk.RESPONSE_OK))
+ dialog.set_default_response(Gtk.RESPONSE_OK)
- filter = gtk.FileFilter()
+ filter = Gtk.FileFilter()
filter.set_name("Preset files")
filter.add_pattern("*.preset")
dialog.add_filter(filter)
@@ -310,209 +312,209 @@ class Equalizer:
dialog.show()
response = dialog.run() response = dialog.run()
if response == gtk.RESPONSE_OK: - if response == gtk.RESPONSE_OK:
- filename = dialog.get_filename() - filename = dialog.get_filename()
- path_and_name = os.path.split(filename) - path_and_name = os.path.split(filename)
- name = path_and_name[1] - name = path_and_name[1]
@ -561,6 +586,7 @@
- # Repopulate preset list into ComboBox - # Repopulate preset list into ComboBox
- for i in range(len(rawpresets)): - for i in range(len(rawpresets)):
- presetsbox.append_text(rawpresets[i]) - presetsbox.append_text(rawpresets[i])
+ if response == Gtk.RESPONSE_OK:
+ filename = dialog.get_filename() + filename = dialog.get_filename()
+ path_and_name = os.path.split(filename) + path_and_name = os.path.split(filename)
+ name = path_and_name[1] + name = path_and_name[1]
@ -599,25 +625,29 @@
dialog.destroy() dialog.destroy()
@@ -351,7 +353,7 @@ class Equalizer: def destroy_equalizer(self, widget, data=None):
gtk.main_quit() - gtk.main_quit()
+ Gtk.main_quit()
def __init__(self): def __init__(self):
- GetSettings() - GetSettings()
+ GetSettings() + GetSettings()
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) - self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ self.window = Gtk.Window(Gtk.WINDOW_TOPLEVEL)
self.window.set_resizable(True) self.window.set_resizable(True)
@@ -359,18 +361,18 @@ class Equalizer:
self.window.connect("destroy", self.destroy_equalizer) self.window.connect("destroy", self.destroy_equalizer)
self.window.set_title(windowtitle + " [" + realstatus + "]") self.window.set_title(windowtitle + " [" + realstatus + "]")
self.window.set_border_width(0) self.window.set_border_width(0)
- icon = self.window.set_icon_from_file("/usr/share/icons/hicolor/scalable/apps/multimedia-volume-control.svg") - icon = self.window.set_icon_from_file("/usr/share/icons/hicolor/scalable/apps/multimedia-volume-control.svg")
+ icon = self.window.set_icon_from_file("/usr/share/icons/hicolor/scalable/apps/multimedia-volume-control.svg") + icon = self.window.set_icon_from_file("/usr/share/icons/hicolor/scalable/apps/multimedia-volume-control.svg")
menu = gtk.Menu() - menu = gtk.Menu()
+ menu = Gtk.Menu()
menu_item = gtk.MenuItem('Reset to defaults') - menu_item = gtk.MenuItem('Reset to defaults')
+ menu_item = Gtk.MenuItem("Reset to defaults")
menu_item.connect("activate", self.on_resetsettings) menu_item.connect("activate", self.on_resetsettings)
- menu.append(menu_item) - menu.append(menu_item)
- menu_item.show() - menu_item.show()
@ -625,15 +655,34 @@
- menu_item.connect("activate", self.on_removepreset) - menu_item.connect("activate", self.on_removepreset)
menu.append(menu_item) menu.append(menu_item)
- menu_item.show() - menu_item.show()
- root_menu = gtk.MenuItem("Advanced")
+ menu_item.show() + menu_item.show()
+ menu_item = gtk.MenuItem("Remove user preset...") + menu_item = Gtk.MenuItem("Remove user preset...")
+ menu_item.connect("activate", self.on_removepreset) + menu_item.connect("activate", self.on_removepreset)
+ menu.append(menu_item) + menu.append(menu_item)
+ menu_item.show() + menu_item.show()
root_menu = gtk.MenuItem("Advanced") + root_menu = Gtk.MenuItem("Advanced")
root_menu.show() root_menu.show()
root_menu.set_submenu(menu) root_menu.set_submenu(menu)
@@ -392,67 +394,67 @@ class Equalizer:
- vbox1 = gtk.VBox(False, 0)
+ vbox1 = Gtk.VBox(False, 0)
self.window.add(vbox1)
vbox1.show()
- menu_bar = gtk.MenuBar()
+ menu_bar = Gtk.MenuBar()
vbox1.pack_start(menu_bar, False, False, 2)
menu_bar.show()
menu_bar.append (root_menu)
- hbox1 = gtk.HBox(False, 1)
+ hbox1 = Gtk.HBox(False, 1)
#hbox1.set_border_width(10)
vbox1.add(hbox1)
hbox1.show()
- table = gtk.Table(3, 17, False)
+ table = Gtk.Table(3, 17, False)
table.set_border_width(5) table.set_border_width(5)
hbox1.add(table) hbox1.add(table)
@ -699,19 +748,19 @@
+ # Preamp widget + # Preamp widget
+ global preampscale + global preampscale
+ global preampscalevalue + global preampscalevalue
+ preampscale = gtk.VScale() + preampscale = Gtk.VScale()
+ preampscale.set_draw_value(0) + preampscale.set_draw_value(0)
+ preampscale.set_inverted(1) + preampscale.set_inverted(1)
+ preampscale.set_value_pos(gtk.POS_BOTTOM) + preampscale.set_value_pos(Gtk.POS_BOTTOM)
+ preampscale.set_range(0.0, 2.0) + preampscale.set_range(0.0, 2.0)
+ preampscale.set_increments(1, 0.1) + preampscale.set_increments(1, 0.1)
+ preampscale.set_digits(1) + preampscale.set_digits(1)
+ preampscale.set_size_request(35, 200) + preampscale.set_size_request(35, 200)
+ preampscale.set_value(float(preamp)) + preampscale.set_value(float(preamp))
+ preampscale.connect("value-changed", self.on_preampscale) + preampscale.connect("value-changed", self.on_preampscale)
+ label = gtk.Label() + label = Gtk.Label()
+ label.set_markup("<small>Preamp</small>") + label.set_markup("<small>Preamp</small>")
+ preampscalevalue = gtk.Label() + preampscalevalue = Gtk.Label()
+ preampscalevalue.set_markup(str(preampscale.get_value()) + "x") + preampscalevalue.set_markup(str(preampscale.get_value()) + "x")
+ table.attach(label, 1, 2, 0, 1) + table.attach(label, 1, 2, 0, 1)
+ table.attach(preampscale, 1, 2, 1, 2) + table.attach(preampscale, 1, 2, 1, 2)
@ -721,7 +770,7 @@
+ preampscalevalue.show() + preampscalevalue.show()
+ +
+ # Separator between preamp and bands + # Separator between preamp and bands
+ separator = gtk.VSeparator() + separator = Gtk.VSeparator()
+ table.attach(separator, 2, 3, 1, 2) + table.attach(separator, 2, 3, 1, 2)
+ separator.show() + separator.show()
+ +
@ -731,11 +780,11 @@
+ self.labels = {} + self.labels = {}
+ self.scalevalues = {} + self.scalevalues = {}
+ for x in range(1,num_ladspa_controls+1): + for x in range(1,num_ladspa_controls+1):
+ scale = gtk.VScale() + scale = Gtk.VScale()
+ self.scales[x] = scale + self.scales[x] = scale
+ scale.set_draw_value(0) + scale.set_draw_value(0)
+ scale.set_inverted(1) + scale.set_inverted(1)
+ scale.set_value_pos(gtk.POS_BOTTOM) + scale.set_value_pos(Gtk.POS_BOTTOM)
+ scale.set_range(float(ranges[0]), float(ranges[1])) + scale.set_range(float(ranges[0]), float(ranges[1]))
+ scale.set_increments(1, 0.1) + scale.set_increments(1, 0.1)
+ scale.set_digits(1) + scale.set_digits(1)
@ -743,10 +792,10 @@
+ scale.set_value(float(ladspa_controls[x - 1])) + scale.set_value(float(ladspa_controls[x - 1]))
+ scale.connect("value-changed", self.on_scale, x) + scale.connect("value-changed", self.on_scale, x)
+ FormatLabels(x) + FormatLabels(x)
+ label = gtk.Label() + label = Gtk.Label()
+ self.labels[x] = label + self.labels[x] = label
+ label.set_markup("<small>" + whitespace1 + c + "\n" + whitespace2 + suffix + "</small>") + label.set_markup("<small>" + whitespace1 + c + "\n" + whitespace2 + suffix + "</small>")
+ scalevalue = gtk.Label() + scalevalue = Gtk.Label()
+ self.scalevalues[x] = scalevalue + self.scalevalues[x] = scalevalue
+ scalevalue.set_markup("<small>" + str(scale.get_value()) + "\ndB</small>") + scalevalue.set_markup("<small>" + str(scale.get_value()) + "\ndB</small>")
+ table.attach(label, x + 2, x + 3, 0, 1) + table.attach(label, x + 2, x + 3, 0, 1)
@ -759,12 +808,13 @@
- table.show() - table.show()
+ table.show() + table.show()
vbox2 = gtk.VBox(True, 1) - vbox2 = gtk.VBox(True, 1)
+ vbox2 = Gtk.VBox(True, 1)
vbox2.set_border_width(10) vbox2.set_border_width(10)
@@ -460,54 +462,54 @@ class Equalizer: hbox1.add(vbox2)
vbox2.show() vbox2.show()
presetslabel = gtk.Label() - presetslabel = gtk.Label()
- presetslabel.set_markup("<small>Preset:</small>") - presetslabel.set_markup("<small>Preset:</small>")
- vbox2.pack_start(presetslabel, False, False, 0) - vbox2.pack_start(presetslabel, False, False, 0)
- presetslabel.show() - presetslabel.show()
@ -775,12 +825,13 @@
- presetsbox.get_child().set_text(preset) - presetsbox.get_child().set_text(preset)
- for i in range(len(rawpresets)): - for i in range(len(rawpresets)):
- presetsbox.append_text(rawpresets[i]) - presetsbox.append_text(rawpresets[i])
+ presetslabel = Gtk.Label()
+ presetslabel.set_markup("<small>Preset:</small>") + presetslabel.set_markup("<small>Preset:</small>")
+ vbox2.pack_start(presetslabel, False, False, 0) + vbox2.pack_start(presetslabel, False, False, 0)
+ presetslabel.show() + presetslabel.show()
+ +
+ global presetsbox + global presetsbox
+ presetsbox = gtk.combo_box_entry_new_text() + presetsbox = Gtk.combo_box_entry_new_text()
+ vbox2.pack_start(presetsbox, False, False, 0) + vbox2.pack_start(presetsbox, False, False, 0)
+ presetsbox.get_child().set_text(preset) + presetsbox.get_child().set_text(preset)
+ for i in range(len(rawpresets)): + for i in range(len(rawpresets)):
@ -791,17 +842,19 @@
- savepreset = gtk.Button('Save Preset') - savepreset = gtk.Button('Save Preset')
- vbox2.pack_start(savepreset, False, False, 0) - vbox2.pack_start(savepreset, False, False, 0)
+ savepreset = gtk.Button("Save Preset") + savepreset = Gtk.Button("Save Preset")
+ vbox2.pack_start(savepreset, False, False, 0) + vbox2.pack_start(savepreset, False, False, 0)
savepreset.connect("clicked", self.on_savepreset) savepreset.connect("clicked", self.on_savepreset)
- savepreset.show() - savepreset.show()
+ savepreset.show() + savepreset.show()
- global eqenabled - global eqenabled
- eqenabled = gtk.CheckButton("EQ Enabled")
+ global eqenabled + global eqenabled
eqenabled = gtk.CheckButton("EQ Enabled") + eqenabled = Gtk.CheckButton("EQ Enabled")
eqenabled.set_active(status) eqenabled.set_active(status)
eqenabled.unset_flags(gtk.CAN_FOCUS) - eqenabled.unset_flags(gtk.CAN_FOCUS)
+ eqenabled.unset_flags(Gtk.CAN_FOCUS)
eqenabled.connect("clicked", self.on_eqenabled) eqenabled.connect("clicked", self.on_eqenabled)
- vbox2.pack_start(eqenabled, False, False, 0) - vbox2.pack_start(eqenabled, False, False, 0)
- eqenabled.show() - eqenabled.show()
@ -809,11 +862,13 @@
+ eqenabled.show() + eqenabled.show()
- global keepsettings - global keepsettings
+ global keepsettings - keepsettings = gtk.CheckButton('Keep Settings')
keepsettings = gtk.CheckButton('Keep Settings')
- keepsettings.set_active(persistence) - keepsettings.set_active(persistence)
- keepsettings.unset_flags(gtk.CAN_FOCUS)
+ global keepsettings
+ keepsettings = Gtk.CheckButton("Keep Settings")
+ keepsettings.set_active(persistence) + keepsettings.set_active(persistence)
keepsettings.unset_flags(gtk.CAN_FOCUS) + keepsettings.unset_flags(Gtk.CAN_FOCUS)
keepsettings.connect("clicked", self.on_keepsettings) keepsettings.connect("clicked", self.on_keepsettings)
- vbox2.pack_start(keepsettings, False, False, 0) - vbox2.pack_start(keepsettings, False, False, 0)
- keepsettings.show() - keepsettings.show()
@ -822,7 +877,7 @@
- applysettings = gtk.Button('Apply Settings') - applysettings = gtk.Button('Apply Settings')
- vbox2.pack_start(applysettings, False, False, 0) - vbox2.pack_start(applysettings, False, False, 0)
+ applysettings = gtk.Button("Apply Settings") + applysettings = Gtk.Button("Apply Settings")
+ vbox2.pack_start(applysettings, False, False, 0) + vbox2.pack_start(applysettings, False, False, 0)
applysettings.connect("clicked", self.on_applysettings) applysettings.connect("clicked", self.on_applysettings)
- applysettings.show() - applysettings.show()
@ -837,15 +892,21 @@
- vbox2.pack_start(separator, False, False, 0) - vbox2.pack_start(separator, False, False, 0)
- separator.set_size_request(100, 10) - separator.set_size_request(100, 10)
- #separator.show() - #separator.show()
+ quitbutton = gtk.Button("Quit") + quitbutton = Gtk.Button("Quit")
+ vbox2.pack_start(quitbutton, False, False, 0) + vbox2.pack_start(quitbutton, False, False, 0)
+ quitbutton.connect("clicked", lambda w: gtk.main_quit()) + quitbutton.connect("clicked", lambda w: Gtk.main_quit())
+ quitbutton.show() + quitbutton.show()
+ +
+ separator = gtk.HSeparator() + separator = Gtk.HSeparator()
+ vbox2.pack_start(separator, False, False, 0) + vbox2.pack_start(separator, False, False, 0)
+ separator.set_size_request(100, 10) + separator.set_size_request(100, 10)
+ #separator.show() + #separator.show()
self.window.show() self.window.show()
def main():
- gtk.main()
+ Gtk.main()
return 0
if __name__ == "__main__":

View File

@ -163,12 +163,16 @@
echo "Equalizer control: [$PA_LADSPA_CONTROLS]" echo "Equalizer control: [$PA_LADSPA_CONTROLS]"
--- a/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py --- a/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py
+++ b/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py +++ b/usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py
@@ -13,7 +13,7 @@ pygtk.require('2.0') @@ -10,10 +10,10 @@
import gtk, gobject
import pygtk
pygtk.require('2.0')
-import gtk as Gtk
+import glib as GLib, gtk as Gtk
import os import os
-configdir = os.getenv('HOME') + "/.pulse" -configdir = os.getenv('HOME') + "/.pulse"
+configdir = glib.get_user_config_dir() + "/pulse" +configdir = GLib.get_user_config_dir() + "/pulse"
eqconfig = configdir + "/equalizerrc" eqconfig = configdir + "/equalizerrc"
eqconfig2 = configdir + "/equalizerrc.test" eqconfig2 = configdir + "/equalizerrc.test"
eqpresets = eqconfig + ".availablepresets" eqpresets = eqconfig + ".availablepresets"

View File

@ -32,7 +32,7 @@
+ #preampscalevalue.show() + #preampscalevalue.show()
# Separator between preamp and bands # Separator between preamp and bands
separator = gtk.VSeparator() separator = Gtk.VSeparator()
table.attach(separator, 2, 3, 1, 2) table.attach(separator, 2, 3, 1, 2)
- separator.show() - separator.show()
+ #separator.show() + #separator.show()

View File

@ -6,7 +6,7 @@
self.window.set_border_width(0) self.window.set_border_width(0)
- icon = self.window.set_icon_from_file("/usr/share/icons/hicolor/scalable/apps/multimedia-volume-control.svg") - icon = self.window.set_icon_from_file("/usr/share/icons/hicolor/scalable/apps/multimedia-volume-control.svg")
+ +
+ icon_theme = gtk.icon_theme_get_default() + icon_theme = Gtk.icon_theme_get_default()
+ if icon_theme.has_icon("multimedia-volume-control"): + if icon_theme.has_icon("multimedia-volume-control"):
+ icon = icon_theme.load_icon("multimedia-volume-control", 16, 0) + icon = icon_theme.load_icon("multimedia-volume-control", 16, 0)
+ self.window.set_icon(icon) + self.window.set_icon(icon)
@ -19,5 +19,5 @@
+ else: + else:
+ print("No icon found, window will be iconless") + print("No icon found, window will be iconless")
menu = gtk.Menu() menu = Gtk.Menu()

View File

@ -6,46 +6,46 @@
-import pygtk -import pygtk
-pygtk.require('2.0') -pygtk.require('2.0')
-import gtk, gobject -import glib as GLib, gtk as Gtk
+import gi +import gi
+gi.require_version("Gtk", "3.0") +gi.require_version("Gtk", "3.0")
+from gi.repository import GLib as glib, Gtk as gtk +from gi.repository import GLib, Gtk
import os import os
+GTK_VERSION = (gtk.MAJOR_VERSION, gtk.MINOR_VERSION, gtk.MICRO_VERSION) +GTK_VERSION = (Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION, Gtk.MICRO_VERSION)
+ +
configdir = glib.get_user_config_dir() + "/pulse" configdir = GLib.get_user_config_dir() + "/pulse"
eqconfig = configdir + "/equalizerrc" eqconfig = configdir + "/equalizerrc"
eqconfig2 = configdir + "/equalizerrc.test" eqconfig2 = configdir + "/equalizerrc.test"
@@ -300,12 +302,16 @@ class Equalizer: @@ -300,12 +302,16 @@ class Equalizer:
def on_removepreset(self,widget): def on_removepreset(self,widget):
global preset global preset
global presets global presets
- dialog = gtk.FileChooserDialog("Choose preset to remove...", - dialog = Gtk.FileChooserDialog("Choose preset to remove...",
- None, - None,
- gtk.FILE_CHOOSER_ACTION_OPEN, - Gtk.FILE_CHOOSER_ACTION_OPEN,
- (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, - (Gtk.STOCK_CANCEL, Gtk.RESPONSE_CANCEL,
- gtk.STOCK_OK, gtk.RESPONSE_OK)) - Gtk.STOCK_OK, Gtk.RESPONSE_OK))
- dialog.set_default_response(gtk.RESPONSE_OK) - dialog.set_default_response(Gtk.RESPONSE_OK)
+ dialog = gtk.FileChooserDialog(title="Choose preset to remove...", + dialog = Gtk.FileChooserDialog(title="Choose preset to remove...",
+ transient_for=widget.get_toplevel(), + transient_for=widget.get_toplevel(),
+ action=gtk.FileChooserAction.OPEN) + action=Gtk.FileChooserAction.OPEN)
+ +
+ button = dialog.add_button("_Cancel", gtk.ResponseType.CANCEL) + button = dialog.add_button("_Cancel", Gtk.ResponseType.CANCEL)
+ button.set_image(gtk.Image.new_from_icon_name("gtk-cancel", gtk.IconSize.BUTTON)) + button.set_image(Gtk.Image.new_from_icon_name("gtk-cancel", Gtk.IconSize.BUTTON))
+ button = dialog.add_button("_Open", gtk.ResponseType.OK) + button = dialog.add_button("_Open", Gtk.ResponseType.OK)
+ button.set_image(gtk.Image.new_from_icon_name("document-open", gtk.IconSize.BUTTON)) + button.set_image(Gtk.Image.new_from_icon_name("document-open", Gtk.IconSize.BUTTON))
+ button.grab_default() + button.grab_default()
+ dialog.set_default_response(gtk.ResponseType.OK) + dialog.set_default_response(Gtk.ResponseType.OK)
filter = gtk.FileFilter() filter = Gtk.FileFilter()
filter.set_name("Preset files") filter.set_name("Preset files")
@@ -315,7 +321,7 @@ class Equalizer: @@ -315,7 +321,7 @@ class Equalizer:
dialog.show() dialog.show()
response = dialog.run() response = dialog.run()
- if response == gtk.RESPONSE_OK: - if response == Gtk.RESPONSE_OK:
+ if response == gtk.ResponseType.OK: + if response == Gtk.ResponseType.OK:
filename = dialog.get_filename() filename = dialog.get_filename()
path_and_name = os.path.split(filename) path_and_name = os.path.split(filename)
name = path_and_name[1] name = path_and_name[1]
@ -53,46 +53,46 @@
def __init__(self): def __init__(self):
GetSettings() GetSettings()
- self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) - self.window = Gtk.Window(Gtk.WINDOW_TOPLEVEL)
+ self.window = gtk.Window() + self.window = Gtk.Window()
self.window.set_resizable(True) self.window.set_resizable(True)
self.window.connect("destroy", self.destroy_equalizer) self.window.connect("destroy", self.destroy_equalizer)
self.window.set_title(windowtitle + " [" + realstatus + "]") self.window.set_title(windowtitle + " [" + realstatus + "]")
- self.window.set_border_width(0) - self.window.set_border_width(0)
- icon_theme = gtk.icon_theme_get_default() - icon_theme = Gtk.icon_theme_get_default()
+ icon_theme = gtk.IconTheme.get_default() + icon_theme = Gtk.IconTheme.get_default()
if icon_theme.has_icon("multimedia-volume-control"): if icon_theme.has_icon("multimedia-volume-control"):
icon = icon_theme.load_icon("multimedia-volume-control", 16, 0) icon = icon_theme.load_icon("multimedia-volume-control", 16, 0)
self.window.set_icon(icon) self.window.set_icon(icon)
@@ -380,42 +385,59 @@ class Equalizer: @@ -380,42 +385,59 @@ class Equalizer:
menu = gtk.Menu() menu = Gtk.Menu()
- menu_item = gtk.MenuItem('Reset to defaults') - menu_item = Gtk.MenuItem("Reset to defaults")
+ menu_item = gtk.MenuItem(label="Reset to defaults") + menu_item = Gtk.MenuItem(label="Reset to defaults")
menu_item.connect("activate", self.on_resetsettings) menu_item.connect("activate", self.on_resetsettings)
menu.append(menu_item) menu.append(menu_item)
menu_item.show() menu_item.show()
- menu_item = gtk.MenuItem("Remove user preset...") - menu_item = Gtk.MenuItem("Remove user preset...")
+ menu_item = gtk.MenuItem(label="Remove user preset...") + menu_item = Gtk.MenuItem(label="Remove user preset...")
menu_item.connect("activate", self.on_removepreset) menu_item.connect("activate", self.on_removepreset)
menu.append(menu_item) menu.append(menu_item)
menu_item.show() menu_item.show()
- root_menu = gtk.MenuItem("Advanced") - root_menu = Gtk.MenuItem("Advanced")
+ root_menu = gtk.MenuItem(label="Advanced") + root_menu = Gtk.MenuItem(label="Advanced")
root_menu.show() root_menu.show()
root_menu.set_submenu(menu) root_menu.set_submenu(menu)
- vbox1 = gtk.VBox(False, 0) - vbox1 = Gtk.VBox(False, 0)
+ if GTK_VERSION >= (3, 0, 0): + if GTK_VERSION >= (3, 0, 0):
+ vbox1 = gtk.Box(orientation=gtk.Orientation.VERTICAL) + vbox1 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ else: + else:
+ vbox1 = gtk.VBox() + vbox1 = Gtk.VBox()
self.window.add(vbox1) self.window.add(vbox1)
vbox1.show() vbox1.show()
menu_bar = gtk.MenuBar() menu_bar = Gtk.MenuBar()
- vbox1.pack_start(menu_bar, False, False, 2) - vbox1.pack_start(menu_bar, False, False, 2)
+ if GTK_VERSION >= (3, 0, 0): + if GTK_VERSION >= (3, 0, 0):
+ menu_bar.set_margin_bottom(4) + menu_bar.set_margin_bottom(4)
@ -103,45 +103,45 @@
- menu_bar.append (root_menu) - menu_bar.append (root_menu)
+ menu_bar.append(root_menu) + menu_bar.append(root_menu)
- hbox1 = gtk.HBox(False, 1) - hbox1 = Gtk.HBox(False, 1)
- #hbox1.set_border_width(10) - #hbox1.set_border_width(10)
+ if GTK_VERSION >= (3, 0, 0): + if GTK_VERSION >= (3, 0, 0):
+ hbox1 = gtk.Box(orientation=gtk.Orientation.HORIZONTAL, spacing=1) + hbox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=1)
+ else: + else:
+ hbox1 = gtk.HBox(spacing=1) + hbox1 = Gtk.HBox(spacing=1)
+ #hbox1.props.margin = 10 + #hbox1.props.margin = 10
vbox1.add(hbox1) vbox1.add(hbox1)
hbox1.show() hbox1.show()
- table = gtk.Table(3, 17, False) - table = Gtk.Table(3, 17, False)
- table.set_border_width(5) - table.set_border_width(5)
- hbox1.add(table) - hbox1.add(table)
+ if GTK_VERSION >= (3, 10, 0): + if GTK_VERSION >= (3, 10, 0):
+ grid = gtk.Grid() + grid = Gtk.Grid()
+ grid.props.margin = 5 + grid.props.margin = 5
+ else: + else:
+ grid = gtk.Table(n_rows=3, n_columns=17) + grid = Gtk.Table(n_rows=3, n_columns=17)
+ grid.set_border_width(5) + grid.set_border_width(5)
+ hbox1.add(grid) + hbox1.add(grid)
# Preamp widget # Preamp widget
global preampscale global preampscale
global preampscalevalue global preampscalevalue
- preampscale = gtk.VScale() - preampscale = Gtk.VScale()
+ if GTK_VERSION >= (3, 2, 0): + if GTK_VERSION >= (3, 2, 0):
+ preampscale = gtk.Scale(orientation=gtk.Orientation.VERTICAL) + preampscale = Gtk.Scale(orientation=Gtk.Orientation.VERTICAL)
+ else: + else:
+ preampscale = gtk.VScale() + preampscale = Gtk.VScale()
preampscale.set_draw_value(0) preampscale.set_draw_value(0)
preampscale.set_inverted(1) preampscale.set_inverted(1)
- preampscale.set_value_pos(gtk.POS_BOTTOM) - preampscale.set_value_pos(Gtk.POS_BOTTOM)
+ preampscale.set_value_pos(gtk.PositionType.BOTTOM) + preampscale.set_value_pos(Gtk.PositionType.BOTTOM)
preampscale.set_range(0.0, 2.0) preampscale.set_range(0.0, 2.0)
preampscale.set_increments(1, 0.1) preampscale.set_increments(1, 0.1)
preampscale.set_digits(1) preampscale.set_digits(1)
@@ -426,16 +448,25 @@ class Equalizer: @@ -426,16 +448,25 @@ class Equalizer:
label.set_markup("<small>Preamp</small>") label.set_markup("<small>Preamp</small>")
preampscalevalue = gtk.Label() preampscalevalue = Gtk.Label()
preampscalevalue.set_markup(str(preampscale.get_value()) + "x") preampscalevalue.set_markup(str(preampscale.get_value()) + "x")
- table.attach(label, 1, 2, 0, 1) - table.attach(label, 1, 2, 0, 1)
- table.attach(preampscale, 1, 2, 1, 2) - table.attach(preampscale, 1, 2, 1, 2)
@ -159,13 +159,13 @@
#preampscalevalue.show() #preampscalevalue.show()
# Separator between preamp and bands # Separator between preamp and bands
- separator = gtk.VSeparator() - separator = Gtk.VSeparator()
- table.attach(separator, 2, 3, 1, 2) - table.attach(separator, 2, 3, 1, 2)
+ if GTK_VERSION >= (3, 10, 0): + if GTK_VERSION >= (3, 10, 0):
+ separator = gtk.Separator(orientation=gtk.Orientation.VERTICAL) + separator = Gtk.Separator(orientation=Gtk.Orientation.VERTICAL)
+ grid.attach(separator, 2, 1, 1, 1) + grid.attach(separator, 2, 1, 1, 1)
+ else: + else:
+ separator = gtk.VSeparator() + separator = Gtk.VSeparator()
+ grid.attach(separator, 2, 3, 1, 2) + grid.attach(separator, 2, 3, 1, 2)
#separator.show() #separator.show()
@ -174,21 +174,21 @@
self.labels = {} self.labels = {}
self.scalevalues = {} self.scalevalues = {}
for x in range(1,num_ladspa_controls+1): for x in range(1,num_ladspa_controls+1):
- scale = gtk.VScale() - scale = Gtk.VScale()
+ if GTK_VERSION >= (3, 2, 0): + if GTK_VERSION >= (3, 2, 0):
+ scale = gtk.Scale(orientation=gtk.Orientation.VERTICAL) + scale = Gtk.Scale(orientation=Gtk.Orientation.VERTICAL)
+ else: + else:
+ scale = gtk.VScale() + scale = Gtk.VScale()
self.scales[x] = scale self.scales[x] = scale
scale.set_draw_value(0) scale.set_draw_value(0)
scale.set_inverted(1) scale.set_inverted(1)
- scale.set_value_pos(gtk.POS_BOTTOM) - scale.set_value_pos(Gtk.POS_BOTTOM)
+ scale.set_value_pos(gtk.PositionType.BOTTOM) + scale.set_value_pos(Gtk.PositionType.BOTTOM)
scale.set_range(float(ranges[0]), float(ranges[1])) scale.set_range(float(ranges[0]), float(ranges[1]))
scale.set_increments(1, 0.1) scale.set_increments(1, 0.1)
scale.set_digits(1) scale.set_digits(1)
@@ -462,67 +496,79 @@ class Equalizer: @@ -462,67 +496,79 @@ class Equalizer:
scalevalue = gtk.Label() scalevalue = Gtk.Label()
self.scalevalues[x] = scalevalue self.scalevalues[x] = scalevalue
scalevalue.set_markup("<small>" + str(scale.get_value()) + "\ndB</small>") scalevalue.set_markup("<small>" + str(scale.get_value()) + "\ndB</small>")
- table.attach(label, x + 2, x + 3, 0, 1) - table.attach(label, x + 2, x + 3, 0, 1)
@ -209,27 +209,27 @@
- table.show() - table.show()
+ grid.show() + grid.show()
- vbox2 = gtk.VBox(True, 1) - vbox2 = Gtk.VBox(True, 1)
- vbox2.set_border_width(10) - vbox2.set_border_width(10)
+ if GTK_VERSION >= (3, 0, 0): + if GTK_VERSION >= (3, 0, 0):
+ vbox2 = gtk.Box(orientation=gtk.Orientation.VERTICAL, homogeneous=True, spacing=1) + vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=True, spacing=1)
+ vbox2.props.margin = 10 + vbox2.props.margin = 10
+ else: + else:
+ vbox2 = gtk.VBox(homogeneous=True, spacing=1) + vbox2 = Gtk.VBox(homogeneous=True, spacing=1)
+ vbox2.set_border_width(10) + vbox2.set_border_width(10)
hbox1.add(vbox2) hbox1.add(vbox2)
vbox2.show() vbox2.show()
presetslabel = gtk.Label() presetslabel = Gtk.Label()
presetslabel.set_markup("<small>Preset:</small>") presetslabel.set_markup("<small>Preset:</small>")
- vbox2.pack_start(presetslabel, False, False, 0) - vbox2.pack_start(presetslabel, False, False, 0)
+ vbox2.add(presetslabel) + vbox2.add(presetslabel)
presetslabel.show() presetslabel.show()
global presetsbox global presetsbox
- presetsbox = gtk.combo_box_entry_new_text() - presetsbox = Gtk.combo_box_entry_new_text()
- vbox2.pack_start(presetsbox, False, False, 0) - vbox2.pack_start(presetsbox, False, False, 0)
+ presetsbox = gtk.ComboBoxText.new_with_entry() + presetsbox = Gtk.ComboBoxText.new_with_entry()
+ vbox2.add(presetsbox) + vbox2.add(presetsbox)
presetsbox.get_child().set_text(preset) presetsbox.get_child().set_text(preset)
for i in range(len(rawpresets)): for i in range(len(rawpresets)):
@ -237,18 +237,18 @@
presetsbox.connect("changed", self.on_presetsbox, x) presetsbox.connect("changed", self.on_presetsbox, x)
presetsbox.show() presetsbox.show()
- savepreset = gtk.Button("Save Preset") - savepreset = Gtk.Button("Save Preset")
- vbox2.pack_start(savepreset, False, False, 0) - vbox2.pack_start(savepreset, False, False, 0)
+ savepreset = gtk.Button(label="Save Preset") + savepreset = Gtk.Button(label="Save Preset")
+ vbox2.add(savepreset) + vbox2.add(savepreset)
savepreset.connect("clicked", self.on_savepreset) savepreset.connect("clicked", self.on_savepreset)
savepreset.show() savepreset.show()
global eqenabled global eqenabled
- eqenabled = gtk.CheckButton("EQ Enabled") - eqenabled = Gtk.CheckButton("EQ Enabled")
+ eqenabled = gtk.CheckButton(label="EQ Enabled") + eqenabled = Gtk.CheckButton(label="EQ Enabled")
eqenabled.set_active(status) eqenabled.set_active(status)
- eqenabled.unset_flags(gtk.CAN_FOCUS) - eqenabled.unset_flags(Gtk.CAN_FOCUS)
+ eqenabled.set_can_focus(False) + eqenabled.set_can_focus(False)
eqenabled.connect("clicked", self.on_eqenabled) eqenabled.connect("clicked", self.on_eqenabled)
- vbox2.pack_start(eqenabled, False, False, 0) - vbox2.pack_start(eqenabled, False, False, 0)
@ -256,36 +256,36 @@
eqenabled.show() eqenabled.show()
global keepsettings global keepsettings
- keepsettings = gtk.CheckButton('Keep Settings') - keepsettings = Gtk.CheckButton("Keep Settings")
+ keepsettings = gtk.CheckButton(label="Keep Settings") + keepsettings = Gtk.CheckButton(label="Keep Settings")
keepsettings.set_active(persistence) keepsettings.set_active(persistence)
- keepsettings.unset_flags(gtk.CAN_FOCUS) - keepsettings.unset_flags(Gtk.CAN_FOCUS)
+ keepsettings.set_can_focus(False) + keepsettings.set_can_focus(False)
keepsettings.connect("clicked", self.on_keepsettings) keepsettings.connect("clicked", self.on_keepsettings)
- vbox2.pack_start(keepsettings, False, False, 0) - vbox2.pack_start(keepsettings, False, False, 0)
+ vbox2.add(keepsettings) + vbox2.add(keepsettings)
keepsettings.show() keepsettings.show()
- applysettings = gtk.Button("Apply Settings") - applysettings = Gtk.Button("Apply Settings")
- vbox2.pack_start(applysettings, False, False, 0) - vbox2.pack_start(applysettings, False, False, 0)
+ applysettings = gtk.Button(label="Apply Settings") + applysettings = Gtk.Button(label="Apply Settings")
+ vbox2.add(applysettings) + vbox2.add(applysettings)
applysettings.connect("clicked", self.on_applysettings) applysettings.connect("clicked", self.on_applysettings)
applysettings.show() applysettings.show()
- quitbutton = gtk.Button("Quit") - quitbutton = Gtk.Button("Quit")
- vbox2.pack_start(quitbutton, False, False, 0) - vbox2.pack_start(quitbutton, False, False, 0)
+ quitbutton = gtk.Button(label="Quit") + quitbutton = Gtk.Button(label="Quit")
+ vbox2.add(quitbutton) + vbox2.add(quitbutton)
quitbutton.connect("clicked", lambda w: gtk.main_quit()) quitbutton.connect("clicked", lambda w: Gtk.main_quit())
quitbutton.show() quitbutton.show()
- separator = gtk.HSeparator() - separator = Gtk.HSeparator()
- vbox2.pack_start(separator, False, False, 0) - vbox2.pack_start(separator, False, False, 0)
+ if GTK_VERSION >= (3, 2, 0): + if GTK_VERSION >= (3, 2, 0):
+ separator = gtk.Separator(orientation=gtk.Orientation.HORIZONTAL) + separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
+ else: + else:
+ separator = gtk.HSeparator() + separator = Gtk.HSeparator()
+ vbox2.add(separator) + vbox2.add(separator)
separator.set_size_request(100, 10) separator.set_size_request(100, 10)
#separator.show() #separator.show()