[Dirssync-opendisc] Amazing foresight!
Status: Pre-Alpha
Brought to you by:
vincent_delft
|
From: Mark C. <xs...@uk...> - 2003-12-18 16:13:01
|
I don't know about you, but I have customized my own version of dirssync to suit my particular purposes. What I do is define a module called custom.py in which I define a frame f derived from DsFrame.
One of the things it does is to automatically open a sync file dependent on the machine that it is invoked from.
The other thing is does is work around a snag in the .dirsync exclusion file. What I want to happen is to ignore anything in the .svn directory, which is a source code control directory. It does this by redefining the DirFilterCallback() function in paninputs.
So DirFilterCallback() has a use after all - which is why I said that there was an amazing foresight in the original class design.
For the curious, here is the actual module:
---begin
import pickle, platform, re
from wxPython.wx import *
import dirssync
from dirssync import DsFrame
#define booleans, if necessary (pre-python 2.3)
try: True
except NameError: True, False = 1 , 0
def syncfilename():
return "%s-pen.sync" % (platform.node())
class f(DsFrame):
def __init__(self, parent, id, title):
DsFrame.__init__(self, parent, id, title)
#the stuff below here is from the inherited class
#load the sync file br default
#global listdirs
fname = syncfilename()
print fname
pickfile=open(fname,"r") # use a filename of your choice
listdirs=pickle.load(pickfile)
self.paninputs.IntoListCtrl(listdirs)
pickfile.close()
#write something in the log
self.panlog.add('My custom synchronizer')
#change the default options
self.panoptions.cb2.SetValue(False) # local to remote
self.panoptions.cb3.SetValue(False) # remote to local
self.panoptions.cb4.SetValue(True) # set one-way deletion
self.paninputs.DirFilterCallback = self.NoSvn
def NoSvn(self, list):
listout = filter(self.IsSvn, list)
return listout
def IsSvn(self, el):
r = re.compile("\\.svn")
return None == r.search(el[2],1)
class mApp(wxApp):
def OnInit(self):
frame=f(None,-1,"Custom synchronizer")
frame.Show(true)
self.SetTopWindow(frame)
return true
app=mApp(0)
app.MainLoop()
---end
And talking about documentation ... it may be worthwhile having a little think about user documentation. One obvious place to put it is in the documentation section over at Sourceforge:
http://sourceforge.net/docman/?group_id=14777
What I don't know is if the documentation can only then be viewed online at Sourceforge, or whether it is possible to "compile" and bundle the documentation in with the releases.
Another obvious place would be to put it on the home page, which would also be under CVS control.
I don't know, I'm only mooting the idea.
_____________________________________________________________
Sign up for your very own email address from UKmail.com To-day !!
|