Window refactoring, added appmenu and abou dialog

Signed-off-by: somas95 <manuel.genoves@gmail.com>
gh-pages
somas95 2018-03-22 01:21:58 +01:00
parent 2723459cc2
commit bae0c846e9
11 changed files with 535 additions and 819 deletions

View File

@ -1,51 +0,0 @@
<interface>
<!-- interface-requires about_uberwriter_dialog 1.0 -->
<!-- interface-requires gtk+ 3.0 -->
<object class="AboutUberwriterDialog" id="about_uberwriter_dialog">
<property name="website">https://launchpad.net/uberwriter</property><property translatable="yes" name="license"># Copyright (C) 2012, Wolf Vollprecht &lt;w.vollprecht@gmail.com&gt;
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
</property><property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="icon">../media/uberwriter.svg</property>
<property name="type_hint">normal</property>
<property name="program_name">UberWriter</property>
<property name="version">12.07.9</property>
<property name="copyright" translatable="yes">Copyright (C) 2012, Wolf Vollprecht &lt;w.vollprecht@gmail.com&gt;</property>
<property name="authors">Copyright (C) 2012, Wolf Vollprecht &lt;w.vollprecht@gmail.com&gt;</property>
<property name="logo">../media/uberwriter.svg</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@ -2,29 +2,34 @@
<interface>
<menu id="app-menu">
<section>
<attribute name="label" translatable="yes">Change label</attribute>
<item>
<!--
<attribute name="action">win.change_label</attribute>
<attribute name="target">String 1</attribute>
-->
<attribute name="label" translatable="yes">String 1</attribute>
</item>
<item>
<attribute name="label" translatable="yes">String 2</attribute>
</item>
<item>
<attribute name="label" translatable="yes">String 3</attribute>
<attribute name="label" translatable="yes">New window</attribute>
</item>
</section>
<!--
<section>
<item>
<attribute name="action">win.maximize</attribute>
<attribute name="label" translatable="yes">Maximize</attribute>
<attribute name="label" translatable="yes">Preferences</attribute>
</item>
</section>
-->
<section>
<item>
<!--
<attribute name="action">app.about</attribute>
-->
<attribute name="label" translatable="yes">_Shortcuts</attribute>
</item>
<item>
<attribute name="action">app.help</attribute>
<attribute name="label" translatable="yes">Pandoc _Help</attribute>
</item>
<item>
<attribute name="action">app.about</attribute>
<attribute name="label" translatable="yes">_About</attribute>
</item>

View File

@ -25,310 +25,385 @@
<property name="can_focus">False</property>
<property name="icon_name">format-text-capitalize</property>
</object>
<object class="GtkImage" id="ortografia1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-spell-check</property>
</object>
<object class="GtkRecentFilter" id="recentfilter1">
<mime-types>
<mime-type>text/plain</mime-type>
<mime-type>text/x-markdown</mime-type>
</mime-types>
</object>
<object class="GtkImage" id="reemplaza">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Open Replace</property>
<property name="stock">gtk-find-and-replace</property>
</object>
<object class="GtkImage" id="reemplaza1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-find-and-replace</property>
</object>
<object class="GtkImage" id="regex1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Activate Regex</property>
<property name="icon_name">find-location-symbolic</property>
</object>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="mnu_file">
<object class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child type="submenu">
<object class="GtkMenu" id="menu1">
<child>
<object class="GtkMenuItem" id="mnu_file">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="mnu_new">
<property name="label" translatable="yes">_File</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="menu1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="new_document" swapped="no"/>
<accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_open">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="open_document" swapped="no"/>
<accelerator key="o" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="recent">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_examples">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<child type="submenu">
<object class="GtkMenu" id="menu1_1">
<child>
<object class="GtkImageMenuItem" id="mnu_new">
<property name="label">_New</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="mnu_tutorial">
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="new_document" swapped="no"/>
<accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_open">
<property name="label">_Open</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="open_document" swapped="no"/>
<accelerator key="o" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="recent">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Open Recent File</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_examples">
<property name="label">Open examples</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<child type="submenu">
<object class="GtkMenu" id="menu1_1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="activate" handler="open_uberwriter_markdown" swapped="no"/>
<child>
<object class="GtkMenuItem" id="mnu_tutorial">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Quick markdown tutorial</property>
<property name="use_underline">True</property>
<signal name="activate" handler="open_uberwriter_markdown" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem3">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_save">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="save_document" swapped="no"/>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_save_as">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="save_document_as" swapped="no"/>
<accelerator key="s" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_export_html">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="export_as_html" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_export_pdf">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="export_as_pdf" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_export_odt">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="export_as_odt" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="advanced_export">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="activate" handler="open_advanced_export" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="seperatoritem10">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="copy-html-to-clipboard">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="activate" handler="copy_html_to_clipboard" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem5">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_close">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<accelerator key="w" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem3">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_save">
<property name="label">_Save</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="save_document" swapped="no"/>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_save_as">
<property name="label">Save _As</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="save_document_as" swapped="no"/>
<accelerator key="s" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_export_html">
<property name="label">Export as HTML</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="export_as_html" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_export_pdf">
<property name="label">Export as PDF</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="export_as_pdf" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_export_odt">
<property name="label" translatable="yes">Export as ODT</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<signal name="activate" handler="export_as_odt" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="advanced_export">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Advanced Export...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="open_advanced_export" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="seperatoritem10">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="copy-html-to-clipboard">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Copy Raw HTML to Clipboard</property>
<property name="use_underline">True</property>
<signal name="activate" handler="copy_html_to_clipboard" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem5">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_close">
<property name="label">_Quit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<accelerator key="w" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="mnu_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child type="submenu">
<object class="GtkMenu" id="menu4">
<child>
<object class="GtkMenuItem" id="mnu_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckMenuItem" id="mnu_focusmode">
<property name="label" translatable="yes">_View</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="menu4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="toggled" handler="set_focusmode" swapped="no"/>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mnu_fullscreen">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="toggled" handler="toggle_fullscreen" swapped="no"/>
<accelerator key="F11" signal="activate"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mnu_sidebar">
<property name="can_focus">False</property>
<accelerator key="F12" signal="activate"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="dark_mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Light text on a dark background</property>
<signal name="activate" handler="dark_mode_toggled" swapped="no"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mnu_preview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Switch to preview mode</property>
<signal name="toggled" handler="toggle_preview" swapped="no"/>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="searchreplacemenuitem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Open Search and Replace</property>
<signal name="activate" handler="open_search_and_replace" swapped="no"/>
<accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem6">
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mnu_toggle_typewriter">
<property name="can_focus">False</property>
<property name="active">True</property>
<property name="draw_as_radio">True</property>
<accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem4">
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="disable_spellcheck">
<property name="can_focus">False</property>
<property name="active">True</property>
<signal name="activate" handler="toggle_spellcheck" swapped="no"/>
<accelerator key="F7" signal="activate"/>
<child>
<object class="GtkCheckMenuItem" id="mnu_focusmode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Focus Mode</property>
<signal name="toggled" handler="set_focusmode" swapped="no"/>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mnu_fullscreen">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Fullscreen</property>
<signal name="toggled" handler="toggle_fullscreen" swapped="no"/>
<accelerator key="F11" signal="activate"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mnu_sidebar">
<property name="can_focus">False</property>
<property name="label" translatable="yes">Sidebar</property>
<accelerator key="F12" signal="activate"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="dark_mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Light text on a dark background</property>
<property name="label" translatable="yes">Dark Mode</property>
<signal name="activate" handler="dark_mode_toggled" swapped="no"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mnu_preview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Switch to preview mode</property>
<property name="label" translatable="yes">Preview</property>
<signal name="toggled" handler="toggle_preview" swapped="no"/>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="searchreplacemenuitem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Open Search and Replace</property>
<property name="label" translatable="yes">Search and Replace ...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="open_search_and_replace" swapped="no"/>
<accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem6">
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="mnu_toggle_typewriter">
<property name="can_focus">False</property>
<property name="label">Use Typewritermode (experimental)</property>
<property name="active">True</property>
<property name="draw_as_radio">True</property>
<accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem4">
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="disable_spellcheck">
<property name="can_focus">False</property>
<property name="label" translatable="yes">Auto _Spellcheck</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="activate" handler="toggle_spellcheck" swapped="no"/>
<accelerator key="F7" signal="activate"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="mnu_help">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child type="submenu">
<object class="GtkMenu" id="helpMenu">
<child>
<object class="GtkMenuItem" id="mnu_help">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="mnu_contents">
<property name="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="helpMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<accelerator key="F1" signal="activate"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem8">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="mnu_uberwriter_markdown">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="activate" handler="open_uberwriter_markdown" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="mnu_pandoc_markdown">
<property name="visible">True</property>
<property name="can_focus">False</property>
<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>
<signal name="activate" handler="open_launchpad_help" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="translate_launchpad">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="activate" handler="open_launchpad_translation" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem9">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_about">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_stock">False</property>
<child>
<object class="GtkMenuItem" id="mnu_contents">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Contents</property>
<accelerator key="F1" signal="activate"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem8">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="mnu_uberwriter_markdown">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Short Markdown Tutorial</property>
<signal name="activate" handler="open_uberwriter_markdown" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="mnu_pandoc_markdown">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Open Pandoc Online Markdown Help ...</property>
<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>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Translate This Application...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="open_launchpad_translation" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem9">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="mnu_about">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
@ -825,32 +900,4 @@
</packing>
</child>
</object>
<object class="GtkImage" id="ortografia1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-spell-check</property>
</object>
<object class="GtkRecentFilter" id="recentfilter1">
<mime-types>
<mime-type>text/plain</mime-type>
<mime-type>text/x-markdown</mime-type>
</mime-types>
</object>
<object class="GtkImage" id="reemplaza">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Open Replace</property>
<property name="stock">gtk-find-and-replace</property>
</object>
<object class="GtkImage" id="reemplaza1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-find-and-replace</property>
</object>
<object class="GtkImage" id="regex1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Activate Regex</property>
<property name="icon_name">find-location-symbolic</property>
</object>
</interface>

View File

@ -1,9 +0,0 @@
<glade-catalog name="about_uberwriter_dialog" domain="glade-3"
depends="gtk+" version="1.0">
<glade-widget-classes>
<glade-widget-class title="About Uberwriter Dialog" name="AboutUberwriterDialog"
generic-name="AboutUberwriterDialog" parent="GtkAboutDialog"
icon-name="widget-gtk-about-dialog"/>
</glade-widget-classes>
</glade-catalog>

View File

@ -1,8 +0,0 @@
<glade-catalog name="uberwriter_window" domain="glade-3"
depends="gtk+" version="3.26">
<glade-widget-classes>
<glade-widget-class title="Uberwriter Window" name="UberwriterWindow"
generic-name="UberwriterWindow" parent="GtkApplicationWindow"
icon-name="widget-gtk-window"/>
</glade-widget-classes>
</glade-catalog>

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-19 23:56+0200\n"
"POT-Creation-Date: 2018-03-21 20:10+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -25,95 +25,168 @@ msgstr ""
msgid "UberWriter, a simple and distraction free Markdown Editor"
msgstr ""
#: ../uberwriter/UberwriterInlinePreview.py:172
msgid "Website is not available"
msgstr ""
#: ../uberwriter/UberwriterInlinePreview.py:174
msgid "Website is available"
msgstr ""
#: ../uberwriter/UberwriterInlinePreview.py:414
msgid "Open Link in Webbrowser"
msgstr ""
#: ../uberwriter/UberwriterInlinePreview.py:470
msgid "No matching footnote found"
msgstr ""
#: ../uberwriter/UberwriterWindow.py:343
#: ../uberwriter/UberwriterWindow.py:354
msgid "Save your File"
msgstr ""
#: ../uberwriter/UberwriterWindow.py:489
#: ../uberwriter/UberwriterWindow.py:500
msgid "You can not export to PDF."
msgstr ""
#: ../uberwriter/UberwriterWindow.py:491
#: ../uberwriter/UberwriterWindow.py:502
msgid ""
"Please install <a href=\"apt:texlive\">texlive</a> from the software center."
msgstr ""
#: ../uberwriter/UberwriterWindow.py:521
#: ../uberwriter/UberwriterWindow.py:532
msgid "MarkDown or Plain Text"
msgstr ""
#: ../uberwriter/UberwriterWindow.py:524
#: ../uberwriter/UberwriterWindow.py:535
msgid "Open a .md-File"
msgstr ""
#: ../uberwriter/UberwriterWindow.py:546
#: ../uberwriter/UberwriterWindow.py:557
msgid "You have not saved your changes."
msgstr ""
#: ../uberwriter/UberwriterWindow.py:548
#: ../uberwriter/UberwriterWindow.py:559
msgid "Close without Saving"
msgstr ""
#: ../uberwriter/UberwriterWindow.py:549
#: ../uberwriter/UberwriterWindow.py:560
msgid "Cancel"
msgstr ""
#: ../uberwriter/UberwriterWindow.py:550
#: ../uberwriter/UberwriterWindow.py:561
msgid "Save now"
msgstr ""
#: ../uberwriter/UberwriterWindow.py:551
#: ../uberwriter/UberwriterWindow.py:562
msgid "Unsaved changes"
msgstr ""
#: ../uberwriter/UberwriterWindow.py:617
#: ../uberwriter/UberwriterWindow.py:628
msgid "You can not enable the Spell Checker."
msgstr ""
#: ../uberwriter/UberwriterWindow.py:619
#: ../uberwriter/UberwriterWindow.py:630
msgid ""
"Please install 'hunspell' or 'aspell' dictionarys for your language from the "
"software center."
msgstr ""
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:507
msgid "(no suggestions)"
#: ../data/ui/AboutUberwriterDialog.ui.h:1
msgid ""
"# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>\n"
"# This program is free software: you can redistribute it and/or modify it \n"
"# under the terms of the GNU General Public License version 3, as "
"published \n"
"# by the Free Software Foundation.\n"
"# \n"
"# This program is distributed in the hope that it will be useful, but \n"
"# WITHOUT ANY WARRANTY; without even the implied warranties of \n"
"# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR \n"
"# PURPOSE. See the GNU General Public License for more details.\n"
"# \n"
"# You should have received a copy of the GNU General Public License along \n"
"# with this program. If not, see <http://www.gnu.org/licenses/>.\n"
msgstr ""
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:544
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:547
msgid "Add \"{}\" to Dictionary"
#: ../data/ui/AboutUberwriterDialog.ui.h:14
msgid "Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>"
msgstr ""
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:551
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:553
msgid "Ignore All"
#: ../data/ui/UberwriterWindow.ui.h:1
msgid "Next Match"
msgstr ""
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:568
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:570
msgid "Languages"
#: ../data/ui/UberwriterWindow.ui.h:2
msgid "Light text on a dark background"
msgstr ""
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:586
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:589
msgid "Suggestions"
#: ../data/ui/UberwriterWindow.ui.h:3
msgid "Switch to preview mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:4
msgid "Open Search and Replace"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:5
msgid "Focus Mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:6
msgid "Go into focus mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:7
msgid "Fullscreen"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:8
msgid "Go into fullscreen mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:9
msgid "Preview"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:10
msgid "Show HTML preview"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:11
msgid "Words:"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:12
msgid "Characters:"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:13
msgid "Previous Match"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:14
msgid "Case Sensitive"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:15
msgid "Replace"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:16
msgid "Replace all"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:17
msgid "Open Replace"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:18
msgid "Activate Regex"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:88
msgid "emphasized text"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:90
msgid "strong text"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:92
msgid "striked out text"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:106
msgid "List item"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:187
msgid "Heading"
msgstr ""
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:1
@ -229,195 +302,46 @@ msgstr ""
msgid "Commandline Reference"
msgstr ""
#: ../data/ui/AboutUberwriterDialog.ui.h:1
msgid ""
"# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>\n"
"# This program is free software: you can redistribute it and/or modify it \n"
"# under the terms of the GNU General Public License version 3, as "
"published \n"
"# by the Free Software Foundation.\n"
"# \n"
"# This program is distributed in the hope that it will be useful, but \n"
"# WITHOUT ANY WARRANTY; without even the implied warranties of \n"
"# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR \n"
"# PURPOSE. See the GNU General Public License for more details.\n"
"# \n"
"# You should have received a copy of the GNU General Public License along \n"
"# with this program. If not, see <http://www.gnu.org/licenses/>.\n"
#: ../uberwriter/UberwriterInlinePreview.py:186
msgid "Website is not available"
msgstr ""
#: ../data/ui/AboutUberwriterDialog.ui.h:14
msgid "Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>"
#: ../uberwriter/UberwriterInlinePreview.py:188
msgid "Website is available"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:1
msgid "Case Sensitive"
#: ../uberwriter/UberwriterInlinePreview.py:432
msgid "Open Link in Webbrowser"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:2
msgid "Activate Regex"
#: ../uberwriter/UberwriterInlinePreview.py:488
msgid "No matching footnote found"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:3
msgid "_File"
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:507
msgid "(no suggestions)"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:4
msgid "Open Recent File"
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:544
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:547
msgid "Add \"{}\" to Dictionary"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:5
msgid "Export as ODT"
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:551
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:553
msgid "Ignore All"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:6
msgid "Advanced Export..."
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:568
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:570
msgid "Languages"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:7
msgid "Copy Raw HTML to Clipboard"
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:586
#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:589
msgid "Suggestions"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:8
msgid "_View"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:9
msgid "Light text on a dark background"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:10
msgid "Dark Mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:11
msgid "Switch to preview mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:12
msgid "Preview"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:13
msgid "Open Search and Replace"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:14
msgid "Search and Replace ..."
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:15
msgid "Auto _Spellcheck"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:16
msgid "_Help"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:17
msgid "Contents"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:18
msgid "Short Markdown Tutorial"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:19
msgid "Open Pandoc Online Markdown Help ..."
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:20
msgid "Get Help Online..."
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:21
msgid "Translate This Application..."
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:22
msgid "Next Match"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:23
msgid "Normal"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:24
msgid "Previous Match"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:25
msgid "Active"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:26
msgid "toolbutton"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:27
msgid "Open Replace"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:28
msgid "Replace with"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:29
msgid "Replace"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:30
msgid "Replace All"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:31
msgid "Focus Mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:32
msgid "Go into focus mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:33
msgid "Fullscreen"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:34
msgid "Go into fullscreen mode"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:35
msgid "Show HTML preview"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:36
msgid "Words:"
msgstr ""
#: ../data/ui/UberwriterWindow.ui.h:37
msgid "Characters:"
msgstr ""
#: ../uberwriter/__init__.py:35
#: ../uberwriter/__init__.py:36
msgid "Show debug messages (-vv debugs uberwriter_lib also)"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:88
msgid "emphasized text"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:90
msgid "strong text"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:92
msgid "striked out text"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:106
msgid "List item"
msgstr ""
#: ../uberwriter/FormatShortcuts.py:187
msgid "Heading"
msgstr ""

View File

@ -1,35 +0,0 @@
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
import locale
from locale import gettext as _
locale.textdomain('uberwriter')
import logging
logger = logging.getLogger('uberwriter')
from uberwriter_lib.AboutDialog import AboutDialog
# See uberwriter_lib.AboutDialog.py for more details about how this class works.
class AboutUberwriterDialog(AboutDialog):
__gtype_name__ = "AboutUberwriterDialog"
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the about dialog"""
super(AboutUberwriterDialog, self).finish_initializing(builder)
# Code for other initialization actions should be added here.

View File

@ -921,11 +921,14 @@ class UberwriterWindow(Window):
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the main window"""
super(UberwriterWindow, self).finish_initializing(builder)
self.AboutDialog = AboutUberwriterDialog
self.UberwriterAdvancedExportDialog = UberwriterAdvancedExportDialog
self.builder = builder
self.connect('save-file', self.save_document)
self.connect('save-file-as', self.save_document_as)
@ -945,6 +948,7 @@ class UberwriterWindow(Window):
self.texlive_installed = False
self.set_name('UberwriterWindow')
self.use_headerbar = True
if self.use_headerbar == True:
@ -987,6 +991,7 @@ class UberwriterWindow(Window):
self.char_count = builder.get_object('char_count')
self.menubar = builder.get_object('menubar1')
self.menubar.hide()
# Wire up buttons
self.fullscreen_button = builder.get_object('fullscreen_toggle')

View File

@ -1,50 +0,0 @@
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
from gi.repository import Gtk # pylint: disable=E0611
from . helpers import get_builder
class AboutDialog(Gtk.AboutDialog):
__gtype_name__ = "AboutDialog"
def __new__(cls):
"""Special static method that's automatically called by Python when
constructing a new instance of this class.
Returns a fully instantiated AboutDialog object.
"""
builder = get_builder('AboutUberwriterDialog')
new_object = builder.get_object("about_uberwriter_dialog")
new_object.finish_initializing(builder)
return new_object
def finish_initializing(self, builder):
"""Called while initializing this instance in __new__
finish_initalizing should be called after parsing the ui definition
and creating a AboutDialog object with it in order
to finish initializing the start of the new AboutUberwriterDialog
instance.
Put your initialization code in here and leave __init__ undefined.
"""
# Get a reference to the builder and set up the signals.
self.builder = builder
self.ui = builder.get_ui(self)

View File

@ -1,8 +1,20 @@
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GLib, Gio, Gtk
from gi.repository import GLib, Gio, Gtk, GdkPixbuf
from . helpers import get_builder, show_uri, get_help_uri
from uberwriter import UberwriterWindow
@ -35,7 +47,7 @@ class Window(Gtk.ApplicationWindow):
self.finish_initializing(builder)
return self
return super().__init__(*args, **kwargs)
def on_maximize_toggle(self, action, value):
@ -91,9 +103,13 @@ class Application(Gtk.Application):
def do_startup(self):
Gtk.Application.do_startup(self)
# ~ action = Gio.SimpleAction.new("about", None)
# ~ action.connect("activate", self.on_about)
# ~ self.add_action(action)
action = Gio.SimpleAction.new("help", None)
action.connect("activate", self.on_quit)
self.add_action(action)
action = Gio.SimpleAction.new("about", None)
action.connect("activate", self.on_about)
self.add_action(action)
action = Gio.SimpleAction.new("quit", None)
action.connect("activate", self.on_quit)
@ -109,7 +125,7 @@ class Application(Gtk.Application):
# Windows are associated with the application
# when the last one is closed the application shuts down
# self.window = Window(application=self, title="UberWriter")
self.window = UberwriterWindow.UberwriterWindow()
self.window = UberwriterWindow.UberwriterWindow(application=self, title="UberWriter")
self.window.present()
@ -123,10 +139,21 @@ class Application(Gtk.Application):
self.activate()
return 0
# TODO
# ~ def on_about(self, action, param):
# ~ about_dialog = Gtk.AboutDialog(transient_for=self.window, modal=True)
# ~ about_dialog.present()
def on_about(self, action, param):
about_dialog = Gtk.AboutDialog(transient_for=self.window, modal=True)
about_dialog.set_program_name("Uberwriter")
about_dialog.set_version("TODO.beta")
about_dialog.set_copyright("Copyright (C) 2018, Wolf Vollprecht")
about_dialog.set_license_type(Gtk.License.GPL_3_0)
about_dialog.set_website("http://uberwriter.wolfvollprecht.de")
about_dialog.set_authors(["Wolf Vollprecht"])
logo = GdkPixbuf.Pixbuf.new_from_file("data/media/uberwriter.svg")
about_dialog.set_logo(logo)
about_dialog.present()
def on_quit(self, action, param):
self.quit()

View File

@ -1,139 +0,0 @@
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
from gi.repository import Gio, Gtk # pylint: disable=E0611
import logging
logger = logging.getLogger('uberwriter_lib')
from . helpers import get_builder, show_uri, get_help_uri
# This class is meant to be subclassed by UberwriterWindow. It provides
# common functions and some boilerplate.
class Window(Gtk.Application):
__gtype_name__ = "Window"
# To construct a new instance of this method, the following notable
# methods are called in this order:
# __new__(cls)
# __init__(self)
# finish_initializing(self, builder)
# __init__(self)
#
# For this reason, it's recommended you leave __init__ empty and put
# your initialization code in finish_initializing
def __new__(cls):
"""Special static method that's automatically called by Python when
constructing a new instance of this class.
Returns a fully instantiated BaseUberwriterWindow object.
"""
App = Gtk.Application()
window = Gtk.ApplicationWindow()
builder = get_builder('UberwriterWindow')
new_object = builder.get_object("grid1")
window.add(new_object)
App.window = window
App.window.present()
#window.finish_initializing(builder)
return App
def finish_initializing(self, builder):
"""Called while initializing this instance in __new__
finish_initializing should be called after parsing the UI definition
and creating a UberwriterWindow object with it in order to finish
initializing the start of the new UberwriterWindow instance.
"""
# Get a reference to the builder and set up the signals.
self.builder = builder
self.ui = builder.get_ui(self, True)
self.PreferencesDialog = None # class
self.preferences_dialog = None # instance
self.AboutDialog = None # class
# self.settings = Gio.Settings("net.launchpad.uberwriter")
# self.settings.connect('changed', self.on_preferences_changed)
# Optional application indicator support
# Run 'quickly add indicator' to get started.
# More information:
# http://owaislone.org/quickly-add-indicator/
# https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators
try:
from uberwriter import indicator
# self is passed so methods of this class can be called from indicator.py
# Comment this next line out to disable appindicator
self.indicator = indicator.new_application_indicator(self)
except ImportError:
pass
def on_mnu_contents_activate(self, widget, data=None):
show_uri(self, "ghelp:%s" % get_help_uri())
def on_mnu_about_activate(self, widget, data=None):
"""Display the about box for uberwriter."""
if self.AboutDialog is not None:
about = self.AboutDialog() # pylint: disable=E1102
response = about.run()
about.destroy()
def on_mnu_preferences_activate(self, widget, data=None):
"""Display the preferences window for uberwriter."""
""" From the PyGTK Reference manual
Say for example the preferences dialog is currently open,
and the user chooses Preferences from the menu a second time;
use the present() method to move the already-open dialog
where the user can see it."""
if self.preferences_dialog is not None:
logger.debug('show existing preferences_dialog')
self.preferences_dialog.present()
elif self.PreferencesDialog is not None:
logger.debug('create new preferences_dialog')
self.preferences_dialog = self.PreferencesDialog() # pylint: disable=E1102
self.preferences_dialog.connect('destroy', self.on_preferences_dialog_destroyed)
self.preferences_dialog.show()
# destroy command moved into dialog to allow for a help button
def on_mnu_close_activate(self, widget, data=None):
"""Signal handler for closing the UberwriterWindow."""
self.destroy()
def on_destroy(self, widget, data=None):
"""Called when the UberwriterWindow is closed."""
# Clean up code for saving application state should be added here.
Gtk.main_quit()
def on_preferences_changed(self, settings, key, data=None):
logger.debug('preference changed: %s = %s' % (key, str(settings.get_value(key))))
def on_preferences_dialog_destroyed(self, widget, data=None):
'''only affects gui
logically there is no difference between the user closing,
minimising or ignoring the preferences dialog'''
logger.debug('on_preferences_dialog_destroyed')
# to determine whether to create or present preferences_dialog
self.preferences_dialog = None