I got to show a Tk/Python window in WinCVS with a
small workaround.
If the user clicks anywhere in WinCVS while the Tk
window is shown, the Window goes behind WinCVS
(thus hiding it) and then if the user do any action that
trigs a macro (showing the Admin Menu for example),
WinCVS completely hangs.
The problem, I think, is that the Tk Window is not a
Modal Dialog (or maybe I am just doing it wrong?). We
could maybe workaround this by "disabling" almost
everything to at least prevent a Script Engine-re-entry so
it doesn't hang, etc.
I think WinCVS would become much more customizable
if we could allow the use of the powerful Tk set.
Currently, in macros, the only interfaces choices are:
menu item text (and checkbox), message boxes, and a
prompt that includes a single line textbox.
Try it for yourself. Dump this TkTest.py in the
<wincvs>/Macros directory: (file also attached)
Bernard Poulin
bernard@acm.org
-----------------------cut here--------------------------
from cvsgui.Macro import *
from Tkinter import *
class GUITest(Macro):
def __init__(self):
Macro.__init__(self, "Hello World",
MACRO_SELECTION,
0, "Tk Tests")
def OnCmdUI(self, cmdui):
return
def Run(self):
# workaround to keep Tk happy
(??)
sys.argv = ("base");
root = Tk()
w = Label(root, text="Hello,
world!")
w.pack()
root.mainloop()
return
GUITest()
Tk Test Python Macro
Logged In: YES
user_id=158827
This is indeed a known bug. The Tk-window only becomes modal
as soon as you invoke cvs.Run and even then not under all
circumstances AFAICT.
FWIW, there already is a Tk-enabled macro in the package
since b11, namely my Recursive Add macro (in the Macros|CVS
submenu). I have also written one other Tk-enabled macro
which I haven't donated yet. It is available from
http://people.freenet.de/ogiesen/readme.html .
Also, if you're intending to share your Tk-enabled macros
with people who still use TCL macros, make sure you're using
the SafeTk module as shown in my macros, otherwise TCL
macros will no longer work if your macro is loaded.
Feel free to contact me directly if you have any questions
about this:
Mail: ogware@gmx.net
ICQ: 18777742
[Reclassified as Bug and changed Summary accordingly]
Logged In: YES
user_id=929505
With a recent build (b14+), it is easier to reproduce than
ever: (no need for the attached macro)
Just go: Admin macros -> Browse Repository Folders
and start clicking around.