Commit e9971750 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

code cleanup & i18n fixes

parent 059e0d59
Pipeline #58349 passed with stages
in 2 minutes and 18 seconds
......@@ -103,6 +103,6 @@
</releases>
<developer_name>Bilal Elmoussaoui</developer_name>
<update_contact>bil.elmoussaoui@gmail.com</update_contact>
<translation type="gettext">Authenticator</translation>
<translation type="gettext">@gettext-package@</translation>
<launchable type="desktop-id">@appid@.desktop</launchable>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema path="@schema-path@" id="@app-id@" gettext-domain="Authenticator">
<schema path="@schema-path@" id="@app-id@" gettext-domain="@gettext-package@">
<key name="window-position" type="ai">
<default>[0,0]</default>
<summary>Default window position</summary>
......
......@@ -28,6 +28,7 @@ gnome.compile_resources(
# Install gschema
gschema_conf = configuration_data()
gschema_conf.set('app-id', application_id)
gschema_conf.set('gettext_package', gettext_package)
if get_option('profile') == 'development'
gschema_conf.set('schema-path', '/com/github/bilelmoussaoui/Authenticator/')
else
......@@ -91,6 +92,7 @@ endif
# Freedesktop AppData File
appdata_conf = configuration_data()
appdata_conf.set('appid', application_id)
appdata_conf.set('gettext_package', gettext_package)
appdata_file = i18n.merge_file(
'appdata',
input: configure_file(
......
......@@ -8,12 +8,15 @@ python = import('python3')
gnome = import('gnome')
i18n = import('i18n')
gettext_package = 'Authenticator'
if get_option('profile') == 'development'
profile = 'Devel'
name_suffix = ' (Development)'
else
profile = ''
name_suffix = ''
gettext_package += '-devel'
endif
application_id = 'com.github.bilelmoussaoui.Authenticator@0@'.format(profile)
......@@ -45,7 +48,7 @@ LIBEXEC_DIR = join_paths(get_option('prefix'), get_option('libexecdir'))
# Configuration params
conf = configuration_data()
conf.set('APP_ID', application_id)
conf.set('GETTEXT_PACKAGE', meson.project_name())
conf.set('GETTEXT_PACKAGE', gettext_package)
conf.set('PKGDATA_DIR', PKGDATA_DIR)
conf.set('LOCALE_DIR', LOCALE_DIR)
conf.set('PYTHON_DIR', join_paths(get_option('prefix'), python.sysconfig_path('purelib')))
......
......@@ -3,7 +3,12 @@ data/com.github.bilelmoussaoui.Authenticator.appdata.xml.in.in
data/com.github.bilelmoussaoui.Authenticator.desktop.in.in
data/com.github.bilelmoussaoui.Authenticator.gschema.xml.in
data/ui/about_dialog.ui.in
data/ui/account_add.ui
data/ui/account_edit.ui
data/ui/account_row.ui
data/ui/settings.ui.in
data/ui/shortcuts.ui
data/ui/window.ui.in
src/authenticator.py.in
src/Authenticator/application.py.in
src/Authenticator/models/account.py
......@@ -13,4 +18,3 @@ src/Authenticator/widgets/accounts/list.py
src/Authenticator/widgets/accounts/row.py
src/Authenticator/widgets/settings.py
src/Authenticator/widgets/utils.py
src/Authenticator/widgets/window.py
i18n.gettext('Authenticator', preset: 'glib')
i18n.gettext(gettext_package, preset: 'glib')
......@@ -18,3 +18,5 @@
"""
from .application import Application
from .utils import load_pixbuf, load_pixbuf_from_provider
from .models import *
from .widgets import *
......@@ -17,13 +17,10 @@
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import gettext as _
from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib, Gio, Gdk, GObject
from .widgets import Window, WindowState, AboutDialog, import_json, export_json
from .models import Database, Settings, Clipboard, Logger, Keyring
from Authenticator.widgets import Window, WindowState, AboutDialog, import_json, export_json
from Authenticator.models import Database, Settings, Clipboard, Logger, Keyring
class Application(Gtk.Application):
......
......@@ -16,14 +16,17 @@
You should have received a copy of the GNU General Public License
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from .account import Account
from .accounts_manager import AccountsManager
from .backup import BackupJSON
from .clipboard import Clipboard
from .database import Database
from .keyring import Keyring
from .logger import Logger
from .otp import OTP
from .qr_reader import QRReader
from .screenshot import GNOMEScreenshot
from .settings import Settings
from Authenticator.models.logger import Logger
from Authenticator.models.otp import OTP
from Authenticator.models.clipboard import Clipboard
from Authenticator.models.database import Database
from Authenticator.models.keyring import Keyring
from Authenticator.models.account import Account
from Authenticator.models.accounts_manager import AccountsManager
from Authenticator.models.backup import BackupJSON
from Authenticator.models.qr_reader import QRReader
from Authenticator.models.screenshot import GNOMEScreenshot
from Authenticator.models.settings import Settings
......@@ -20,11 +20,7 @@ from hashlib import sha256
from gettext import gettext as _
from gi.repository import GObject
from .clipboard import Clipboard
from .database import Database
from .keyring import Keyring
from .logger import Logger
from .otp import OTP
from Authenticator.models import Clipboard, Database, Keyring, Logger, OTP
class Account(GObject.GObject):
......
......@@ -18,7 +18,6 @@
"""
from threading import Thread
from time import sleep
from gi.repository import GObject
......
......@@ -19,10 +19,7 @@
import json
from gi.repository import Gio
from .account import Account
from .accounts_manager import AccountsManager
from .keyring import Keyring
from .logger import Logger
from Authenticator.models import Account, AccountsManager, Logger, Keyring
class Backup:
......
......@@ -16,10 +16,6 @@
You should have received a copy of the GNU General Public License
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gdk, Gtk
......
......@@ -19,10 +19,9 @@
import sqlite3
from collections import OrderedDict
from os import path, makedirs
from gi.repository import GLib
from .logger import Logger
from Authenticator.models import Logger
class Database:
......
......@@ -16,9 +16,6 @@
You should have received a copy of the GNU General Public License
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gi import require_version
require_version('Secret', '1')
from gi.repository import Secret
......
......@@ -18,7 +18,7 @@
"""
import binascii
from .logger import Logger
from Authenticator.models import Logger
try:
from pyotp import TOTP
......
......@@ -22,8 +22,7 @@ from urllib.parse import urlparse, parse_qsl, unquote
from PIL import Image
from pyzbar.pyzbar import decode
from .logger import Logger
from .otp import OTP
from Authenticator.models import Logger, OTP
class QRReader:
......
......@@ -17,11 +17,7 @@
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from os import environ
from gi import require_version
require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf, GLib, Gio
from gi.repository import Gtk, GdkPixbuf, GLib
def load_pixbuf(icon_name, size):
......
......@@ -18,15 +18,10 @@
"""
import json
from gettext import gettext as _
from gi.repository import Gio, Gtk, GObject, GLib
from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gio, Gtk, GObject, Gdk, GLib
from ...models import OTP
from ...utils import load_pixbuf_from_provider
from Authenticator.models import OTP
from Authenticator.utils import load_pixbuf_from_provider
@Gtk.Template(resource_path='/com/github/bilelmoussaoui/Authenticator/account_add.ui')
class AddAccountWindow(Gtk.Window):
......@@ -91,8 +86,8 @@ class AccountConfig(Gtk.Box, GObject.GObject):
token_entry = Gtk.Template.Child()
provider_combobox = Gtk.Template.Child()
provider_entry = Gtk.Template.Child()
providers_store = Gtk.Template.Child()
providers_store = Gtk.Template.Child()
provider_completion = Gtk.Template.Child()
notification = Gtk.Template.Child()
notification_label = Gtk.Template.Child()
......
......@@ -17,13 +17,9 @@
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import gettext as _
from gi.repository import Gtk, GObject
from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GObject
from .add import AccountConfig
from Authenticator.widgets.accounts.add import AccountConfig
@Gtk.Template(resource_path='/com/github/bilelmoussaoui/Authenticator/account_edit.ui')
class EditAccountWindow(Gtk.Window, GObject.GObject):
......
......@@ -17,16 +17,11 @@
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import gettext as _
from gi.repository import Gtk, GObject, Handy
from gi import require_version
require_version("Gtk", "3.0")
require_version("Handy", "0.0")
from gi.repository import Gtk, GObject, Gio, Handy
from .row import AccountRow
from ...models import Database, Account, AccountsManager
from ...utils import load_pixbuf_from_provider
from Authenticator.widgets.accounts.row import AccountRow
from Authenticator.models import Account, AccountsManager
from Authenticator.utils import load_pixbuf_from_provider
class AccountsWidget(Gtk.Box, GObject.GObject):
......
......@@ -17,13 +17,9 @@
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import gettext as _
from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject
from .edit import EditAccountWindow
from Authenticator.widgets.accounts.edit import EditAccountWindow
@Gtk.Template(resource_path='/com/github/bilelmoussaoui/Authenticator/account_row.ui')
class AccountRow(Gtk.ListBoxRow, GObject.GObject):
......
......@@ -16,7 +16,6 @@
You should have received a copy of the GNU General Public License
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import gettext as _
from gi.repository import Gio, GLib, Gtk, GObject
......
from gettext import gettext as _
"""
Copyright © 2017 Bilal Elmoussaoui <bil.elmoussaoui@gmail.com>
This file is part of Authenticator.
from gi import require_version
Authenticator 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.
require_version("Gtk", "3.0")
Authenticator 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 Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import gettext as _
from gi.repository import Gtk
......
......@@ -16,8 +16,6 @@
You should have received a copy of the GNU General Public License
along with Authenticator. If not, see <http://www.gnu.org/licenses/>.
"""
from gettext import gettext as _
from gi.repository import Gtk, GObject, Gio, GLib
from ..models import Logger, Settings, AccountsManager
from .accounts import AccountsWidget, AddAccountWindow
......
......@@ -26,7 +26,9 @@ import sys
from os import path
from gettext import gettext as _
from gi import require_version
require_version('Gtk', '3.0')
require_version("Handy", "0.0")
require_version('Secret', '1')
from gi.repository import Gio
sys.path.insert(1, '@PYTHON_EXEC_DIR@')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment