Skip to content

Commit

Permalink
Initial app with Blueprint
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Maksimov committed Nov 16, 2023
0 parents commit 3810108
Show file tree
Hide file tree
Showing 24 changed files with 624 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea
.flatpak-builder/

/subprojects/blueprint-compiler

__pycache__
*.local
*.db
21 changes: 21 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Andrey Maksimov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# bureau

A description of this project.
51 changes: 51 additions & 0 deletions bin/bureau.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!@PYTHON@

# MIT License
#
# Copyright (c) 2023 Andrey Maksimov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# SPDX-License-Identifier: MIT

import os
import sys
import signal
import locale
import gettext

VERSION = '@VERSION@'
pkgdatadir = '@pkgdatadir@'
localedir = '@localedir@'

sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)
locale.bindtextdomain('bureau', localedir)
locale.textdomain('bureau')
gettext.install('bureau', localedir)

if __name__ == '__main__':
import gi

from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'bureau.gresource'))
resource._register()

from bureau import main
sys.exit(main.main(VERSION))
21 changes: 21 additions & 0 deletions bin/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@



python = import('python')

conf = configuration_data()
conf.set('PYTHON', python.find_installation('python3').path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', get_option('prefix') / get_option('localedir'))
conf.set('pkgdatadir', pkgdatadir)

configure_file(
input: 'bureau.in',
output: 'bureau',
configuration: conf,
install: true,
install_dir: get_option('bindir'),
install_mode: 'r-xr--r--'
)


Empty file added bureau/__init__.py
Empty file.
90 changes: 90 additions & 0 deletions bureau/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# MIT License
#
# Copyright (c) 2023 Andrey Maksimov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# SPDX-License-Identifier: MIT

import sys
import gi

gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')

from gi.repository import Gtk, Gio, Adw
from .window import BureauWindow


class BureauApplication(Adw.Application):
"""The main application singleton class."""

def __init__(self):
super().__init__(application_id='com.tenderowl.bureau',
flags=Gio.ApplicationFlags.DEFAULT_FLAGS)
self.create_action('quit', lambda *_: self.quit(), ['<primary>q'])
self.create_action('about', self.on_about_action)
self.create_action('preferences', self.on_preferences_action)

def do_activate(self):
"""Called when the application is activated.
We raise the application's main window, creating it if
necessary.
"""
win = self.props.active_window
if not win:
win = BureauWindow(application=self)
win.present()

def on_about_action(self, widget, _):
"""Callback for the app.about action."""
about = Adw.AboutWindow(transient_for=self.props.active_window,
application_name='bureau',
application_icon='com.tenderowl.bureau',
developer_name='Andrey Maksimov',
version='0.1.0',
developers=['Andrey Maksimov'],
copyright='© 2023 Andrey Maksimov')
about.present()

def on_preferences_action(self, widget, _):
"""Callback for the app.preferences action."""
print('app.preferences action activated')

def create_action(self, name, callback, shortcuts=None):
"""Add an application action.
Args:
name: the name of the action
callback: the function to be called when the action is
activated
shortcuts: an optional list of accelerators
"""
action = Gio.SimpleAction.new(name, None)
action.connect("activate", callback)
self.add_action(action)
if shortcuts:
self.set_accels_for_action(f"app.{name}", shortcuts)


def main(version):
"""The application's entry point."""
app = BureauApplication()
return app.run(sys.argv)
35 changes: 35 additions & 0 deletions bureau/window.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# MIT License
#
# Copyright (c) 2023 Andrey Maksimov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# SPDX-License-Identifier: MIT

from gi.repository import Adw
from gi.repository import Gtk

@Gtk.Template(resource_path='/com/tenderowl/bureau/ui/window.ui')
class BureauWindow(Adw.ApplicationWindow):
__gtype_name__ = 'BureauWindow'

label = Gtk.Template.Child()

def __init__(self, **kwargs):
super().__init__(**kwargs)
38 changes: 38 additions & 0 deletions com.tenderowl.bureau.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"app-id" : "com.tenderowl.bureau",
"runtime" : "org.gnome.Platform",
"runtime-version" : "45",
"sdk" : "org.gnome.Sdk",
"command" : "bureau",
"finish-args" : [
"--share=network",
"--share=ipc",
"--socket=fallback-x11",
"--device=dri",
"--socket=wayland"
],
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"*.la",
"*.a"
],
"modules" : [
{
"name" : "bureau",
"builddir" : true,
"buildsystem" : "meson",
"sources" : [
{
"type" : "git",
"url" : "file:///home/meamka/Documents/Python"
}
]
}
]
}
7 changes: 7 additions & 0 deletions data/bureau.gresource.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/tenderowl/bureau">
<file preprocess="xml-stripblanks">ui/window.ui</file>
<file preprocess="xml-stripblanks">ui/help-overlay.ui</file>
</gresource>
</gresources>
8 changes: 8 additions & 0 deletions data/com.tenderowl.bureau.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=bureau
Exec=bureau
Icon=com.tenderowl.bureau
Terminal=false
Type=Application
Categories=GTK;
StartupNotify=true
5 changes: 5 additions & 0 deletions data/com.tenderowl.bureau.gschema.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="bureau">
<schema id="com.tenderowl.bureau" path="/com/tenderowl/bureau/">
</schema>
</schemalist>
9 changes: 9 additions & 0 deletions data/com.tenderowl.bureau.metainfo.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>com.tenderowl.bureau.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>MIT</project_license>
<description>
<p>No description</p>
</description>
</component>
Loading

0 comments on commit 3810108

Please sign in to comment.