forked from Mirrors/apostrophe
added click support to autocorrections
parent
ee9635bfd9
commit
0c9e6263b9
1
Ideas.md
1
Ideas.md
|
@ -6,6 +6,7 @@ Ideas For Plugins:
|
||||||
3. Autocomplete Words
|
3. Autocomplete Words
|
||||||
4. Latex Equation Editor
|
4. Latex Equation Editor
|
||||||
5. Thesaurus / Dictionary
|
5. Thesaurus / Dictionary
|
||||||
|
6. Todo Implementation
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
bind "<ctl>h" { "insert-heading" () };
|
bind "<ctl>h" { "insert-heading" () };
|
||||||
bind "<ctl>z" { "undo" () };
|
bind "<ctl>z" { "undo" () };
|
||||||
bind "<ctl>y" { "redo" () };
|
bind "<ctl>y" { "redo" () };
|
||||||
|
bind "<ctl><shift>d" { "insert-strikeout" () };
|
||||||
/*bind "<ctl>t" { "insert-at-cursor" ('[ ] ') };*/
|
/*bind "<ctl>t" { "insert-at-cursor" ('[ ] ') };*/
|
||||||
bind "<ctl><shift>z" { "redo" () };
|
bind "<ctl><shift>z" { "redo" () };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
uberwriter (14.09.08-publicubuntu3) trusty; urgency=medium
|
||||||
|
|
||||||
|
* added missing dependency
|
||||||
|
|
||||||
|
-- Wolf Vollprecht <w.vollprecht@gmail.com> Thu, 04 Oct 2014 11:47:32 +0200
|
||||||
|
|
||||||
|
uberwriter (14.09.08-publicubuntu2) trusty; urgency=medium
|
||||||
|
|
||||||
|
* icon working again
|
||||||
|
|
||||||
|
-- Wolf Vollprecht <w.vollprecht@gmail.com> 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 <w.vollprecht@gmail.com> Mon, 02 Oct 2014 19:36:08 +0200
|
||||||
|
|
||||||
uberwriter (14.09.07-publicubuntu1) trusty; urgency=medium
|
uberwriter (14.09.07-publicubuntu1) trusty; urgency=medium
|
||||||
|
|
||||||
* reworking the installation script
|
* reworking the installation script
|
||||||
|
|
|
@ -26,6 +26,7 @@ Depends:
|
||||||
gnome-web-photo,
|
gnome-web-photo,
|
||||||
fonts-inconsolata,
|
fonts-inconsolata,
|
||||||
python3-levenshtein,
|
python3-levenshtein,
|
||||||
|
python3-regex,
|
||||||
dvipng
|
dvipng
|
||||||
Suggests: texlive
|
Suggests: texlive
|
||||||
Description: UberWriter, beautiful distraction free writing
|
Description: UberWriter, beautiful distraction free writing
|
||||||
|
|
|
@ -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 --buildsystem=pybuild
|
||||||
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
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -17,6 +17,27 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: ../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 ""
|
||||||
|
|
||||||
|
#: ../data/ui/AboutUberwriterDialog.ui.h:14
|
||||||
|
msgid "Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: ../uberwriter/UberwriterInlinePreview.py:172
|
#: ../uberwriter/UberwriterInlinePreview.py:172
|
||||||
msgid "Website is not available"
|
msgid "Website is not available"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -185,6 +206,39 @@ msgstr ""
|
||||||
msgid "Characters:"
|
msgid "Characters:"
|
||||||
msgstr ""
|
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
|
#: ../data/ui/UberwriterAdvancedExportDialog.ui.h:1
|
||||||
msgid "Export"
|
msgid "Export"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -298,12 +352,20 @@ msgstr ""
|
||||||
msgid "Commandline Reference"
|
msgid "Commandline Reference"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../uberwriter.desktop.in.h:1
|
#: ../uberwriter/FormatShortcuts.py:85
|
||||||
msgid "UberWriter"
|
msgid "emphasized text"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../uberwriter.desktop.in.h:2
|
#: ../uberwriter/FormatShortcuts.py:87
|
||||||
msgid "UberWriter, a simple and distraction free Markdown Editor"
|
msgid "strong text"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../uberwriter/FormatShortcuts.py:101
|
||||||
|
msgid "List item"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../uberwriter/FormatShortcuts.py:182
|
||||||
|
msgid "Heading"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../uberwriter/UberwriterWindow.py:340
|
#: ../uberwriter/UberwriterWindow.py:340
|
||||||
|
@ -357,67 +419,6 @@ msgid ""
|
||||||
"software center."
|
"software center."
|
||||||
msgstr ""
|
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"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../data/ui/AboutUberwriterDialog.ui.h:14
|
|
||||||
msgid "Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>"
|
|
||||||
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
|
#: ../uberwriter/__init__.py:35
|
||||||
msgid "Show debug messages (-vv debugs uberwriter_lib also)"
|
msgid "Show debug messages (-vv debugs uberwriter_lib also)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
30
setup.py
30
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.
|
# the main system to be found. Only actually useful for /opt installs.
|
||||||
print("renaming desktop file")
|
print("renaming desktop file")
|
||||||
print(root, target_data, prefix)
|
print(root, target_data, prefix)
|
||||||
if(root == '/'): root = ''
|
if root.endswith("/"): root = root[:-1]
|
||||||
old_desktop_path = os.path.normpath(root + target_data +
|
print(os.getcwd())
|
||||||
'/share/applications')
|
old_desktop_path = root + target_data + 'share/applications'
|
||||||
old_desktop_file = old_desktop_path + '/uberwriter.desktop'
|
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'
|
desktop_file = desktop_path + '/uberwriter.desktop'
|
||||||
|
print("OLD: " + old_desktop_file)
|
||||||
if not os.path.exists(old_desktop_file):
|
if not os.path.exists(old_desktop_file):
|
||||||
print ("ERROR: Can't find", old_desktop_file)
|
print ("ERROR: Can't find", old_desktop_file)
|
||||||
sys.exit(1)
|
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-
|
# This is an /opt install, so rename desktop file to use extras-
|
||||||
desktop_file = desktop_path + '/extras-uberwriter.desktop'
|
desktop_file = desktop_path + '/extras-uberwriter.desktop'
|
||||||
print(desktop_file, desktop_path)
|
|
||||||
try:
|
try:
|
||||||
# os.makedirs(desktop_path)
|
os.makedirs(desktop_path)
|
||||||
print('renaming to: %s' % desktop_file)
|
print('renaming to: %s' % desktop_file)
|
||||||
os.rename(old_desktop_file, desktop_file)
|
os.rename(old_desktop_file, desktop_file)
|
||||||
os.rmdir(old_desktop_path)
|
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)
|
desktop_file = move_desktop_file(self.root, target_data, self.prefix)
|
||||||
update_desktop_file(desktop_file, target_pkgdata, target_scripts)
|
update_desktop_file(desktop_file, target_pkgdata, target_scripts)
|
||||||
compile_schemas(self.root, target_data)
|
compile_schemas(self.root, target_data)
|
||||||
|
try:
|
||||||
os.symlink(target_scripts + "uberwriter", "/usr/bin/uberwriter")
|
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 ######################
|
###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
|
||||||
|
@ -169,5 +174,8 @@ DistUtilsExtra.auto.setup(
|
||||||
},
|
},
|
||||||
data_files=[
|
data_files=[
|
||||||
('uberwriter_lib/pylocales', ['uberwriter_lib/pylocales/locales.db']),
|
('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'])
|
||||||
|
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -43,6 +43,9 @@ class FormatShortcuts():
|
||||||
def italic(self):
|
def italic(self):
|
||||||
self.apply_format("*")
|
self.apply_format("*")
|
||||||
|
|
||||||
|
def strikeout(self):
|
||||||
|
self.apply_format("~~")
|
||||||
|
|
||||||
def apply_format(self, wrap = "*"):
|
def apply_format(self, wrap = "*"):
|
||||||
if self.TextBuffer.get_has_selection():
|
if self.TextBuffer.get_has_selection():
|
||||||
## Find current highlighting
|
## Find current highlighting
|
||||||
|
@ -85,6 +88,8 @@ class FormatShortcuts():
|
||||||
helptext = _("emphasized text")
|
helptext = _("emphasized text")
|
||||||
elif wrap == "**":
|
elif wrap == "**":
|
||||||
helptext = _("strong text")
|
helptext = _("strong text")
|
||||||
|
elif wrap == "~~":
|
||||||
|
helptext = _("striked out text")
|
||||||
|
|
||||||
self.TextBuffer.insert_at_cursor(wrap + helptext + wrap)
|
self.TextBuffer.insert_at_cursor(wrap + helptext + wrap)
|
||||||
text_length = len(helptext)
|
text_length = len(helptext)
|
||||||
|
|
|
@ -39,21 +39,40 @@ class PressagioCallback(pressagio.callback.Callback):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
class UberwriterAutoCorrect:
|
class UberwriterAutoCorrect:
|
||||||
|
|
||||||
def show_bubble(self, iter, suggestion):
|
def show_bubble(self, iter, suggestion):
|
||||||
self.suggestion = suggestion
|
self.suggestion = suggestion
|
||||||
if self.bubble:
|
if self.bubble:
|
||||||
self.bubble_label.set_text(suggestion)
|
self.bubble_label.set_text(suggestion)
|
||||||
else:
|
else:
|
||||||
pos = self.TextView.get_iter_location(iter)
|
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 = Gtk.Grid.new()
|
||||||
self.bubble.set_name("AutoCorrect")
|
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_label = Gtk.Label.new(suggestion)
|
||||||
|
|
||||||
self.bubble.attach(self.bubble_label, 0, 0, 1, 1)
|
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)
|
close = Gtk.Image.new_from_icon_name('dialog-close', Gtk.IconSize.SMALL_TOOLBAR)
|
||||||
self.bubble.attach(close, 1, 0, 1, 1)
|
self.bubble_close_eventbox.add(close)
|
||||||
self.bubble.show_all()
|
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):
|
def suggest(self, stump, context):
|
||||||
if self.enchant_dict.check(stump):
|
if self.enchant_dict.check(stump):
|
||||||
|
@ -78,7 +97,7 @@ class UberwriterAutoCorrect:
|
||||||
else:
|
else:
|
||||||
suggestions_map.append({'suggestion': suggestion, 'freq': 0})
|
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()
|
suggestions_map.reverse()
|
||||||
prediction = suggestions_map[0]
|
prediction = suggestions_map[0]
|
||||||
print(predictions)
|
print(predictions)
|
||||||
|
|
|
@ -105,6 +105,7 @@ class TextEditor(Gtk.TextView):
|
||||||
'insert-hrule': (GObject.SIGNAL_ACTION, None, ()),
|
'insert-hrule': (GObject.SIGNAL_ACTION, None, ()),
|
||||||
'insert-ulistitem': (GObject.SIGNAL_ACTION, None, ()),
|
'insert-ulistitem': (GObject.SIGNAL_ACTION, None, ()),
|
||||||
'insert-heading': (GObject.SIGNAL_ACTION, None, ()),
|
'insert-heading': (GObject.SIGNAL_ACTION, None, ()),
|
||||||
|
'insert-strikeout': (GObject.SIGNAL_ACTION, None, ()),
|
||||||
'undo': (GObject.SIGNAL_ACTION, None, ()),
|
'undo': (GObject.SIGNAL_ACTION, None, ()),
|
||||||
'redo': (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-italic', self.set_italic)
|
||||||
self.connect('insert-bold', self.set_bold)
|
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-hrule', self.insert_horizontal_rule)
|
||||||
self.connect('insert-ulistitem', self.insert_unordered_list_item)
|
self.connect('insert-ulistitem', self.insert_unordered_list_item)
|
||||||
self.connect('insert-heading', self.insert_heading)
|
self.connect('insert-heading', self.insert_heading)
|
||||||
|
@ -405,9 +407,13 @@ class TextEditor(Gtk.TextView):
|
||||||
self.FormatShortcuts.italic()
|
self.FormatShortcuts.italic()
|
||||||
|
|
||||||
def set_bold(self, widget, data=None):
|
def set_bold(self, widget, data=None):
|
||||||
"""Ctrl + B"""
|
"""Ctrl + Shift + D"""
|
||||||
self.FormatShortcuts.bold()
|
self.FormatShortcuts.bold()
|
||||||
|
|
||||||
|
def set_strikeout(self, widget, data=None):
|
||||||
|
"""Ctrl + B"""
|
||||||
|
self.FormatShortcuts.strikeout()
|
||||||
|
|
||||||
def insert_horizontal_rule(self, widget, data=None):
|
def insert_horizontal_rule(self, widget, data=None):
|
||||||
"""Ctrl + R"""
|
"""Ctrl + R"""
|
||||||
self.FormatShortcuts.rule()
|
self.FormatShortcuts.rule()
|
||||||
|
|
|
@ -737,26 +737,23 @@ class UberwriterWindow(Window):
|
||||||
def load_file(self, filename=None):
|
def load_file(self, filename=None):
|
||||||
"""Open File from command line or open / open recent etc."""
|
"""Open File from command line or open / open recent etc."""
|
||||||
if filename:
|
if filename:
|
||||||
self.preview_button.set_active(False)
|
|
||||||
if filename.startswith('file://'):
|
if filename.startswith('file://'):
|
||||||
filename = filename[7:]
|
filename = filename[7:]
|
||||||
filename = urllib.parse.unquote_plus(filename)
|
filename = urllib.parse.unquote_plus(filename)
|
||||||
try:
|
try:
|
||||||
|
self.preview_button.set_active(False)
|
||||||
if not os.path.exists(filename):
|
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("")
|
self.TextBuffer.set_text("")
|
||||||
else:
|
else:
|
||||||
self.filename = filename
|
|
||||||
f = codecs.open(filename, encoding="utf-8", mode='r')
|
f = codecs.open(filename, encoding="utf-8", mode='r')
|
||||||
self.TextBuffer.set_text(f.read())
|
self.TextBuffer.set_text(f.read())
|
||||||
f.close()
|
f.close()
|
||||||
self.MarkupBuffer.markup_buffer(0)
|
self.MarkupBuffer.markup_buffer(0)
|
||||||
self.set_headerbar_title(os.path.basename(filename) + self.title_end)
|
|
||||||
self.TextEditor.undo_stack = []
|
self.set_headerbar_title(os.path.basename(filename) + self.title_end)
|
||||||
self.TextEditor.redo_stack = []
|
self.TextEditor.undo_stack = []
|
||||||
|
self.TextEditor.redo_stack = []
|
||||||
|
self.filename = filename
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Error Reading File: %r" % e)
|
logger.warning("Error Reading File: %r" % e)
|
||||||
|
|
Loading…
Reference in New Issue