Frank

Attached is an updated patch

I am not sure how many of my previous changes you took (I am battling 
with Tortoise SVN).
I thought you took them all, but the column clicking itself (in the 
treectrl) did not seem to be included.

I have fixed the improper column clicking.  It works well enough.

Thanks,

Carl.
Index: taskcoach/taskcoachlib/gui/dialog/editor.py
===================================================================
--- taskcoach/taskcoachlib/gui/dialog/editor.py (revision 1222)
+++ taskcoach/taskcoachlib/gui/dialog/editor.py (working copy)
@@ -198,6 +198,7 @@
         self._fieldMap['subject']    = self._subjectEntry
         self._fieldMap['description']= self._descriptionEntry
         self._fieldMap['priority']   = self._prioritySpinner
+        self._fieldMap['totalPriority']   = self._prioritySpinner
 
     def containsField(self,fieldname):
         #FIXME: cz: remove when subject page is an editor page
@@ -269,6 +270,7 @@
             else:
                 recursiveEntry = (0, 0)
             datesBox.add(recursiveEntry)
+        self._fieldMap['timeLeft']= self._dueDateEntry
 
         reminderBox = widgets.BoxWithFlexGridSizer(self, label=_('Reminder'),
             cols=2)
@@ -469,10 +471,12 @@
         self._fieldMap['timeSpent']=self._budgetEntry
         self._fieldMap['totalTimeSpent']=self._budgetEntry
         self._fieldMap['totalBudget']=self._budgetEntry
-        self._fieldMap['timeLeft']=self._budgetEntry
         self._fieldMap['budgetLeft']=self._budgetEntry
+        self._fieldMap['totalBudgetLeft']=self._budgetEntry
         self._fieldMap['totalTimeLeft']=self._budgetEntry
         self._fieldMap['hourlyFee']=self._hourlyFeeEntry
+        self._fieldMap['fixedFee']=self._fixedFeeEntry
+        self._fieldMap['totalFixedFee']=self._fixedFeeEntry
         self._fieldMap['revenue']=self._hourlyFeeEntry
         self._fieldMap['totalRevenue']=self._hourlyFeeEntry
         self._defaultControl = self._budgetEntry
@@ -988,11 +992,10 @@
 class EditorWithCommand(widgets.NotebookDialog):
     def __init__(self, parent, command, *args, **kwargs):
         self._command = command
-        super(EditorWithCommand, self).__init__(parent, command.name(), 
-                                                *args, **kwargs)
-
+        bitmap=kwargs.pop('bitmap','edit') # hack due to bitmap being a 
positional arg now
+        super(EditorWithCommand, self).__init__(parent, command.name(), 
bitmap, *args, **kwargs)
         # FIXMERGE: should we call setFocusOnFirstEntry ?
-
+        
     def setFocusOnFirstEntry(self):
         firstEntry = self[0][0]._subjectEntry
         firstEntry.SetSelection(-1, -1) # Select all text
Index: taskcoach/taskcoachlib/gui/uicommand.py
===================================================================
--- taskcoach/taskcoachlib/gui/uicommand.py     (revision 1222)
+++ taskcoach/taskcoachlib/gui/uicommand.py     (working copy)
@@ -1165,8 +1165,49 @@
             menuText=taskList.editItemMenuText, 
             helpText=taskList.editItemHelpText, *args, **kwargs)
 
-    def doCommand(self, event, show=True):
-        editor = self.viewer.editTaskDialog(bitmap=self.bitmap)
+    def onCommandActivate(self, event, field=''):
+        ''' 
+        this is a menu command, so we need to check for enabled, but we also 
want to 
+        pass in an optional field.
+        '''
+        #FIXME: cz: I put this in early in the development cycle when adding 
the 'field' parameter
+        # I am not sure if it is necessary
+        if self.enabled(event):
+            self.doCommand(event, True, field)
+
+
+
+    def doCommand(self, event, show=True, field=''):
+        ''' 
+        open the task editor
+
+        If the mouse has been clicked, check to see what column it is in.
+        open the appropriate page on the edit task dialog.
+        '''
+        #
+        columnName='subject'
+        
+        if 'columnName' in dir(event):
+            columnName=event.columnName
+        #FIXME: cz: remove event.columnHeader everywhere, not used
+        try: #FIXME: cz: remove debug code
+            print 'doTaskEdit', columnName
+        except e: # AttributeError: # this is debug code.  column name and 
column header might not exist.
+            pass  #just ignore exceptions for now.
+        #   The following code will need to get executed someplace (for 
treecontroller, but 
+        #   The event should carry the field to edit if appropriate
+        #        pos = event.GetPosition()
+        #        item, flags, col = self.tree.HitTest(pos)
+        #        if item:
+        #
+        #    Page should be the page that the column that is clicked on can be 
+        #    found on.  This parameter should change to "FieldToEdit and the 
editor should
+        #    know where the field resides.
+        #    can we pass the information in the event?
+        editor = self.viewer.editTaskDialog(bitmap=self.bitmap, 
+                                            Field=columnName,
+                                            Task=0,  # This is always 
appropriate.
+                                            Page=1)  
         editor.Show(show)
 
 
Index: taskcoach/taskcoachlib/gui/viewer.py
===================================================================
--- taskcoach/taskcoachlib/gui/viewer.py        (revision 1222)
+++ taskcoach/taskcoachlib/gui/viewer.py        (working copy)
@@ -1250,10 +1250,12 @@
             self.settings, self.categories, bitmap=bitmap)
     
     def editItemDialog(self, *args, **kwargs):
+        bitmap=kwargs.pop('bitmap','edit') # hack due to bitmap being a 
positional arg now
         return dialog.editor.TaskEditor(wx.GetTopLevelParent(self),
             command.EditTaskCommand(self.list, self.curselection()),
             self.list, self.settings, self.categories,
-            bitmap=kwargs['bitmap'])
+            bitmap, **kwargs)
+        #fixme: cz: bitmap should be removed from kwargs and probably made 
into a parameter for editItemDialog 
     
     editTaskDialog = editItemDialog
     
Index: taskcoach/taskcoachlib/widgets/treectrl.py
===================================================================
--- taskcoach/taskcoachlib/widgets/treectrl.py  (revision 1222)
+++ taskcoach/taskcoachlib/widgets/treectrl.py  (working copy)
@@ -365,3 +365,23 @@
             item = self.GetNextVisible(item)
         return count
 
+    def onItemActivated(self, event):
+        ''' override TreeMixin default behavior
+            we know that there is a column, so use it.
+        '''    
+        
+        pos=self.ScreenToClient(wx.GetMousePosition())
+        item, flags, col = self.HitTest(pos)
+        if item:
+            # only get the column name if the hittest returned an item
+            # otherwise the item was activated from the menu or by 
doubleclicking
+            # on a portion of the treeview not containing a record.
+            #FIXME: cz Remove debug prints
+            print ('ItemActivated: column name %s, %s' % 
(self._getColumn(col).name(),self._getColumn(col).header() ))
+            print ('Flags: %s, Col:%s, Text: %s' % (flags, col, 
self.GetItemText(item, col)))
+            event.hitTestFlags=flags
+            #            event.column=col
+            event.columnName=self._getColumn(col).name()
+        self.editCommand(event)
+        event.Skip(False)
+

Reply via email to