Commit 9f43e772 authored by Nico Alt's avatar Nico Alt

Clean up project tree by renaming src to briar-gtk and move parts into it

parent 90426f9d
......@@ -47,7 +47,7 @@ def prepare():
prepare_resource()
def start_application():
from briar.gtk.application import Application
from briar_gtk.application import Application
sys.exit(Application().run(sys.argv))
if __name__ == '__main__':
......
......@@ -13,9 +13,9 @@ from gi.repository import Gdk, Gio, GLib, Gtk
from briar_wrapper.api import Api
from briar.gtk.define import APPLICATION_ID, APPLICATION_NAME
from briar.gtk.define import APPLICATION_STYLING_PATH, BRIAR_HEADLESS_JAR
from briar.gtk.window import Window
from briar_gtk.define import APPLICATION_ID, APPLICATION_NAME
from briar_gtk.define import APPLICATION_STYLING_PATH, BRIAR_HEADLESS_JAR
from briar_gtk.window import Window
class Application(Gtk.Application):
......
......@@ -7,8 +7,9 @@ from gettext import gettext as _
from gi.repository import GLib
from briar_wrapper.models.contacts import Contacts
from briar.gtk.container import Container
from briar.gtk.define import APP
from briar_gtk.container import Container
from briar_gtk.define import APP
class AddContactContainer(Container):
......
......@@ -5,8 +5,9 @@
from gi.repository import GLib, Gtk
from briar_wrapper.models.private_chat import PrivateChat
from briar.gtk.container import Container
from briar.gtk.define import APP
from briar_gtk.container import Container
from briar_gtk.define import APP
class ChatContainer(Container):
......
......@@ -4,8 +4,8 @@
from gi.repository import GLib
from briar.gtk.container import Container
from briar.gtk.define import APP
from briar_gtk.container import Container
from briar_gtk.define import APP
class LoginContainer(Container):
......
......@@ -5,8 +5,9 @@
from gi.repository import GLib, Gtk
from briar_wrapper.models.contacts import Contacts
from briar.gtk.container import Container
from briar.gtk.define import APP
from briar_gtk.container import Container
from briar_gtk.define import APP
class MainContainer(Container):
......
......@@ -6,8 +6,8 @@ from gettext import gettext as _
from gi.repository import GLib
from briar.gtk.container import Container
from briar.gtk.define import APP
from briar_gtk.container import Container
from briar_gtk.define import APP
class RegistrationContainer(Container):
......
......@@ -2,10 +2,10 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
from briar.gtk.container import Container
from briar.gtk.containers.login import LoginContainer
from briar.gtk.containers.registration import RegistrationContainer
from briar.gtk.define import APP
from briar_gtk.container import Container
from briar_gtk.containers.login import LoginContainer
from briar_gtk.containers.registration import RegistrationContainer
from briar_gtk.define import APP
class StartupContainer(Container):
......
......@@ -8,7 +8,7 @@
from gi.repository import Gtk
from briar.gtk.define import APPLICATION_NAME
from briar_gtk.define import APPLICATION_NAME
class Toolbar(Gtk.HeaderBar):
......
......@@ -4,12 +4,12 @@
from gi.repository.Gtk import ApplicationWindow, Grid
from briar.gtk.containers.add_contact import AddContactContainer
from briar.gtk.containers.chat import ChatContainer
from briar.gtk.containers.main import MainContainer
from briar.gtk.containers.startup import StartupContainer
from briar.gtk.define import APP, APPLICATION_ID, APPLICATION_NAME
from briar.gtk.toolbar import Toolbar
from briar_gtk.containers.add_contact import AddContactContainer
from briar_gtk.containers.chat import ChatContainer
from briar_gtk.containers.main import MainContainer
from briar_gtk.containers.startup import StartupContainer
from briar_gtk.define import APP, APPLICATION_ID, APPLICATION_NAME
from briar_gtk.toolbar import Toolbar
class Window(ApplicationWindow):
......
......@@ -3,7 +3,9 @@
# License-Filename: LICENSE.md
PACKAGE_DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
MODULE_DIR = join_paths(PACKAGE_DATA_DIR, 'briar')
subdir('data')
subdir('po')
python3 = import('python3')
......@@ -21,4 +23,6 @@ configure_file(
install_dir: get_option('bindir')
)
install_subdir('briar/gtk', install_dir: MODULE_DIR)
install_subdir('briar_gtk', install_dir: PACKAGE_DATA_DIR)
meson.add_install_script('meson_post_install.py')
......@@ -7,18 +7,19 @@ from unittest.mock import Mock
import pytest
from briar_wrapper.api import Api
from briar.gtk.application import Application
from briar.gtk.define import APPLICATION_NAME, APPLICATION_STYLING_PATH
from briar.gtk.define import BRIAR_HEADLESS_JAR
from briar.gtk.window import Window
from briar_gtk.application import Application
from briar_gtk.define import APPLICATION_NAME, APPLICATION_STYLING_PATH
from briar_gtk.define import BRIAR_HEADLESS_JAR
from briar_gtk.window import Window
def test_do_startup(mocker):
do_startup_mock = mocker.patch("gi.repository.Gtk.Application.do_startup")
_setup_styling_mock = mocker.patch(
"briar.gtk.application.Application._setup_styling")
"briar_gtk.application.Application._setup_styling")
_setup_api_mock = mocker.patch(
"briar.gtk.application.Application._setup_api")
"briar_gtk.application.Application._setup_api")
Application().do_startup()
......@@ -29,7 +30,7 @@ def test_do_startup(mocker):
def test_do_activate(mocker):
_setup_window_mock = mocker.patch(
"briar.gtk.application.Application._setup_window")
"briar_gtk.application.Application._setup_window")
Application().do_activate()
......@@ -39,8 +40,8 @@ def test_do_activate(mocker):
def test_quit(mocker):
api_mock = mocker.patch("briar_wrapper.api.Api")
api_stop_mock = mocker.patch("briar_wrapper.api.Api.stop")
window_mock = mocker.patch("briar.gtk.window.Window")
window_hide_mock = mocker.patch("briar.gtk.window.Window.hide")
window_mock = mocker.patch("briar_gtk.window.Window")
window_hide_mock = mocker.patch("briar_gtk.window.Window.hide")
quit_mock = mocker.patch("gi.repository.Gio.Application.quit")
application = Application()
......@@ -105,9 +106,9 @@ def test_setup_api(mocker):
def test_setup_window(mocker):
mocker.patch("briar.gtk.window.Window.__init__").return_value = None
window_show_mock = mocker.patch("briar.gtk.window.Window.show")
window_present_mock = mocker.patch("briar.gtk.window.Window.present")
mocker.patch("briar_gtk.window.Window.__init__").return_value = None
window_show_mock = mocker.patch("briar_gtk.window.Window.show")
window_present_mock = mocker.patch("briar_gtk.window.Window.present")
Application()._setup_window()
......@@ -116,7 +117,7 @@ def test_setup_window(mocker):
def test_setup_window_has_attribute(mocker):
mocker.patch("briar.gtk.window.Window.__init__").return_value = None
mocker.patch("briar_gtk.window.Window.__init__").return_value = None
window_mock = Mock()
application = Application()
......@@ -129,9 +130,9 @@ def test_setup_window_has_attribute(mocker):
def test_setup_window_has_none_attribute(mocker):
mocker.patch("briar.gtk.window.Window.__init__").return_value = None
window_show_mock = mocker.patch("briar.gtk.window.Window.show")
window_present_mock = mocker.patch("briar.gtk.window.Window.present")
mocker.patch("briar_gtk.window.Window.__init__").return_value = None
window_show_mock = mocker.patch("briar_gtk.window.Window.show")
window_present_mock = mocker.patch("briar_gtk.window.Window.present")
application = Application()
......
......@@ -5,14 +5,14 @@
import pytest
from unittest.mock import Mock
from briar.gtk.toolbar import Toolbar
from briar_gtk.toolbar import Toolbar
def test_show_back_button(mocker):
get_object_mock = mocker.patch("gi.repository.Gtk.Builder.get_object")
back_button_mock = get_object_mock.return_value
callback = Mock()
mocker.patch("briar.gtk.toolbar.Toolbar._setup_toolbar")
mocker.patch("briar_gtk.toolbar.Toolbar._setup_toolbar")
Toolbar().show_back_button(True, callback)
......@@ -25,7 +25,7 @@ def test_show_back_button(mocker):
def test_show_back_button_without_callback(mocker):
get_object_mock = mocker.patch("gi.repository.Gtk.Builder.get_object")
back_button_mock = get_object_mock.return_value
mocker.patch("briar.gtk.toolbar.Toolbar._setup_toolbar")
mocker.patch("briar_gtk.toolbar.Toolbar._setup_toolbar")
with pytest.raises(Exception,
match="Callback needed when showing back button"):
......@@ -40,7 +40,7 @@ def test_show_back_button_without_callback(mocker):
def test_hide_back_button(mocker):
get_object_mock = mocker.patch("gi.repository.Gtk.Builder.get_object")
back_button_mock = get_object_mock.return_value
mocker.patch("briar.gtk.toolbar.Toolbar._setup_toolbar")
mocker.patch("briar_gtk.toolbar.Toolbar._setup_toolbar")
Toolbar().show_back_button(False)
......
......@@ -10,8 +10,4 @@ project(
i18n = import('i18n')
subdir('data')
subdir('src')
subdir('po')
meson.add_install_script('src/meson_post_install.py')
subdir('briar-gtk')
......@@ -11,14 +11,14 @@ function generate_resource()
echo '<?xml version="1.0" encoding="UTF-8"?>'
echo '<gresources>'
echo ' <gresource prefix="/app/briar/gtk">'
for file in data/ui/*.css
for file in briar-gtk/data/ui/*.css
do
echo -n ' <file compressed="true">'
echo -n 'ui/'
echo -n $(basename $file)
echo '</file>'
done
for file in data/ui/*.ui
for file in briar-gtk/data/ui/*.ui
do
echo -n ' <file compressed="true" preprocess="xml-stripblanks">'
echo -n 'ui/'
......@@ -31,10 +31,10 @@ function generate_resource()
function generate_po()
{
cd po
cd briar-gtk/po
# git pull https://www.transifex.com/otf/briar/
>briar-gtk.pot
for file in ../data/app.briar.gtk.gschema.xml ../data/ui/*.ui $(find "../src/briar" -name '*.py');
for file in ../data/app.briar.gtk.gschema.xml ../data/ui/*.ui $(find "../briar_gtk" -name '*.py');
do
xgettext --from-code=UTF-8 -j $file -o briar-gtk.pot
done
......@@ -48,5 +48,5 @@ function generate_po()
done
}
generate_resource > data/ui/app.briar.gtk.gresource.xml
generate_resource > briar-gtk/data/ui/app.briar.gtk.gresource.xml
generate_po
......@@ -3,4 +3,4 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
pycodestyle --show-source --show-pep8 src tests
pycodestyle --show-source --show-pep8 briar-gtk/briar_gtk briar-gtk/tests
......@@ -3,4 +3,4 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
pylint src tests
pylint briar-gtk/briar_gtk briar-gtk/tests
......@@ -3,4 +3,4 @@
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
PYTHONPATH=src pytest --cov=src tests/
PYTHONPATH=briar-gtk/briar_gtk pytest --cov=briar_gtk briar-gtk/tests/
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