diff --git a/gaphor/services/helpservice.py b/gaphor/services/helpservice.py deleted file mode 100644 index 120d50260..000000000 --- a/gaphor/services/helpservice.py +++ /dev/null @@ -1,53 +0,0 @@ -"""About and help services. (help browser anyone?)""" - - -import importlib_metadata -from gi.repository import GdkPixbuf, Gtk - -from gaphor import __version__ -from gaphor.abc import ActionProvider, Service -from gaphor.core import action - - -class HelpService(Service, ActionProvider): - def __init__(self, main_window): - self.main_window = main_window - - def shutdown(self): - pass - - @action(name="app.about") - def about(self): - logo_file = importlib_metadata.distribution("gaphor").locate_file( - "gaphor/ui/pixmaps/gaphor-96x96.png" - ) - logo = GdkPixbuf.Pixbuf.new_from_file(str(logo_file)) - about = Gtk.AboutDialog.new() - about.set_logo(logo) - about.set_title("About Gaphor") - about.set_program_name("Gaphor") - about.set_comments("Gaphor is the simple modeling tool written in Python") - about.set_version(str(__version__)) - about.set_copyright("Copyright (c) 2001-2019 Arjan J. Molenaar and Dan Yeaw") - about.set_license( - "This software is published under the terms of the\n" - "Apache Software License, version 2.0.\n" - "See the LICENSE.txt file for details." - ) - about.set_website("https://github.com/gaphor/gaphor") - about.set_website_label("Fork me on GitHub") - about.set_authors( - [ - "Arjan Molenaar, Artur Wroblewski,", - "Jeroen Vloothuis, Dan Yeaw, ", - "Enno Groeper, Adam Boduch, ", - "Alexis Howells, Melis Doğan", - ] - ) - about.set_translator_credits( - "Jordi Mallach (ca), " "Antonin Delpeuch (fr), " "Ygor Mutti (pt_BR)" - ) - about.set_transient_for(self.main_window.window) - about.show_all() - about.run() - about.destroy() diff --git a/gaphor/services/helpservice/__init__.py b/gaphor/services/helpservice/__init__.py new file mode 100644 index 000000000..9ba5885c5 --- /dev/null +++ b/gaphor/services/helpservice/__init__.py @@ -0,0 +1,50 @@ +"""About and help services. (help browser anyone?)""" + + +import importlib + +from gi.repository import GdkPixbuf, Gtk + +from gaphor import __version__ +from gaphor.abc import ActionProvider, Service +from gaphor.core import action + + +class HelpService(Service, ActionProvider): + def __init__(self, main_window): + self.main_window = main_window + + def shutdown(self): + pass + + @action(name="app.about") + def about(self): + builder = Gtk.Builder() + with importlib.resources.path( + "gaphor.services.helpservice", "about.glade" + ) as glade_file: + builder.add_objects_from_file(str(glade_file), ("about",)) + + about = builder.get_object("about") + + about.set_version(str(__version__)) + + about.set_transient_for(self.main_window.window) + + about.show_all() + about.run() + about.destroy() + + @action(name="app.shortcuts") + def shortcuts(self): + builder = Gtk.Builder() + with importlib.resources.path( + "gaphor.services.helpservice", "shortcuts.glade" + ) as glade_file: + builder.add_objects_from_file(str(glade_file), ("shortcuts-gaphor",)) + + shortcuts = builder.get_object("shortcuts-gaphor") + shortcuts.set_transient_for(self.main_window.window) + + shortcuts.show_all() + return shortcuts diff --git a/gaphor/services/helpservice/about.glade b/gaphor/services/helpservice/about.glade new file mode 100644 index 000000000..ece5b0698 --- /dev/null +++ b/gaphor/services/helpservice/about.glade @@ -0,0 +1,54 @@ + + + + + + False + dialog + Gaphor + 1.1.0 + Copyright © 2001-2019 Arjan J. Molenaar and Dan Yeaw + Gaphor is the simple modeling tool written in Python + https://github.com/gaphor/gaphor + Fork me on GitHub + This software is published under the terms of the +Apache Software License, version 2.0. +See the LICENSE.txt file for details. + Arjan Molenaar, Artur Wroblewski, +Jeroen Vloothuis, Dan Yeaw, +Enno Groeper, Adam Boduch, +Alexis Howells, Melis Doğan + Jordi Mallach (ca), Antonin Delpeuch (fr), Ygor Mutti (pt_BR) + gaphor-96x96.png + + + + + + False + vertical + 2 + + + False + end + + + + + + + + + False + False + 0 + + + + + + + + + diff --git a/gaphor/services/helpservice/gaphor-96x96.png b/gaphor/services/helpservice/gaphor-96x96.png new file mode 100644 index 000000000..f49890f40 Binary files /dev/null and b/gaphor/services/helpservice/gaphor-96x96.png differ diff --git a/gaphor/ui/shortcuts.glade b/gaphor/services/helpservice/shortcuts.glade similarity index 100% rename from gaphor/ui/shortcuts.glade rename to gaphor/services/helpservice/shortcuts.glade diff --git a/gaphor/ui/shortcuts.py b/gaphor/ui/shortcuts.py deleted file mode 100644 index 2e03f9afe..000000000 --- a/gaphor/ui/shortcuts.py +++ /dev/null @@ -1,27 +0,0 @@ -import importlib - -from gi.repository import Gtk - -from gaphor.abc import ActionProvider, Service -from gaphor.core import action -from gaphor.ui.actiongroup import create_action_group, set_action_state - - -class Shortcuts(Service, ActionProvider): - def __init__(self, main_window, properties): - self.main_window = main_window - - @action(name="app.shortcuts") - def open(self): - builder = Gtk.Builder() - with importlib.resources.path("gaphor.ui", "shortcuts.glade") as glade_file: - builder.add_objects_from_file(str(glade_file), ("shortcuts-gaphor",)) - - shortcuts = builder.get_object("shortcuts-gaphor") - shortcuts.set_transient_for(self.main_window.window) - - shortcuts.show_all() - return shortcuts - - def shutdown(self): - pass diff --git a/pyproject.toml b/pyproject.toml index b6b752838..7d8d90d9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,6 @@ gaphorconvert = 'gaphor.tools.gaphorconvert:main' "recent_files" = "gaphor.ui.recentfiles:RecentFiles" "main_window" = "gaphor.ui.mainwindow:MainWindow" "preferences" = "gaphor.ui.preferences:Preferences" -"shortcuts" = "gaphor.ui.shortcuts:Shortcuts" "export_menu" = "gaphor.ui.menufragment:MenuFragment" "tools_menu" = "gaphor.ui.menufragment:MenuFragment" "copy" = "gaphor.services.copyservice:CopyService"