Config Files Need Updating, Too
-
@PeterJones said in Config Files Need Updating, Too:
I have updated the script to hardcode the double-quotes for xml declaration/prolog.
Thank you for the fix, works as expected.
However, you might want to put in an issue at XML Tools …
You are right, I will do that. [EDIT] Done [/EDIT]
@Lycan-Thrope @PeterJones
I use Notepad++ v8.6.9 (64 Bit), PythonScript v3.0.18 and XML Tools v3.1.1.13@Snabel42
I’m not sure, but it seems like the engine setting you mentioned above only affects the formatting during pretty-printing. However, I use QuickXML. -
@Snabel42 ,
Apparently mine is QuickXML. I didn’t set anything, so it looks like it was preset for me. -
@dinkumoil said in Config Files Need Updating, Too:
I use Notepad++ v8.6.9 (64 Bit), PythonScript v3.0.18 and XML Tools v3.1.1.13
That would explain the difference. I can’t remember exactly what the problem was or why I went back to 2.7 for the PythonScript plugin, but I just did…it might have been an early version where there were problems and I just stayed with the tried and true, at the time.
-
@Lycan-Thrope said at various times:
Hmm, I have both installed. 2.7 and 3.10.
and
I went back to 2.7 for the PythonScript plugin
The way you’ve phrased things in this conversation, you seem to have mentally blurred the lines between the plugin version and the version of Python that the plugin uses.
All that matters to the plugin is which version of the PythonScript plugin you use, and which
python###.dll
the plugin provides. It doesn’t matter which python.exe you might have installed elsewhere on your computer, whether they are Python 2.7 or Python 3.10 or anything else (and, in fact, the plugin ignores other installations unless you have checkmarked the☑ Prefer installed Python libraries
plugin option; and if you have that option checked, the installed version must match the 3.xx that PythonScript was compiled against).- PythonScript plugin v2.0.0.0 uses Python 2.7.
- There is no plugin v2.7.
- PythonScript plugin v3.0.xx uses Python 3.yy.
- The plugin hasn’t gotten to v3.10 yet
- It’s currently on PythonScript v3.0.18 using Python 3.12.3
- you might want to give PythonScript v3.0.18 a try, because it seems pretty stable
Both the plugin version and the python version are available in Plugins > PythonScript > About and printed to the console when you first open Plugins > PythonScript > Show Console
- PythonScript plugin v2.0.0.0 uses Python 2.7.
-
Hello Peter,
many thanks for the script.Two comments:
a) Themes with commented LexerTypes cause an exception when sorting.
Not really tested, but you could think about something like
def sort_key(child): child_name = child.get('name') return (False, '') if child_name is None else (child_name == 'searchResult', child_name) elThemeLexerStyles[:] = sorted(elThemeLexerStyles, key=sort_key)
b) Themes without top-level comments receive the comments from the previous theme. For example, I have a theme called
mytheme.xml
that now contains the copyright comments frommossylawn.xml
. -
Thanks for those catches. v1.03 is now available at the permalink, and should fix both of those issues
-
@PeterJones ,
The first is what mine shows.
PythonScript plugin v2.0.0.0 uses Python 2.7.
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] Copyright (c) 2001-2020 Python Software Foundation. All Rights Reserved.
I have Python27.dll in the C:\Program Files\Notepad++\plugins\PythonScript - directory.
And, I didn’t have the Prefer option checked, in the Options menu.
Just for confirmation. -
-
v1.06 is available from the permalink:
- v1.05 (2024-Sep-05): Add URLs to source code, so you remember where to get an updated copy. (was not announced, since it was not a critical feature/bugfix upgrade)
- v1.06 (2024-Sep-14): IMPROVEMENT = error handling for
<installed>\themes\
permissions- The most common error is that you don’t have write permissions for the default themes, which are installed in the installation directory instead of your AppData or other config directory.
- Users have been confused when it doesn’t complete because of write permissions, because I forgot that not everyone has PythonScript set to show the Console if there’s an error, and that error isn’t intuitive to the general audience even if they look in the Console.
- I now trap that error, and I’ve added a MessageBox to inform you of the error, letting you know that if you re-run Notepad++ As Admin, then it should work.
- Some users have found that when they run As Admin, PythonScript no longer sees their user scripts from the AppData hierarchy. If that’s the case, just save another copy of the script in the Machine Scripts section while you’re running As Admin.
- Even if you get the write error on the
<installed>\themes
, your AppData or other config-directory stylers and themes and langs.xml should all be properly updated. (If you use Windows Explorer, you should be able to see the last-modified time on the AppData or other config-directory files has been updated after running the script.)
-
v1.07 is available from the permalink:
- fix global styles
- copy global-styles colors from
stylers.model.xml
tostylers.xml
(similar to what’s already done onstylers.xml
’s lexer-styles) - when updating/adding global styles in either
stylers.xml
orthemes\*.xml
, make sure global-styles don’t have extra attributes that confuse the StyleConfigurator interface
- copy global-styles colors from
running v1.07 will clean up the Global Styles attributes to match the
stylers.model.xml
, even if you’ve run a previous version of the script - fix global styles
-
@PeterJones, I used version 1.07 of the script and the copyright information on top got removed from the theme files.
They were also unmodified, straight from the install directories, version Portable v8.7.1
-
Apparently the
xml.etree
library behaves differently between Python 2.7 and 3.12 (used by PS2 and PS3 respectively).I really wish PS3 would move out of alpha and release into Plugins Admin, so that we could just stick with PythonScript 3 for sharing scripts in the forum, and not have to contend with all the headaches of keeping scripts compatible with two major versions of Python, and all the library differences that come with that.
(it also would’ve been nice if Don hadn’t allowed theme authors to submit themes with XML that have invalid top-level comments, which the XML parsing engines don’t like because it’s not valid XML)
v1.08 is available from the permalink, fixing the handling of the invalid XML in PythonScript 2.
However, I highly recommend making the switch to PythonScript 3, despite it claiming to be alpha, unless you are using a lot of ANSI characterset files rather than real unicode-based encodings. I don’t know how much longer I’ll support PythonScript 2 for this script.