Merge pull request #70 from UberWriter/FullscreenHeaderBar

webkit2png
somas95 2018-07-18 16:35:27 +02:00 committed by GitHub
commit e5027303bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 5378 additions and 1428 deletions

View File

@ -8,10 +8,6 @@
@define-color light_bg #EDEDED;
@binding-set window-bindings {
bind "<ctl>n" { "new-file" () };
bind "<ctl>o" { "open-file" () };
bind "<ctl>s" { "save-file" () };
bind "<ctl><shift>s" { "save-file-as" () };
bind "<ctl>w" { "close-window" () };
bind "<ctl><shift>b" { "toggle-bibtex" () };
}

139
data/ui/About.ui 100644
View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkAboutDialog" id="AboutDialog">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center</property>
<property name="type_hint">dialog</property>
<property name="program_name">Uberwriter</property>
<property name="version">2.0.3</property>
<property name="copyright" translatable="yes">Copyright (C) 2018, Wolf Vollprecht</property>
<property name="website">http://uberwriter.github.io/uberwriter</property>
<property name="website_label" translatable="yes">Uberwriter website</property>
<property name="authors">Wolf Vollprecht &lt;w.vollprecht@gmail.com&gt;
Manuel Genovés &lt;manuel.genoves@gmail.com&gt;</property>
<property name="logo_icon_name">image-missing</property>
<property name="license_type">gpl-3-0</property>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="About_main">
<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="About_buttons">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="About_links">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid" id="About_links_donations">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkLabel" id="donations_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Donations:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="donations_link">
<property name="label" translatable="yes">Liberapay</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">start</property>
<property name="relief">none</property>
<property name="uri">https://liberapay.com/UberWriter/donate</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="About_links_translations">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkLabel" id="translations_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Help to translate:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="translations_link">
<property name="label" translatable="yes">Poeditor</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">start</property>
<property name="relief">none</property>
<property name="uri">https://poeditor.com/join/project/gxVzFyXb2x</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="app-menu">
<section>
<item>
<!--
<attribute name="action">win.change_label</attribute>
<attribute name="target">String 1</attribute>
-->
<attribute name="label" translatable="yes">New window</attribute>
</item>
</section>
<!--
<section>
<item>
<attribute name="action">win.maximize</attribute>
<attribute name="label" translatable="yes">Preferences</attribute>
</item>
</section>
-->
<section>
<item>
<attribute name="action">app.shortcuts</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>
<item>
<attribute name="action">app.translate</attribute>
<attribute name="label" translatable="yes">Help to _translate</attribute>
</item>
<item>
<attribute name="action">app.donate</attribute>
<attribute name="label" translatable="yes">Donate to the project</attribute>
</item>
</section>
<section>
<item>
<attribute name="action">app.quit</attribute>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
</interface>

621
data/ui/Export.ui 100644
View File

@ -0,0 +1,621 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkGrid" id="advanced_export_options">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<child>
<object class="GtkGrid" id="advanced_export_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="margin_top">10</property>
<property name="column_spacing">10</property>
<child>
<object class="GtkFrame" id="frame4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="smart">
<property name="label" translatable="yes">Smart</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Pandoc can automatically make "--" to a long dash and more</property>
<property name="halign">start</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="toc">
<property name="label" translatable="yes">Table of Contents</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="standalone">
<property name="label" translatable="yes">Standalone</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Use a header and footer to include things like stylesheets and meta information</property>
<property name="halign">start</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="number_sections">
<property name="label" translatable="yes">Number Sections</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="strict">
<property name="label" translatable="yes">Strict Markdown</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Use "strict" markdown instead of "pandoc" markdown</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="incremental">
<property name="label" translatable="yes">Slideshow incremental bullets</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Show one bullet point after another in a slideshow</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;General Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="advanced_export_middle">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="highlight">
<property name="label" translatable="yes">Highlight syntax</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Choose a color theme for syntax highlighting</property>
<property name="label" translatable="yes">Highlight style </property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="highlight_style">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Choose a color theme for syntax highlighting</property>
<property name="active">0</property>
<property name="active_id">0</property>
<items>
<item>pygments</item>
<item>kate</item>
<item>monochrome</item>
<item>espresso</item>
<item>zenburn</item>
<item>haddock</item>
<item>tango</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Syntax highlighting&lt;/b&gt; (HTML, LaTeX)</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkFileChooserButton" id="bib_filechooser">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Bibliography File&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkCheckButton" id="self_contained">
<property name="label" translatable="yes">Self Contained</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Produces a HTML that has no external dependencies (all images and stylesheets are included)</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="html5">
<property name="label" translatable="yes">HTML 5</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Use HTML 5 syntax</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Choose a CSS File that you want to use</property>
<property name="label" translatable="yes">CSS File</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="css_filechooser">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Choose a CSS File that you want to use</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;HTML Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="linkbutton1">
<property name="label" translatable="yes">Commandline Reference</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="relief">none</property>
<property name="uri">http://johnmacfarlane.net/pandoc/README.html</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="advanced_export_name_area">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkEntry" id="advanced_export_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="choose_format">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<object class="GtkFileFilter" id="html_filter">
<mime-types>
<mime-type>text/html</mime-type>
</mime-types>
</object>
<object class="GtkFileFilter" id="odt_filter">
<mime-types>
<mime-type>application/vnd.oasis.opendocument.text</mime-type>
</mime-types>
</object>
<object class="GtkFileFilter" id="pdf_filter">
<mime-types>
<mime-type>application/pdf</mime-type>
</mime-types>
</object>
<object class="GtkDialog" id="Export">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<action-widgets>
<action-widget response="cancel">cancel_btn</action-widget>
<action-widget response="1" default="true">export_btn</action-widget>
</action-widgets>
<child type="titlebar">
<object class="GtkHeaderBar" id="Export_hb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="cancel_btn">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="title">
<object class="GtkStackSwitcher" id="format_switcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stack">export_stack</property>
</object>
</child>
<child>
<object class="GtkButton" id="export_btn">
<property name="label" translatable="yes">Export</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="DialogBox">
<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="ButtonBox">
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkStack" id="export_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="transition_type">crossfade</property>
<child>
<object class="GtkFileChooserWidget" id="pdf">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">save</property>
<property name="filter">pdf_filter</property>
</object>
<packing>
<property name="name">pdf</property>
<property name="title" translatable="yes">PDF</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="pdf_disabled">
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="name">pdf_disabled</property>
<property name="title" translatable="yes">PDF</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFileChooserWidget" id="html">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">save</property>
<property name="filter">html_filter</property>
</object>
<packing>
<property name="name">html</property>
<property name="title" translatable="yes">HTML</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFileChooserWidget" id="odt">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">save</property>
<property name="filter">odt_filter</property>
</object>
<packing>
<property name="name">odt</property>
<property name="title" translatable="yes">ODT</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkFileChooserWidget" id="advanced">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="extra_widget">advanced_export_options</property>
</object>
<packing>
<property name="name">advanced</property>
<property name="title" translatable="yes">Advanced</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

67
data/ui/Menu.ui 100644
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="Menu">
<section>
<attribute name="display-hint">horizontal-buttons</attribute>
<item>
<attribute name="label" translatable="yes">Focus Mode</attribute>
<attribute name="action">app.focus_mode</attribute>
<attribute name="verb-icon">find-location-symbolic</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Preview</attribute>
<attribute name="action">app.preview</attribute>
<attribute name="verb-icon">x-office-presentation-symbolic</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Fullscreen</attribute>
<attribute name="action">app.fullscreen</attribute>
<attribute name="verb-icon">view-fullscreen-symbolic</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Save _As</attribute>
<attribute name="action">app.save_as</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Export</attribute>
<attribute name="action">app.export</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Copy HTML</attribute>
<attribute name="action">app.HTML_copy</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Open Tutorial</attribute>
<attribute name="action">app.open_examples</attribute>
</item>
<item>
<attribute name="action">app.help</attribute>
<attribute name="label" translatable="yes">Pandoc _Help</attribute>
</item>
<item>
<attribute name="action">app.shortcuts</attribute>
<attribute name="label" translatable="yes">_Shortcuts</attribute>
</item>
</section>
<section>
<item>
<attribute name="action">app.about</attribute>
<attribute name="label" translatable="yes">_About</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
</item>
</section>
</menu>
</interface>

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="PreferencesWindow">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="skip_taskbar_hint">True</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="Preferences_hb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Preferences</property>
<property name="show_close_button">True</property>
<child>
<placeholder/>
</child>
</object>
</child>
<child>
<object class="GtkNotebook" id="Preferences_nb">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
<object class="GtkGrid" id="Grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_left">30</property>
<property name="margin_right">30</property>
<property name="margin_top">30</property>
<property name="margin_bottom">30</property>
<property name="row_spacing">10</property>
<property name="column_spacing">10</property>
<child>
<object class="GtkLabel" id="Dark_mode_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="label" translatable="yes">Use dark mode</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="Spellcheck_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Autospellcheck</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="Dark_mode_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="action_name">app.dark_mode</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="Spellcheck_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="action_name">app.spellcheck</property>
<property name="active">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="tab_expand">True</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">page 1</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="WindowMenu">
<section>
<item>
<attribute name="label" translatable="yes">Focus Mode</attribute>
<attribute name="action">app.focus_mode</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Fullscreen</attribute>
<attribute name="action">app.fullscreen</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Dark Mode</attribute>
<attribute name="action">app.dark_mode</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Preview</attribute>
<attribute name="action">app.preview</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Search and Replace</attribute>
<attribute name="action">app.search</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Auto _Spellcheck</attribute>
<attribute name="action">app.spellcheck</attribute>
</item>
</section>
</menu>
</interface>

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="WindowMenu">
<section>
<item>
<attribute name="label" translatable="yes">Focus Mode</attribute>
<signal name="toggled" handler="set_focusmode" swapped="no"/>
</item>
<item>
<attribute name="label" translatable="yes">Fullscreen</attribute>
<signal name="toggled" handler="toggle_fullscreen" swapped="no"/>
</item>
<item>
<attribute name="tooltip_text" translatable="yes">Light text on a dark background</attribute>
<attribute name="label" translatable="yes">Dark Mode</attribute>
<signal name="activate" handler="dark_mode_toggled" swapped="no"/>
</item>
<item>
<attribute name="tooltip_text" translatable="yes">Switch to preview mode</attribute>
<attribute name="label" translatable="yes">Preview</attribute>
<signal name="toggled" handler="toggle_preview" swapped="no"/>
</item>
</section>
<section>
<item>
<attribute name="tooltip_text" translatable="yes">Open Search and Replace</attribute>
<attribute name="label" translatable="yes">Search and Replace ...</attribute>
<attribute name="use_underline">True</attribute>
<signal name="activate" handler="open_search_and_replace" swapped="no"/>
</item>
<item>
<attribute name="label" translatable="yes">Auto _Spellcheck</attribute>
<attribute name="use_underline">True</attribute>
<attribute name="active">True</attribute>
<signal name="toggled" handler="toggle_spellcheck" swapped="no"/>
</item>
</section>
</menu>
</interface>

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 71 KiB

View File

@ -1,255 +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
from gi.repository import Gtk
import os
import subprocess
import gettext
from gettext import gettext as _
import logging
logger = logging.getLogger('uberwriter')
from uberwriter_lib.AdvancedExportDialog import AdvancedExportDialog
# See uberwriter_lib.AboutDialog.py for more details about how this class works.
class UberwriterAdvancedExportDialog(AdvancedExportDialog):
__gtype_name__ = "UberwriterAdvancedExportDialog"
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the about dialog"""
super(UberwriterAdvancedExportDialog, self).finish_initializing(builder)
# Code for other initialization actions should be added here.
self.builder.get_object("highlight_style").set_active(0)
format_store = Gtk.ListStore(int, str)
for fmt_id in self.formats_dict:
format_store.append([fmt_id, self.formats_dict[fmt_id]["name"]])
self.format_field = builder.get_object('choose_format')
self.format_field.set_model(format_store)
format_renderer = Gtk.CellRendererText()
self.format_field.pack_start(format_renderer, True)
self.format_field.add_attribute(format_renderer, "text", 1)
self.format_field.set_active(0)
self.show_all()
formats_dict = {
1: {
"name": "LaTeX Source",
"ext": "tex",
"to": "latex"
},
2: {
"name": "LaTeX PDF",
"ext": "pdf",
"to": "pdf"
},
3: {
"name": "LaTeX beamer slide show Source .tex",
"ext": "tex",
"to": "beamer"
},
4: {
"name": "LaTeX beamer slide show PDF",
"ext": "pdf",
"to": "beamer"
},
5: {
"name": "HTML",
"ext": "html",
"to": "html"
},
6: {
"name": "Textile",
"ext": "txt",
"to": "textile"
},
7: {
"name": "OpenOffice text document",
"ext": "odt",
"to": "odt"
},
8: {
"name": "Word docx",
"ext": "docx",
"to": "docx"
},
9: {
"name": "reStructuredText txt",
"ext": "txt",
"to": "rst"
},
10: {
"name": "ConTeXt tex",
"ext": "tex",
"to": "context"
},
11: {
"name": "groff man",
"ext": "man",
"to": "man"
},
12: {
"name": "MediaWiki markup",
"ext": "txt",
"to": "mediawiki"
},
13: {
"name": "OpenDocument XML",
"ext": "xml",
"to": "opendocument"
},
14: {
"name": "OpenDocument XML",
"ext": "texi",
"to": "texinfo"
},
15: {
"name": "Slidy HTML and javascript slide show",
"ext": "html",
"to": "slidy"
},
16: {
"name": "Slideous HTML and javascript slide show",
"ext": "html",
"to": "slideous"
},
17: {
"name": "HTML5 + javascript slide show",
"ext": "html",
"to": "dzslides"
},
18: {
"name": "S5 HTML and javascript slide show",
"ext": "html",
"to": "s5"
},
19: {
"name": "EPub electronic publication",
"ext": "epub",
"to": "epub"
},
20: {
"name": "RTF Rich Text Format",
"ext": "rtf",
"to": "rtf"
}
}
def advanced_export(self, text = ""):
tree_iter = self.format_field.get_active_iter()
if tree_iter != None:
model = self.format_field.get_model()
row_id, name = model[tree_iter][:2]
fmt = self.formats_dict[row_id]
logger.info(fmt)
filechooser = Gtk.FileChooserDialog(
"Export as %s" % fmt["name"],
self,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
)
filechooser.set_do_overwrite_confirmation(True)
response = filechooser.run()
if response == Gtk.ResponseType.OK:
filename = filechooser.get_filename()
filechooser.destroy()
else:
filechooser.destroy()
return
output_dir = os.path.abspath(os.path.join(filename, os.path.pardir))
basename = os.path.basename(filename)
args = ['pandoc', '--from=markdown']
to = "--to=%s" % fmt["to"]
if basename.endswith("." + fmt["ext"]):
output_file = "--output=%s" % basename
else:
output_file = "--output=%s.%s" % (basename, fmt["ext"])
if self.builder.get_object("toc").get_active():
args.append('--toc')
if self.builder.get_object("normalize").get_active():
args.append('--normalize')
if self.builder.get_object("smart").get_active():
args.append('--smart')
if self.builder.get_object("highlight").get_active == False:
args.append('--no-highlight')
else:
hs = self.builder.get_object("highlight_style").get_active_text()
args.append("--highlight-style=%s" % hs)
if self.builder.get_object("standalone").get_active():
args.append("--standalone")
if self.builder.get_object("number_sections").get_active():
args.append("--number-sections")
if self.builder.get_object("strict").get_active():
args.append("--strict")
if self.builder.get_object("incremental").get_active():
args.append("--incremental")
if self.builder.get_object("self_contained").get_active():
args.append("--self-contained")
if self.builder.get_object("html5").get_active():
if fmt["to"] == "html":
to = "--to=%s" % "html5"
# Pandoc can't handle verbose -t pdf (#571)
if fmt["to"] != "pdf":
args.append(to)
css_uri = self.builder.get_object("css_filechooser").get_uri()
if css_uri:
if css_uri.startswith("file://"):
css_uri = css_uri[7:]
args.append("--css=%s" % css_uri)
bib_uri = self.builder.get_object("bib_filechooser").get_uri()
if bib_uri:
if bib_uri.startswith("file://"):
bib_uri = bib_uri[7:]
args.append("--bibliography=%s" % bib_uri)
args.append(output_file)
logger.info(args)
p = subprocess.Popen(args, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, cwd=output_dir)
output = p.communicate(text)[0]
return filename

View File

@ -0,0 +1,376 @@
# -*- 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
"""Manages all the export operations and dialogs
"""
import os
import subprocess
import logging
# import gettext
from gettext import gettext as _
from gi.repository import Gtk
from uberwriter_lib import helpers
from uberwriter_lib.helpers import get_builder
LOGGER = logging.getLogger('uberwriter')
class Export:
"""
Manages all the export operations and dialogs
"""
__gtype_name__ = "UberwriterExportDialog"
def __init__(self, filename):
"""Set up the about dialog"""
self.builder = get_builder('Export')
self.dialog = self.builder.get_object("Export")
self.stack = self.builder.get_object("export_stack")
self.stack_switcher = self.builder.get_object("format_switcher")
stack_pdf_disabled = self.builder.get_object("pdf_disabled")
filename = filename or _("Untitled document.md")
self.filechoosers = {export_format:self.stack.get_child_by_name(export_format)\
for export_format in ["pdf", "html", "odt", "advanced"]}
for export_format, filechooser in self.filechoosers.items():
filechooser.set_do_overwrite_confirmation(True)
filechooser.set_current_folder(os.path.dirname(filename))
if export_format == "advanced":
self.adv_export_name = self.builder.get_object("advanced_export_name")
self.adv_export_name.set_text(os.path.basename(filename)[:-3])
else:
filechooser.set_current_name(os.path.basename(filename)[:-2] + export_format)
# Disable pdf if Texlive not installed
texlive_installed = helpers.exist_executable("pdftex")
if not texlive_installed:
self.filechoosers["pdf"].set_visible(False)
stack_pdf_disabled.set_visible(True)
stack_pdf_disabled.set_text(disabled_text())
stack_pdf_disabled.set_justify(Gtk.Justification.CENTER)
self.stack.connect('notify', self.allow_export, 'visible_child_name')
self.builder.get_object("highlight_style").set_active(0)
format_store = Gtk.ListStore(int, str)
for fmt_id in self.formats_dict:
format_store.append([fmt_id, self.formats_dict[fmt_id]["name"]])
self.format_field = self.builder.get_object('choose_format')
self.format_field.set_model(format_store)
format_renderer = Gtk.CellRendererText()
self.format_field.pack_start(format_renderer, True)
self.format_field.add_attribute(format_renderer, "text", 1)
self.format_field.set_active(0)
formats_dict = {
1: {
"name": "LaTeX Source",
"ext": "tex",
"to": "latex"
},
2: {
"name": "LaTeX PDF",
"ext": "pdf",
"to": "pdf"
},
3: {
"name": "LaTeX beamer slide show Source .tex",
"ext": "tex",
"to": "beamer"
},
4: {
"name": "LaTeX beamer slide show PDF",
"ext": "pdf",
"to": "beamer"
},
5: {
"name": "HTML",
"ext": "html",
"to": "html"
},
6: {
"name": "Textile",
"ext": "txt",
"to": "textile"
},
7: {
"name": "OpenOffice text document",
"ext": "odt",
"to": "odt"
},
8: {
"name": "Word docx",
"ext": "docx",
"to": "docx"
},
9: {
"name": "reStructuredText txt",
"ext": "txt",
"to": "rst"
},
10: {
"name": "ConTeXt tex",
"ext": "tex",
"to": "context"
},
11: {
"name": "groff man",
"ext": "man",
"to": "man"
},
12: {
"name": "MediaWiki markup",
"ext": "txt",
"to": "mediawiki"
},
13: {
"name": "OpenDocument XML",
"ext": "xml",
"to": "opendocument"
},
14: {
"name": "OpenDocument XML",
"ext": "texi",
"to": "texinfo"
},
15: {
"name": "Slidy HTML and javascript slide show",
"ext": "html",
"to": "slidy"
},
16: {
"name": "Slideous HTML and javascript slide show",
"ext": "html",
"to": "slideous"
},
17: {
"name": "HTML5 + javascript slide show",
"ext": "html",
"to": "dzslides"
},
18: {
"name": "S5 HTML and javascript slide show",
"ext": "html",
"to": "s5"
},
19: {
"name": "EPub electronic publication",
"ext": "epub",
"to": "epub"
},
20: {
"name": "RTF Rich Text Format",
"ext": "rtf",
"to": "rtf"
}
}
def export(self, text=""):
"""Export to pdf, html or odt the given text
Keyword Arguments:
text {str} -- Text to export (default: {""})
"""
export_format = self.stack.get_visible_child_name()
if export_format == "advanced":
self.advanced_export(text)
else:
filename = self.filechoosers[export_format].get_filename()
if filename.endswith("." + export_format):
filename = filename[:-len(export_format)-1]
output_dir = os.path.abspath(os.path.join(filename, os.path.pardir))
basename = os.path.basename(filename)
args = ['pandoc', '--from=markdown', '-s']
if export_format == "pdf":
args.append("-o%s.pdf" % basename)
elif export_format == "odt":
args.append("-o%s.odt" % basename)
elif export_format == "html":
css = helpers.get_media_file('uberwriter.css')
relativize = helpers.get_script_path('relative_to_absolute.lua')
task_list = helpers.get_script_path('task-list.lua')
args.append("-c%s" % css)
args.append("-o%s.html" % basename)
args.append("--mathjax")
args.append("--lua-filter=" + relativize)
args.append("--lua-filter=" + task_list)
proc = subprocess.Popen(args, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, cwd=output_dir)
_ = proc.communicate(text)[0]
def advanced_export(self, text=""):
"""Export the given text to special formats with the enabled flags
Keyword Arguments:
text {str} -- The text to export (default: {""})
"""
filename = self.adv_export_name.get_text()
output_dir = os.path.abspath(self.filechoosers["advanced"].get_current_folder())
basename = os.path.basename(filename)
args = self.set_arguments(basename)
LOGGER.info(args)
proc = subprocess.Popen(args, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, cwd=output_dir)
_ = proc.communicate(text)[0]
def set_arguments(self, basename):
"""Retrieve a list of the selected arguments
For most of the advanced option checkboxes, returns a list
of the related pandoc flags
Arguments:
basename {str} -- the name of the file
Returns:
list of {str} -- related pandoc flags
"""
highlight_style = self.builder.get_object("highlight_style").get_active_text()
conditions_dict = {
1: {
"condition": self.builder.get_object("toc").get_active(),
"yes": "--toc",
"no": None
},
2: {
"condition": self.builder.get_object("highlight").get_active(),
"yes": "--highlight-style=%s" % highlight_style,
"no": "--no-highlight"
},
3: {
"condition": self.builder.get_object("standalone").get_active(),
"yes": "--standalone",
"no": None
},
4: {
"condition": self.builder.get_object("number_sections").get_active(),
"yes": "--number-sections",
"no": None
},
5: {
"condition": self.builder.get_object("strict").get_active(),
"yes": "--strict",
"no": None
},
6: {
"condition": self.builder.get_object("incremental").get_active(),
"yes": "--incremental",
"no": None
},
7: {
"condition": self.builder.get_object("self_contained").get_active(),
"yes": "--self-contained",
"no": None
}
}
tree_iter = self.format_field.get_active_iter()
if tree_iter is not None:
model = self.format_field.get_model()
row_id, _ = model[tree_iter][:2]
fmt = self.formats_dict[row_id]
args = ['pandoc', '--from=markdown']
extension = "--to=%s" % fmt["to"]
if basename.endswith("." + fmt["ext"]):
output_file = "--output=%s" % basename
else:
output_file = "--output=%s.%s" % (basename, fmt["ext"])
args.extend([conditions_dict[c_id]["yes"]\
if conditions_dict[c_id]["condition"]\
else conditions_dict[c_id]["no"]\
for c_id in conditions_dict])
args = list(filter(None, args))
if self.builder.get_object("html5").get_active():
if fmt["to"] == "html":
extension = "--to=%s" % "html5"
if self.builder.get_object("smart").get_active():
extension += '+smart'
else:
extension += '-smart'
if fmt["to"] != "pdf":
args.append(extension)
css_uri = self.builder.get_object("css_filechooser").get_uri()
if css_uri:
if css_uri.startswith("file://"):
css_uri = css_uri[7:]
args.append("--css=%s" % css_uri)
bib_uri = self.builder.get_object("bib_filechooser").get_uri()
if bib_uri:
if bib_uri.startswith("file://"):
bib_uri = bib_uri[7:]
args.append("--bibliography=%s" % bib_uri)
args.append(output_file)
return args
def allow_export(self, widget, data, signal):
"""Disable export button if the visible child is "pdf_disabled"
"""
del widget, data, signal
export_btn = self.builder.get_object("export_btn")
if self.stack.get_visible_child_name() == "pdf_disabled":
export_btn.set_sensitive(False)
else:
export_btn.set_sensitive(True)
def disabled_text():
"""Return the TexLive installation instructions
Returns:
{str} -- [TexLive installation instructions]
"""
if os.path.isfile("/.flatpak-info"):
text = _("Please, install the TexLive extension from Gnome Software or running\n")\
+ ("flatpak install flathub de.wolfvollprecht.UberWriter.Plugin.TexLive")
else:
text = _("Please, install TexLive from your distribuiton repositories")
return text

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +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
from gi.repository import Gtk # pylint: disable=E0611
from . helpers import get_builder
class AdvancedExportDialog(Gtk.Dialog):
__gtype_name__ = "AdvancedExportDialog"
def __new__(cls):
"""Special static method that's automatically called by Python when
constructing a new instance of this class.
Returns a fully instantiated AdvancedExportDialog object.
"""
builder = get_builder('UberwriterAdvancedExportDialog')
new_object = builder.get_object("uberwriter_advanced_export_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 AdvancedExportDialog 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

@ -24,6 +24,7 @@ from . helpers import get_builder, show_uri, get_help_uri, get_media_path
from uberwriter import UberwriterWindow
from uberwriter.Settings import Settings
from uberwriter_lib import set_up_logging
from uberwriter_lib.PreferencesDialog import PreferencesDialog
from gettext import gettext as _
@ -49,15 +50,12 @@ class Window(Gtk.ApplicationWindow):
self.set_icon_from_file(icon_file)
builder = get_builder('UberwriterWindow')
new_object = builder.get_object("grid1")
new_object = builder.get_object("FullscreenOverlay")
self.contents = new_object
self.add(self.contents)
self.finish_initializing(builder)
return super().__init__(*args, **kwargs)
def on_maximize_toggle(self, action, value):
action.set_state(value)
@ -110,7 +108,7 @@ class Application(Gtk.Application):
def do_startup(self):
Gtk.Application.do_startup(self)
'''AppMenu Actions'''
'''Actions'''
action = Gio.SimpleAction.new("help", None)
action.connect("activate", self.on_help)
@ -136,8 +134,6 @@ class Application(Gtk.Application):
action.connect("activate", self.on_quit)
self.add_action(action)
'''Right menu actions'''
set_dark_mode = self.settings.get_value("dark-mode")
action = Gio.SimpleAction.new_stateful("dark_mode",
None,
@ -167,20 +163,50 @@ class Application(Gtk.Application):
action.connect("activate", self.on_search)
self.add_action(action)
action = Gio.SimpleAction.new_stateful("preview",
None,
GLib.Variant.new_boolean(False))
action.connect("change-state", self.on_preview)
self.add_action(action)
action = Gio.SimpleAction.new_stateful("spellcheck",
None,
GLib.Variant.new_boolean(True))
action.connect("change-state", self.on_spellcheck)
self.add_action(action)
builder = get_builder('App_menu')
self.set_app_menu(builder.get_object("app-menu"))
'''Menu Actions'''
action = Gio.SimpleAction.new("new", None)
action.connect("activate", self.on_new)
self.add_action(action)
action = Gio.SimpleAction.new("open", None)
action.connect("activate", self.on_open)
self.add_action(action)
action = Gio.SimpleAction.new("open_recent", None)
action.connect("activate", self.on_open_recent)
self.add_action(action)
action = Gio.SimpleAction.new("open_examples", None)
action.connect("activate", self.on_example)
self.add_action(action)
action = Gio.SimpleAction.new("save", None)
action.connect("activate", self.on_save)
self.add_action(action)
action = Gio.SimpleAction.new("save_as", None)
action.connect("activate", self.on_save_as)
self.add_action(action)
action = Gio.SimpleAction.new("export", None)
action.connect("activate", self.on_export)
self.add_action(action)
action = Gio.SimpleAction.new("HTML_copy", None)
action.connect("activate", self.on_html_copy)
self.add_action(action)
action = Gio.SimpleAction.new("preferences", None)
action.connect("activate", self.on_preferences)
self.add_action(action)
'''Shortcuts'''
@ -190,6 +216,11 @@ class Application(Gtk.Application):
self.set_accels_for_action("app.search",["<Ctl>f"])
self.set_accels_for_action("app.spellcheck",["F7"])
self.set_accels_for_action("app.new",["<Ctl>n"])
self.set_accels_for_action("app.open",["<Ctl>o"])
self.set_accels_for_action("app.save",["<Ctl>s"])
self.set_accels_for_action("app.save_as",["<Ctl><shift>s"])
def do_activate(self):
# We only allow a single window and raise any existing ones
@ -226,15 +257,10 @@ class Application(Gtk.Application):
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("2.0.4")
about_dialog.set_copyright("Copyright (C) 2018, Wolf Vollprecht")
about_dialog.set_license_type(Gtk.License.GPL_3_0)
about_dialog.set_website("Uberwriter website http://uberwriter.github.io/uberwriter")
about_dialog.set_authors(["Wolf Vollprecht <w.vollprecht@gmail.com>",
"Manuel Genovés <manuel.genoves@gmail.com>"])
builder = get_builder('About')
about_dialog = builder.get_object("AboutDialog")
about_dialog.set_transient_for(self.window)
logo_file = get_media_path("uberwriter.svg")
logo = GdkPixbuf.Pixbuf.new_from_file(logo_file)
@ -284,7 +310,37 @@ class Application(Gtk.Application):
def on_spellcheck(self, action, value):
action.set_state(value)
self.window.toggle_spellcheck(value)
def on_new(self, action, value):
self.window.new_document()
def on_open(self, action, value):
self.window.open_document()
def on_open_recent(self, action, value):
pass
def on_example(self, action, value):
self.window.open_uberwriter_markdown()
def on_save(self, action, value):
self.window.save_document()
def on_save_as(self, action, value):
self.window.save_document_as()
def on_export(self, action, value):
self.window.open_advanced_export()
def on_html_copy(self, action, value):
self.window.copy_html_to_clipboard()
def on_preferences(self, action, value):
PreferencesWindow = PreferencesDialog()
PreferencesWindow.set_application(self)
PreferencesWindow.set_transient_for(self.window)
PreferencesWindow.show()
def on_quit(self, action, param):
self.quit()

View File

@ -25,7 +25,7 @@ logger = logging.getLogger('uberwriter_lib')
from . helpers import get_builder, show_uri, get_help_uri
class PreferencesDialog(Gtk.Dialog):
class PreferencesDialog(Gtk.Window):
__gtype_name__ = "PreferencesDialog"
def __new__(cls):
@ -34,31 +34,6 @@ class PreferencesDialog(Gtk.Dialog):
Returns a fully instantiated PreferencesDialog object.
"""
builder = get_builder('PreferencesUberwriterDialog')
new_object = builder.get_object("preferences_uberwriter_dialog")
new_object.finish_initializing(builder)
builder = get_builder('Preferences')
new_object = builder.get_object("PreferencesWindow")
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 PreferencesDialog object with it in order to
finish initializing the start of the new PerferencesUberwriterDialog
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, True)
# code for other initialization actions should be added here
def on_btn_close_clicked(self, widget, data=None):
self.destroy()
def on_btn_help_clicked(self, widget, data=None):
show_uri(self, "ghelp:%s" % get_help_uri('preferences'))