Define appname and app_id only once

This commit is contained in:
Teemu Ikonen 2022-10-07 21:27:54 +03:00
parent 1f1435ee2a
commit 247b7a5683

View file

@ -33,6 +33,8 @@ gi.require_version('Gdk', '3.0')
gi.require_version('Handy', '1')
from gi.repository import Gdk, Gio, GLib, Gtk, Handy # noqa: E402
appname = 'Satellite'
app_id = 'page.codeberg.tpikonen.satellite'
def is_on_mobile_screen(widget):
"""Return True if widget is on a small screen."""
@ -52,7 +54,7 @@ class SatelliteApp(Gtk.Application):
def __init__(self, *args, **kwargs):
Gtk.Application.__init__(
self, *args, application_id="page.codeberg.tpikonen.satellite",
self, *args, application_id=app_id,
flags=Gio.ApplicationFlags.FLAGS_NONE, **kwargs)
Handy.init()
@ -191,10 +193,9 @@ class SatelliteApp(Gtk.Application):
print("...done.")
def init_source(self):
self.log_msg(f"{appname} version {__version__} started")
source_init = False
self.log_msg(f"Satellite version {__version__} started")
self.log_msg(f'Trying to initialize source "{self.args.source}"')
if self.args.source == 'quectel':
@ -308,8 +309,8 @@ class SatelliteApp(Gtk.Application):
adlg = Gtk.AboutDialog(
transient_for=self.window,
modal=True,
program_name="Satellite",
logo_icon_name="page.codeberg.tpikonen.satellite",
program_name=appname,
logo_icon_name=app_id,
version=__version__,
comments="A program for showing navigation satellite data",
license_type=Gtk.License.GPL_3_0_ONLY,