class ZContextInfoImagesView(ZView): def __init__(self, parent): ZView.__init__(self, parent, wx.ID_ANY) self.sashPosition = 0 self._createWidgets() self._layoutWidgets() self._populateWidgets() self._bindWidgetEvents() # end __init__() def getViewId(self): return IZViewIds.IMAGES_VIEW # end getViewId() def _createWidgets(self): self.splitterWindow = ZSplitterWindow(self) self.imagesView = ZImagesView(self.splitterWindow) self.imageSummaryView = ZImageSummaryView(self.splitterWindow) self.splitterWindow.SplitHorizontally(self.imagesView, self.imageSummaryView) self.splitterWindow.SetMinimumPaneSize(100) self.splitterWindow.SetSashSize(8) self.splitterWindow.SetSashGravity(0.0) # end _createWidgets() def _layoutWidgets(self): box = wx.BoxSizer(wx.VERTICAL) box.Add(self.splitterWindow, 1, wx.EXPAND) self.SetAutoLayout(True) self.SetSizer(box) # end _layoutWidgets() def _populateWidgets(self): self._restoreSashPosition() # end _populateWidgets() def _bindWidgetEvents(self): self.Bind(ZEVT_SPLITTER_SASH_POS_CHANGED, self.onSashPosChanged, self.splitterWindow) # end _bindWidgetEvents def onSashPosChanged(self, event): self.sashPosition = self.splitterWindow.GetSashPosition() event.Skip() # end onSashPosChanged() def destroy(self): self._saveSashPosition() self.imagesView.destroy() self.imageSummaryView.destroy() # end destroy() def _saveSashPosition(self): userPrefs = getApplicationModel().getUserProfile().getPreferences() userPrefs.setUserPreference(IZBlogAppUserPrefsKeys.IMAGES_VIEW_SASH_POS, self.splitterWindow.GetSashPosition()) # end _saveSashPosition() def _restoreSashPosition(self): userPrefs = getApplicationModel().getUserProfile().getPreferences() self.sashPosition = userPrefs.getUserPreferenceInt(IZBlogAppUserPrefsKeys.IMAGES_VIEW_SASH_POS, 200) self.splitterWindow.SetSashPosition(self.sashPosition)
class ZContextInfoImagesView(ZView): def __init__(self, parent): ZView.__init__(self, parent, wx.ID_ANY) self.sashPosition = 0 self._createWidgets() self._layoutWidgets() self._populateWidgets() self._bindWidgetEvents() # end __init__() def getViewId(self): return IZViewIds.IMAGES_VIEW # end getViewId() def _createWidgets(self): self.splitterWindow = ZSplitterWindow(self) self.imagesView = ZImagesView(self.splitterWindow) self.imageSummaryView = ZImageSummaryView(self.splitterWindow) self.splitterWindow.SplitHorizontally(self.imagesView, self.imageSummaryView) self.splitterWindow.SetMinimumPaneSize(100) self.splitterWindow.SetSashSize(8) self.splitterWindow.SetSashGravity(0.0) # end _createWidgets() def _layoutWidgets(self): box = wx.BoxSizer(wx.VERTICAL) box.Add(self.splitterWindow, 1, wx.EXPAND) self.SetAutoLayout(True) self.SetSizer(box) # end _layoutWidgets() def _populateWidgets(self): self._restoreSashPosition() # end _populateWidgets() def _bindWidgetEvents(self): self.Bind(ZEVT_SPLITTER_SASH_POS_CHANGED, self.onSashPosChanged, self.splitterWindow) # end _bindWidgetEvents def onSashPosChanged(self, event): self.sashPosition = self.splitterWindow.GetSashPosition() event.Skip() # end onSashPosChanged() def destroy(self): self._saveSashPosition() self.imagesView.destroy() self.imageSummaryView.destroy() # end destroy() def _saveSashPosition(self): userPrefs = getApplicationModel().getUserProfile().getPreferences() userPrefs.setUserPreference( IZBlogAppUserPrefsKeys.IMAGES_VIEW_SASH_POS, self.splitterWindow.GetSashPosition()) # end _saveSashPosition() def _restoreSashPosition(self): userPrefs = getApplicationModel().getUserProfile().getPreferences() self.sashPosition = userPrefs.getUserPreferenceInt( IZBlogAppUserPrefsKeys.IMAGES_VIEW_SASH_POS, 200) self.splitterWindow.SetSashPosition(self.sashPosition)