Title: [commits] (pje) [15990] [APP] Update to latest Trellis; rules that change values no longer
Revision
15990
Author
pje
Date
2007-11-30 14:58:38 -0800 (Fri, 30 Nov 2007)

Log Message

[APP] Update to latest Trellis; rules that change values no longer
need to be @actions; and rules that send output to wx or elsewhere
should now be @observers. Calls to wx that may cause recursive
events to fire, should now be called via trellis.on_commit().

Modified Paths

Diff

Modified: branches/rearchitecture/Chandler-App/ocap/chandler/minicalendar.py (15989 => 15990)

--- branches/rearchitecture/Chandler-App/ocap/chandler/minicalendar.py	2007-11-30 22:53:03 UTC (rev 15989)
+++ branches/rearchitecture/Chandler-App/ocap/chandler/minicalendar.py	2007-11-30 22:58:38 UTC (rev 15990)
@@ -83,8 +83,11 @@
     def __init__(self, parent, application, **kw):
         minical.PyMiniCalendar.__init__(self, parent, id=-1)
         minicalendar = application.minicalendar
+        cells = trellis.Cells(minicalendar)
         app_cells = trellis.Cells(application)
         trellis.Component.__init__(self,
+                                   #months_displayed = cells['months_displayed'],
+                                   #firstVisibleDate = cells['range_start'],
                                    busy_months = minicalendar.months,
                                    active_view = app_cells['active_view'],
                                    filter = app_cells['filter'],
@@ -106,13 +109,13 @@
                   self.OnWXSelectItem)
         self.SetMinSize((0, 0))
 
-    @trellis.action
+    @trellis.observer
     def updateSelectedDate(self):
         if self.selectedDate is not None:
             # SetDate will change the visible range if necessary
-            self.SetDate(self.selectedDate)
+            self.Refresh(False)
 
-    @trellis.action
+    @trellis.observer
     def updateRangeMode(self):
         """Change the window style when view_displayed changes."""
         style = PLATFORM_BORDER
@@ -129,7 +132,7 @@
         hours = min(hours, 12)
         return float(hours) / 12
 
-    @trellis.action
+    @trellis.observer
     def updateBusyBars(self):
         for month in self.busy_months:
             for date, day in month.days.iteritems():
@@ -164,7 +167,7 @@
         return max(1, int(round(fraction_displayed)))
         
 
-    @trellis.action
+    @trellis.observer
     def refreshOnSize(self):
         self.months_displayed, self.scale, self.height
         self.Refresh(False)

Modified: branches/rearchitecture/Chandler-App/ocap/chandler/preview.py (15989 => 15990)

--- branches/rearchitecture/Chandler-App/ocap/chandler/preview.py	2007-11-30 22:53:03 UTC (rev 15989)
+++ branches/rearchitecture/Chandler-App/ocap/chandler/preview.py	2007-11-30 22:58:38 UTC (rev 15990)
@@ -130,7 +130,7 @@
     def OnSize(self, event):
         self.width, self.height = self.GetSize()
 
-    @trellis.action
+    @trellis.observer
     def refresher(self):
         self.width, self.ideal_height
         # watch cells within event_list, not just event_list
@@ -283,7 +283,7 @@
             
         return self.line_height * rows + 2*self.vMargin
 
-    @trellis.action
+    @trellis.observer
     def resize(self):
         if self.height != self.ideal_height:
             self.SetMinSize((0, self.ideal_height))

Modified: branches/rearchitecture/Chandler-App/ocap/chandler/sidebar.py (15989 => 15990)

--- branches/rearchitecture/Chandler-App/ocap/chandler/sidebar.py	2007-11-30 22:53:03 UTC (rev 15989)
+++ branches/rearchitecture/Chandler-App/ocap/chandler/sidebar.py	2007-11-30 22:58:38 UTC (rev 15990)
@@ -59,7 +59,7 @@
 class SidebarPresentation(table.TablePresentation):
     filter = trellis.value(None)
     
-    @trellis.action
+    @trellis.observer
     def print_filter(self):
         filter = self.filter
         self.View.Refresh()

Modified: branches/rearchitecture/Chandler-Debugging/ocap/debugging/py_crust.py (15989 => 15990)

--- branches/rearchitecture/Chandler-Debugging/ocap/debugging/py_crust.py	2007-11-30 22:53:03 UTC (rev 15989)
+++ branches/rearchitecture/Chandler-Debugging/ocap/debugging/py_crust.py	2007-11-30 22:58:38 UTC (rev 15990)
@@ -167,7 +167,7 @@
         cell = None
     )
     
-    @trellis.action
+    @trellis.observer
     def printCell(self):
         print self.cell
 
@@ -215,14 +215,14 @@
             top, bottom, *args, **kwargs
         )
     
-    @trellis.action
+    @trellis.rule
     def adjust_split(self):
         if not self.changing:
             bottom = self.bottom
             height = self.Size.height
             if (height > 0 and bottom is not None and 
                 bottom.height != bottom.ideal_height):
-                self.update_sash(float(height - bottom.ideal_height) / height)
+                trellis.on_commit(self.update_sash, float(height - bottom.ideal_height) / height)
 
 
 def ExampleFrame(app):

Modified: branches/rearchitecture/Chandler-Platform/ocap/wxui/table.py (15989 => 15990)

--- branches/rearchitecture/Chandler-Platform/ocap/wxui/table.py	2007-11-30 22:53:03 UTC (rev 15989)
+++ branches/rearchitecture/Chandler-Platform/ocap/wxui/table.py	2007-11-30 22:58:38 UTC (rev 15990)
@@ -123,16 +123,16 @@
         activeColumn = None,
     )
     
-    @trellis.action
+    @trellis.rule
     def switchColumn(self):
         if (self.activeColumn is not None and
             self.activeColumn.sortKey is not None):
-            self.listModel.sort_key = self.activeColumn.sortKey
+            setattr(self.listModel, 'sort_key', self.activeColumn.sortKey)
             
         self.View.SetUseColSortArrows(self.activeColumn is not None and
                                       self.activeColumn.useSortArrows)
     
-    @trellis.action
+    @trellis.observer
     def updateGrid(self):
         view = self.GetView()
         
@@ -163,11 +163,11 @@
 
         for row in view.GetSelectedRows():
             if not self.listModel[row] in self.listModel.selected:
-                view.SelectBlock(index, 0, index, 1, False)
+                trellis.on_commit(view.SelectBlock, index, 0, index, 1, False)
 
         for row, item in enumerate(self.listModel):
             if item in self.listModel.selected:
-                view.SelectBlock(row, 0, row, 1, True)
+                trellis.on_commit(view.SelectBlock, row, 0, row, 1, True)
     
     defaultRWAttribute = wxGrid.GridCellAttr()
     defaultROAttribute = wxGrid.GridCellAttr()

Modified: branches/rearchitecture/Chandler-Platform/setup.py (15989 => 15990)

--- branches/rearchitecture/Chandler-Platform/setup.py	2007-11-30 22:53:03 UTC (rev 15989)
+++ branches/rearchitecture/Chandler-Platform/setup.py	2007-11-30 22:58:38 UTC (rev 15990)
@@ -27,7 +27,7 @@
     long_description = open('README.txt').read(), # get_description(),
     install_requires=[
         'DecoratorTools>=1.6',
-        'Trellis>=0.5b2dev-r2421,==dev',
+        'Trellis>=0.6a1dev-r2436,==dev',
         'Plugins>=0.5a1dev-r2404,==dev',
         'Importing>=1.9.2'
     ],




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to