The new Plugin Functions (in openfile and savefile)
are very useful.
for the check syntax on Save:
If an error happens, the Prompt window opens. Ok with this.
But if then the file is ok, it is difficult to discern,
if it really is, because the prompt is still visible.
My thought:
Maybe a messagebox could be more clear (with the compile output
message). If the file is ok, no messagebox should appear.
Small annoying: if at the end of a python file the linebreak
is missing, compile says it is an error.
I have made several patches, and now I want to get rid of
it.
I made some plugins or scripts for this.
So what is left, and I don't want to make for for every single line
an extra script or plugin, so I ask you kindly to put
following into the core:
* drPython.py: OnSaveAll
at the begin: oldpos = self.docPosition
at the end: (before return): self.setDocumentTo(oldpos)
So the active tab is the same as before
* drPluginMenu.py in EditPlugin
alreadyopen = self.parent.GetAlreadyOpen()
try:
c = alreadyopen.index(pluginfile)
self.parent.setDocumentTo(c)
except:
if len...
(Prevent opening file a second time)
* drFindReplaceDialog.py in DoFindPrevious
if (not self.RE):
...
else:
->drScrolledMessageDialog.ShowMessage(self.parent, 'FindPrevious not possible (Regular Expressions are on)', "DrPython Find")
(I wondered several times, why it didn't do anything; because RE were on)
(this should make it clear)
* drBookMarksDialog.py
currentItem = self.datatree.AppendItem(sel, d.GetPath())
I replaced with
currentItem = self.datatree.AppendItem(sel, d.GetPath().replace("\\", "/"))
(So no mixing slashes and backslashes could happen)
One problem persist:
(I could make a plugin for it, but it's not so easy)
(for c++ editing, i only use spaces and indentation 2)
so i put in drText.py in SetupPrefsDocument at the end of the method;
and for python files for reason of compatbility with drPython
I have tab, unix lineendings and indentation 4)
This SetupPrefsDocument will be called several times,
so I cannot put this in DrText init section.
(And before:
self.SetupTabs(self.grandparent.prefs.docusetabs)
will be called, and this overwrites my tab and indentation settings)
(or to use a new plugin function for DrText init)
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
At first, I thought, i can use the new plugin
functions for simplifying Keyboard macros
with a plugin function for DrText.
But the plugin, which overwrites it, should have been loaded before the first call of Drtext (in the init section).
So I updatet Keyboard macros to be aligned
with DrPython 3.8.3
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Messagebox idea is a good one, it is in 3.8.4, as are the other patches all the way to the bookmarks dialog one.
The eol bit I have noticed too. My reasoning is if compile catches it, it should be noticed. (I have on occasion had something not run becasue of this, but only on windows.).
Now onto the loading bit:
When loading Plugins, I could have set them to load at the start of DrFrame.__init__, but then .txtDocument and such would not yet exist for manipulation in plugins. Placing them at the end causes problems as well (as you have noticed).
Perhaps for the future, I could classify plugins that are loaded before anything else.
The problem is, even if this does happen, when the DrText class is referenced, it will still be the built in version.
Perhaps I need to figure out some clever way of telling the interpreter to always load a specific version of a file first. (So import DrText will always yield the desired version). Of course this raises concerns about plugins conflicting with each other.
One possible solution is to add more PluginFunctions (eg for SetupPrefsDocument), however I am concerned about the performance cost of a host of these.
Also, such a method only allows plugin developers to add additional functionality, not "instead of" functionality.
So that leaves me with the question, which would be best?
1. Leave things as they are, with limited access to core elements of drpy.
2. Add more plugin functions, performance costs notwithstanding (or figure out a clever way to minimize them).
3. Allow for completely overriding classes/modules.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Dan, thank you very much for accepting my patches.
* The one patch with load plugins from index:
Oops, a bug in my patch
if there is no default.idx, drpython will not start, because of an uncatched exception.
File "c:\temp\drpython-3.8.4\drPluginMenu.py", line 204, in __init__
self.setupMenu()
File "c:\temp\drpython-3.8.4\drPluginMenu.py", line 248, in setupMenu
if not os.path.splitext(os.path.split (index)[1])[0] in pluginstoload:
UnboundLocalError: local variable 'pluginstoload' referenced before assignment
drPluginMenu => function def setupMenu(self):
the whole function after try: belongs to the try block, and the except at the end of the function,
should solve the problem.
* The class browser isn't working anymore (there is only a little white square at the left upper corner):
File "C:\Eigene Dateien\python\drpython\drpython.py", line 2410, in OnToggleSourceBrowser
self.currentpage.OnSize(None)
File "c:\Eigene Dateien\python\drpython\drNotebook.py", line 718, in OnSize
self.documentpanel.OnSize(None)
File "c:\Eigene Dateien\python\drpython\drNotebook.py", line 467, in OnSize
lefttotal = self.Sum(self.leftsizes)
File "c:\Eigene Dateien\python\drpython\drNotebook.py", line 566, in Sum
return reduce(operator.add, seq)
NameError: global name 'operator' is not defined
I think, "import operator" is missing.
* Small thing: View=> Goto... is GotoLine and Goto opens the "under menu".
The Menu identifier should be exchanged.
* The last statement in DrPluginDialog OnbtnAdd in the except branch should also be: self.SetNotInIndex()
(it is now only in onbtnremove)
>One possible solution is to add more PluginFunctions (eg for SetupPrefsDocument),
>however I am concerned about the performance cost of a host of these.
>Also, such a method only allows plugin developers to add additional functionality,
>not "instead of" functionality.
Anyway, I think, this is the simples solution; performance cost, no, I don't think.
it only looks in the before collected plugin-function list, if there is any
pluginfunction.
I too can imagine, that these
before-after and the distortion of namespace does the whole project
more harm than good.
If you could offer a plugin function at the end of SetupPrefsDocument,
it will fulfill my need of tabs/indent/lineendings for specific fileextensions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried split panel and got this traceback:
Traceback (most recent call last):
File "C:\Eigene Dateien\python\drpython\drpython.py", line 3276, in ViewInPanel
txtDocument = drSplitTextPanel(target, self, self.txtDocumentArray[self.docPosition],
self.viewinpaneltarget, i)
File "C:\Eigene Dateien\python\drpython\drNotebook.py", line 155, in __init__
self.txtDoc = DrText(self, docid, grandparent, SplitView=sv)
NameError: global name 'DrText' is not defined -
"from drText import *" solved the problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some comments:
an drpython-developer-forum, 10.01.2005:
* Scrolling throug the styles, I got following traceback:
Traceback (most recent call last):
File "C:\Eigene Dateien\python\drpython\drStyleDialog.py", line 772, in OnSelectStyle
self.fgPanel.SetValue(self.foreground)
File "C:\Eigene Dateien\python\drpython\drStyleDialog.py", line 143, in SetValue
r = int(colorstring[1:3], 16)
ValueError: invalid literal for int():
* Would it be possible to add "9" in the size array?
Line 248, 462, 760 in drStyleDialog?
otherwise, this value will always be cleared, it editing styles (And I use Courier New size 9)
* to insert color values (rgb) would be easier, if one can insert them directly (without the sliders)
* is it possbile to use here two different styles (txtDocumentStyleArray) for STRING and STRINGEOL?:
stc.StyleSetSpec(wx.stc.STC_P_STRING, frame.prefs.txtDocumentStyleArray[11])
stc.StyleSetSpec(wx.stc.STC_P_STRINGEOL, frame.prefs.txtDocumentStyleArray[11])
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
>I could not reproduce the error in the style dialog.
Solved:
There was an error in the preferences.dat.
<doc.style.caret>fore:#000000,back:#A7FFFF</doc.style.caret>
but this should be
<doc.style.caret>#000000,back:#A7FFFF</doc.style.caret>
(don't know, why)
corrected this and now it is working.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Dan,
The new Plugin Functions (in openfile and savefile)
are very useful.
for the check syntax on Save:
If an error happens, the Prompt window opens. Ok with this.
But if then the file is ok, it is difficult to discern,
if it really is, because the prompt is still visible.
My thought:
Maybe a messagebox could be more clear (with the compile output
message). If the file is ok, no messagebox should appear.
Small annoying: if at the end of a python file the linebreak
is missing, compile says it is an error.
I have made several patches, and now I want to get rid of
it.
I made some plugins or scripts for this.
So what is left, and I don't want to make for for every single line
an extra script or plugin, so I ask you kindly to put
following into the core:
* drPython.py: OnSaveAll
at the begin: oldpos = self.docPosition
at the end: (before return): self.setDocumentTo(oldpos)
So the active tab is the same as before
* drPluginMenu.py in EditPlugin
alreadyopen = self.parent.GetAlreadyOpen()
try:
c = alreadyopen.index(pluginfile)
self.parent.setDocumentTo(c)
except:
if len...
(Prevent opening file a second time)
* drFindReplaceDialog.py in DoFindPrevious
if (not self.RE):
...
else:
->drScrolledMessageDialog.ShowMessage(self.parent, 'FindPrevious not possible (Regular Expressions are on)', "DrPython Find")
(I wondered several times, why it didn't do anything; because RE were on)
(this should make it clear)
* drBookMarksDialog.py
currentItem = self.datatree.AppendItem(sel, d.GetPath())
I replaced with
currentItem = self.datatree.AppendItem(sel, d.GetPath().replace("\\", "/"))
(So no mixing slashes and backslashes could happen)
One problem persist:
(I could make a plugin for it, but it's not so easy)
(for c++ editing, i only use spaces and indentation 2)
so i put in drText.py in SetupPrefsDocument at the end of the method;
and for python files for reason of compatbility with drPython
I have tab, unix lineendings and indentation 4)
if self.currentlanguage != 0: # cpp
self.SetUseTabs(0)
#self.SetTabWidth(2)
self.SetEOLMode(wx.stc.STC_EOL_CRLF)
self.addchar = "\t".expandtabs(2)
self.tabwidth = 2
This SetupPrefsDocument will be called several times,
so I cannot put this in DrText init section.
(And before:
self.SetupTabs(self.grandparent.prefs.docusetabs)
will be called, and this overwrites my tab and indentation settings)
(or to use a new plugin function for DrText init)
Cheers
At first, I thought, i can use the new plugin
functions for simplifying Keyboard macros
with a plugin function for DrText.
But the plugin, which overwrites it, should have been loaded before the first call of Drtext (in the init section).
So I updatet Keyboard macros to be aligned
with DrPython 3.8.3
Hey:
The Messagebox idea is a good one, it is in 3.8.4, as are the other patches all the way to the bookmarks dialog one.
The eol bit I have noticed too. My reasoning is if compile catches it, it should be noticed. (I have on occasion had something not run becasue of this, but only on windows.).
Now onto the loading bit:
When loading Plugins, I could have set them to load at the start of DrFrame.__init__, but then .txtDocument and such would not yet exist for manipulation in plugins. Placing them at the end causes problems as well (as you have noticed).
Perhaps for the future, I could classify plugins that are loaded before anything else.
The problem is, even if this does happen, when the DrText class is referenced, it will still be the built in version.
Perhaps I need to figure out some clever way of telling the interpreter to always load a specific version of a file first. (So import DrText will always yield the desired version). Of course this raises concerns about plugins conflicting with each other.
One possible solution is to add more PluginFunctions (eg for SetupPrefsDocument), however I am concerned about the performance cost of a host of these.
Also, such a method only allows plugin developers to add additional functionality, not "instead of" functionality.
So that leaves me with the question, which would be best?
1. Leave things as they are, with limited access to core elements of drpy.
2. Add more plugin functions, performance costs notwithstanding (or figure out a clever way to minimize them).
3. Allow for completely overriding classes/modules.
Hi Dan, thank you very much for accepting my patches.
* The one patch with load plugins from index:
Oops, a bug in my patch
if there is no default.idx, drpython will not start, because of an uncatched exception.
File "c:\temp\drpython-3.8.4\drPluginMenu.py", line 204, in __init__
self.setupMenu()
File "c:\temp\drpython-3.8.4\drPluginMenu.py", line 248, in setupMenu
if not os.path.splitext(os.path.split (index)[1])[0] in pluginstoload:
UnboundLocalError: local variable 'pluginstoload' referenced before assignment
drPluginMenu => function def setupMenu(self):
the whole function after try: belongs to the try block, and the except at the end of the function,
should solve the problem.
* The class browser isn't working anymore (there is only a little white square at the left upper corner):
File "C:\Eigene Dateien\python\drpython\drpython.py", line 2410, in OnToggleSourceBrowser
self.currentpage.OnSize(None)
File "c:\Eigene Dateien\python\drpython\drNotebook.py", line 718, in OnSize
self.documentpanel.OnSize(None)
File "c:\Eigene Dateien\python\drpython\drNotebook.py", line 467, in OnSize
lefttotal = self.Sum(self.leftsizes)
File "c:\Eigene Dateien\python\drpython\drNotebook.py", line 566, in Sum
return reduce(operator.add, seq)
NameError: global name 'operator' is not defined
I think, "import operator" is missing.
* Small thing: View=> Goto... is GotoLine and Goto opens the "under menu".
The Menu identifier should be exchanged.
* The last statement in DrPluginDialog OnbtnAdd in the except branch should also be: self.SetNotInIndex()
(it is now only in onbtnremove)
>One possible solution is to add more PluginFunctions (eg for SetupPrefsDocument),
>however I am concerned about the performance cost of a host of these.
>Also, such a method only allows plugin developers to add additional functionality,
>not "instead of" functionality.
Anyway, I think, this is the simples solution; performance cost, no, I don't think.
it only looks in the before collected plugin-function list, if there is any
pluginfunction.
I too can imagine, that these
before-after and the distortion of namespace does the whole project
more harm than good.
If you could offer a plugin function at the end of SetupPrefsDocument,
it will fulfill my need of tabs/indent/lineendings for specific fileextensions.
I tried split panel and got this traceback:
Traceback (most recent call last):
File "C:\Eigene Dateien\python\drpython\drpython.py", line 3276, in ViewInPanel
txtDocument = drSplitTextPanel(target, self, self.txtDocumentArray[self.docPosition],
self.viewinpaneltarget, i)
File "C:\Eigene Dateien\python\drpython\drNotebook.py", line 155, in __init__
self.txtDoc = DrText(self, docid, grandparent, SplitView=sv)
NameError: global name 'DrText' is not defined -
"from drText import *" solved the problem.
Some comments:
an drpython-developer-forum, 10.01.2005:
* Scrolling throug the styles, I got following traceback:
Traceback (most recent call last):
File "C:\Eigene Dateien\python\drpython\drStyleDialog.py", line 772, in OnSelectStyle
self.fgPanel.SetValue(self.foreground)
File "C:\Eigene Dateien\python\drpython\drStyleDialog.py", line 143, in SetValue
r = int(colorstring[1:3], 16)
ValueError: invalid literal for int():
* Would it be possible to add "9" in the size array?
Line 248, 462, 760 in drStyleDialog?
otherwise, this value will always be cleared, it editing styles (And I use Courier New size 9)
* to insert color values (rgb) would be easier, if one can insert them directly (without the sliders)
* is it possbile to use here two different styles (txtDocumentStyleArray) for STRING and STRINGEOL?:
stc.StyleSetSpec(wx.stc.STC_P_STRING, frame.prefs.txtDocumentStyleArray[11])
stc.StyleSetSpec(wx.stc.STC_P_STRINGEOL, frame.prefs.txtDocumentStyleArray[11])
I could not reproduce the error in the style dialog.
I will look into the style bits.
>I could not reproduce the error in the style dialog.
Solved:
There was an error in the preferences.dat.
<doc.style.caret>fore:#000000,back:#A7FFFF</doc.style.caret>
but this should be
<doc.style.caret>#000000,back:#A7FFFF</doc.style.caret>
(don't know, why)
corrected this and now it is working.