forked from Mirrors/apostrophe
commit
5f7c537c98
|
@ -0,0 +1,135 @@
|
|||
local List = require 'pandoc.List'
|
||||
|
||||
local M = {}
|
||||
|
||||
local function is_html (format)
|
||||
return format == 'html' or format == 'html4' or format == 'html5'
|
||||
end
|
||||
|
||||
--- Create a ballot box for the given output format.
|
||||
function M.ballot_box (format)
|
||||
if is_html(format) then
|
||||
return pandoc.RawInline(
|
||||
'html',
|
||||
'<input type="checkbox" class="task-list-item-checkbox" disabled />'
|
||||
)
|
||||
elseif format == 'gfm' then
|
||||
-- GFM includes raw HTML
|
||||
return pandoc.RawInline('html', '[ ]')
|
||||
elseif format == 'org' then
|
||||
return pandoc.RawInline('org', '[ ]')
|
||||
elseif format == 'latex' then
|
||||
return pandoc.RawInline('tex', '$\\square$')
|
||||
else
|
||||
return pandoc.Str '☐'
|
||||
end
|
||||
end
|
||||
|
||||
--- Create a checked ballot box for the given output format.
|
||||
function M.ballot_box_with_check (format)
|
||||
if is_html(format) then
|
||||
return pandoc.RawInline(
|
||||
'html',
|
||||
'<input type="checkbox" class="task-list-item-checkbox" checked disabled />'
|
||||
)
|
||||
elseif format == 'gfm' then
|
||||
-- GFM includes raw HTML
|
||||
return pandoc.RawInline('html', '[x]')
|
||||
elseif format == 'org' then
|
||||
return pandoc.RawInline('org', '[X]')
|
||||
elseif format == 'latex' then
|
||||
return pandoc.RawInline('tex', '$\\rlap{$\\checkmark$}\\square$')
|
||||
else
|
||||
return pandoc.Str '☑'
|
||||
end
|
||||
end
|
||||
|
||||
--- Replace a Github-style task indicator with a bullet box representation
|
||||
--- suitable for the given output format.
|
||||
function M.todo_marker (inlines, format)
|
||||
if (inlines[1] and inlines[1].text == '[' and
|
||||
inlines[2] and inlines[2].t == 'Space' and
|
||||
inlines[3] and inlines[3].text == ']') then
|
||||
return M.ballot_box(format), 3
|
||||
elseif (inlines[1] and
|
||||
(inlines[1].text == '[x]' or
|
||||
inlines[1].text == '[X]')) then
|
||||
return M.ballot_box_with_check(format), 1
|
||||
else
|
||||
return nil, 0
|
||||
end
|
||||
end
|
||||
|
||||
M.css_styles = [[
|
||||
<style>
|
||||
.task-list-item {
|
||||
list-style-type: none;
|
||||
}
|
||||
.task-list-item-checkbox {
|
||||
margin-left: -1.6em;
|
||||
}
|
||||
</style>
|
||||
]]
|
||||
|
||||
--- Add task-list CSS styles to the header.
|
||||
function M.add_task_list_css(meta)
|
||||
local header_includes
|
||||
if meta['header-includes'] and meta['header-includes'].t == 'MetaList' then
|
||||
header_includes = meta['header-includes']
|
||||
else
|
||||
header_includes = pandoc.MetaList{meta['header-includes']}
|
||||
end
|
||||
header_includes[#header_includes + 1] =
|
||||
pandoc.MetaBlocks{pandoc.RawBlock('html', M.css_styles)}
|
||||
meta['header-includes'] = header_includes
|
||||
return meta
|
||||
end
|
||||
|
||||
--- Replace the todo marker in the given block, if any.
|
||||
function M.replace_todo_markers (blk, format)
|
||||
if blk.t ~= 'Para' and blk.t ~= 'Plain' then
|
||||
return blk
|
||||
end
|
||||
local inlines = blk.content
|
||||
local box, num_inlines = M.todo_marker(inlines, format)
|
||||
if box == nil then
|
||||
return blk
|
||||
end
|
||||
local new_inlines = List:new{box}
|
||||
for j = 1, #inlines do
|
||||
new_inlines[j + 1] = inlines[j + num_inlines]
|
||||
end
|
||||
return pandoc[blk.t](new_inlines) -- create Plain or Para
|
||||
end
|
||||
|
||||
--- Convert Github- and org-mode-style task markers in a BulletList.
|
||||
function M.modifyBulletList (list)
|
||||
if not is_html(FORMAT) then
|
||||
for _, item in ipairs(list.content) do
|
||||
item[1] = M.replace_todo_markers(item[1], FORMAT)
|
||||
end
|
||||
return list
|
||||
else
|
||||
local res = List:new{pandoc.RawBlock('html', '<ul>')}
|
||||
for _, item in ipairs(list.content) do
|
||||
local blk = M.replace_todo_markers(item[1], FORMAT)
|
||||
if blk == item[1] then -- does not have a todo marker
|
||||
res[#res + 1] = pandoc.RawBlock('html', '<li>')
|
||||
else
|
||||
res[#res + 1] = pandoc.RawBlock('html', '<li class="task-list-item">')
|
||||
item[1] = blk
|
||||
end
|
||||
res:extend(item)
|
||||
res[#res + 1] = pandoc.RawBlock('html', '</li>')
|
||||
end
|
||||
res[#res + 1] = pandoc.RawBlock('html', '</ul>')
|
||||
return res
|
||||
end
|
||||
end
|
||||
|
||||
M[1] = {
|
||||
BulletList = M.modifyBulletList,
|
||||
Meta = is_html(FORMAT) and M.add_task_list_css or nil
|
||||
}
|
||||
|
||||
return M
|
|
@ -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 <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/>.
|
||||
</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 <w.vollprecht@gmail.com></property>
|
||||
<property name="authors">Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com></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>
|
|
@ -0,0 +1,42 @@
|
|||
<?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.about</attribute>
|
||||
<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.quit</attribute>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="accel"><Primary>q</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
</interface>
|
|
@ -0,0 +1,151 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkShortcutsWindow" id="shortcuts">
|
||||
<property name="modal">True</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsSection" id="section1">
|
||||
<property name="visible">True</property>
|
||||
<property name="section-name">shortcuts</property>
|
||||
<property name="max-height">10</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup" id="s1lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">General</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-1">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">New</property>
|
||||
<property name="accelerator"><Primary>n</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-2">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Open</property>
|
||||
<property name="accelerator"><Primary>o</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-3">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Save</property>
|
||||
<property name="accelerator"><Primary>s</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-4">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Save as</property>
|
||||
<property name="accelerator"><Shift><Primary>s</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-5">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Quit</property>
|
||||
<property name="accelerator"><Primary>w</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-6">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Focus mode</property>
|
||||
<property name="accelerator"><Primary>d</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-7">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Fullscreen</property>
|
||||
<property name="accelerator">F11</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-8">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Preview</property>
|
||||
<property name="accelerator"><Primary>p</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s1-9">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Search</property>
|
||||
<property name="accelerator"><Primary>f</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup" id="s2">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Editor</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-1">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Separator</property>
|
||||
<property name="accelerator"><Primary>r</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-2">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">List item</property>
|
||||
<property name="accelerator"><Primary>u</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-3">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Italic</property>
|
||||
<property name="accelerator"><Primary>i</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-4">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Bold</property>
|
||||
<property name="accelerator"><Primary>b</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-5">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Header</property>
|
||||
<property name="accelerator"><Primary>h</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-6">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Cut</property>
|
||||
<property name="accelerator"><Primary>x</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-7">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Copy</property>
|
||||
<property name="accelerator"><Primary>c</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-8">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Paste</property>
|
||||
<property name="accelerator"><Primary>v</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut" id="s2-9">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Select all</property>
|
||||
<property name="accelerator"><Primary>a</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
File diff suppressed because it is too large
Load Diff
|
@ -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>
|
|
@ -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="GtkWindow"
|
||||
icon-name="widget-gtk-window"/>
|
||||
</glade-widget-classes>
|
||||
</glade-catalog>
|
|
@ -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 ""
|
||||
|
|
|
@ -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.
|
||||
|
|
@ -109,9 +109,9 @@ class MarkupBuffer():
|
|||
|
||||
# self.ftag = self.TextBuffer.create_tag("pix_front", pixels_above_lines = 100)
|
||||
regex = {
|
||||
"ITALIC": re.compile(r"\*\w(.+?)\*| _\w(.+?)_ ", re.UNICODE), # *asdasd* // _asdasd asd asd_
|
||||
"STRONG": re.compile(r"\*{2}\w(.+?)\*{2}| [_]{2}\w(.+?)[_]{2} ", re.UNICODE), # **as das** // __asdasdasd asd ad a__
|
||||
"STRONGITALIC": re.compile(r"\*{3}\w(.+?)\*{3}| [_]{3}\w(.+?)[_]{3} "),
|
||||
"ITALIC": re.compile(r"\*\w(.+?)\*| _\w(.+?)_ |\*(.)\*| _(.)_ ", re.UNICODE), # *asdasd* // _asdasd asd asd_
|
||||
"STRONG": re.compile(r"\*{2}\w(.+?)\*{2}|\*{2}(.)\*{2}| [_]{2}\w(.+?)[_]{2} | [_]{2}(.)[_]{2} ", re.UNICODE), # **as das** // __asdasdasd asd ad a__
|
||||
"STRONGITALIC": re.compile(r"\*{3}\w(.+?)\*{3}|\*{3}(.)\*{3}| [_]{3}\w(.+?)[_]{3} | [_]{3}(.)[_]{3} "),
|
||||
"BLOCKQUOTE": re.compile(r"^([\>]+ )", re.MULTILINE),
|
||||
"STRIKETHROUGH": re.compile(r"~~[^ `~\n].+?~~"),
|
||||
"LIST": re.compile(r"^[\-\*\+] ", re.MULTILINE),
|
||||
|
|
|
@ -27,6 +27,8 @@ locale.textdomain('uberwriter')
|
|||
|
||||
import mimetypes
|
||||
|
||||
import gi
|
||||
gi.require_version('WebKit2', '4.0')
|
||||
from gi.repository import Gtk, Gdk, GObject, Gio # pylint: disable=E0611
|
||||
from gi.repository import WebKit2 as WebKit
|
||||
from gi.repository import Pango # pylint: disable=E0611
|
||||
|
@ -58,9 +60,9 @@ try:
|
|||
except:
|
||||
APT_ENABLED = False
|
||||
|
||||
from uberwriter_lib import Window
|
||||
#from uberwriter_lib import Window
|
||||
from uberwriter_lib.AppWindow import Window
|
||||
from uberwriter_lib import helpers
|
||||
from .AboutUberwriterDialog import AboutUberwriterDialog
|
||||
from .UberwriterAdvancedExportDialog import UberwriterAdvancedExportDialog
|
||||
# from .plugins.bibtex import BibTex
|
||||
# Some Globals
|
||||
|
@ -72,8 +74,8 @@ CONFIG_PATH = os.path.expanduser("~/.config/uberwriter/")
|
|||
# See texteditor_lib.Window.py for more details about how this class works
|
||||
class UberwriterWindow(Window):
|
||||
|
||||
__gtype_name__ = "UberwriterWindow"
|
||||
|
||||
#__gtype_name__ = "UberwriterWindow"
|
||||
|
||||
__gsignals__ = {
|
||||
'save-file': (GObject.SIGNAL_ACTION, None, ()),
|
||||
'open-file': (GObject.SIGNAL_ACTION, None, ()),
|
||||
|
@ -697,7 +699,9 @@ class UberwriterWindow(Window):
|
|||
'-smart',
|
||||
'-thtml',
|
||||
'--mathjax',
|
||||
'--lua-filter=' + helpers.get_media_path('task-list.lua'),
|
||||
'-c', helpers.get_media_file('uberwriter.css')]
|
||||
print(args)
|
||||
|
||||
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
|
||||
|
@ -722,7 +726,7 @@ class UberwriterWindow(Window):
|
|||
|
||||
# This saying that all links will be opened in default browser, \
|
||||
# but local files are opened in appropriate apps:
|
||||
self.webview.connect("navigation-requested", self.on_click_link)
|
||||
self.webview.connect("decide-policy", self.on_click_link)
|
||||
else:
|
||||
self.ScrolledWindow.remove(self.webview)
|
||||
self.webview.destroy()
|
||||
|
@ -735,10 +739,11 @@ class UberwriterWindow(Window):
|
|||
self.queue_draw()
|
||||
return True
|
||||
|
||||
def on_click_link(self, view, frame, req, data=None):
|
||||
def on_click_link(self, web_view, decision, decision_type):
|
||||
# This provide ability for self.webview to open links in default browser
|
||||
if(req.get_uri().startswith("http://")):
|
||||
webbrowser.open(req.get_uri())
|
||||
if(web_view.get_uri().startswith(("http://","https://","www."))):
|
||||
webbrowser.open(web_view.get_uri())
|
||||
decision.ignore()
|
||||
return True # Don't let the event "bubble up"
|
||||
|
||||
def dark_mode_toggled(self, widget, data=None):
|
||||
|
@ -791,9 +796,6 @@ class UberwriterWindow(Window):
|
|||
def open_launchpad_translation(self, widget, data=None):
|
||||
webbrowser.open("https://translations.launchpad.net/uberwriter")
|
||||
|
||||
def open_launchpad_help(self, widget, data=None):
|
||||
webbrowser.open("https://answers.launchpad.net/uberwriter")
|
||||
|
||||
def open_pandoc_markdown(self, widget, data=None):
|
||||
webbrowser.open("http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown")
|
||||
|
||||
|
@ -920,11 +922,13 @@ 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)
|
||||
|
@ -944,6 +948,7 @@ class UberwriterWindow(Window):
|
|||
self.texlive_installed = False
|
||||
|
||||
self.set_name('UberwriterWindow')
|
||||
|
||||
|
||||
self.use_headerbar = True
|
||||
if self.use_headerbar == True:
|
||||
|
@ -986,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')
|
||||
|
|
|
@ -13,50 +13,34 @@
|
|||
# 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 optparse
|
||||
import sys
|
||||
|
||||
import locale
|
||||
import os
|
||||
from locale import gettext as _
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk # pylint: disable=E0611
|
||||
|
||||
from . import UberwriterWindow
|
||||
|
||||
from uberwriter_lib import set_up_logging, get_version
|
||||
|
||||
def parse_options():
|
||||
"""Support for command line options"""
|
||||
parser = optparse.OptionParser(version="%%prog %s" % get_version())
|
||||
parser.add_option(
|
||||
"-v", "--verbose", action="count", dest="verbose",
|
||||
help=_("Show debug messages (-vv debugs uberwriter_lib also)"))
|
||||
parser.add_option(
|
||||
"-e", "--experimental-features", help="Use experimental features",
|
||||
action='store_true'
|
||||
)
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
set_up_logging(options)
|
||||
|
||||
# print args
|
||||
|
||||
return options, args
|
||||
from uberwriter_lib import AppWindow
|
||||
|
||||
def main():
|
||||
'constructor for your class instances'
|
||||
(options, args) = parse_options()
|
||||
|
||||
# (options, args) = parse_options()
|
||||
|
||||
# Run the application.
|
||||
if args:
|
||||
for arg in args:
|
||||
window = UberwriterWindow.UberwriterWindow()
|
||||
window.load_file(arg)
|
||||
else:
|
||||
window = UberwriterWindow.UberwriterWindow()
|
||||
if options.experimental_features:
|
||||
window.use_experimental_features(True)
|
||||
window.show()
|
||||
Gtk.main()
|
||||
app = AppWindow.Application()
|
||||
|
||||
# ~ if args:
|
||||
# ~ for arg in args:
|
||||
# ~ pass
|
||||
# ~ else:
|
||||
# ~ pass
|
||||
# ~ if options.experimental_features:
|
||||
# ~ window.use_experimental_features(True)
|
||||
|
||||
app.run(sys.argv)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
# 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/>.
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
import locale
|
||||
import os
|
||||
from locale import gettext as _
|
||||
locale.textdomain('uberwriter')
|
||||
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import GLib, Gio, Gtk, GdkPixbuf
|
||||
|
||||
from . helpers import get_builder, show_uri, get_help_uri, get_media_path
|
||||
from uberwriter import UberwriterWindow
|
||||
from uberwriter_lib import set_up_logging
|
||||
|
||||
class Window(Gtk.ApplicationWindow):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# This will be in the windows group and have the "win" prefix
|
||||
max_action = Gio.SimpleAction.new_stateful("maximize", None,
|
||||
GLib.Variant.new_boolean(False))
|
||||
max_action.connect("change-state", self.on_maximize_toggle)
|
||||
self.add_action(max_action)
|
||||
|
||||
# Keep it in sync with the actual state
|
||||
self.connect("notify::is-maximized",
|
||||
lambda obj, pspec: max_action.set_state(
|
||||
GLib.Variant.new_boolean(obj.props.is_maximized)))
|
||||
|
||||
self.set_default_size(800,500)
|
||||
|
||||
icon_file = get_media_path("uberwriter.svg")
|
||||
self.set_icon_from_file(icon_file)
|
||||
|
||||
builder = get_builder('UberwriterWindow')
|
||||
new_object = builder.get_object("grid1")
|
||||
|
||||
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)
|
||||
if value.get_boolean():
|
||||
self.maximize()
|
||||
else:
|
||||
self.unmaximize()
|
||||
|
||||
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
|
||||
|
||||
|
||||
class Application(Gtk.Application):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, application_id="de.wolfvollprecht.UberWriter",
|
||||
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
|
||||
**kwargs)
|
||||
self.window = None
|
||||
|
||||
def do_startup(self):
|
||||
Gtk.Application.do_startup(self)
|
||||
|
||||
action = Gio.SimpleAction.new("help", None)
|
||||
action.connect("activate", self.on_help)
|
||||
self.add_action(action)
|
||||
|
||||
action = Gio.SimpleAction.new("shortcuts", None)
|
||||
action.connect("activate", self.on_shortcuts)
|
||||
self.add_action(action)
|
||||
|
||||
action = Gio.SimpleAction.new("about", None)
|
||||
action.connect("activate", self.on_about)
|
||||
self.add_action(action)
|
||||
|
||||
action = Gio.SimpleAction.new("quit", None)
|
||||
action.connect("activate", self.on_quit)
|
||||
self.add_action(action)
|
||||
|
||||
builder = get_builder('App_menu')
|
||||
self.set_app_menu(builder.get_object("app-menu"))
|
||||
|
||||
|
||||
def do_activate(self):
|
||||
# We only allow a single window and raise any existing ones
|
||||
if not self.window:
|
||||
# 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(application=self, title="UberWriter")
|
||||
if len(self.args) > 0:
|
||||
self.window.load_file(self.args[0])
|
||||
if self.options.experimental_features:
|
||||
self.window.use_experimental_features(True)
|
||||
|
||||
|
||||
self.window.present()
|
||||
|
||||
def do_command_line(self, command_line):
|
||||
|
||||
"""Support for command line options"""
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"-v", "--verbose", action="count", dest="verbose",
|
||||
help=_("Show debug messages (-vv debugs uberwriter_lib also)"))
|
||||
parser.add_argument(
|
||||
"-e", "--experimental-features", help=_("Use experimental features"),
|
||||
action='store_true'
|
||||
)
|
||||
(self.options, self.args) = parser.parse_known_args()
|
||||
|
||||
set_up_logging(self.options)
|
||||
|
||||
self.activate()
|
||||
return 0
|
||||
|
||||
|
||||
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("Uberwriter website http://uberwriter.wolfvollprecht.de")
|
||||
about_dialog.set_authors(["Wolf Vollprecht <w.vollprecht@gmail.com>",
|
||||
"Manuel Genovés <manuel.genoves@gmail.com>"])
|
||||
|
||||
logo_file = get_media_path("uberwriter.svg")
|
||||
logo = GdkPixbuf.Pixbuf.new_from_file(logo_file)
|
||||
|
||||
about_dialog.set_logo(logo)
|
||||
|
||||
about_dialog.present()
|
||||
|
||||
def on_help(self, action, param):
|
||||
self.window.open_pandoc_markdown(self)
|
||||
|
||||
def on_shortcuts(self, action, param):
|
||||
builder = get_builder('Shortcuts')
|
||||
builder.get_object("shortcuts").set_transient_for(self.window)
|
||||
builder.get_object("shortcuts").show()
|
||||
|
||||
def on_quit(self, action, param):
|
||||
self.quit()
|
||||
|
||||
# ~ if __name__ == "__main__":
|
||||
# ~ app = Application()
|
||||
# ~ app.run(sys.argv)
|
|
@ -1,129 +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.ApplicationWindow):
|
||||
__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.
|
||||
"""
|
||||
builder = get_builder('UberwriterWindow')
|
||||
new_object = builder.get_object("uberwriter_window")
|
||||
new_object.finish_initializing(builder)
|
||||
return new_object
|
||||
|
||||
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
|
||||
|
|
@ -20,6 +20,6 @@
|
|||
|
||||
while keeping its api constant'''
|
||||
from . helpers import set_up_logging
|
||||
from . Window import Window
|
||||
from . AppWindow import Window
|
||||
from . uberwriterconfig import get_version
|
||||
|
||||
|
|
Loading…
Reference in New Issue