added ShortcutWindow

Signed-off-by: somas95 <manuel.genoves@gmail.com>
gh-pages
somas95 2018-03-22 14:10:14 +01:00
parent 2839470671
commit 64cc82a0bc
4 changed files with 327 additions and 328 deletions

View File

@ -20,9 +20,8 @@
-->
<section>
<item>
<!--
<attribute name="action">app.about</attribute>
-->
<attribute name="action">app.shortcuts</attribute>
<attribute name="label" translatable="yes">_Shortcuts</attribute>
</item>
<item>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<!-- interface-local-resource-path ../media -->
@ -366,15 +366,6 @@
<signal name="activate" handler="open_pandoc_markdown" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="get_help_online">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Get Help Online...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="open_launchpad_help" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="translate_launchpad">
<property name="visible">True</property>

View File

@ -791,9 +791,6 @@ class UberwriterWindow(Window):
def open_launchpad_translation(self, widget, data=None):
webbrowser.open("https://translations.launchpad.net/uberwriter")
def open_launchpad_help(self, widget, data=None):
webbrowser.open("https://answers.launchpad.net/uberwriter")
def open_pandoc_markdown(self, widget, data=None):
webbrowser.open("http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown")

View File

@ -108,7 +108,11 @@ class Application(Gtk.Application):
Gtk.Application.do_startup(self)
action = Gio.SimpleAction.new("help", None)
action.connect("activate", self.on_quit)
action.connect("activate", self.on_help)
self.add_action(action)
action = Gio.SimpleAction.new("shortcuts", None)
action.connect("activate", self.on_shortcuts)
self.add_action(action)
action = Gio.SimpleAction.new("about", None)
@ -159,6 +163,14 @@ class Application(Gtk.Application):
about_dialog.present()
def on_help(self, action, param):
self.window.open_pandoc_markdown(self)
def on_shortcuts(self, action, param):
builder = get_builder('Shortcuts')
builder.get_object("shortcuts").set_transient_for(self.window)
builder.get_object("shortcuts").show()
def on_quit(self, action, param):
self.quit()