Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#13 Deleting the job in edit mode will prevent new jobs from add

open
nobody
None
5
2005-02-15
2005-02-15
Anonymous
No

Version: 2.1rc2

Deleting the job in the edit mode will prevent new jobs
from being added properly.

If you have only one job in the list, you edit it, and
you decide to delete. You would get the following error
message. No jobs can ce added anymore.
---------Error message-------
C:/Program Files/Python24/pythonw.exe -u "C:/Program
Files/Python24/Dirssync/2_1rc2/run.pyw"
Traceback (most recent call last):
File "C:\Program
Files\Python24\Dirssync\2_1rc2\dirssync_gui.py", line
566, in OnAddJob

self.jobslist[x]=dirssync.Job(dirlocal,dirremote,options)
IndexError: list assignment index out of range
-----------

If you have more than one jobs in the list, you edit
one of them and decide to delete it. When you hit the
Add button, the job of the same index as the the one
being edited+deleted before will be overwritten by the
new one.

A quick fix can be done by adding the following line to
line 646 (OnDeleteJob() of class MyFrame()) of
dirssync_gui.py:
self.jobedited=None

The OnDeleteJob() would look like:
def OnDeleteJob(self,event):
if self.jobedited!=None:
dlgW = wxMessageDialog(self, "You will
looze the current Job card edited. Do you want to
continue ?", "Warning", wxYES | wxNO | wxICON_EXCLAMATION)
if dlgW.ShowModal()!=wxID_YES:
dlgW.Destroy()
return
dlgW.Destroy()
selection=self.LCJobs.currentItemSelected
self.LCJobs.DeleteItem(selection)
self.jobslist.pop(int(selection))
self.jobedited=None ###Add this line
if self.LCJobs.GetItemCount()==0:
self.BNext.Enable(0)

Thanks,
hlihn@brocade.com

Discussion