I'm effectively done, but will release this after work tomorrow. I still want to test it a bit, I have one last bug I want to hunt down (if it still exists).
Basically, the major changes are how the plugin list is downloaded (from the website: so new versions of plugins will be automatically found), and a lot in preferences. Optional Drag and Drop for Text is in (at the same time as Files), and I've added the replace table (using regular expressions) for linux, so windows shortcuts work perfectly on linux. Also some dialog fixing, a lot of work in the preferences dialog, and some nice tweaks (like the sourcebrowser has an auto refresh on save option).
So that's where that is. Mostly, this is a lot of under the hood work that the user won't immediately see, but a lot of the code has been cleaned up.
Cheers,
Dan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sounds great. Nice work. I was wondering what you thought about a syntax check on save? I'm not trying to compare here but SPE ( Stani's Python Editor ) does this and it sounds simple but it is a rather nice feature for me personally. What do you think?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you could make a script or rather a plugin, to call
a syntax check before and then DrFrame.OnSave.
That shouldn't be to complicated, I suppose.
Do you mean the "tabnanny" module?
In PythonCard (Codeeditor) there is such a check,
and this could give you an idea, how to implement
this in DrPython.
Franz
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
An optional syntax check on save is probably a very good idea. I'll have to see about the specific code for doing it, but that would belong in the core (syntax check is a drscheme feature as well).
In terms of Franz's question, yes, that is possible.
You can check to see if a plugin has been loaded by either trying to load it in a try block, or even better:
if 'SyntaxCheckPlugin' in DrFrame.LoadedPlugins:
if SyntaxCheckPlugin.CheckCurrentFile():
DrFrame.OnSave(None)
In any case, this will find its way into the core, but such code is possible for other plugins
(especially if you want one plugin to work with a different plugin).
Dan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Tabnanny is exactly what I was meaning. The plugin I thought about but I'm really new to python and programming in general so I attempt some ideas but they seem to fail. It teaches me a lot though. I appreciate that you guys are so quick to respond and keep such an open mind.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
self.userhomedirectory = self.homedirectory
to insert:
if self.homedirectory.endswith ('/'):
self.homedirectory = self.homedirectory[:-1]
Reason: my homedir is c:/ and the homedir is always
displayed as c://drpython.
This can make troubles also in the txtDocumentarray.
(The entry would be C://drpython/plugins/xy.py)
If I want to open xy.py, it opens a second time, because C://drpython/plugins/xy.py do not match
C:/drpython/plugins/xy.py
Franz
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Franz, All of your bugfixes mentioned here are in 3.7.6, which should be done soonish (I want to do the syntax check bit, the paste & format, and the extra whitespace option. I may clean up the drtext/drprompt code too)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I added the check syntax bit. I did not highlight the current line (or mark it), although I do go to that line.
I also did not do the remove trailing spaces bit. That should make its way into the core as well, although I am not sure where.
I think it should be its own option:
Remove Trailing Whitespace on Save.
Then I could add it to the Whitespace submenu.
What thoughts?
I am reluctant to use clean up indentation on save, since that can sometimes have unintended consequences in how a program works. (Mixed indentation can be a very nasty thing in python, or completely benign).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
>I am reluctant to use clean up indentation on save, ...
I agree.
Remove Trailing Whitespace isn't so important.
It doesn't do any harm; they are only annoying,
if one edit a file with a lot of such things, because
autoindent and cursor movement don't work as expected.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm effectively done, but will release this after work tomorrow. I still want to test it a bit, I have one last bug I want to hunt down (if it still exists).
Basically, the major changes are how the plugin list is downloaded (from the website: so new versions of plugins will be automatically found), and a lot in preferences. Optional Drag and Drop for Text is in (at the same time as Files), and I've added the replace table (using regular expressions) for linux, so windows shortcuts work perfectly on linux. Also some dialog fixing, a lot of work in the preferences dialog, and some nice tweaks (like the sourcebrowser has an auto refresh on save option).
So that's where that is. Mostly, this is a lot of under the hood work that the user won't immediately see, but a lot of the code has been cleaned up.
Cheers,
Dan
Sounds great. Nice work. I was wondering what you thought about a syntax check on save? I'm not trying to compare here but SPE ( Stani's Python Editor ) does this and it sounds simple but it is a rather nice feature for me personally. What do you think?
Hi RunLevelZero,
you could make a script or rather a plugin, to call
a syntax check before and then DrFrame.OnSave.
That shouldn't be to complicated, I suppose.
Do you mean the "tabnanny" module?
In PythonCard (Codeeditor) there is such a check,
and this could give you an idea, how to implement
this in DrPython.
Franz
BTW: (Question to Dan):
Is this possible anyhow?:
Plugin: "SyntaxCheck"
For Example SyntaxCheck.CheckCurrentFile Function.
then in drScript:
#drscript
if <SyntaxCheckPlugin>.CheckCurrentFile():
->DrFrame.OnSave(None)
If not, could such an interface integrated into the core?
I think, it is an overkill for this two Lines to make
an extra PluginFunction.
Franz
An optional syntax check on save is probably a very good idea. I'll have to see about the specific code for doing it, but that would belong in the core (syntax check is a drscheme feature as well).
In terms of Franz's question, yes, that is possible.
You can check to see if a plugin has been loaded by either trying to load it in a try block, or even better:
if 'SyntaxCheckPlugin' in DrFrame.LoadedPlugins:
if SyntaxCheckPlugin.CheckCurrentFile():
DrFrame.OnSave(None)
In any case, this will find its way into the core, but such code is possible for other plugins
(especially if you want one plugin to work with a different plugin).
Dan
Tabnanny is exactly what I was meaning. The plugin I thought about but I'm really new to python and programming in general so I attempt some ideas but they seem to fail. It teaches me a lot though. I appreciate that you guys are so quick to respond and keep such an open mind.
RunLevelZero: youre welcome
Dan:
1) thanks for explanation
I found another solution:
GetPluginFunction(function)
for f in DrFrame.PluginAction:
if f.func_name = function
f (None)
CallPluginFunction(function)
2) for the SyntaxCheck:
could you restrict this only for .py or .pyw file
if a problem orccurs:
jump to and mark the offending line with color
3) OnSave: it could be also a check for trim trailing spaces
(option) bei save, line endings mixed (auto-correct), tab-spaces mixed (auto-correct)
I think, it would be better in DrPython.py
after:
self.userhomedirectory = self.homedirectory
to insert:
if self.homedirectory.endswith ('/'):
self.homedirectory = self.homedirectory[:-1]
Reason: my homedir is c:/ and the homedir is always
displayed as c://drpython.
This can make troubles also in the txtDocumentarray.
(The entry would be C://drpython/plugins/xy.py)
If I want to open xy.py, it opens a second time, because C://drpython/plugins/xy.py do not match
C:/drpython/plugins/xy.py
Franz
Franz, All of your bugfixes mentioned here are in 3.7.6, which should be done soonish (I want to do the syntax check bit, the paste & format, and the extra whitespace option. I may clean up the drtext/drprompt code too)
I added the check syntax bit. I did not highlight the current line (or mark it), although I do go to that line.
I also did not do the remove trailing spaces bit. That should make its way into the core as well, although I am not sure where.
I think it should be its own option:
Remove Trailing Whitespace on Save.
Then I could add it to the Whitespace submenu.
What thoughts?
I am reluctant to use clean up indentation on save, since that can sometimes have unintended consequences in how a program works. (Mixed indentation can be a very nasty thing in python, or completely benign).
>I am reluctant to use clean up indentation on save, ...
I agree.
Remove Trailing Whitespace isn't so important.
It doesn't do any harm; they are only annoying,
if one edit a file with a lot of such things, because
autoindent and cursor movement don't work as expected.