diff --git a/.gitignore b/.gitignore index 9300151..8aa3903 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,10 @@ -build/lib.linux-x86_64-2.7 *.pyc __pycache__/ +_build/* build/ -_build/ -debian/uberwriter/DEBIAN -debian/uberwriter/opt -debian/uberwriter/usr -flatpak/* -!flatpak/uberwriter.json -!flatpak/de.wolfvollprecht.UberWriter.* -!flatpak/flatpak_texlive.json -!flatpak/texlive_install.sh -!flatpak/python3-enchant.json -!flatpak/python3-packages.json -*.py~ -data/ui/shortcut_handlers -*.ui~ +*.*~ .vscode/ .idea/ -*.glade~ -dist/uberwriter-2.0b0-py3.7.egg builddir/* -dist/ -uberwriter.egg-info -build-aux/flatpak/.flatpak-builder/* \ No newline at end of file +build-aux/* +flatpak/* diff --git a/build-aux/flatpak/de.wolfvollprecht.UberWriter.json b/build-aux/flatpak/de.wolfvollprecht.UberWriter.json index a0276fc..a847af9 100644 --- a/build-aux/flatpak/de.wolfvollprecht.UberWriter.json +++ b/build-aux/flatpak/de.wolfvollprecht.UberWriter.json @@ -1,10 +1,10 @@ { - "app-id": "de.wolfvollprecht.UberWriter", - "runtime": "org.gnome.Platform", - "runtime-version": "3.34", - "sdk": "org.gnome.Sdk", - "command": "uberwriter", - "finish-args": [ + "app-id" : "de.wolfvollprecht.UberWriter", + "runtime" : "org.gnome.Platform", + "runtime-version" : "3.34", + "sdk" : "org.gnome.Sdk", + "command" : "uberwriter", + "finish-args" : [ "--socket=x11", "--socket=wayland", "--share=ipc", @@ -13,94 +13,108 @@ "--env=PATH=/app/bin:/usr/bin:/app/extensions/TexLive/2019/bin/x86_64-linux/", "--metadata=X-DConf=migrate-path=/de/wolfvollprecht/UberWriter/" ], - "add-extensions": { - "de.wolfvollprecht.UberWriter.Plugin": { - "directory": "extensions", - "version": "stable", - "subdirectories": true, - "no-autodownload": true, - "autodelete": true - } + "add-extensions" : { + "de.wolfvollprecht.UberWriter.Plugin" : { + "directory" : "extensions", + "version" : "stable", + "subdirectories" : true, + "no-autodownload" : true, + "autodelete" : true + } }, - "modules": [{ - "name":"gspell", - "sources":[{ - "type":"archive", - "url":"https://download.gnome.org/sources/gspell/1.8/gspell-1.8.1.tar.xz", - "sha256":"819a1d23c7603000e73f5e738bdd284342e0cd345fb0c7650999c31ec741bbe5" - }] - }, - { - "name": "pandoc", - "only-arches": [ - "x86_64" - ], - "buildsystem": "simple", - "build-commands": [ - "cp bin/pandoc /app/bin/pandoc", - "cp bin/pandoc-citeproc /app/bin/pandoc-citeproc" - ], - "sources": [{ - "type": "archive", - "url": "https://github.com/jgm/pandoc/releases/download/2.2/pandoc-2.2-linux.tar.gz", - "sha256": "06ecd882e42ef9b7390b1c82e1e71b3ea48679181289b9b810a8797825bed8ed" - }] - }, - { - "name": "pipdeps", - "buildsystem": "simple", - "build-commands": [ - "pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} regex pypandoc" - ], - "sources": [{ - "type": "file", - "url": "https://files.pythonhosted.org/packages/5d/c1/45947333669b31bc6b4933308dd07c2aa2fedcec0a95b14eedae993bd449/wheel-0.31.0.tar.gz", - "sha256": "1ae8153bed701cb062913b72429bcf854ba824f973735427681882a688cb55ce" + "modules" : [ + { + "name" : "gspell", + "sources" : [ + { + "type" : "archive", + "url" : "https://download.gnome.org/sources/gspell/1.8/gspell-1.8.1.tar.xz", + "sha256" : "819a1d23c7603000e73f5e738bdd284342e0cd345fb0c7650999c31ec741bbe5" + } + ] }, { - "type": "file", - "url": "https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz", - "sha256": "f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68" - }, - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/71/81/00184643e5a10a456b4118fc12c96780823adb8ed974eb2289f29703b29b/pypandoc-1.4.tar.gz", - "sha256": "e914e6d5f84a76764887e4d909b09d63308725f0cbb5293872c2c92f07c11a5b" + "name" : "pandoc", + "only-arches" : [ + "x86_64" + ], + "buildsystem" : "simple", + "build-commands" : [ + "cp bin/pandoc /app/bin/pandoc", + "cp bin/pandoc-citeproc /app/bin/pandoc-citeproc" + ], + "sources" : [ + { + "type" : "archive", + "url" : "https://github.com/jgm/pandoc/releases/download/2.2/pandoc-2.2-linux.tar.gz", + "sha256" : "06ecd882e42ef9b7390b1c82e1e71b3ea48679181289b9b810a8797825bed8ed" + } + ] }, { - "type": "file", - "url": "https://files.pythonhosted.org/packages/a2/51/c39562cfed3272592c60cfd229e5464d715b78537e332eac2b695422dc49/regex-2018.02.21.tar.gz", - "sha256": "b44624a38d07d3c954c84ad302c29f7930f4bf01443beef5589e9157b14e2a29" + "name" : "pipdeps", + "buildsystem" : "simple", + "build-commands" : [ + "pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} regex pypandoc" + ], + "sources" : [ + { + "type" : "file", + "url" : "https://files.pythonhosted.org/packages/5d/c1/45947333669b31bc6b4933308dd07c2aa2fedcec0a95b14eedae993bd449/wheel-0.31.0.tar.gz", + "sha256" : "1ae8153bed701cb062913b72429bcf854ba824f973735427681882a688cb55ce" + }, + { + "type" : "file", + "url" : "https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz", + "sha256" : "f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68" + }, + { + "type" : "file", + "url" : "https://files.pythonhosted.org/packages/71/81/00184643e5a10a456b4118fc12c96780823adb8ed974eb2289f29703b29b/pypandoc-1.4.tar.gz", + "sha256" : "e914e6d5f84a76764887e4d909b09d63308725f0cbb5293872c2c92f07c11a5b" + }, + { + "type" : "file", + "url" : "https://files.pythonhosted.org/packages/a2/51/c39562cfed3272592c60cfd229e5464d715b78537e332eac2b695422dc49/regex-2018.02.21.tar.gz", + "sha256" : "b44624a38d07d3c954c84ad302c29f7930f4bf01443beef5589e9157b14e2a29" + }, + { + "type" : "file", + "url" : "https://files.pythonhosted.org/packages/9e/54/04d88a59efa33fefb88133ceb638cdf754319030c28aadc5a379d82140ed/pyenchant-2.0.0.tar.gz", + "sha256" : "fc31cda72ace001da8fe5d42f11c26e514a91fa8c70468739216ddd8de64e2a0" + } + ] }, { - "type": "file", - "url": "https://files.pythonhosted.org/packages/9e/54/04d88a59efa33fefb88133ceb638cdf754319030c28aadc5a379d82140ed/pyenchant-2.0.0.tar.gz", - "sha256": "fc31cda72ace001da8fe5d42f11c26e514a91fa8c70468739216ddd8de64e2a0" - }] - }, - { - "name": "fonts", - "buildsystem": "simple", - "build-commands": [ - "mkdir -p /app/share/fonts/", - "cp ttf/* /app/share/fonts/" - ], - "sources": [{ - "type": "git", - "url": "https://github.com/mozilla/Fira", - "tag": "4.202" - }] - }, - { - "name": "uberwriter", - "buildsystem": "meson", - "sources": [{ - "type" : "dir", - "path" : "../../" - }], - "post-install": [ - "install -d /app/extensions" - ] - } - ] + "name" : "fonts", + "buildsystem" : "simple", + "build-commands" : [ + "mkdir -p /app/share/fonts/", + "cp ttf/* /app/share/fonts/" + ], + "sources" : [ + { + "type" : "git", + "url" : "https://github.com/mozilla/Fira", + "tag" : "4.202" + } + ] + }, + { + "name" : "uberwriter", + "buildsystem" : "meson", + "config-opts" : [ + "-Dprofile=development" + ], + "sources" : [ + { + "type" : "dir", + "path" : "../../" + } + ], + "post-install" : [ + "install -d /app/extensions" + ] + } + ] } diff --git a/data/de.wolfvollprecht.UberWriter.appdata.xml.in.in b/data/de.wolfvollprecht.UberWriter.appdata.xml.in.in index 4ae13b4..a124815 100644 --- a/data/de.wolfvollprecht.UberWriter.appdata.xml.in.in +++ b/data/de.wolfvollprecht.UberWriter.appdata.xml.in.in @@ -3,7 +3,7 @@ @app-id@ @app-id@.desktop UberWriter - An elegant, free distraction GTK+ markdown editor + An elegant, distraction-free GTK+ markdown editor

Uberwriter is a GTK+ based distraction free Markdown editor, mainly developed by Wolf Vollprecht and Manuel Genovés. It uses pandoc as backend for markdown parsing and offers a very clean and sleek user interface.

You can install the recommended TexLive extension with the command:

diff --git a/data/de.wolfvollprecht.UberWriter.gschema.xml b/data/de.wolfvollprecht.UberWriter.gschema.xml index 664870c..a043c68 100644 --- a/data/de.wolfvollprecht.UberWriter.gschema.xml +++ b/data/de.wolfvollprecht.UberWriter.gschema.xml @@ -18,17 +18,9 @@ - - - true - Set dark mode automatically - - Whether dark mode depends on the system theme, or is set to what the user specifies. - - false - Force dark mode + Use dark mode Enable or disable the dark mode. @@ -40,14 +32,6 @@ Enable or disable spellchecking.
- - false - Draw scroll gradient - - Show a gradient overlay over the text at the top anf bottom of the window. - It can cause performance problems to some users. - - true Synchronize editor/preview scrolling @@ -62,11 +46,11 @@ Input format to use when previewing and exporting using Pandoc. - + true - Allow Uberwriter to poll cursor motion + Autohide Headerbar - Hide the header and status bars if the cursor is not moving. + Hide the header and status bars when typing. diff --git a/data/icons/de.wolfvollprecht.UberWriter.Devel.svg b/data/icons/de.wolfvollprecht.UberWriter.Devel.svg new file mode 100644 index 0000000..4bca977 --- /dev/null +++ b/data/icons/de.wolfvollprecht.UberWriter.Devel.svg @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/icons/de.wolfvollprecht.uberwriter.Source b/data/icons/de.wolfvollprecht.uberwriter.Source new file mode 100644 index 0000000..942a89e --- /dev/null +++ b/data/icons/de.wolfvollprecht.uberwriter.Source @@ -0,0 +1,2820 @@ + + + Adwaita Icon Template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + GNOME Design Team + + + + + Adwaita Icon Template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/icons/meson.build b/data/icons/meson.build index 9aa6dc9..1b84295 100644 --- a/data/icons/meson.build +++ b/data/icons/meson.build @@ -1,7 +1,6 @@ install_data( - 'de.wolfvollprecht.UberWriter.svg', - install_dir: datadir / 'icons' / 'hicolor' / 'scalable' / 'apps', - rename: '@0@.svg'.format(application_id) + '@0@.svg'.format(application_id), + install_dir: datadir / 'icons' / 'hicolor' / 'scalable' / 'apps' ) install_data( diff --git a/data/media/css/gtk/base.css b/data/media/css/gtk/base.css index 810bc9c..8d4bffa 100644 --- a/data/media/css/gtk/base.css +++ b/data/media/css/gtk/base.css @@ -27,6 +27,19 @@ caret-color: @theme_fg_color; } +.uberwriter-window.focus:not(.tiled):not(.tiled-top):not(.tiled-bottom):not(.tiled-left):not(.tiled-right):not(.maximized):not(.fullscreen) { + border-top-left-radius: 8px; + border-top-right-radius: 8px; +} + +.uberwriter-window.focus:not(.tiled):not(.tiled-top):not(.tiled-bottom):not(.tiled-left):not(.tiled-right):not(.maximized):not(.fullscreen):dir(ltr) scrollbar { + border-top-right-radius: 8px; +} + +.uberwriter-window.focus:not(.tiled):not(.tiled-top):not(.tiled-bottom):not(.tiled-left):not(.tiled-right):not(.maximized):not(.fullscreen):dir(rtl) scrollbar { + border-top-left-radius: 8px; +} + #titlebar-revealer { padding: 0; } @@ -94,6 +107,7 @@ .inline-button { color: alpha(@theme_fg_color, 0.6); + background-color: alpha(@theme_base_color, 0.9); text-shadow: inherit; box-shadow: initial; background-clip: initial; @@ -157,5 +171,48 @@ } .quick-preview-popup label { - color: @theme_fg_color; + color: @theme_fg_color; +} + +.plain-listview { + background-color: @fg-color; +} + +/* theme selector */ + +.color-button { + padding: 12px; + border-radius: 999px; + -gtk-outline-radius: 999px; + outline-offset: 1px; + border: none; + -gtk-icon-shadow: none; + min-width: 0px; + min-height: 0px; + color: transparent; + transition: all 200ms ease-out; +} + +.color-light { + background: #ffffff; + box-shadow: inset 0 0 0 1px #2e3436; +} + +.color-light:checked { + color: #2e3436; + box-shadow: inset 0 0 0 2px @theme_selected_bg_color; +} + +.color-dark { + background: #2d2d2d; + box-shadow: inset 0 0 0 1px alpha(black, .35); +} +.color-dark:checked { + color: #eeeeec; + box-shadow: inset 0 0 0 2px @theme_selected_bg_color; +} + +.color-button:disabled { + background: #929292; + box-shadow: inset 0 0 0 1px #2e3436; } \ No newline at end of file diff --git a/data/media/css/web/adwaita.css b/data/media/css/web/adwaita.css index e784b20..f37b57e 100644 --- a/data/media/css/web/adwaita.css +++ b/data/media/css/web/adwaita.css @@ -15,5 +15,23 @@ --kbd-background-color: #f1f1f1; --kbd-border-color: #bdc1c6; --kbd-shadow-color: #8c939a; +} -} \ No newline at end of file +@media (prefers-color-scheme: dark) { + :root { + --text-color: #eeeeec; + --background-color: #353535; + --alt-background-color: #3a3a3a; + --link-color: #b5daff; + --blockquote-text-color: #a8a8a6; + --blockquote-border-color: #525252; + --header-border-color: #474747; + --hr-background-color: #505050; + --table-tr-border-color: #696969; + --table-td-border-color: #525252; + --kbd-text-color: #cececc; + --kbd-background-color: #3c3c3c; + --kbd-border-color: #696969; + --kbd-shadow-color: #979797; + } +} diff --git a/data/media/css/web/adwaita_dark.css b/data/media/css/web/adwaita_dark.css deleted file mode 100644 index afedc5c..0000000 --- a/data/media/css/web/adwaita_dark.css +++ /dev/null @@ -1,18 +0,0 @@ -@import url("base.css"); - -:root { - --text-color: #eeeeec; - --background-color: #353535; - --alt-background-color: #3a3a3a; - --link-color: #b5daff; - --blockquote-text-color: #a8a8a6; - --blockquote-border-color: #525252; - --header-border-color: #474747; - --hr-background-color: #505050; - --table-tr-border-color: #696969; - --table-td-border-color: #525252; - --kbd-text-color: #cececc; - --kbd-background-color: #3c3c3c; - --kbd-border-color: #696969; - --kbd-shadow-color: #979797; -} \ No newline at end of file diff --git a/data/media/css/web/arc.css b/data/media/css/web/arc.css index 7ee62ac..ea0d3c4 100644 --- a/data/media/css/web/arc.css +++ b/data/media/css/web/arc.css @@ -15,4 +15,23 @@ --kbd-background-color: #f0f2f4; --kbd-border-color: #bcc2c9; --kbd-shadow-color: #8b949d; -} \ No newline at end of file +} + +@media (prefers-color-scheme: dark) { + :root { + --text-color: #d3dae3; + --background-color: #383c4a; + --alt-background-color: #3d414f; + --link-color: #9ac6ff; + --blockquote-text-color: #8d949d; + --blockquote-border-color: #555967; + --header-border-color: #4a4e5c; + --hr-background-color: #535765; + --table-tr-border-color: #6c707e; + --table-td-border-color: #555967; + --kbd-text-color: #b3bac3; + --kbd-background-color: #3f4351; + --kbd-border-color: #6c707e; + --kbd-shadow-color: #9a9eac; + } +} diff --git a/data/media/css/web/arc_dark.css b/data/media/css/web/arc_dark.css deleted file mode 100644 index f421845..0000000 --- a/data/media/css/web/arc_dark.css +++ /dev/null @@ -1,18 +0,0 @@ -@import url("base.css"); - -:root { - --text-color: #d3dae3; - --background-color: #383c4a; - --alt-background-color: #3d414f; - --link-color: #9ac6ff; - --blockquote-text-color: #8d949d; - --blockquote-border-color: #555967; - --header-border-color: #4a4e5c; - --hr-background-color: #535765; - --table-tr-border-color: #6c707e; - --table-td-border-color: #555967; - --kbd-text-color: #b3bac3; - --kbd-background-color: #3f4351; - --kbd-border-color: #6c707e; - --kbd-shadow-color: #9a9eac; -} \ No newline at end of file diff --git a/data/media/css/web/arc_darker.css b/data/media/css/web/arc_darker.css deleted file mode 100644 index a2b855f..0000000 --- a/data/media/css/web/arc_darker.css +++ /dev/null @@ -1 +0,0 @@ -@import url("arc.css"); diff --git a/data/media/icons/icon-case-off.png b/data/media/icons/icon-case-off.png deleted file mode 100644 index 281ae05..0000000 Binary files a/data/media/icons/icon-case-off.png and /dev/null differ diff --git a/data/media/icons/icon-regex-off.png b/data/media/icons/icon-regex-off.png deleted file mode 100644 index 61ff932..0000000 Binary files a/data/media/icons/icon-regex-off.png and /dev/null differ diff --git a/data/media/icons/icon-reverse-off.png b/data/media/icons/icon-reverse-off.png deleted file mode 100644 index d6ec595..0000000 Binary files a/data/media/icons/icon-reverse-off.png and /dev/null differ diff --git a/data/media/icons/icon-word-off.png b/data/media/icons/icon-word-off.png deleted file mode 100644 index b0af0ca..0000000 Binary files a/data/media/icons/icon-word-off.png and /dev/null differ diff --git a/data/media/icons/icon-wrap-off.png b/data/media/icons/icon-wrap-off.png deleted file mode 100644 index f9de6d3..0000000 Binary files a/data/media/icons/icon-wrap-off.png and /dev/null differ diff --git a/data/media/icons/preview-layout-full-width-symbolic.svg b/data/media/icons/preview-layout-full-width-symbolic.svg new file mode 100644 index 0000000..1519879 --- /dev/null +++ b/data/media/icons/preview-layout-full-width-symbolic.svg @@ -0,0 +1,71 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/data/media/icons/preview-layout-half-height-symbolic.svg b/data/media/icons/preview-layout-half-height-symbolic.svg new file mode 100644 index 0000000..1d39397 --- /dev/null +++ b/data/media/icons/preview-layout-half-height-symbolic.svg @@ -0,0 +1,72 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/data/media/icons/preview-layout-half-width-symbolic.svg b/data/media/icons/preview-layout-half-width-symbolic.svg new file mode 100644 index 0000000..66c963f --- /dev/null +++ b/data/media/icons/preview-layout-half-width-symbolic.svg @@ -0,0 +1,70 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/data/media/icons/preview-layout-windowed-symbolic.svg b/data/media/icons/preview-layout-windowed-symbolic.svg new file mode 100644 index 0000000..f2b61d3 --- /dev/null +++ b/data/media/icons/preview-layout-windowed-symbolic.svg @@ -0,0 +1,66 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/data/uberwriter.gresource.xml b/data/uberwriter.gresource.xml index ea9446b..9be8947 100644 --- a/data/uberwriter.gresource.xml +++ b/data/uberwriter.gresource.xml @@ -1,14 +1,20 @@ + media/icons/preview-layout-full-width-symbolic.svg + media/icons/preview-layout-half-width-symbolic.svg + media/icons/preview-layout-windowed-symbolic.svg + media/icons/preview-layout-half-height-symbolic.svg media/css/gtk/base.css ui/Export.ui + ui/ExportPopover.ui ui/Menu.ui ui/Preferences.ui - ui/Preview.ui ui/Recents.ui ui/Shortcuts.ui ui/Window.ui + ui/Headerbar.ui + ui/PreviewLayoutSwitcherItem.ui About.ui diff --git a/data/ui/Export.ui b/data/ui/Export.ui index 318abe5..8d71eb4 100644 --- a/data/ui/Export.ui +++ b/data/ui/Export.ui @@ -584,6 +584,9 @@ 1 + 0 @@ -591,28 +594,45 @@ - - - text/html - - - - - application/vnd.oasis.opendocument.text - - - - - application/pdf - - False dialog cancel_btn - export_btn + export_btn + + + True + False + False + + + gtk-cancel + True + True + True + True + + + 1 + + + + + Export + True + True + True + True + + + end + 2 + + + + False @@ -629,58 +649,12 @@ - + True False - crossfade - - - True - False - save - html_filter - - - html - HTML - - - - - False - label - - - pdf_disabled - PDF - 1 - - - - - True - False - save - pdf_filter - - - pdf - PDF - 2 - - - - - True - False - advanced_export_options - - - advanced - Advanced - 3 - - + select-folder + True + advanced_export_options False diff --git a/data/ui/ExportPopover.ui b/data/ui/ExportPopover.ui new file mode 100644 index 0000000..d164a1e --- /dev/null +++ b/data/ui/ExportPopover.ui @@ -0,0 +1,101 @@ + + + + + + False + + + True + False + 12 + vertical + + + True + True + True + app.save_as + Save as... + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + True + True + app.export + "pdf" + Pdf + + + False + True + 2 + + + + + True + True + True + app.export + "html" + Html + + + False + True + 3 + + + + + True + True + True + app.export + "odt" + ODT + + + False + True + 4 + + + + + True + True + True + app.export + "advanced" + Advanced + + + False + True + 5 + + + + + + \ No newline at end of file diff --git a/data/ui/Headerbar.ui b/data/ui/Headerbar.ui new file mode 100644 index 0000000..051366f --- /dev/null +++ b/data/ui/Headerbar.ui @@ -0,0 +1,388 @@ + + + + + + False + + + True + False + + + True + True + True + + + + + + False + True + 0 + + + + + True + True + True + + + + + + False + True + 1 + + + + + + + True + False + view-restore-symbolic + + + True + False + document-new-symbolic + + + True + False + view-dual-symbolic + + + False + + + True + False + vertical + + + True + False + 12 + 6 + False + 0 + none + + + True + False + + + + + + + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + False + 12 + 12 + 10 + 12 + 10 + + + True + True + + + False + True + 0 + + + + + True + False + 6 + Sync views + + + False + True + 1 + + + + + False + True + 2 + + + + + + + True + False + system-search-symbolic + + + titlebar-revealer + True + False + start + 350 + True + + + + True + False + 7 + + + True + True + True + New + app.new + new_icon + + + + + True + False + + + Open + True + True + True + app.open + + + False + True + 0 + + + + + True + True + True + Open Recent + app.on_open_recent + + + + + + False + True + 1 + + + + + + 1 + + + + + True + False + + + Save + True + True + True + app.save + + + False + True + 0 + + + + + True + True + True + Save as... + + + + + + False + True + 1 + + + + + + 2 + + + + + True + True + True + app.fullscreen + exit_fs_icon + + + end + 1 + + + + + True + True + True + + + True + False + Menu + open-menu-symbolic + + + + + end + 2 + + + + + True + False + 2 + + + True + True + True + Preview + app.preview + preview_icon + True + + + False + True + 0 + + + + + True + False + slide-right + + + True + True + True + preview_switcher + + + True + False + + + True + False + gtk-copy + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + + + False + True + 1 + + + + + end + 3 + + + + + True + True + True + Find + app.search + search_icon + True + + + end + 4 + + + + + + diff --git a/data/ui/Menu.ui b/data/ui/Menu.ui index 33f6df7..cb2214f 100644 --- a/data/ui/Menu.ui +++ b/data/ui/Menu.ui @@ -1,61 +1,228 @@ - - -
- - Focus Mode - app.focus_mode - - - Hemingway Mode - app.hemingway_mode - - - Preview - app.preview - - - Fullscreen - app.fullscreen - -
-
- - Save As - app.save_as - - - Export - app.export - - - Copy HTML - app.copy_html - -
-
- - Find and Replace - app.search_replace - -
-
- - Preferences - app.preferences - - - app.shortcuts - _Keyboard Shortcuts - - - Open Tutorial - app.open_tutorial - - - app.about - _About UberWriter - -
-
+ + + + + False + + + True + False + 12 + 12 + 12 + 12 + vertical + + + True + False + center + 12 + 12 + 6 + 24 + + + True + True + False + center + False + + + True + False + emblem-ok-symbolic + + + + + + False + True + 0 + + + + + True + True + False + center + False + light_mode_button + + + True + False + emblem-ok-symbolic + + + + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + True + True + app.hemingway_mode + Hemingway mode + + + False + True + 2 + + + + + True + True + True + app.focus_mode + Focus Mode + + + False + True + 3 + + + + + True + False + + + False + True + 4 + + + + + True + True + True + app.search_replace + Find and Replace + + + False + True + 5 + + + + + True + False + + + False + True + 6 + + + + + True + True + True + app.preferences + Preferences + + + False + True + 7 + + + + + True + False + + + False + True + 8 + + + + + True + True + True + app.open_tutorial + Open Tutorial + + + False + True + 9 + + + + + True + True + True + app.shortcuts + Keyboard Shortcuts + + + False + True + 10 + + + + + True + True + True + app.about + About Uberwriter + + + False + True + 11 + + + + + diff --git a/data/ui/Preferences.ui b/data/ui/Preferences.ui index d02cdd7..509e55d 100644 --- a/data/ui/Preferences.ui +++ b/data/ui/Preferences.ui @@ -41,54 +41,6 @@ 16 8 8 - - - True - False - start - Set dark mode automatically - right - - - 0 - 0 - - - - - True - True - end - - - 2 - 0 - - - - - True - False - start - Force dark mode - right - - - 0 - 1 - - - - - True - True - end - - - 2 - 1 - - True @@ -99,7 +51,7 @@ 0 - 2 + 1 @@ -110,55 +62,7 @@
2 - 2 - -
- - - True - False - start - Draw scroll gradient - right - - - 0 - 3 - - - - - True - True - end - - - 2 - 3 - - - - - True - False - start - Synchronize editor/preview scrolling - right - - - 0 - 4 - - - - - True - True - end - - - 2 - 4 + 1 @@ -171,7 +75,7 @@
0 - 5 + 2
@@ -184,7 +88,7 @@
2 - 5 + 2 @@ -196,17 +100,33 @@ 1 - 5 + 2 - + + True + False + Autohide header and statusbars while typing + start + Autohide headerbar + right + + + 0 + 0 + - - - - + + True + True + end + + + 2 + 0 + diff --git a/data/ui/Preview.ui b/data/ui/Preview.ui deleted file mode 100644 index ddc354b..0000000 --- a/data/ui/Preview.ui +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - True - False - pan-down-symbolic - 2 - - - True - False - True - vertical - - - - - - True - False - crossfade - 750 - True - - - Full-Width - True - True - True - Switch Preview Mode - end - pan-down - right - True - - - - - - False - True - end - 1 - - - - diff --git a/data/ui/PreviewLayoutSwitcherItem.ui b/data/ui/PreviewLayoutSwitcherItem.ui new file mode 100644 index 0000000..cddd539 --- /dev/null +++ b/data/ui/PreviewLayoutSwitcherItem.ui @@ -0,0 +1,47 @@ + + + + + + True + True + app.preview_mode + + + True + False + 4 + 4 + 10 + + + True + False + 12 + 16 + preview-layout-full-width-symbolic + + + False + True + 0 + + + + + True + False + start + 12 + Full-Width + + + True + True + 1 + + + + + + diff --git a/data/ui/Recents.ui b/data/ui/Recents.ui index ae75e95..a7b237c 100644 --- a/data/ui/Recents.ui +++ b/data/ui/Recents.ui @@ -17,6 +17,10 @@ True False start + 6 + 6 + 6 + 6 recent_md_filter 20 False diff --git a/data/ui/Window.ui b/data/ui/Window.ui index 5d17ee0..fabc638 100644 --- a/data/ui/Window.ui +++ b/data/ui/Window.ui @@ -1,12 +1,11 @@ - + True False - 12 edit-find-replace-symbolic @@ -30,12 +29,12 @@ False gtk-spell-check - + FullscreenOverlay True False - + True False @@ -71,10 +70,9 @@ False True - + True False - vertical True @@ -87,15 +85,15 @@ - False - True - 0 + -1 - + True False + GDK_ENTER_NOTIFY_MASK | GDK_STRUCTURE_MASK + end crossfade 750 True @@ -116,11 +114,6 @@ - - False - True - 1 - @@ -236,6 +229,7 @@ True False + True aA @@ -414,27 +408,27 @@ 1 - True False start - - True - False - start - - - True - False - start - - - - - - + + + + 60 + False + start + False + True + + + + + + 1 + + diff --git a/meson.build b/meson.build index 6173c51..7718852 100644 --- a/meson.build +++ b/meson.build @@ -5,7 +5,7 @@ project( ) if get_option('profile') == 'development' - profile = 'Devel' + profile = '.Devel' name_suffix = ' (Development)' vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() if vcs_tag == '' diff --git a/screenshots/mockups_text.svg b/screenshots/mockups_text.svg index d99093f..6b78ad5 100644 --- a/screenshots/mockups_text.svg +++ b/screenshots/mockups_text.svg @@ -16,7 +16,7 @@ viewBox="0 0 1034.14 578.502" id="svg8720" sodipodi:docname="mockups_text.svg" - inkscape:version="0.92.2 2405546, 2018-03-11" + inkscape:version="0.92.4 5da689c313, 2019-01-14" inkscape:export-filename="/home/manu/Documentos/Programacion/Uberwriter/uberwriter/screenshots/mockups.svg.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> @@ -29,21 +29,22 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1366" - inkscape:window-height="741" + inkscape:window-width="1920" + inkscape:window-height="1016" id="namedview8722" showgrid="false" - inkscape:zoom="0.70710678" - inkscape:cx="623.96349" - inkscape:cy="469.33901" + inkscape:zoom="0.5" + inkscape:cx="693.82738" + inkscape:cy="260.3702" inkscape:window-x="1280" - inkscape:window-y="525" + inkscape:window-y="27" inkscape:window-maximized="1" - inkscape:current-layer="MainApp" + inkscape:current-layer="g8020-9-6" inkscape:snap-midpoints="true" inkscape:snap-object-midpoints="true" showguides="true" - inkscape:guide-bbox="true" /> + inkscape:guide-bbox="true" + inkscape:snap-page="true" /> @@ -52,7 +53,7 @@ image/svg+xml - + @@ -526,797 +527,2561 @@ id="radialGradient3834" xlink:href="#StandardGradient" inkscape:collect="always" /> + + + + + + - - - - - - - - - + id="MainApp" + class="sprite" + transform="translate(-0.585037,-0.838695)" + style="display:inline" + inkscape:export-filename="/home/manu/mockup.png" + inkscape:export-xdpi="300.02115" + inkscape:export-ydpi="300.02115"> - + style="fill:#f2f2f2;stroke:#919191;stroke-width:1.17298734;stroke-linecap:square" + id="rect8155" + ry="9.8180552" + rx="11.3513" + height="102.54028" + width="1032.9708" + y="1.4261495" + x="1.1679047" /> - - - - - Words: 37 - Characters: 4576 - - + style="fill:#ededed;stroke:#919191;stroke-width:1.17318892;stroke-linecap:square" + id="rect8157" + height="526.01947" + width="1032.9171" + y="52.73592" + x="1.1679047" /> + + + + + + + + + + + + + + + Words: 37 + Characters: 4576 + + + UberWriter helps your textediting workflow - UberWriter helps your textediting workflow + # - # + It's a simple markdown editor that offers a It's a simple markdown editor that offers a **lot** of features.**lot** of Reasons to install:features.Reasons to install:Because you love markdown as much as I doBecause you like writting in a clutter free environmentBecause you love markdown as much as I doBecause you did not know that you only have always Because you like writting in a clutter free environmentBecause you did not know that you only have always searched for an editor like this - searched for an editor like this + ## ## 1.2.2.3. - - 3. + + UberWriter.md - UberWriter - - - - + font-size="40px" + letter-spacing="0px" + word-spacing="0px" + style="font-size:40px;line-height:25px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#2e3436;stroke-width:1px" + xml:space="preserve" + id="text8307">UberWriter.md - UberWriter + transform="translate(750.32102,2.8991699e-4)" + style="display:inline" + id="g2151-2"> + + - - - - - - - - - - - - - PopUp Tabs - - - - - - Save As ...ExportCopy HTMLPreferencesOpen TutorialPandoc HelpShortcutsAbout - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Open - - - - - - - - - - + id="layer9-30" + inkscape:label="status" + style="display:inline;fill:#3e4444" + transform="translate(-441.0004,-195)" /> + + + - - + d="m 447.50781,195.99554 c -3.02886,0 -5.51073,2.47905 -5.51073,5.50447 0,3.02541 2.48187,5.50446 5.51073,5.50446 3.02885,0 5.51072,-2.47905 5.51072,-5.50446 0,-3.02542 -2.48187,-5.50447 -5.51072,-5.50447 z m 0,2.00893 c 1.94735,0 3.49951,1.55039 3.49951,3.49554 0,1.94514 -1.55216,3.49553 -3.49951,3.49553 -1.94736,0 -3.49952,-1.55039 -3.49952,-3.49553 0,-1.94515 1.55216,-3.49554 3.49952,-3.49554 z" + id="path5079" + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:Sans;-inkscape-font-specification:Sans;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#3e4444;fill-opacity:1;stroke:none;stroke-width:1.55467153;marker:none;enable-background:new" /> + + + + + + + + + + PopUp Tabs + + + + + + Save As ...ExportCopy HTMLPreferencesOpen TutorialPandoc HelpShortcutsAbout + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + Open + + + + + + + + + + + + + + + + + + Save - Save + New + id="text18336-5">New + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UberWriter.md - UberWriter + ~/Documents/examples/UberWriter.md + (save as) + + + + + + + + + + + + + + + + + + + + + + + + Open + + + + + + + + + + Save + + + + + + + + + + + + + + + + + + + + + + + + + + + + Save + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Save As + PDF + + HTML + ODT + LaTeX + ... + + PopUp Tabs + + + + + + [Export]Copy HTMLPreferencesTutorialKeyboard ShortcutsAbout UberWriter + + + + + + + + + + + + + + + + + + + + + + + + PopUp Tabs + + Search + + + 150: - # filter out accidental motions - self.timestamp_last_mouse_motion = now - return - if now - self.timestamp_last_mouse_motion < 100: - # filter out accidental motion - return - if now - self.timestamp_last_mouse_motion > 100: - # react on motion by fading in headerbar and statusbar - self.reveal_top_bottom_bars(True) - self.was_motion = True - def focus_out(self, _widget, _data=None): """events called when the window losses focus """ - self.reveal_top_bottom_bars(True) + self.reveal_headerbar_bottombar() - def reveal_top_bottom_bars(self, reveal): - if self.top_bottom_bars_visible != reveal: - self.headerbar.hb_revealer.set_reveal_child(reveal) - self.stats_revealer.set_reveal_child(reveal) - for revealer in self.preview_handler.get_top_bottom_bar_revealers(): - revealer.set_reveal_child(reveal) - self.top_bottom_bars_visible = reveal - self.buffer_modified_for_status_bar = reveal + def reveal_headerbar_bottombar(self, _widget=None, _data=None): - def draw_gradient(self, _widget, cr): - """draw fading gradient over the top and the bottom of the - TextWindow - """ - bg_color = self.get_style_context().get_background_color(Gtk.StateFlags.ACTIVE) + def __reveal_hb(): + self.headerbar_eventbox.hide() + self.headerbar.hb_revealer.set_reveal_child(True) + self.get_style_context().remove_class("focus") + return False - lg_top = cairo.LinearGradient(0, 0, 0, 32) # pylint: disable=no-member - lg_top.add_color_stop_rgba( - 0, bg_color.red, bg_color.green, bg_color.blue, 1) - lg_top.add_color_stop_rgba( - 1, bg_color.red, bg_color.green, bg_color.blue, 0) + self.reveal_bottombar() - width = self.scrolled_window.get_allocation().width - height = self.scrolled_window.get_allocation().height + if not self.headerbar_visible: + self.dm_headerbar.hide_dm_hb() + GLib.timeout_add(400, __reveal_hb) - cr.rectangle(0, 0, width, 32) - cr.set_source(lg_top) - cr.fill() - cr.rectangle(0, height - 32, width, height) + self.headerbar_visible = True - lg_btm = cairo.LinearGradient(0, height - 32, 0, height) # pylint: disable=no-member - lg_btm.add_color_stop_rgba( - 1, bg_color.red, bg_color.green, bg_color.blue, 1) - lg_btm.add_color_stop_rgba( - 0, bg_color.red, bg_color.green, bg_color.blue, 0) + def reveal_bottombar(self, _widget=None, _data=None): - cr.set_source(lg_btm) - cr.fill() + if not self.bottombar_visible: + self.stats_revealer.set_reveal_child(True) + + self.bottombar_visible = True + + self.buffer_modified_for_status_bar = True + + def hide_headerbar_bottombar(self): + + if self.headerbar_visible: + self.headerbar.hb_revealer.set_reveal_child(False) + self.dm_headerbar.show_dm_hb() + self.get_style_context().add_class("focus") + + self.headerbar_visible = False + + if self.bottombar_visible: + self.stats_revealer.set_reveal_child(False) + + self.bottombar_visible = False + + self.headerbar_eventbox.show() + self.buffer_modified_for_status_bar = False def on_delete_called(self, _widget, _data=None): """Called when the TexteditorWindow is closed. @@ -616,11 +625,18 @@ class MainWindow(StyledWindow): self.destroy() return - def set_headerbar_title(self, title): + def set_headerbar_title(self, title, subtitle=None): """set the desired headerbar title """ self.headerbar.hb.props.title = title + self.dm_headerbar.hb.props.title = title self.fs_headerbar.hb.props.title = title + if subtitle: + self.headerbar.hb.props.subtitle = subtitle + self.dm_headerbar.hb.props.subtitle = subtitle + self.fs_headerbar.hb.props.subtitle = subtitle + self.headerbar.hb.set_tooltip_text(subtitle) + self.fs_headerbar.hb.set_tooltip_text(subtitle) self.set_title(title) def set_filename(self, filename=None): diff --git a/uberwriter/preferences_dialog.py b/uberwriter/preferences_dialog.py index 5158298..d679dca 100644 --- a/uberwriter/preferences_dialog.py +++ b/uberwriter/preferences_dialog.py @@ -67,26 +67,14 @@ class PreferencesDialog: self.builder.add_from_resource( "/de/wolfvollprecht/UberWriter/ui/Preferences.ui") - self.dark_mode_auto_switch = self.builder.get_object("dark_mode_auto_switch") - self.dark_mode_auto_switch.set_active(self.settings.get_value("dark-mode-auto")) - self.dark_mode_auto_switch.connect("state-set", self.on_dark_mode_auto) - - self.dark_mode_switch = self.builder.get_object("dark_mode_switch") - self.dark_mode_switch.set_active(self.settings.get_value("dark-mode")) - self.dark_mode_switch.connect("state-set", self.on_dark_mode) + self.autohide_headerbar_switch = self.builder.get_object("autohide_headerbar_switch") + self.autohide_headerbar_switch.set_active(self.settings.get_value("autohide-headerbar")) + self.autohide_headerbar_switch.connect("state-set", self.on_autohide_headerbar) self.spellcheck_switch = self.builder.get_object("spellcheck_switch") self.spellcheck_switch.set_active(self.settings.get_value("spellcheck")) self.spellcheck_switch.connect("state-set", self.on_spellcheck) - self.gradient_overlay_switch = self.builder.get_object("gradient_overlay_switch") - self.gradient_overlay_switch.set_active(self.settings.get_value("gradient-overlay")) - self.gradient_overlay_switch.connect("state-set", self.on_gradient_overlay) - - self.sync_scroll_switch = self.builder.get_object("sync_scroll_switch") - self.sync_scroll_switch.set_active(self.settings.get_value("sync-scroll")) - self.sync_scroll_switch.connect("state-set", self.on_sync_scroll) - input_format_store = Gtk.ListStore(int, str) input_format = self.settings.get_string("input-format") input_format_active = 0 @@ -111,30 +99,14 @@ class PreferencesDialog: preferences_window.set_transient_for(window) preferences_window.show() - def on_dark_mode_auto(self, _, state): - self.settings.set_boolean("dark-mode-auto", state) - if state and self.dark_mode_switch.get_active(): - self.dark_mode_switch.set_active(GLib.Variant.new_boolean(False)) - return False - - def on_dark_mode(self, _, state): - self.settings.set_boolean("dark-mode", state) - if state and self.dark_mode_auto_switch.get_active(): - self.dark_mode_auto_switch.set_active(GLib.Variant.new_boolean(False)) + def on_autohide_headerbar(self, _, state): + self.settings.set_boolean("autohide-headerbar", state) return False def on_spellcheck(self, _, state): self.settings.set_boolean("spellcheck", state) return False - def on_gradient_overlay(self, _, state): - self.settings.set_boolean("gradient-overlay", state) - return False - - def on_sync_scroll(self, _, state): - self.settings.set_boolean("sync-scroll", state) - return False - def on_input_format(self, combobox): fmt = self.formats[combobox.get_active()] self.settings.set_string("input-format", fmt["format"]) diff --git a/uberwriter/preview_handler.py b/uberwriter/preview_handler.py index 4331957..1e3a2c6 100644 --- a/uberwriter/preview_handler.py +++ b/uberwriter/preview_handler.py @@ -32,16 +32,9 @@ class PreviewHandler: self.web_view = None self.web_view_pending_html = None - builder = Gtk.Builder() - builder.add_from_resource( - "/de/wolfvollprecht/UberWriter/ui/Preview.ui") - preview = builder.get_object("preview") - mode_button = builder.get_object("preview_mode_button") - self.mode_revealer = builder.get_object("preview_mode_revealer") - self.preview_converter = PreviewConverter() self.preview_renderer = PreviewRenderer( - window, content, editor, text_view, preview, self.mode_revealer, mode_button) + window, content, editor, text_view) window.connect("style-updated", self.reload) @@ -135,12 +128,6 @@ class PreviewHandler: def update_preview_mode(self): self.preview_renderer.update_mode(self.web_view) - def get_top_bottom_bar_revealers(self): - if self.shown and not self.preview_renderer.window: - return [self.mode_revealer] - else: - return [] - def on_load_changed(self, _web_view, event): if event == WebKit2.LoadEvent.FINISHED: self.loading = False diff --git a/uberwriter/preview_renderer.py b/uberwriter/preview_renderer.py index 2185486..3e81d7a 100644 --- a/uberwriter/preview_renderer.py +++ b/uberwriter/preview_renderer.py @@ -17,16 +17,12 @@ class PreviewRenderer: WINDOWED = 3 def __init__( - self, main_window, content, editor, text_view, preview, mode_revealer, mode_button): + self, main_window, content, editor, text_view): self.main_window = main_window self.main_window.connect("delete-event", self.on_window_closed) self.content = content self.editor = editor self.text_view = text_view - self.preview = preview - self.mode_revealer = mode_revealer - self.mode_button = mode_button - self.mode_button.connect("clicked", self.show_mode_popover) self.settings = Settings.new() self.popover = None @@ -49,9 +45,6 @@ class PreviewRenderer: headerbar = headerbars.PreviewHeaderbar() self.headerbar = headerbar.hb self.headerbar.set_title(_("Preview")) - self.mode_button.get_style_context().remove_class("inline-button") - self.mode_revealer.remove(self.mode_button) - self.headerbar.pack_end(self.mode_button) self.window.set_titlebar(headerbar.hb_container) # Position it next to the main window. @@ -67,8 +60,7 @@ class PreviewRenderer: self.window.show() else: - self.preview.pack_start(web_view, True, True, 0) - self.content.add(self.preview) + self.content.pack_start(web_view, True, True, 0) # Full-width preview: swap editor with preview. if self.mode == self.FULL_WIDTH: @@ -97,17 +89,13 @@ class PreviewRenderer: # Windowed preview: remove preview and destroy window. if self.mode == self.WINDOWED: self.main_window.present() - self.headerbar.remove(self.mode_button) - self.mode_button.get_style_context().add_class("inline-button") - self.mode_revealer.add(self.mode_button) self.headerbar = None self.window.remove(web_view) self.window.destroy() self.window = None else: - self.preview.remove(web_view) - self.content.remove(self.preview) + self.content.remove(web_view) # Full-width preview: swap preview with editor. if self.mode == self.FULL_WIDTH: @@ -130,32 +118,6 @@ class PreviewRenderer: self.show(web_view) else: self.mode = mode - if self.mode_button: - text = self.get_text_for_preview_mode(self.mode) - self.mode_button.set_label(text) - if self.popover: - self.popover.popdown() - - def show_mode_popover(self, button): - """Show preview mode popover.""" - - self.mode_button.set_state_flags(Gtk.StateFlags.CHECKED, False) - - menu = Gio.Menu() - modes = self.settings.props.settings_schema.get_key("preview-mode").get_range()[1] - for i, mode in enumerate(modes): - menu_item = Gio.MenuItem.new(self.get_text_for_preview_mode(i), None) - menu_item.set_action_and_target_value("app.preview_mode", GLib.Variant.new_string(mode)) - menu.append_item(menu_item) - self.popover = Gtk.Popover.new_from_model(button, menu) - self.popover.connect('closed', self.on_popover_closed) - self.popover.popup() - - def on_popover_closed(self, _popover): - self.mode_button.unset_state_flags(Gtk.StateFlags.CHECKED) - - self.popover = None - self.text_view.grab_focus() def on_window_closed(self, window, _event): preview_action = window.get_application().lookup_action("preview") diff --git a/uberwriter/preview_web_view.py b/uberwriter/preview_web_view.py index 19f1c0b..b837b61 100644 --- a/uberwriter/preview_web_view.py +++ b/uberwriter/preview_web_view.py @@ -62,6 +62,8 @@ if (canScroll && isRendered) {{ self.connect("load-failed", self.on_load_failed) self.connect("destroy", self.on_destroy) + self.props.expand = True + self.scroll_scale = -1 self.state_loaded = False diff --git a/uberwriter/styled_window.py b/uberwriter/styled_window.py index b95ad03..9e0fed6 100644 --- a/uberwriter/styled_window.py +++ b/uberwriter/styled_window.py @@ -1,7 +1,6 @@ import gi from uberwriter import helpers -from uberwriter.theme import Theme gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GLib, Gio @@ -13,27 +12,11 @@ class StyledWindow(Gtk.ApplicationWindow): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.connect("style-updated", self.apply_current_theme) - self.apply_current_theme() - - def apply_current_theme(self, *_): - """Adjusts the window, CSD and preview for the current theme.""" - # Get current theme - theme, changed = Theme.get_current_changed() - if changed: - # Set theme variant (dark/light) - Gtk.Settings.get_default().set_property( - "gtk-application-prefer-dark-theme", - GLib.Variant("b", theme.is_dark)) - - # Set theme css - css_provider_file = Gio.File.new_for_uri( - "resource:///de/wolfvollprecht/UberWriter/media/css/gtk/base.css") - style_provider = Gtk.CssProvider() - style_provider.load_from_file(css_provider_file) - Gtk.StyleContext.add_provider_for_screen( - self.get_screen(), style_provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) - - # Redraw contents of window - self.queue_draw() \ No newline at end of file + # Set theme css + css_provider_file = Gio.File.new_for_uri( + "resource:///de/wolfvollprecht/UberWriter/media/css/gtk/base.css") + style_provider = Gtk.CssProvider() + style_provider.load_from_file(css_provider_file) + Gtk.StyleContext.add_provider_for_screen( + self.get_screen(), style_provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) diff --git a/uberwriter/text_view.py b/uberwriter/text_view.py index 0d3ec9a..d4a749a 100644 --- a/uberwriter/text_view.py +++ b/uberwriter/text_view.py @@ -54,6 +54,9 @@ class TextView(Gtk.TextView): self.set_pixels_inside_wrap(8) self.get_style_context().add_class('uberwriter-editor') + self.set_margin_left(8) + self.set_margin_right(8) + # Text sizing self.props.halign = Gtk.Align.FILL self.line_chars = line_chars @@ -144,7 +147,6 @@ class TextView(Gtk.TextView): def on_size_allocate(self, *_): self.update_horizontal_margin() - self.update_vertical_margin() self.markup.update_margins_indents() self.queue_draw() @@ -192,14 +194,14 @@ class TextView(Gtk.TextView): self.frozen_scroll_scale = None self.queue_draw() - def set_focus_mode(self, focus_mode): + def set_focus_mode(self, focus_mode, hb_height): """Toggle focus mode. When in focus mode, the cursor sits in the middle of the text view, and the surrounding text is greyed out.""" self.focus_mode = focus_mode - self.update_vertical_margin() + self.update_vertical_margin(hb_size=hb_height) self.markup.apply() self.smooth_scroll_to() self.set_spellcheck(self.spellcheck) @@ -227,13 +229,14 @@ class TextView(Gtk.TextView): self.props.left_margin = horizontal_margin self.props.right_margin = horizontal_margin - def update_vertical_margin(self): + def update_vertical_margin(self, top_margin=0, hb_size=0): if self.focus_mode: - height = self.get_allocation().height - self.props.top_margin = height / 2 - self.props.bottom_margin = height / 2 + height = self.get_allocation().height + top_margin + hb_size + + self.props.top_margin = height / 2 + top_margin + self.props.bottom_margin = height / 2 - top_margin else: - self.props.top_margin = 80 + self.props.top_margin = 80 + top_margin self.props.bottom_margin = 64 def set_hemingway_mode(self, hemingway_mode): diff --git a/uberwriter/theme.py b/uberwriter/theme.py index 2c11e2f..a80cc18 100644 --- a/uberwriter/theme.py +++ b/uberwriter/theme.py @@ -31,10 +31,9 @@ class Theme: @classmethod def get_current_changed(cls): theme_name = Gtk.Settings.get_default().get_property('gtk-theme-name') - dark_mode_auto = cls.settings.get_boolean('dark-mode-auto') dark_mode = cls.settings.get_boolean('dark-mode') current_theme = cls.get_for_name(theme_name) - if not dark_mode_auto and dark_mode != current_theme.is_dark and current_theme.inverse_name: + if dark_mode != current_theme.is_dark and current_theme.inverse_name: current_theme = cls.get_for_name(current_theme.inverse_name, current_theme.name) changed = current_theme != cls.previous cls.previous = current_theme @@ -56,11 +55,11 @@ class Theme: defaultThemes = [ # https://gitlab.gnome.org/GNOME/gtk/tree/master/gtk/theme/Adwaita Theme('Adwaita', get_css_path('web/adwaita.css'), False, 'Adwaita-dark'), - Theme('Adwaita-dark', get_css_path('web/adwaita_dark.css'), True, 'Adwaita'), + Theme('Adwaita-dark', get_css_path('web/adwaita.css'), True, 'Adwaita'), # https://github.com/NicoHood/arc-theme/tree/master/common/gtk-3.0/3.20/sass Theme('Arc', get_css_path('web/arc.css'), False, 'Arc-Dark'), - Theme('Arc-Darker', get_css_path('web/arc_darker.css'), False, 'Arc-Dark'), - Theme('Arc-Dark', get_css_path('web/arc_dark.css'), True, 'Arc'), + Theme('Arc-Darker', get_css_path('web/arc.css'), False, 'Arc-Dark'), + Theme('Arc-Dark', get_css_path('web/arc.css'), True, 'Arc'), # https://gitlab.gnome.org/GNOME/gtk/tree/master/gtk/theme/HighContrast Theme('HighContrast', get_css_path('web/highcontrast.css'), False, 'HighContrastInverse'), Theme('HighContrastInverse', get_css_path('web/highcontrast_inverse.css'), True, 'HighContrast')