2014-03-02 15:50:40 +00:00
|
|
|
#!/usr/bin/python3
|
2013-07-12 17:56:24 +00:00
|
|
|
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
2014-03-02 15:50:40 +00:00
|
|
|
# Mugshot - Lightweight user configuration utility
|
2020-12-29 03:55:14 +00:00
|
|
|
# Copyright (C) 2013-2020 Sean Davis <sean@bluesabre.org>
|
2014-03-02 15:50:40 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify it
|
2014-07-28 00:07:47 +00:00
|
|
|
# under the terms of the GNU General Public License as published by
|
2014-08-24 16:14:29 +00:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
2014-07-28 00:07:47 +00:00
|
|
|
# (at your option) any later version.
|
2014-03-02 15:50:40 +00:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranties of
|
|
|
|
# MERCHANTABILITY, SATISFACTORY QUALITY, 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/>.
|
2013-07-12 17:56:24 +00:00
|
|
|
|
2018-08-07 11:05:53 +00:00
|
|
|
import argparse
|
2016-03-27 02:12:05 +00:00
|
|
|
import signal
|
2013-07-12 17:56:24 +00:00
|
|
|
|
|
|
|
from locale import gettext as _
|
|
|
|
|
2014-03-02 15:50:40 +00:00
|
|
|
from gi.repository import Gtk # pylint: disable=E0611
|
2013-07-12 17:56:24 +00:00
|
|
|
|
|
|
|
from mugshot import MugshotWindow
|
|
|
|
|
2014-03-29 15:29:49 +00:00
|
|
|
from mugshot_lib import set_up_logging, get_version, helpers
|
2013-07-12 17:56:24 +00:00
|
|
|
|
2014-03-02 15:50:40 +00:00
|
|
|
|
2013-07-12 17:56:24 +00:00
|
|
|
def parse_options():
|
|
|
|
"""Support for command line options"""
|
2018-08-07 11:05:53 +00:00
|
|
|
parser = argparse.ArgumentParser(description="Mugshot %s" % get_version())
|
|
|
|
parser.add_argument(
|
2013-07-12 17:56:24 +00:00
|
|
|
"-v", "--verbose", action="count", dest="verbose",
|
|
|
|
help=_("Show debug messages (-vv debugs mugshot_lib also)"))
|
2018-08-07 11:05:53 +00:00
|
|
|
options = parser.parse_args()
|
2013-07-12 17:56:24 +00:00
|
|
|
|
|
|
|
set_up_logging(options)
|
|
|
|
|
2014-03-02 15:50:40 +00:00
|
|
|
|
2013-07-12 17:56:24 +00:00
|
|
|
def main():
|
|
|
|
'constructor for your class instances'
|
|
|
|
parse_options()
|
|
|
|
|
2014-03-02 15:50:40 +00:00
|
|
|
# Run the application.
|
2013-07-12 17:56:24 +00:00
|
|
|
window = MugshotWindow.MugshotWindow()
|
|
|
|
window.show()
|
2016-10-18 10:34:57 +00:00
|
|
|
|
2016-03-27 02:12:05 +00:00
|
|
|
# Allow application shutdown with Ctrl-C in terminal
|
|
|
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
2013-07-12 17:56:24 +00:00
|
|
|
Gtk.main()
|
2014-03-29 15:29:49 +00:00
|
|
|
|
|
|
|
# Cleanup temporary files
|
2014-04-02 01:42:05 +00:00
|
|
|
helpers.clear_tempfiles()
|