diff --git a/data/glib-2.0/schemas/gschemas.compiled b/data/glib-2.0/schemas/gschemas.compiled
index 30e71a8..88aba02 100644
Binary files a/data/glib-2.0/schemas/gschemas.compiled and b/data/glib-2.0/schemas/gschemas.compiled differ
diff --git a/data/glib-2.0/schemas/net.launchpad.uberwriter.gschema.xml b/data/glib-2.0/schemas/net.launchpad.uberwriter.gschema.xml
index e24efce..951c4d4 100644
--- a/data/glib-2.0/schemas/net.launchpad.uberwriter.gschema.xml
+++ b/data/glib-2.0/schemas/net.launchpad.uberwriter.gschema.xml
@@ -1,10 +1,10 @@
-
+
''
Sample setting
- Longer description of this sample setting. Talk about allowed values and what it does.
+ Yolo.
diff --git a/data/media/style.css b/data/media/style.css
index b432d6c..cbb77d1 100644
--- a/data/media/style.css
+++ b/data/media/style.css
@@ -18,6 +18,7 @@
bind "r" { "toggle-search-replace" () };
bind "f" { "toggle-search-replace" () };
bind "F11" { "toggle-fullscreen" () };
+ bind "F7" { "toggle-spellcheck" () };
}
@binding-set editor-bindings {
@@ -28,6 +29,7 @@
bind "h" { "insert-heading" () };
bind "z" { "undo" () };
bind "y" { "redo" () };
+ /*bind "t" { "insert-at-cursor" ('[ ] ') };*/
bind "z" { "redo" () };
}
@@ -53,7 +55,10 @@
font: initial;
}
-
+#UberwriterWindow GtkAlignment {
+ margin-top: 30px;
+ margin-bottom: 60px;
+}
#UberwriterWindow.dark_mode {
background: #333;
@@ -132,7 +137,6 @@
transition: 500ms ease-in;
}
-
#status_bar_box GtkButton:hover,
#status_bar_box GtkButton:active:hover {
transition: 0s ease-in;
@@ -140,7 +144,6 @@
background: #EEE;
}
-
#status_bar_box GtkButton:active {
color: #EEE;
background-color: #EEE;
@@ -175,15 +178,55 @@
#LexikonBubble {
font: serif 12;
+ background: #FFF;
+ border-radius: 4px;
+ margin: 5px;
+ padding: 5px;
+}
+
+#QuickPreviewPopup {
+ padding: 5px;
+ margin: 5px;
+ border: 1px solid #333;
+ /*background: #FFF;*/
+ border-radius: 3px;
+}
+
+#LexikonBubble GtkLabel {
+ /*padding: 5px;*/
+}
+
+#LexikonBubble {
+ border: 5px solid #FFF;
}
#LexikonBubble .lexikon_heading {
font: serif 12;
padding-bottom: 5px;
- padding-top: 3px;
+ padding-top: 5px;
font-weight: bold;
+ padding-left: 10px;
}
#LexikonBubble .lexikon_num {
padding-right: 5px;
- }
\ No newline at end of file
+ padding-left: 20px;
+}
+
+#UberwriterWindow #AutoCorrect {
+ padding: 10px;
+ background: #FFF;
+ /*box-shadow: 0 0 5px #000;*/
+ border: 1px solid #BCD1EB;
+ border-radius: 3px 10px 10px 3px;
+ color: #333;
+}
+
+#UberwriterWindow #AutoCorrect GtkLabel {
+ padding: 3px 5px;
+ font: sans-serif;
+}
+
+#UberwriterWindow #AutoCorrect GtkImage {
+ padding: 3px 5px;
+}
\ No newline at end of file
diff --git a/data/ui/UberwriterWindow.ui b/data/ui/UberwriterWindow.ui
index 641398f..941750b 100644
--- a/data/ui/UberwriterWindow.ui
+++ b/data/ui/UberwriterWindow.ui
@@ -21,22 +21,6 @@
Activate Regex
icon-regex-off.png
-
-
-
@@ -140,8 +118,6 @@
Export as PDF
True
False
- image3
- False
@@ -150,8 +126,6 @@
Export as ODT
True
False
- image1
- False
@@ -174,7 +148,7 @@
@@ -187,11 +161,10 @@
@@ -243,7 +216,7 @@
Light text on a dark background
Dark Mode
True
-
+
@@ -253,7 +226,7 @@
Switch to preview mode
Preview
True
-
+
@@ -279,7 +252,7 @@
Use Typewritermode (experimental)
True
True
-
+
@@ -296,7 +269,7 @@
Auto _Spellcheck
True
True
-
+
@@ -374,7 +347,6 @@
True
False
True
- True
@@ -403,7 +375,7 @@
100
True
False
- 5
+ 5
0
Search
@@ -533,7 +505,7 @@
100
True
False
- 5
+ 5
0
Replace with
@@ -655,9 +627,7 @@
@@ -799,7 +769,7 @@
True
False
end
- 11
+ 11
1
0
6
diff --git a/po/uberwriter.pot b/po/uberwriter.pot
index 7d0b74f..62eb240 100644
--- a/po/uberwriter.pot
+++ b/po/uberwriter.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-09-15 14:02+0200\n"
+"POT-Creation-Date: 2014-09-30 01:49+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -17,6 +17,10 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
+#: ../uberwriter/__init__.py:35
+msgid "Show debug messages (-vv debugs uberwriter_lib also)"
+msgstr ""
+
#: ../data/ui/AboutUberwriterDialog.ui.h:1
msgid ""
"# Copyright (C) 2012, Wolf Vollprecht \n"
@@ -38,171 +42,6 @@ msgstr ""
msgid "Copyright (C) 2012, Wolf Vollprecht "
msgstr ""
-#: ../uberwriter/__init__.py:35
-msgid "Show debug messages (-vv debugs uberwriter_lib also)"
-msgstr ""
-
-#: ../uberwriter/FormatShortcuts.py:85
-msgid "emphasized text"
-msgstr ""
-
-#: ../uberwriter/FormatShortcuts.py:87
-msgid "strong text"
-msgstr ""
-
-#: ../uberwriter/FormatShortcuts.py:101
-msgid "List item"
-msgstr ""
-
-#: ../uberwriter/FormatShortcuts.py:182
-msgid "Heading"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:1
-msgid "Export"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:2
-msgid "Smart"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:3
-msgid "Pandoc can automatically make \"--\" to a long dash and more"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:4
-msgid "Normalize"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:5
-msgid ""
-"Removes things like double spaces or spaces at the beginning of a paragraph"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:6
-msgid "Table of Contents"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:7
-msgid "Standalone"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:8
-msgid ""
-"Use a header and footer to include things like stylesheets and meta "
-"information"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:9
-msgid "Number Sections"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:10
-msgid "Strict Markdown"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:11
-msgid "Use \"strict\" markdown instead of \"pandoc\" markdown"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:12
-msgid "Slideshow incremental bullets"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:13
-msgid "Show one bullet point after another in a slideshow"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:14
-msgid "General Options"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:15
-msgid "Highlight syntax"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:16
-msgid "Choose a color theme for syntax highlighting"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:17
-msgid "Highlight style "
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:18
-msgid "Syntax highlighting (HTML, LaTeX)"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:19
-msgid "Self Contained"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:20
-msgid ""
-"Produces a HTML that has no external dependencies (all images and "
-"stylesheets are included)"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:21
-msgid "HTML 5"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:22
-msgid "Use HTML 5 syntax"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:23
-msgid "Choose a CSS File that you want to use"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:24
-msgid "CSS File"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:25
-msgid "HTML Options"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:26
-msgid "Bibliography File"
-msgstr ""
-
-#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:27
-msgid "Commandline Reference"
-msgstr ""
-
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:475
-msgid "(no suggestions)"
-msgstr ""
-
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:499
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:502
-msgid "Add \"{}\" to Dictionary"
-msgstr ""
-
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:506
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:508
-msgid "Ignore All"
-msgstr ""
-
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:523
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:525
-msgid "Languages"
-msgstr ""
-
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:541
-#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:544
-msgid "Suggestions"
-msgstr ""
-
-#: ../uberwriter.desktop.in.h:1
-msgid "UberWriter"
-msgstr ""
-
-#: ../uberwriter.desktop.in.h:2
-msgid "UberWriter, a simple and distraction free Markdown Editor"
-msgstr ""
-
#: ../data/ui/UberwriterWindow.ui.h:1
msgid "Case Sensitive"
msgstr ""
@@ -355,57 +194,6 @@ msgstr ""
msgid "Characters:"
msgstr ""
-#: ../uberwriter/UberwriterWindow.py:338
-msgid "Save your File"
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:484
-msgid "You can not export to PDF."
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:486
-msgid ""
-"Please install texlive from the software center."
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:516
-msgid "MarkDown or Plain Text"
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:519
-msgid "Open a .md-File"
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:541
-msgid "You have not saved your changes."
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:543
-msgid "Close without Saving"
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:544
-msgid "Cancel"
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:545
-msgid "Save now"
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:546
-msgid "Unsaved changes"
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:611
-msgid "You can not enable the Spell Checker."
-msgstr ""
-
-#: ../uberwriter/UberwriterWindow.py:613
-msgid ""
-"Please install 'hunspell' or 'aspell' dictionarys for your language from the "
-"software center."
-msgstr ""
-
#: ../uberwriter/UberwriterInlinePreview.py:174
msgid "Website is not available"
msgstr ""
@@ -414,10 +202,222 @@ msgstr ""
msgid "Website is available"
msgstr ""
-#: ../uberwriter/UberwriterInlinePreview.py:385
+#: ../uberwriter/UberwriterInlinePreview.py:419
msgid "Open Link in Webbrowser"
msgstr ""
-#: ../uberwriter/UberwriterInlinePreview.py:443
+#: ../uberwriter/UberwriterInlinePreview.py:475
msgid "No matching footnote found"
msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:344
+msgid "Save your File"
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:490
+msgid "You can not export to PDF."
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:492
+msgid ""
+"Please install texlive from the software center."
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:522
+msgid "MarkDown or Plain Text"
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:525
+msgid "Open a .md-File"
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:547
+msgid "You have not saved your changes."
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:549
+msgid "Close without Saving"
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:550
+msgid "Cancel"
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:551
+msgid "Save now"
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:552
+msgid "Unsaved changes"
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:617
+msgid "You can not enable the Spell Checker."
+msgstr ""
+
+#: ../uberwriter/UberwriterWindow.py:619
+msgid ""
+"Please install 'hunspell' or 'aspell' dictionarys for your language from the "
+"software center."
+msgstr ""
+
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:499
+msgid "(no suggestions)"
+msgstr ""
+
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:533
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:536
+msgid "Add \"{}\" to Dictionary"
+msgstr ""
+
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:540
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:542
+msgid "Ignore All"
+msgstr ""
+
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:557
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:559
+msgid "Languages"
+msgstr ""
+
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:575
+#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:578
+msgid "Suggestions"
+msgstr ""
+
+#: ../uberwriter/FormatShortcuts.py:85
+msgid "emphasized text"
+msgstr ""
+
+#: ../uberwriter/FormatShortcuts.py:87
+msgid "strong text"
+msgstr ""
+
+#: ../uberwriter/FormatShortcuts.py:101
+msgid "List item"
+msgstr ""
+
+#: ../uberwriter/FormatShortcuts.py:182
+msgid "Heading"
+msgstr ""
+
+#: ../uberwriter.desktop.in.h:1
+msgid "UberWriter"
+msgstr ""
+
+#: ../uberwriter.desktop.in.h:2
+msgid "UberWriter, a simple and distraction free Markdown Editor"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:1
+msgid "Export"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:2
+msgid "Smart"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:3
+msgid "Pandoc can automatically make \"--\" to a long dash and more"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:4
+msgid "Normalize"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:5
+msgid ""
+"Removes things like double spaces or spaces at the beginning of a paragraph"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:6
+msgid "Table of Contents"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:7
+msgid "Standalone"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:8
+msgid ""
+"Use a header and footer to include things like stylesheets and meta "
+"information"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:9
+msgid "Number Sections"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:10
+msgid "Strict Markdown"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:11
+msgid "Use \"strict\" markdown instead of \"pandoc\" markdown"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:12
+msgid "Slideshow incremental bullets"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:13
+msgid "Show one bullet point after another in a slideshow"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:14
+msgid "General Options"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:15
+msgid "Highlight syntax"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:16
+msgid "Choose a color theme for syntax highlighting"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:17
+msgid "Highlight style "
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:18
+msgid "Syntax highlighting (HTML, LaTeX)"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:19
+msgid "Self Contained"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:20
+msgid ""
+"Produces a HTML that has no external dependencies (all images and "
+"stylesheets are included)"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:21
+msgid "HTML 5"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:22
+msgid "Use HTML 5 syntax"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:23
+msgid "Choose a CSS File that you want to use"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:24
+msgid "CSS File"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:25
+msgid "HTML Options"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:26
+msgid "Bibliography File"
+msgstr ""
+
+#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:27
+msgid "Commandline Reference"
+msgstr ""
diff --git a/setup.py b/setup.py
index b11bae6..9456d81 100644
--- a/setup.py
+++ b/setup.py
@@ -104,14 +104,13 @@ def update_desktop_file(filename, target_pkgdata, target_scripts):
fout.close()
fin.close()
os.rename(fout.name, fin.name)
+
except (OSError, IOError) as e:
print ("ERROR: Can't find %s" % filename)
sys.exit(1)
def compile_schemas(root, target_data):
- if target_data == '/usr/':
- return # /usr paths don't need this, they will be handled by dpkg
- schemadir = os.path.normpath(root + target_data + 'share/glib-2.0/schemas')
+ schemadir = os.path.normpath('usr/share/glib-2.0/schemas')
if (os.path.isdir(schemadir) and
os.path.isfile('/usr/bin/glib-compile-schemas')):
os.system('/usr/bin/glib-compile-schemas "%s"' % schemadir)
@@ -166,5 +165,7 @@ DistUtilsExtra.auto.setup(
package_data={
'uberwriter_lib.pylocales' : ['locales.db']
},
- data_files=[('uberwriter_lib/pylocales', ['uberwriter_lib/pylocales/locales.db'])]
+ data_files=[
+ ('uberwriter_lib/pylocales', ['uberwriter_lib/pylocales/locales.db']),
+ ('/usr/share/glib-2.0/schemas', ['data/glib-2.0/schemas/net.launchpad.uberwriter.gschema.xml'])]
)
\ No newline at end of file
diff --git a/uberwriter/MarkupBuffer.py b/uberwriter/MarkupBuffer.py
index f6dfa89..606e9d8 100644
--- a/uberwriter/MarkupBuffer.py
+++ b/uberwriter/MarkupBuffer.py
@@ -306,11 +306,13 @@ class MarkupBuffer():
def recalculate(self, lm):
multiplier = self.multiplier
for i in range(0, 6):
- self.rev_leftmargin[i].set_property("left-margin", (lm - multiplier) - multiplier * (i + 1))
+ new_margin = (lm - multiplier) - multiplier * (i + 1)
+ self.rev_leftmargin[i].set_property("left-margin", 0 if new_margin < 0 else new_margin)
self.rev_leftmargin[i].set_property("indent", - multiplier * (i + 1) - multiplier)
for i in range(0, 6):
- self.leftmargin[i].set_property("left-margin", (lm - multiplier) + multiplier + multiplier * (i + 1))
+ new_margin = (lm - multiplier) + multiplier + multiplier * (i + 1)
+ self.leftmargin[i].set_property("left-margin", 0 if new_margin < 0 else new_margin)
self.leftmargin[i].set_property("indent", - (multiplier - 1) * (i + 1) - multiplier)
def dark_mode(self, active=False):
diff --git a/uberwriter/UberwriterInlinePreview.py b/uberwriter/UberwriterInlinePreview.py
index e0286a5..84689cb 100644
--- a/uberwriter/UberwriterInlinePreview.py
+++ b/uberwriter/UberwriterInlinePreview.py
@@ -125,10 +125,8 @@ class DictAccessor(object):
act_res['class'] = l
else:
ll = re.split('(?: |^)(\d): ', l)
- # print(ll)
act_def = {}
for lll in ll:
- # print (lll)
if lll.strip().isdigit() or not lll.strip():
if 'description' in act_def and act_def['description']:
act_res['defs'].append(act_def.copy())
@@ -181,8 +179,10 @@ def check_url(url, item, spinner):
def get_dictionary(term):
da = DictAccessor()
output = da.getDefinition('wn', term)
- output = output[0]
- print(output)
+ if(len(output)):
+ output = output[0]
+ else:
+ return None
return da.parse_wordnet(output.decode(encoding='UTF-8'))
def get_web_thumbnail(url, item, spinner):
@@ -220,11 +220,15 @@ def fill_lexikon_bubble(vocab, lexikon_dict):
for entry in lexikon_dict:
vocab_label = Gtk.Label.new(vocab + ' ~ ' + entry['class'])
vocab_label.get_style_context().add_class('lexikon_heading')
+ vocab_label.set_halign(Gtk.Align.START)
+ vocab_label.set_justify(Gtk.Justification.LEFT)
grid.attach(vocab_label, 0, i, 3, 1)
+
for definition in entry['defs']:
i = i + 1
num_label = Gtk.Label.new(definition['num'])
num_label.get_style_context().add_class('lexikon_num')
+ num_label.set_justify(Gtk.Justification.RIGHT)
grid.attach(num_label, 0, i, 1, 1)
def_label = Gtk.Label.new(' '.join(definition['description']))
@@ -254,19 +258,44 @@ class UberwriterInlinePreview():
self.TextView.connect_after('populate-popup', self.populate_popup)
self.TextView.connect_after('popup-menu', self.move_popup)
self.TextView.connect('button-press-event', self.click_move_button)
+ self.popover = None
def open_popover_with_widget(self, widget):
- a = self.TextBuffer.create_child_anchor(self.TextBuffer.get_iter_at_mark(self.ClickMark))
+ # a = self.TextBuffer.create_child_anchor(self.TextBuffer.get_iter_at_mark(self.ClickMark))
+ a = Gtk.Window.new(Gtk.WindowType.POPUP)
+ a.set_transient_for(self.TextView.get_toplevel())
+ a.grab_focus()
+ a.set_name("QuickPreviewPopup")
+ # a.set_attached_to(self.TextView)
+ a.move(300, 300)
+ a.set_modal(True)
+ def close(widget, event, *args):
+ if(event.keyval == Gdk.KEY_Escape):
+ widget.destroy()
+ a.connect('key-press-event', close)
b = Gtk.Grid.new()
- self.TextView.add_child_at_anchor(b, a)
- b.show()
- popover = Gtk.Popover.new(b)
- dismiss, rect = popover.get_pointing_to()
- rect.y = rect.y - 20
- popover.set_pointing_to(rect)
- popover.add(widget)
- popover.show_all()
- popover.set_property('width-request', 50)
+ alignment = Gtk.Alignment()
+ alignment.props.margin_bottom = 5
+ alignment.props.margin_top = 5
+ alignment.props.margin_left = 4
+ alignment.add(widget)
+ a.add(alignment)
+ # self.TextView.add_child_in_window(b, Gtk.TextWindowType.WIDGET, 200, 200)
+ # b.attach(Gtk.Label.new("test 123"), 0, 0, 1, 1)
+ # b.show_all()
+ a.show_all()
+ # self.popover = Gtk.Popover.new(b)
+ # dismiss, rect = popover.get_pointing_to()
+ # rect.y = rect.y - 20
+ # popover.set_pointing_to(rect)
+ # widget = Gtk.Label.new("testasds a;12j3 21 lk3j213")
+ # widget.show_all()
+
+ # b.attach(widget, 0, 1, 1, 1)
+ # self.popover.set_modal(False)
+ # self.popover.show_all()
+ # print(self.popover)
+ # popover.set_property('width-request', 50)
def click_move_button(self, widget, event):
if event.button == 3:
@@ -408,10 +437,8 @@ class UberwriterInlinePreview():
pb = GdkPixbuf.Pixbuf.new_from_file_at_size(path, 400, 300)
image = Gtk.Image.new_from_pixbuf(pb)
image.show()
- popover.add(image)
- popover.show_all()
+ self.open_popover_with_widget(image)
item.set_property('width-request', 50)
- popover.set_property('width-request', 50)
# item.add(image)
# item.set_property('width-request', 50)
@@ -461,19 +488,14 @@ class UberwriterInlinePreview():
end_iter = start_iter.copy()
end_iter.forward_word_end()
word = self.TextBuffer.get_text(start_iter, end_iter, False)
- print(word)
terms = get_dictionary(word)
- sc = Gtk.ScrolledWindow.new()
- # tv = Gtk.TextView.new()
- # tv.set_editable(False)
- # tv.set_name('LexikonBubble')
-
- sc.add(fill_lexikon_bubble(word, get_dictionary(word)))
- sc.props.width_request = 500
- sc.props.height_request = 400
- # tv.get_buffer().set_text(terms)
- sc.show_all()
- self.open_popover_with_widget(sc)
+ if terms:
+ sc = Gtk.ScrolledWindow.new()
+ sc.add(fill_lexikon_bubble(word, terms))
+ sc.props.width_request = 500
+ sc.props.height_request = 400
+ sc.show_all()
+ self.open_popover_with_widget(sc)
return
diff --git a/uberwriter/UberwriterTextEditor.py b/uberwriter/UberwriterTextEditor.py
index 4601abb..fa445ff 100644
--- a/uberwriter/UberwriterTextEditor.py
+++ b/uberwriter/UberwriterTextEditor.py
@@ -251,8 +251,8 @@ class TextEditor(Gtk.TextView):
stop = buf.get_iter_at_offset(
offset + undo_action.length
)
- buf.delete(start, stop)
buf.place_cursor(start)
+ buf.delete(start, stop)
else:
start = buf.get_iter_at_offset(undo_action.start)
buf.insert(start, undo_action.text)
@@ -318,8 +318,6 @@ class TextEditor(Gtk.TextView):
if self.not_undoable_action:
return
- logger.debug(text)
- logger.debug("b: %i, l: %i" % (length, len(text)))
undo_action = UndoableInsert(text_iter, text, len(text))
try:
prev_insert = self.undo_stack.pop()
@@ -336,7 +334,7 @@ class TextEditor(Gtk.TextView):
self.undo_stack.append(prev_insert)
else:
self.undo_stack.append(prev_insert)
- self.undo_stack.append(undo_action)
+ self.undo_stack.append(undo_action)
def on_delete_range(self, text_buffer, start_iter, end_iter):
"""
@@ -477,8 +475,6 @@ class TestWindow(Gtk.Window):
redo_button.show()
windowbox.pack_start(redo_button, False, False, 0)
- print(self.editor.text)
-
if __name__== "__main__":
test = TestWindow()
diff --git a/uberwriter/UberwriterWindow.py b/uberwriter/UberwriterWindow.py
index 99cf190..c4c7d62 100644
--- a/uberwriter/UberwriterWindow.py
+++ b/uberwriter/UberwriterWindow.py
@@ -40,6 +40,7 @@ from .UberwriterTextEditor import TextEditor
from .UberwriterInlinePreview import UberwriterInlinePreview
from .UberwriterSidebar import UberwriterSidebar
from .UberwriterSearchAndReplace import UberwriterSearchAndReplace
+from .UberwriterAutoCorrect import UberwriterAutoCorrect
import logging
logger = logging.getLogger('uberwriter')
@@ -48,10 +49,7 @@ logger = logging.getLogger('uberwriter')
import locale
-try:
- from gtkspellcheck import SpellChecker
-except ImportError:
- from uberwriter_lib.gtkspellcheck import SpellChecker
+from uberwriter_lib.gtkspellcheck import SpellChecker
try:
import apt
@@ -108,13 +106,13 @@ class UberwriterWindow(Window):
self.MarkupBuffer.markup_buffer(0)
def init_typewriter(self):
- self.EditorAlignment.props.top_padding = self.window_height / 2
- self.EditorAlignment.props.bottom_padding = self.window_height / 2
+ self.EditorAlignment.props.margin_top = self.window_height / 2
+ self.EditorAlignment.props.margin_bottom = self.window_height / 2
self.typewriter_initiated = True
def remove_typewriter(self):
- self.EditorAlignment.props.top_padding = self.alignment_padding
- self.EditorAlignment.props.bottom_padding = self.alignment_padding
+ self.EditorAlignment.props.margin_top = self.alignment_padding
+ self.EditorAlignment.props.margin_bottom = 250
self.text_change_event = self.TextBuffer.connect('changed', self.text_changed)
def get_text(self):
@@ -207,6 +205,7 @@ class UberwriterWindow(Window):
def ease_out_cubic(t):
p = t - 1;
return p * p * p + 1;
+
now = frame_clock.get_frame_time()
if self.smooth_scroll_acttarget != self.smooth_scroll_data['target_pos']:
self.smooth_scroll_starttime = now
@@ -217,9 +216,13 @@ class UberwriterWindow(Window):
t = float(now - self.smooth_scroll_starttime) / float(self.smooth_scroll_endtime - self.smooth_scroll_starttime)
else:
t = 1
+ pos = self.smooth_scroll_data['source_pos'] + (t * (self.smooth_scroll_data['target_pos'] - self.smooth_scroll_data['source_pos']))
+ widget.get_vadjustment().props.value = pos
+ self.smooth_scroll_data['target_pos'] = -1
+ return True
+
t = ease_out_cubic(t)
pos = self.smooth_scroll_data['source_pos'] + (t * (self.smooth_scroll_data['target_pos'] - self.smooth_scroll_data['source_pos']))
- # print("n %i, t %f, p %i, st %i, et %i" % (now, t, pos, self.smooth_scroll_starttime, self.smooth_scroll_endtime))
widget.get_vadjustment().props.value = pos
return True # continue ticking
@@ -230,7 +233,7 @@ class UberwriterWindow(Window):
loc_rect = self.TextEditor.get_iter_location(ins_it)
# alignment offset added from top
- pos_y = loc_rect.y + loc_rect.height + self.EditorAlignment.props.top_padding
+ pos_y = loc_rect.y + loc_rect.height + self.EditorAlignment.props.margin_top
ha = self.ScrolledWindow.get_vadjustment()
if ha.props.page_size < gradient_offset:
@@ -244,7 +247,7 @@ class UberwriterWindow(Window):
if pos != (ha.props.page_size * 0.5):
target_pos = pos_y - (ha.props.page_size * 0.5)
elif pos > ha.props.page_size - gradient_offset - 60:
- target_pos = pos_y - ha.props.page_size + gradient_offset + 60
+ target_pos = pos_y - ha.props.page_size + gradient_offset + 40
elif pos < gradient_offset:
target_pos = pos_y - gradient_offset
self.smooth_scroll_data = {
@@ -291,8 +294,8 @@ class UberwriterWindow(Window):
self.get_style_context().add_class("large")
- self.EditorAlignment.props.top_padding = self.alignment_padding
- self.EditorAlignment.props.bottom_padding = self.alignment_padding
+ self.EditorAlignment.props.margin_bottom = self.alignment_padding + 30
+ self.EditorAlignment.props.margin_top = self.alignment_padding
self.TextEditor.set_left_margin(lm)
self.TextEditor.set_right_margin(lm)
@@ -312,7 +315,6 @@ class UberwriterWindow(Window):
pgc = self.TextEditor.get_pango_context()
mets = pgc.get_metrics()
self.MarkupBuffer.set_multiplier(Pango.units_to_double(mets.get_approximate_char_width()) + 1)
- print(Pango.units_to_double(mets.get_approximate_char_width()))
def save_document(self, widget, data=None):
@@ -338,8 +340,8 @@ class UberwriterWindow(Window):
_("Save your File"),
self,
Gtk.FileChooserAction.SAVE,
- (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
+ ("_Cancel", Gtk.ResponseType.CANCEL,
+ "_Save", Gtk.ResponseType.OK)
)
filechooser.set_do_overwrite_confirmation(True)
@@ -376,8 +378,8 @@ class UberwriterWindow(Window):
"Save your File",
self,
Gtk.FileChooserAction.SAVE,
- (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
+ ("_Cancel", Gtk.ResponseType.CANCEL,
+ "_Save", Gtk.ResponseType.OK)
)
filechooser.set_do_overwrite_confirmation(True)
if self.filename:
@@ -418,8 +420,8 @@ class UberwriterWindow(Window):
"Export as %s" % export_type.upper(),
self,
Gtk.FileChooserAction.SAVE,
- (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_SAVE, Gtk.ResponseType.OK)
+ ("_Cancel", Gtk.ResponseType.CANCEL,
+ "_Save", Gtk.ResponseType.OK)
)
filechooser.set_do_overwrite_confirmation(True)
@@ -519,8 +521,8 @@ class UberwriterWindow(Window):
_("Open a .md-File"),
self,
Gtk.FileChooserAction.OPEN,
- (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
+ ("_Cancel", Gtk.ResponseType.CANCEL,
+ "_Open", Gtk.ResponseType.OK)
)
filechooser.add_filter(filefilter)
response = filechooser.run()
@@ -587,32 +589,42 @@ class UberwriterWindow(Window):
def menu_activate_preview(self, widget=None):
self.preview_button.emit('activate')
- # # Not added as menu button as of now. Standard is typewriter active.
- # def toggle_typewriter(self, widget, data=None):
- # self.typewriter_active = widget.get_active()
+ def toggle_spellcheck(self, widget=None, data=None):
+ if widget:
+ if self.spellcheck:
+ if widget.get_active():
+ self.SpellChecker.enable()
+ else:
+ self.SpellChecker.disable()
- def toggle_spellcheck(self, widget, data=None):
- if self.spellcheck:
- if widget.get_active():
- self.SpellChecker.enable()
- else:
+ elif widget.get_active():
+ self.SpellChecker = SpellChecker(self.TextEditor, self, locale.getdefaultlocale()[0], collapse=False)
+ if self.auto_correct:
+ self.auto_correct.set_language(self.SpellChecker.language)
+ self.SpellChecker.connect_language_change(self.auto_correct.set_language)
+ try:
+ self.spellcheck = True
+ except:
+ self.SpellChecker = None
+ self.spellcheck = False
+ dialog = Gtk.MessageDialog(self,
+ Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ Gtk.MessageType.INFO,
+ Gtk.ButtonsType.NONE,
+ _("You can not enable the Spell Checker.")
+ )
+ dialog.format_secondary_text(_("Please install 'hunspell' or 'aspell' dictionarys for your language from the software center."))
+ response = dialog.run()
+ return
+ else:
+ widget = self.spellcheck_button
+ if self.spellcheck and self.SpellChecker.enabled():
self.SpellChecker.disable()
- elif widget.get_active():
- try:
- self.SpellChecker = SpellChecker(self.TextEditor, locale.getdefaultlocale()[0], collapse=False)
- self.spellcheck = True
- except:
- self.SpellChecker = None
- self.spellcheck = False
- dialog = Gtk.MessageDialog(self,
- Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
- Gtk.MessageType.INFO,
- Gtk.ButtonsType.NONE,
- _("You can not enable the Spell Checker.")
- )
- dialog.format_secondary_text(_("Please install 'hunspell' or 'aspell' dictionarys for your language from the software center."))
- response = dialog.run()
- return
+ widget.set_active(False)
+ else:
+ self.SpellChecker.enable()
+ widget.set_active(True)
+
return
def on_drag_data_received(self, widget, drag_context, x, y,
@@ -621,7 +633,6 @@ class UberwriterWindow(Window):
if info == 1:
# uri target
uris = data.get_uris()
- print(uris)
for uri in uris:
uri = urllib.parse.unquote_plus(uri)
mime = mimetypes.guess_type(uri)
@@ -643,11 +654,9 @@ class UberwriterWindow(Window):
selection_bound = self.TextBuffer.get_selection_bound()
cursor_iter = self.TextBuffer.get_iter_at_mark(insert_mark)
cursor_iter.backward_chars(len(text) - ll)
- print('move_cursor')
self.TextBuffer.move_mark(insert_mark, cursor_iter)
cursor_iter.forward_chars(lr)
self.TextBuffer.move_mark(selection_bound, cursor_iter)
- print('move selection')
elif info == 2:
# Text target
@@ -656,7 +665,6 @@ class UberwriterWindow(Window):
self.TextBuffer.insert_at_cursor(data.get_text())
Gtk.drag_finish(drag_context, True, True, time)
self.present()
- print("returning true")
return False
def toggle_preview(self, widget, data=None):
@@ -898,6 +906,10 @@ class UberwriterWindow(Window):
cr.set_source(lg_btm)
cr.fill()
+ def use_experimental_features(self, val):
+ self.auto_correct = UberwriterAutoCorrect(self.TextEditor, self.TextBuffer)
+
+
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the main window"""
super(UberwriterWindow, self).finish_initializing(builder)
@@ -942,10 +954,10 @@ class UberwriterWindow(Window):
bbtn = Gtk.MenuButton()
btn_settings = Gtk.MenuButton()
btn_settings.props.image = Gtk.Image.new_from_icon_name('emblem-system-symbolic', Gtk.IconSize.BUTTON)
+ self.builder.get_object("menu4").detach()
btn_settings.set_popup(self.builder.get_object("menu4"))
- # icon = Gio.ThemedIcon(name="mail-sendm receive-symbolic")
- # image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
- # bbtn.add(image)
+
+ self.builder.get_object("menu1").detach()
bbtn.set_popup(self.builder.get_object("menu1"))
self.hb.pack_start(bbtn)
self.hb.pack_end(btn_settings)
@@ -1093,10 +1105,17 @@ class UberwriterWindow(Window):
self.vadjustment = self.ScrolledWindow.get_vadjustment()
self.vadjustment.connect('value-changed', self.scrolled)
+
+ self.spellcheck_button = builder.get_object("disable_spellcheck")
# Setting up spellcheck
+ self.auto_correct = None
try:
self.SpellChecker = SpellChecker(self.TextEditor,
locale.getdefaultlocale()[0], collapse=False)
+ if self.auto_correct:
+ self.auto_correct.set_language(self.SpellChecker.language)
+ self.SpellChecker.connect_language_change(self.auto_correct.set_language)
+
self.spellcheck = True
except:
self.SpellChecker = None
@@ -1122,6 +1141,7 @@ class UberwriterWindow(Window):
###
self.searchreplace = UberwriterSearchAndReplace(self)
+
# Window resize
self.window_resize(self)
self.connect("configure-event", self.window_resize)
diff --git a/uberwriter/__init__.py b/uberwriter/__init__.py
index 633752e..eea85e2 100644
--- a/uberwriter/__init__.py
+++ b/uberwriter/__init__.py
@@ -33,6 +33,10 @@ def parse_options():
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)
@@ -45,12 +49,14 @@ def main():
'constructor for your class instances'
(options, args) = parse_options()
- # Run the application.
+ # 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()
diff --git a/uberwriter_lib/Window.py b/uberwriter_lib/Window.py
index e44f392..9e73374 100644
--- a/uberwriter_lib/Window.py
+++ b/uberwriter_lib/Window.py
@@ -45,7 +45,6 @@ class Window(Gtk.Window):
"""
builder = get_builder('UberwriterWindow')
new_object = builder.get_object("uberwriter_window")
- print(new_object)
new_object.finish_initializing(builder)
return new_object
diff --git a/uberwriter_lib/gtkspellcheck/spellcheck.py b/uberwriter_lib/gtkspellcheck/spellcheck.py
index 5ff4955..e5ac788 100644
--- a/uberwriter_lib/gtkspellcheck/spellcheck.py
+++ b/uberwriter_lib/gtkspellcheck/spellcheck.py
@@ -28,7 +28,10 @@ import gettext
import logging
import re
import sys
+import pickle
+import os
+from ..helpers import get_media_path
import xml.etree.ElementTree as ET
from ..pylocales import code_to_name
@@ -216,6 +219,26 @@ class SpellChecker(object):
self._enabled = True
self.buffer_initialize()
+ self.notify_language_change_functions = []
+
+ self.frequency_dict = {}
+ pp_pickled = 'pickled_dict'
+ if pp_pickled and os.path.isfile(pp_pickled):
+ f = open(pp_pickled, 'rb')
+ self.frequency_dict = pickle.load(f)
+ f.close()
+ else:
+ pp = get_media_path('wordlists/en_us_wordlist.xml')
+ frequencies = ET.parse(pp)
+ root = frequencies.getroot()
+ for child in root:
+ self.frequency_dict[child.text] = int(child.attrib['f'])
+ f = open('pickled_dict', 'wb+')
+ pickle.dump(self.frequency_dict, f)
+ f.close()
+ # print(self.frequency_dict)
+
+
@property
def language(self):
"""
@@ -428,15 +451,24 @@ class SpellChecker(object):
else:
self._check_word(word_start, word_end)
self._deferred_check = False
+
word_end.forward_word_end()
word_end.backward_word_start()
+ word_start = word_end.copy()
+
+
if word_start.equal(word_end):
break
- word_start = word_end.copy()
+
+ def connect_language_change(self, fn):
+ self.notify_language_change_functions.append(fn)
def _languages_menu(self):
def _set_language(item, code):
self.language = code
+ for fn in self.notify_language_change_functions:
+ fn(code)
+
if _pygobject:
menu = gtk.Menu.new()
group = []
@@ -477,7 +509,20 @@ class SpellChecker(object):
menu.append(item)
else:
# add sorting here
+ # suggestions_map = []
+ # print(suggestions)
+ # for suggestion in suggestions:
+ # if suggestion in self.frequency_dict:
+ # suggestions_map.append({'suggestion': suggestion, 'freq': self.frequency_dict[suggestion]})
+ # else:
+ # suggestions_map.append({'suggestion': suggestion, 'freq': 0})
+ # suggestions_map.sort(key= lambda x: x['freq'])
+ # suggestions_map.reverse()
+ # print(suggestions_map)
+ # suggestions = []
+ # for suggestion in suggestions_map:
+ # suggestions.append(suggestion["suggestion"])
for suggestion in suggestions:
if _pygobject:
item = gtk.MenuItem.new()
@@ -639,5 +684,9 @@ class SpellChecker(object):
end = self._buffer.get_iter_at_offset(match.end())
self._buffer.remove_tag(self._misspelled, start, end)
return
+ # Somehow needed now, checking for zero length (happens on double space)
+ if len(word) == 0:
+ return
if not self._dictionary.check(word):
- self._buffer.apply_tag(self._misspelled, start, end)
\ No newline at end of file
+ self._buffer.apply_tag(self._misspelled, start, end)
+
diff --git a/uberwriter_lib/helpers.py b/uberwriter_lib/helpers.py
index a7562fd..29adda7 100644
--- a/uberwriter_lib/helpers.py
+++ b/uberwriter_lib/helpers.py
@@ -55,7 +55,7 @@ def get_media_path(media_file_name):
media_filename = get_data_file('media', '%s' % (media_file_name,))
if not os.path.exists(media_filename):
media_filename = None
- return "/"+media_filename
+ return media_filename
class NullHandler(logging.Handler):
def emit(self, record):