starts and closes

xkb
sezanzeb 4 years ago committed by sezanzeb
parent 163f1b646d
commit f50a7063e8

@ -2,7 +2,9 @@
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>

@ -29,9 +29,9 @@ from argparse import ArgumentParser
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GLib', '2.0')
from gi.repository import Gtk, GLib
from gi.repository import Gtk
from keymapper.util import find_devices
from keymapper.data import get_data_path
from keymapper.logger import logger, update_verbosity, log_info
@ -44,7 +44,7 @@ class Window:
builder.connect_signals(self)
self.builder = builder
window = builder.get_object('key-mapper-gtk_window')
window = builder.get_object('window')
window.show()
self.window = window
@ -52,6 +52,10 @@ class Window:
"""Get a widget from the window"""
return self.builder.get_object(name)
def on_close(self, *_):
"""Safely close the application."""
Gtk.main_quit()
if __name__ == '__main__':
parser = ArgumentParser()

@ -2,8 +2,9 @@
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkWindow">
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<signal name="delete-event" handler="on_close" swapped="no"/>
<child>
<object class="GtkBox">
<property name="visible">True</property>

@ -30,17 +30,7 @@ from keymapper.logger import logger
_config = None
_defaults = {
'pcm_input': 'null',
'input_use_dsnoop': True,
'input_use_softvol': True,
'input_plugin': 'hw',
'pcm_output': 'null',
'output_use_dmix': True,
'output_use_softvol': True,
'output_channels': 2,
'output_plugin': 'hw'
}
_defaults = {}
def _modify_config(config_contents, key, value):

@ -0,0 +1,47 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# ALSA-Control - ALSA configuration interface
# Copyright (C) 2020 sezanzeb <proxima@hip70890b.de>
#
# This file is part of ALSA-Control.
#
# ALSA-Control is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ALSA-Control 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 ALSA-Control. If not, see <https://www.gnu.org/licenses/>.
"""Query settings."""
import os
import site
import pkg_resources
def get_data_path():
"""Depending on the installation prefix, return the data dir."""
source_path = pkg_resources.require('keymapper')[0].location
# depending on where this file is installed to, make sure to use the proper
# prefix path for data
# https://docs.python.org/3/distutils/setupscript.html?highlight=package_data#installing-additional-files # noqa
if source_path.startswith(site.USER_BASE):
data_path = os.path.join(site.USER_BASE, 'share/key-mapper')
elif source_path.startswith('/usr/local/'):
data_path = '/usr/local/share/key-mapper'
elif source_path.startswith('/usr/'):
data_path = '/usr/share/key-mapper'
else:
# installed with -e, running from the cloned git source
data_path = os.path.join(source_path, 'data')
return data_path
Loading…
Cancel
Save