From b7744bbda24692b337b0d17268523f9fec1c2b94 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:25:15 +0100 Subject: [PATCH 1/3] Correct paths for input-none icons (#1297) --- .../assets/icons/typicons_dark/mixed_input-none.svg | 7 +++---- .../assets/icons/typicons_light/mixed_input-none.svg | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/novelwriter/assets/icons/typicons_dark/mixed_input-none.svg b/novelwriter/assets/icons/typicons_dark/mixed_input-none.svg index 105e1d8f..f4b1ae67 100644 --- a/novelwriter/assets/icons/typicons_dark/mixed_input-none.svg +++ b/novelwriter/assets/icons/typicons_dark/mixed_input-none.svg @@ -25,10 +25,9 @@ + id="path2927" + style="fill:#848484;fill-opacity:1" + d="M 6.2851562,2 C 3.9296438,1.9318024 1.8530839,4.1116184 2,6.4548618 2.0068983,10.304935 1.9861657,14.15563 2.0104329,18.005313 2.1401885,20.174302 4.0868901,22.059322 6.2851562,22 c 3.8832648,-0.0037 7.7667178,0.0074 11.6498648,-0.0056 C 20.253096,21.935675 22.190613,19.73469 22,17.432001 21.996299,13.643017 22.007418,9.8538453 21.994414,6.0649793 21.935675,3.7469037 19.734691,1.8093866 17.432001,2 13.716386,2 10.000771,2 6.2851562,2 Z m 7.1621098,2.8554688 c 1.517767,0.018193 3.040205,-0.037158 4.55493,0.029088 0.831903,0.1432784 1.247019,1.0200413 1.140382,1.796579 -0.0049,3.726426 0.0098,7.453347 -0.0074,11.179464 -0.06228,0.897202 -0.990183,1.406807 -1.816343,1.281978 -3.726391,-0.005 -7.4532932,0.0099 -11.1793638,-0.0075 -0.8893499,-0.06498 -1.4061831,-0.991209 -1.2820783,-1.81622 0.00424,-3.720679 -0.00847,-7.4417768 0.00635,-11.1621953 0.056947,-0.8627405 0.9413144,-1.4230927 1.7608001,-1.2992468 2.2741995,-0.00131 4.5486615,0.00261 6.8226985,-0.00195 z" /> + id="path969" + style="fill:#333333;fill-opacity:1" + d="M 6.2851562,2 C 3.9296438,1.9318024 1.8530839,4.1116184 2,6.4548618 2.0068983,10.304935 1.9861657,14.15563 2.0104329,18.005313 2.1401885,20.174302 4.0868901,22.059322 6.2851562,22 c 3.8832648,-0.0037 7.7667178,0.0074 11.6498648,-0.0056 C 20.253096,21.935675 22.190613,19.73469 22,17.432001 21.996299,13.643017 22.007418,9.8538453 21.994414,6.0649793 21.935675,3.7469037 19.734691,1.8093866 17.432001,2 13.716386,2 10.000771,2 6.2851562,2 Z m 7.1621098,2.8554688 c 1.517767,0.018193 3.040205,-0.037158 4.55493,0.029088 0.831903,0.1432784 1.247019,1.0200413 1.140382,1.796579 -0.0049,3.726426 0.0098,7.453347 -0.0074,11.179464 -0.06228,0.897202 -0.990183,1.406807 -1.816343,1.281978 -3.726391,-0.005 -7.4532932,0.0099 -11.1793638,-0.0075 -0.8893499,-0.06498 -1.4061831,-0.991209 -1.2820783,-1.81622 0.00424,-3.720679 -0.00847,-7.4417768 0.00635,-11.1621953 0.056947,-0.8627405 0.9413144,-1.4230927 1.7608001,-1.2992468 2.2741995,-0.00131 4.5486615,0.00261 6.8226985,-0.00195 z" /> Date: Tue, 20 Dec 2022 12:32:42 +0100 Subject: [PATCH 2/3] Remove Inkscape meta data from a bunch of icons --- .../assets/icons/typicons_dark/mixed_edit.svg | 35 +++------------ .../typicons_dark/typ_arrow-maximise.svg | 24 ----------- .../typicons_dark/typ_arrow-minimise.svg | 24 ----------- .../icons/typicons_dark/typ_refresh.svg | 24 ----------- .../icons/typicons_dark/typ_th-list-grey.svg | 28 +----------- .../icons/typicons_light/mixed_edit.svg | 35 +++------------ .../typicons_light/typ_arrow-maximise.svg | 27 +----------- .../typicons_light/typ_arrow-minimise.svg | 24 ----------- .../icons/typicons_light/typ_export.svg | 43 ++++++++----------- .../icons/typicons_light/typ_refresh.svg | 27 +----------- .../icons/typicons_light/typ_th-list-grey.svg | 28 +----------- 11 files changed, 38 insertions(+), 281 deletions(-) diff --git a/novelwriter/assets/icons/typicons_dark/mixed_edit.svg b/novelwriter/assets/icons/typicons_dark/mixed_edit.svg index fac03f3e..5ac0581f 100644 --- a/novelwriter/assets/icons/typicons_dark/mixed_edit.svg +++ b/novelwriter/assets/icons/typicons_dark/mixed_edit.svg @@ -1,37 +1,15 @@ - + id="svg7536"> @@ -40,6 +18,7 @@ image/svg+xml + diff --git a/novelwriter/assets/icons/typicons_dark/typ_arrow-maximise.svg b/novelwriter/assets/icons/typicons_dark/typ_arrow-maximise.svg index a5ee7fa0..48990ef7 100644 --- a/novelwriter/assets/icons/typicons_dark/typ_arrow-maximise.svg +++ b/novelwriter/assets/icons/typicons_dark/typ_arrow-maximise.svg @@ -5,10 +5,6 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - inkscape:version="1.0 (4035a4fb49, 2020-05-01)" - sodipodi:docname="arrow-maximise.svg" id="svg7486" viewBox="0 0 24 24" height="24" @@ -28,26 +24,6 @@ - - - - + id="svg5291"> @@ -42,7 +18,7 @@ image/svg+xml - + diff --git a/novelwriter/assets/icons/typicons_light/mixed_edit.svg b/novelwriter/assets/icons/typicons_light/mixed_edit.svg index 982206ed..ded34ef2 100644 --- a/novelwriter/assets/icons/typicons_light/mixed_edit.svg +++ b/novelwriter/assets/icons/typicons_light/mixed_edit.svg @@ -1,37 +1,15 @@ - + id="svg7536"> @@ -40,6 +18,7 @@ image/svg+xml + diff --git a/novelwriter/assets/icons/typicons_light/typ_arrow-maximise.svg b/novelwriter/assets/icons/typicons_light/typ_arrow-maximise.svg index 3ef012fe..cd00423e 100644 --- a/novelwriter/assets/icons/typicons_light/typ_arrow-maximise.svg +++ b/novelwriter/assets/icons/typicons_light/typ_arrow-maximise.svg @@ -5,15 +5,11 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.2" width="24" height="24" viewBox="0 0 24 24" - id="svg7486" - sodipodi:docname="arrow-maximise.svg" - inkscape:version="1.0 (4035a4fb49, 2020-05-01)"> + id="svg7486"> @@ -28,27 +24,6 @@ - - - + id="svg1169"> + + + + image/svg+xml + + + + + + id="svg6649"> @@ -28,27 +24,6 @@ - - + id="svg5291"> @@ -42,7 +18,7 @@ image/svg+xml - + From 1664f92cc8bcb0534737b2f356714cce052e8633 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:50:21 +0100 Subject: [PATCH 3/3] Also allow custom icon themes --- docs/source/int_customise.rst | 15 +++++++++------ novelwriter/config.py | 3 ++- novelwriter/gui/theme.py | 6 ++++-- tests/test_gui/test_gui_theme.py | 1 - 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/source/int_customise.rst b/docs/source/int_customise.rst index 27b94284..07b130b4 100644 --- a/docs/source/int_customise.rst +++ b/docs/source/int_customise.rst @@ -52,14 +52,16 @@ modify it as you like. `novelwriter/assets/syntax `_. * The existing GUI themes are stored in `novelwriter/assets/themes `_. +* The existing icon themes are stored in + `novelwriter/assets/icons `_. Remember to also change the name of your theme by modifying the ``name`` setting at the top of the file, otherwise you may not be able to distinguish them in :guilabel:`Preferences`. For novelWriter to be able to locate the custom theme files, you must copy them to the :ref:`a_locations_data` location in your home or user area. There should be a folder there named -``syntax`` for syntax themes and just ``themes`` for GUI themes. These folders are created the -first time you start novelWriter. +``syntax`` for syntax themes, just ``themes`` for GUI themes, and ``icons`` for icon themes. These +folders are created the first time you start novelWriter. Once the files are copied there, they should show up in :guilabel:`Preferences` with the label you set as ``name`` inside the file. @@ -70,8 +72,8 @@ set as ``name`` inside the file. theme colour scheme. -Gustom GUI Theme ----------------- +Gustom GUI and Icons Theme +-------------------------- A GUI theme conf file consists of the follwing settings: @@ -109,8 +111,9 @@ A GUI theme conf file consists of the follwing settings: statusunsaved = 100, 100, 100 In the Main section you must at least define the ``name`` and ``icontheme`` settings. The -``icontheme`` settings should correspond to one of the internal icon themes. Either -``typicons_light`` or ``typicons_dark``. +``icontheme`` settings should correspond to one of the internal icon themes, either +``typicons_light`` or ``typicons_dark``, or to an icon theme in your custom icons directory. The +setting must match the icon theme's folder name. The Palette values correspond the the Qt enum values for QPalette::ColorRole, see the `Qt documentation `_ for more details. The diff --git a/novelwriter/config.py b/novelwriter/config.py index b6708add..e60a9444 100644 --- a/novelwriter/config.py +++ b/novelwriter/config.py @@ -461,10 +461,11 @@ class Config: self._confPath.mkdir(exist_ok=True) self._dataPath.mkdir(exist_ok=True) - # Also create the syntax and themes folders if possible + # Also create the syntax, themes and icons folders if possible if self._dataPath.is_dir(): (self._dataPath / "syntax").mkdir(exist_ok=True) (self._dataPath / "themes").mkdir(exist_ok=True) + (self._dataPath / "icons").mkdir(exist_ok=True) # Check if config file exists, and load it. If not, we save defaults if (self._confPath / nwFiles.CONF_FILE).is_file(): diff --git a/novelwriter/gui/theme.py b/novelwriter/gui/theme.py index c3516556..17e58ff4 100644 --- a/novelwriter/gui/theme.py +++ b/novelwriter/gui/theme.py @@ -507,8 +507,10 @@ class GuiIcons: self._themeMap = {} themePath = self._iconPath / iconTheme if not themePath.is_dir(): - logger.warning("No icons loaded for '%s'", iconTheme) - return False + themePath = self.mainConf.dataPath("icons") / iconTheme + if not themePath.is_dir(): + logger.warning("No icons loaded for '%s'", iconTheme) + return False themeConf = themePath / self._confName logger.info("Loading icon theme '%s'", iconTheme) diff --git a/tests/test_gui/test_gui_theme.py b/tests/test_gui/test_gui_theme.py index f5751e7b..c8133f6b 100644 --- a/tests/test_gui/test_gui_theme.py +++ b/tests/test_gui/test_gui_theme.py @@ -282,7 +282,6 @@ def testGuiTheme_Icons(qtbot, caplog, monkeypatch, nwGUI, fncPath): # Load a broken theme file iconsDir = fncPath / "icons" testIcons = iconsDir / "testicons" - iconsDir.mkdir() testIcons.mkdir() writeFile(testIcons / "icons.conf", ( "[Main]\n"