diff --git a/Ideas.md b/Ideas.md index 5e113ea..3fe2b4d 100644 --- a/Ideas.md +++ b/Ideas.md @@ -6,6 +6,7 @@ Ideas For Plugins: 3. Autocomplete Words 4. Latex Equation Editor 5. Thesaurus / Dictionary +6. Todo Implementation TODO: diff --git a/data/media/style.css b/data/media/style.css index cbb77d1..f379ad4 100644 --- a/data/media/style.css +++ b/data/media/style.css @@ -29,6 +29,7 @@ bind "h" { "insert-heading" () }; bind "z" { "undo" () }; bind "y" { "redo" () }; + bind "d" { "insert-strikeout" () }; /*bind "t" { "insert-at-cursor" ('[ ] ') };*/ bind "z" { "redo" () }; } diff --git a/debian/changelog b/debian/changelog index f4cc7ce..bb0f638 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,22 @@ +uberwriter (14.09.08-publicubuntu3) trusty; urgency=medium + + * added missing dependency + + -- Wolf Vollprecht Thu, 04 Oct 2014 11:47:32 +0200 + +uberwriter (14.09.08-publicubuntu2) trusty; urgency=medium + + * icon working again + + -- Wolf Vollprecht Thu, 02 Oct 2014 22:47:32 +0200 + +uberwriter (14.09.08-publicubuntu1) trusty; urgency=medium + + * several bug fixes + * added some experimental features + + -- Wolf Vollprecht Mon, 02 Oct 2014 19:36:08 +0200 + uberwriter (14.09.07-publicubuntu1) trusty; urgency=medium * reworking the installation script diff --git a/debian/control b/debian/control index e3ef567..b335a7c 100644 --- a/debian/control +++ b/debian/control @@ -26,6 +26,7 @@ Depends: gnome-web-photo, fonts-inconsolata, python3-levenshtein, + python3-regex, dvipng Suggests: texlive Description: UberWriter, beautiful distraction free writing diff --git a/debian/rules b/debian/rules index 7cce76f..b9e1deb 100755 --- a/debian/rules +++ b/debian/rules @@ -1,25 +1,9 @@ -#!/usr/bin/make -f + +export PYBUILD_NAME=uberwriter +export PYBUILD_DISABLE=test +export PYBUILD_INSTALL_ARGS_python3="--root=./debian/uberwriter/ --install-scripts=/opt/extras.ubuntu.com/uberwriter/bin --install-data=/opt/extras.ubuntu.com/uberwriter --install-lib=/opt/extras.ubuntu.com/uberwriter" + +export XDG_RUNTIME_DIR=/tmp + %: -ifneq ($(shell dh -l | grep -xF translations),) - dh $@ --with=python3,translations --buildsystem=pybuild -else - dh $@ --with=python3 --buildsystem=pybuild -endif - -override_dh_auto_install: -# dh_auto_install -- --install-scripts=/opt/extras.ubuntu.com/uberwriter/bin --install-data=/opt/extras.ubuntu.com/uberwriter --install-lib=/opt/extras.ubuntu.com/uberwriter - - -override_dh_install: - dh_install - - python3 setup.py install --root=$(CURDIR)/debian/uberwriter/ \ - --install-scripts=/opt/extras.ubuntu.com/uberwriter/bin \ - --install-data=/opt/extras.ubuntu.com/uberwriter \ - --install-lib=/opt/extras.ubuntu.com/uberwriter - -override_dh_python3: - dh_python3 /opt/extras.ubuntu.com/uberwriter - -override_dh_auto_test: - PYBUILD_DISABLE=test \ No newline at end of file + dh $@ --with python3 --buildsystem=pybuild \ No newline at end of file diff --git a/po/uberwriter.pot b/po/uberwriter.pot index bfc2f2e..c39b5d8 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-10-02 19:12+0200\n" +"POT-Creation-Date: 2014-10-02 22:43+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,6 +17,27 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" +#: ../data/ui/AboutUberwriterDialog.ui.h:1 +msgid "" +"# Copyright (C) 2012, Wolf Vollprecht \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 .\n" +msgstr "" + +#: ../data/ui/AboutUberwriterDialog.ui.h:14 +msgid "Copyright (C) 2012, Wolf Vollprecht " +msgstr "" + #: ../uberwriter/UberwriterInlinePreview.py:172 msgid "Website is not available" msgstr "" @@ -185,6 +206,39 @@ msgstr "" msgid "Characters:" msgstr "" +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:507 +msgid "(no suggestions)" +msgstr "" + +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:544 +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:547 +msgid "Add \"{}\" to Dictionary" +msgstr "" + +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:551 +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:553 +msgid "Ignore All" +msgstr "" + +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:568 +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:570 +msgid "Languages" +msgstr "" + +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:586 +#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:589 +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 "" + +#. import SpellChecker class #: ../data/ui/UberwriterAdvancedExportDialog.ui.h:1 msgid "Export" msgstr "" @@ -298,12 +352,20 @@ msgstr "" msgid "Commandline Reference" msgstr "" -#: ../uberwriter.desktop.in.h:1 -msgid "UberWriter" +#: ../uberwriter/FormatShortcuts.py:85 +msgid "emphasized text" msgstr "" -#: ../uberwriter.desktop.in.h:2 -msgid "UberWriter, a simple and distraction free Markdown Editor" +#: ../uberwriter/FormatShortcuts.py:87 +msgid "strong text" +msgstr "" + +#: ../uberwriter/FormatShortcuts.py:101 +msgid "List item" +msgstr "" + +#: ../uberwriter/FormatShortcuts.py:182 +msgid "Heading" msgstr "" #: ../uberwriter/UberwriterWindow.py:340 @@ -357,67 +419,6 @@ msgid "" "software center." msgstr "" -#: ../data/ui/AboutUberwriterDialog.ui.h:1 -msgid "" -"# Copyright (C) 2012, Wolf Vollprecht \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 .\n" -msgstr "" - -#: ../data/ui/AboutUberwriterDialog.ui.h:14 -msgid "Copyright (C) 2012, Wolf Vollprecht " -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_lib/gtkspellcheck/spellcheck.py:507 -msgid "(no suggestions)" -msgstr "" - -#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:544 -#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:547 -msgid "Add \"{}\" to Dictionary" -msgstr "" - -#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:551 -#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:553 -msgid "Ignore All" -msgstr "" - -#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:568 -#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:570 -msgid "Languages" -msgstr "" - -#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:586 -#: ../uberwriter_lib/gtkspellcheck/spellcheck.py:589 -msgid "Suggestions" -msgstr "" - #: ../uberwriter/__init__.py:35 msgid "Show debug messages (-vv debugs uberwriter_lib also)" msgstr "" diff --git a/setup.py b/setup.py index bc1aafb..ff8d91e 100644 --- a/setup.py +++ b/setup.py @@ -59,22 +59,24 @@ def move_desktop_file(root, target_data, prefix): # the main system to be found. Only actually useful for /opt installs. print("renaming desktop file") print(root, target_data, prefix) - if(root == '/'): root = '' - old_desktop_path = os.path.normpath(root + target_data + - '/share/applications') + if root.endswith("/"): root = root[:-1] + print(os.getcwd()) + old_desktop_path = root + target_data + 'share/applications' old_desktop_file = old_desktop_path + '/uberwriter.desktop' - desktop_path = os.path.normpath(root + prefix + '/share/applications') + desktop_path = root + prefix + '/share/applications' desktop_file = desktop_path + '/uberwriter.desktop' - + print("OLD: " + old_desktop_file) if not os.path.exists(old_desktop_file): print ("ERROR: Can't find", old_desktop_file) sys.exit(1) - elif target_data != prefix + '/': + if os.path.exists(desktop_file): + print("REMOVING DESKTOP FILE") + os.remove(desktop_file) + if target_data != prefix + '/': # This is an /opt install, so rename desktop file to use extras- desktop_file = desktop_path + '/extras-uberwriter.desktop' - print(desktop_file, desktop_path) try: - # os.makedirs(desktop_path) + os.makedirs(desktop_path) print('renaming to: %s' % desktop_file) os.rename(old_desktop_file, desktop_file) os.rmdir(old_desktop_path) @@ -131,8 +133,11 @@ class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto): desktop_file = move_desktop_file(self.root, target_data, self.prefix) update_desktop_file(desktop_file, target_pkgdata, target_scripts) compile_schemas(self.root, target_data) - - os.symlink(target_scripts + "uberwriter", "/usr/bin/uberwriter") + try: + os.remove("/usr/bin/uberwriter") + os.symlink(target_scripts + "uberwriter", "/usr/bin/uberwriter") + except: + print("Couldn't remove old symlink or installing new symlink didn't work.") ################################################################################## ###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ###################### @@ -169,5 +174,8 @@ DistUtilsExtra.auto.setup( }, 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'])] + ('/usr/share/glib-2.0/schemas', ['data/glib-2.0/schemas/net.launchpad.uberwriter.gschema.xml']) + #,('/usr/share/icons/hicolor/scalable/apps', ['data/media/uberwriter.svg']) + + ] ) diff --git a/uberwriter/FormatShortcuts.py b/uberwriter/FormatShortcuts.py index 7a1f242..c0b8b77 100644 --- a/uberwriter/FormatShortcuts.py +++ b/uberwriter/FormatShortcuts.py @@ -43,6 +43,9 @@ class FormatShortcuts(): def italic(self): self.apply_format("*") + def strikeout(self): + self.apply_format("~~") + def apply_format(self, wrap = "*"): if self.TextBuffer.get_has_selection(): ## Find current highlighting @@ -85,6 +88,8 @@ class FormatShortcuts(): helptext = _("emphasized text") elif wrap == "**": helptext = _("strong text") + elif wrap == "~~": + helptext = _("striked out text") self.TextBuffer.insert_at_cursor(wrap + helptext + wrap) text_length = len(helptext) diff --git a/uberwriter/UberwriterAutoCorrect.py b/uberwriter/UberwriterAutoCorrect.py index 4a57460..ff9d0a0 100644 --- a/uberwriter/UberwriterAutoCorrect.py +++ b/uberwriter/UberwriterAutoCorrect.py @@ -39,21 +39,40 @@ class PressagioCallback(pressagio.callback.Callback): return '' class UberwriterAutoCorrect: + def show_bubble(self, iter, suggestion): self.suggestion = suggestion if self.bubble: self.bubble_label.set_text(suggestion) else: pos = self.TextView.get_iter_location(iter) - pos_adjusted = self.TextView.buffer_to_window_coords(Gtk.TextWindowType.TEXT, pos.x, pos.y + pos.height) + pos_adjusted = self.TextView.buffer_to_window_coords( + Gtk.TextWindowType.TEXT, pos.x, pos.y + pos.height) + self.bubble_eventbox = Gtk.EventBox.new() self.bubble = Gtk.Grid.new() self.bubble.set_name("AutoCorrect") - self.TextView.add_child_in_window(self.bubble, Gtk.TextWindowType.TEXT, pos_adjusted[0], pos_adjusted[1]) + self.bubble_eventbox.add(self.bubble) + self.bubble_eventbox.add_events(Gdk.EventMask.BUTTON_PRESS_MASK) + self.bubble_eventbox.connect("button_press_event", self.clicked_bubble) + self.TextView.add_child_in_window(self.bubble_eventbox, + Gtk.TextWindowType.TEXT, pos_adjusted[0], pos_adjusted[1]) + self.bubble_label = Gtk.Label.new(suggestion) + self.bubble.attach(self.bubble_label, 0, 0, 1, 1) + self.bubble_close_eventbox = Gtk.EventBox.new() + self.bubble_close_eventbox.add_events(Gdk.EventMask.BUTTON_PRESS_MASK) + self.bubble_close_eventbox.connect("button_press_event", self.clicked_close) close = Gtk.Image.new_from_icon_name('dialog-close', Gtk.IconSize.SMALL_TOOLBAR) - self.bubble.attach(close, 1, 0, 1, 1) - self.bubble.show_all() + self.bubble_close_eventbox.add(close) + self.bubble.attach(self.bubble_close_eventbox, 1, 0, 1, 1) + self.bubble_eventbox.show_all() + + def clicked_bubble(self, widget, data=None): + self.accept_suggestion() + + def clicked_close(self, widget, data=None): + self.destroy_bubble() def suggest(self, stump, context): if self.enchant_dict.check(stump): @@ -78,7 +97,7 @@ class UberwriterAutoCorrect: else: suggestions_map.append({'suggestion': suggestion, 'freq': 0}) - suggestions_map.sort(key= lambda x: x['freq']) + suggestions_map.sort(key=lambda x: x['freq']) suggestions_map.reverse() prediction = suggestions_map[0] print(predictions) diff --git a/uberwriter/UberwriterTextEditor.py b/uberwriter/UberwriterTextEditor.py index fa445ff..534a97b 100644 --- a/uberwriter/UberwriterTextEditor.py +++ b/uberwriter/UberwriterTextEditor.py @@ -105,6 +105,7 @@ class TextEditor(Gtk.TextView): 'insert-hrule': (GObject.SIGNAL_ACTION, None, ()), 'insert-ulistitem': (GObject.SIGNAL_ACTION, None, ()), 'insert-heading': (GObject.SIGNAL_ACTION, None, ()), + 'insert-strikeout': (GObject.SIGNAL_ACTION, None, ()), 'undo': (GObject.SIGNAL_ACTION, None, ()), 'redo': (GObject.SIGNAL_ACTION, None, ()) } @@ -131,6 +132,7 @@ class TextEditor(Gtk.TextView): self.connect('insert-italic', self.set_italic) self.connect('insert-bold', self.set_bold) + self.connect('insert-strikeout', self.set_strikeout) self.connect('insert-hrule', self.insert_horizontal_rule) self.connect('insert-ulistitem', self.insert_unordered_list_item) self.connect('insert-heading', self.insert_heading) @@ -405,9 +407,13 @@ class TextEditor(Gtk.TextView): self.FormatShortcuts.italic() def set_bold(self, widget, data=None): - """Ctrl + B""" + """Ctrl + Shift + D""" self.FormatShortcuts.bold() + def set_strikeout(self, widget, data=None): + """Ctrl + B""" + self.FormatShortcuts.strikeout() + def insert_horizontal_rule(self, widget, data=None): """Ctrl + R""" self.FormatShortcuts.rule() diff --git a/uberwriter/UberwriterWindow.py b/uberwriter/UberwriterWindow.py index 0a832f8..3401e75 100644 --- a/uberwriter/UberwriterWindow.py +++ b/uberwriter/UberwriterWindow.py @@ -737,26 +737,23 @@ class UberwriterWindow(Window): def load_file(self, filename=None): """Open File from command line or open / open recent etc.""" if filename: - self.preview_button.set_active(False) if filename.startswith('file://'): filename = filename[7:] filename = urllib.parse.unquote_plus(filename) try: + self.preview_button.set_active(False) if not os.path.exists(filename): - self.filename = filename - self.set_headerbar_title(os.path.basename(filename) + self.title_end) - self.TextEditor.undo_stack = [] - self.TextEditor.redo_stack = [] self.TextBuffer.set_text("") else: - self.filename = filename f = codecs.open(filename, encoding="utf-8", mode='r') self.TextBuffer.set_text(f.read()) f.close() self.MarkupBuffer.markup_buffer(0) - self.set_headerbar_title(os.path.basename(filename) + self.title_end) - self.TextEditor.undo_stack = [] - self.TextEditor.redo_stack = [] + + self.set_headerbar_title(os.path.basename(filename) + self.title_end) + self.TextEditor.undo_stack = [] + self.TextEditor.redo_stack = [] + self.filename = filename except Exception as e: logger.warning("Error Reading File: %r" % e)