/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/tableview.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/tableview.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1066 by frank, Tue May 27 14:18:05 2003 UTC revision 1068 by bh, Tue May 27 15:02:37 2003 UTC
# Line 19  from Thuban.Model.table import FIELDTYPE Line 19  from Thuban.Model.table import FIELDTYPE
19       FIELDTYPE_STRING, table_to_dbf, table_to_csv       FIELDTYPE_STRING, table_to_dbf, table_to_csv
20  import view  import view
21  from dialogs import NonModalNonParentDialog  from dialogs import NonModalNonParentDialog
22  from messages import SHAPES_SELECTED  
23    from messages import SHAPES_SELECTED, SESSION_REPLACED
24    from Thuban.Model.messages import TABLE_REMOVED
25    
26  wx_value_type_map = {FIELDTYPE_INT: wxGRID_VALUE_NUMBER,  wx_value_type_map = {FIELDTYPE_INT: wxGRID_VALUE_NUMBER,
27                       FIELDTYPE_DOUBLE: wxGRID_VALUE_FLOAT,                       FIELDTYPE_DOUBLE: wxGRID_VALUE_FLOAT,
# Line 244  class TableFrame(NonModalNonParentDialog Line 246  class TableFrame(NonModalNonParentDialog
246          NonModalNonParentDialog.__init__(self, parent, name, title)          NonModalNonParentDialog.__init__(self, parent, name, title)
247          self.table = table          self.table = table
248          self.grid = self.make_grid(self.table)          self.grid = self.make_grid(self.table)
249            self.app = self.parent.application
250            self.app.Subscribe(SESSION_REPLACED, self.close_on_session_replaced)
251            self.session = self.app.Session()
252            self.session.Subscribe(TABLE_REMOVED, self.close_on_table_removed)
253    
254      def make_grid(self, table):      def make_grid(self, table):
255          """Return the table grid to use in the frame.          """Return the table grid to use in the frame.
# Line 253  class TableFrame(NonModalNonParentDialog Line 259  class TableFrame(NonModalNonParentDialog
259          """          """
260          return TableGrid(self, table)          return TableGrid(self, table)
261    
262        def OnClose(self, event):
263            self.app.Unsubscribe(SESSION_REPLACED, self.close_on_session_replaced)
264            self.session.Unsubscribe(TABLE_REMOVED, self.close_on_table_removed)
265            NonModalNonParentDialog.OnClose(self, event)
266    
267        def close_on_session_replaced(self, *args):
268            """Subscriber for the SESSION_REPLACED messages.
269    
270            The table frame is tied to a session so close the window when
271            the session changes.
272            """
273            self.Close()
274    
275        def close_on_table_removed(self, table):
276            """Subscriber for the TABLE_REMOVED messages.
277    
278            The table frame is tied to a particular table so close the
279            window when the table is removed.
280            """
281            if table is self.table:
282                self.Close()
283    
284    
285  ID_QUERY = 4001  ID_QUERY = 4001
286  ID_EXPORT = 4002  ID_EXPORT = 4002

Legend:
Removed from v.1066  
changed lines
  Added in v.1068

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26