def check_gui_dependencies(): if os.getenv("NICOTINE_GTK_VERSION") == '4': gtk_version = (4, 6, 0) pygobject_version = (3, 40, 0) else: gtk_version = pygobject_version = (3, 18, 0) try: import gi gi.check_version(pygobject_version) except (ImportError, ValueError): return _("Cannot find %s, please install it.") % ( "pygobject >= " + '.'.join(map(str, pygobject_version))) try: api_version = (gtk_version[0], 0) gi.require_version('Gtk', '.'.join(map(str, api_version))) except ValueError: return _("Cannot find %s, please install it.") % ("GTK " + str(gtk_version[0])) try: from gi.repository import Gtk except ImportError: return _( "Cannot import the Gtk module. Bad install of the python-gobject module?" ) if Gtk.check_version(*gtk_version): return _( "You are using an unsupported version of GTK %(major_version)s. You should install " "GTK %(complete_version)s or newer.") % { "major_version": gtk_version[0], "complete_version": '.'.join(map(str, gtk_version)) } try: if gtk_version[0] == 4 and os.getenv("NICOTINE_LIBADWAITA") == '1': gi.require_version('Adw', '1') from gi.repository import Adw Adw.init() except (ImportError, ValueError): pass return None
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. # # pylint: disable=E0611 from gi.repository import GObject from gi.repository import Gtk # pylint: enable=E0611 try: import gi gi.check_version("3.7.4") can_set_row_none = True except (ValueError, AttributeError): can_set_row_none = False def set_combo_text_column(combo, col): """ Set the text column of the passed combo to 'col'. Does the right thing whether it's a plain combo or a comboboxentry. Saves some typing. """ if combo.get_has_entry(): combo.set_entry_text_column(col) else: text = Gtk.CellRendererText()
from . import config_panel as _config_panel from . import action as _action, icons as _icons from .about import show_window as _show_about_window # # constants # _SMALL_BUTTON_ICON_SIZE = Gtk.IconSize.MENU _NORMAL_BUTTON_ICON_SIZE = Gtk.IconSize.BUTTON _TREE_ICON_SIZE = Gtk.IconSize.BUTTON _INFO_ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR _DEVICE_ICON_SIZE = Gtk.IconSize.DND try: import gi gi.check_version("3.7.4") _CAN_SET_ROW_NONE = None except (ValueError, AttributeError): _CAN_SET_ROW_NONE = '' # tree model columns _COLUMN = _NamedInts(PATH=0, NUMBER=1, ACTIVE=2, NAME=3, ICON=4, STATUS_TEXT=5, STATUS_ICON=6, DEVICE=7) _COLUMN_TYPES = (str, int, bool, str, str, str, str, TYPE_PYOBJECT) _TREE_SEPATATOR = (None, 0, False, None, None, None, None, None)
_log = getLogger(__name__) del getLogger # # constants # _SMALL_BUTTON_ICON_SIZE = Gtk.IconSize.MENU _NORMAL_BUTTON_ICON_SIZE = Gtk.IconSize.BUTTON _TREE_ICON_SIZE = Gtk.IconSize.BUTTON _INFO_ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR _DEVICE_ICON_SIZE = Gtk.IconSize.DND try: import gi gi.check_version('3.7.4') _CAN_SET_ROW_NONE = None except (ValueError, AttributeError): _CAN_SET_ROW_NONE = '' # tree model columns _COLUMN = _NamedInts(PATH=0, NUMBER=1, ACTIVE=2, NAME=3, ICON=4, STATUS_TEXT=5, STATUS_ICON=6, DEVICE=7) _COLUMN_TYPES = (str, int, bool, str, str, str, str, TYPE_PYOBJECT) _TREE_SEPATATOR = (None, 0, False, None, None, None, None, None)
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os import sys import dbus import gi # Gtk.Template requires at least version 3.30 gi.check_version("3.30") gi.require_version("Gtk", "3.0") from gi.repository import Gio, GLib, Gtk try: gi.require_version("AppIndicator3", "0.1") from gi.repository import AppIndicator3 as AppIndicator except (ValueError, ImportError): AppIndicator = None from .helper import apply_balanced, apply_performance from .window import CpupowerGuiWindow BUS = dbus.SystemBus()
import signal import sys import traceback import gi gi.require_version('LibvirtGLib', '1.0') from gi.repository import LibvirtGLib from virtinst import BuildConfig from virtinst import cli from virtinst import log from .lib.testmock import CLITestOptionsClass try: gi.check_version("3.22.0") except (ValueError, AttributeError): # pragma: no cover print("pygobject3 3.22.0 or later is required.") sys.exit(1) def _show_startup_error(msg, details): log.debug("Error starting virt-manager: %s\n%s", msg, details, exc_info=True) from .error import vmmErrorDialog err = vmmErrorDialog.get_instance() title = _("Error starting Virtual Machine Manager") errmsg = (_("Error starting Virtual Machine Manager: %(error)s") % { "error": msg
# vim: ts=2:sw=2:tw=80:nowrap import gi gi.check_version((3, 0, 0)) from .ui import ArbWave from . import about # remove things we don't want around del gi
gi.require_version('LibvirtGLib', '1.0') from gi.repository import LibvirtGLib from virtinst import BuildConfig from virtinst import cli from virtinst import log from .lib.testmock import CLITestOptionsClass # pygobject commit that I believe universally changed bool arguments # to handle passed None. Without this, None usage keeps slipping into # the code, so add the requirement. # https://github.com/GNOME/pygobject/commit/6c69fc7b582ec1fd3faef4de3fade9a0cb7f8c05 _PYGOBJECT_VERSION = "3.31.3" try: gi.check_version(_PYGOBJECT_VERSION) except (ValueError, AttributeError): # pragma: no cover print("pygobject3 %s or later is required." % _PYGOBJECT_VERSION) sys.exit(1) def _show_startup_error(msg, details): log.debug("Error starting virt-manager: %s\n%s", msg, details, exc_info=True) from .error import vmmErrorDialog err = vmmErrorDialog.get_instance() title = _("Error starting Virtual Machine Manager") errmsg = (_("Error starting Virtual Machine Manager: %(error)s") % { "error": msg
#!/usr/bin/python3 # -*- coding: utf-8 -*- # PulseAudio Equalizer (PyGtk Interface) # version: 2021.11 # # Maintainer: Luis Armando Medina Avitia <lamedina AT gmail DOT com> # # Intended for use in conjunction with pulseaudio-equalizer script # # Author: Conn O'Griofa <connogriofa AT gmail DOT com> # Version: (see '/usr/pulseaudio-equalizer' script) # import gi gi.check_version('3.30') gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gio, GLib import os, sys if 'PULSE_CONFIG_PATH' in os.environ: CONFIG_DIR = os.getenv('PULSE_CONFIG_PATH') elif 'XDG_CONFIG_HOME' in os.environ: CONFIG_DIR = os.path.join(os.getenv('XDG_CONFIG_HOME'), 'pulse') else: CONFIG_DIR = os.path.join(os.getenv('HOME'), '.config', 'pulse') CONFIG_FILE = os.path.join(CONFIG_DIR, 'equalizerrc') PRESETS_FILE = os.path.join(CONFIG_DIR, 'equalizerrc.availablepresets') USER_PRESET_DIR = os.path.join(CONFIG_DIR, 'presets') SYSTEM_PRESET_DIR = os.path.join('/usr/share/pulseaudio-equalizer', 'presets') if os.environ.get('GNOME_DESKTOP_SESSION_ID'):