def _createWidgets(self): self.draftCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.PublishAsDraft")) #$NON-NLS-1$ self.overridePubTimeCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.OverridePubTime")) #$NON-NLS-1$ self.dateCtrl = ZDateTimeChooser(self, None) self.dateCtrl.Enable(False) self.thumbnailsOnlyCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.UploadOnlyTNs")) #$NON-NLS-1$ self.forceUploadCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.ReUpload")) #$NON-NLS-1$ self.lightboxCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.AddLightbox")) #$NON-NLS-1$ self.poweredByZoundryCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.AddPoweredBy")) #$NON-NLS-1$ self.wpPostSlugLabel = wx.StaticText( self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPostSlug")) #$NON-NLS-1$ self.wpPostSlugTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size=wx.Size(200, -1), style=wx.TE_PROCESS_ENTER) self.wpPasswordLabel = wx.StaticText( self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPostPassword")) #$NON-NLS-1$ self.wpPasswordTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size=wx.Size(200, -1), style=wx.TE_PROCESS_ENTER) self.wpPubStatusLabel = wx.StaticText( self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPublishStatus")) #$NON-NLS-1$ choices = self._getWpPublishChoices() self.wpPubStatusCombo = wx.ComboBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPublishStatus_published"), style=wx.CB_READONLY, choices=choices) #$NON-NLS-1$
def _createWidgets(self): self.draftCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.PublishAsDraft")) #$NON-NLS-1$ self.overridePubTimeCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.OverridePubTime")) #$NON-NLS-1$ self.dateCtrl = ZDateTimeChooser(self, None) self.dateCtrl.Enable(False) self.thumbnailsOnlyCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.UploadOnlyTNs")) #$NON-NLS-1$ self.forceUploadCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.ReUpload")) #$NON-NLS-1$ self.lightboxCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.AddLightbox")) #$NON-NLS-1$ self.poweredByZoundryCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.AddPoweredBy")) #$NON-NLS-1$ self.wpPostSlugLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPostSlug")) #$NON-NLS-1$ self.wpPostSlugTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size = wx.Size(200, -1), style=wx.TE_PROCESS_ENTER ) self.wpPasswordLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPostPassword")) #$NON-NLS-1$ self.wpPasswordTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size = wx.Size(200, -1), style=wx.TE_PROCESS_ENTER ) self.wpPubStatusLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPublishStatus")) #$NON-NLS-1$ choices = self._getWpPublishChoices() self.wpPubStatusCombo = wx.ComboBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPublishStatus_published"), style = wx.CB_READONLY, choices = choices) #$NON-NLS-1$
class ZPubMetaDataView(ZTransparentPanel): WP_PUBLISHED = 0 WP_PENDING = 1 WP_DRAFT = 2 WP_PRIVATE = 3 def __init__(self, parent): ZTransparentPanel.__init__(self, parent, wx.ID_ANY) self.wpPublishStatusValue = ZPubMetaDataView.WP_PUBLISHED self._createWidgets() self._layoutWidgets() self._bindWidgetEvents() # end __init__() def _createWidgets(self): self.draftCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.PublishAsDraft")) #$NON-NLS-1$ self.overridePubTimeCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.OverridePubTime")) #$NON-NLS-1$ self.dateCtrl = ZDateTimeChooser(self, None) self.dateCtrl.Enable(False) self.thumbnailsOnlyCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.UploadOnlyTNs")) #$NON-NLS-1$ self.forceUploadCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.ReUpload")) #$NON-NLS-1$ self.lightboxCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.AddLightbox")) #$NON-NLS-1$ self.poweredByZoundryCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.AddPoweredBy")) #$NON-NLS-1$ self.wpPostSlugLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPostSlug")) #$NON-NLS-1$ self.wpPostSlugTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size = wx.Size(200, -1), style=wx.TE_PROCESS_ENTER ) self.wpPasswordLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPostPassword")) #$NON-NLS-1$ self.wpPasswordTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size = wx.Size(200, -1), style=wx.TE_PROCESS_ENTER ) self.wpPubStatusLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPublishStatus")) #$NON-NLS-1$ choices = self._getWpPublishChoices() self.wpPubStatusCombo = wx.ComboBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPublishStatus_published"), style = wx.CB_READONLY, choices = choices) #$NON-NLS-1$ # end _createWidgets() def _getWpPublishChoices(self): return [ _extstr(u"pubdatawidgets.WpPublishStatus_published"), #$NON-NLS-1$ _extstr(u"pubdatawidgets.WpPublishStatus_pending"), #$NON-NLS-1$ _extstr(u"pubdatawidgets.WpPublishStatus_unpublished"), #$NON-NLS-1$ _extstr(u"pubdatawidgets.WpPublishStatus_private")#$NON-NLS-1$ ] # end _getWpPublishChoices() def _layoutWidgets(self): vbox = wx.BoxSizer(wx.VERTICAL) # 'Publishing' section (draft, date/time override) sbSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.Publishing")), wx.VERTICAL) #$NON-NLS-1$ sbSizer.Add(self.draftCB, 0, wx.ALL, 3) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.overridePubTimeCB, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) hbox.Add(self.dateCtrl, 0, wx.LEFT, 3) sbSizer.AddSizer(hbox, 0, wx.ALL, 3) vbox.AddSizer(sbSizer, 0, wx.ALL, 3) # 'Image Upload' section (thumbnails only, force upload) sbSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.ImageUpload")), wx.VERTICAL) #$NON-NLS-1$ sbSizer.Add(self.thumbnailsOnlyCB, 0, wx.EXPAND | wx.ALL, 3) sbSizer.Add(self.forceUploadCB, 0, wx.EXPAND | wx.ALL, 3) sbSizer.Add(self.lightboxCB, 0, wx.EXPAND | wx.ALL, 3) vbox.AddSizer(sbSizer, 0, wx.ALL, 3) # 'Other' section (powered by Zoundry) sbSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.OtherOptions")), wx.VERTICAL) #$NON-NLS-1$ sbSizer.Add(self.poweredByZoundryCB, 0, wx.EXPAND | wx.ALL, 3) vbox.AddSizer(sbSizer, 0, wx.ALL, 3) # 'WP' section sbSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpOptions")), wx.VERTICAL) #$NON-NLS-1$ hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.wpPubStatusLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) hbox.Add(self.wpPubStatusCombo, 1, wx.LEFT, 3) sbSizer.AddSizer(hbox, 0, wx.ALL, 3) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.wpPostSlugLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) hbox.Add(self.wpPostSlugTextCtrl, 1, wx.LEFT, 3) sbSizer.AddSizer(hbox, 0, wx.ALL, 3) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.wpPasswordLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) hbox.Add(self.wpPasswordTextCtrl, 1, wx.LEFT, 3) sbSizer.AddSizer(hbox, 0, wx.ALL, 3) vbox.AddSizer(sbSizer, 0,wx.ALL, 3) self.SetSizer(vbox) self.SetAutoLayout(True) self.Layout() # end _layoutWidgets() def _bindWidgetEvents(self): self.Bind(wx.EVT_CHECKBOX, self.onOverridePubTime, self.overridePubTimeCB) self.Bind(wx.EVT_CHECKBOX, self.onDraftMode, self.draftCB) self.Bind(wx.EVT_COMBOBOX, self.onWpPubStatusCombo, self.wpPubStatusCombo) # end _bindWidgetEvents() def onWpPubStatusCombo(self, event): idx = self.wpPubStatusCombo.GetSelection() self.wpPublishStatusValue = idx self.draftCB.SetValue(idx == ZPubMetaDataView.WP_DRAFT) self.Layout() event.Skip() # end onWpPubStatusCombo() def onDraftMode(self, event): if not event.IsChecked() and self.wpPublishStatusValue == ZPubMetaDataView.WP_DRAFT: self.wpPublishStatusValue = ZPubMetaDataView.WP_PUBLISHED self.wpPubStatusCombo.SetSelection(self.wpPublishStatusValue) elif event.IsChecked() and self.wpPublishStatusValue != ZPubMetaDataView.WP_DRAFT: self.wpPublishStatusValue = ZPubMetaDataView.WP_DRAFT self.wpPubStatusCombo.SetSelection(self.wpPublishStatusValue) self.Layout() event.Skip() # end onDraftMode( def onOverridePubTime(self, event): self.dateCtrl.Enable(event.IsChecked()) self.Layout() event.Skip() # end onOverridePubTime() def enableDraftCheckbox(self, enabled): self.draftCB.Enable(enabled) # end enableDraftCheckbox() def setPubMetaData(self, pubMetaData): # Updates the UI controls based on the data in pubMetaData self.draftCB.SetValue(pubMetaData.isPublishAsDraft()) pubTime = pubMetaData.getPublishTime() if pubTime is not None: self.overridePubTimeCB.SetValue(True) self.dateCtrl.Enable(True) self.dateCtrl.setDateTime(pubTime) self.thumbnailsOnlyCB.SetValue(pubMetaData.isUploadTNsOnly()) self.forceUploadCB.SetValue(pubMetaData.isForceReUploadImages()) self.lightboxCB.SetValue(pubMetaData.isAddLightbox()) self.poweredByZoundryCB.SetValue(pubMetaData.isAddPoweredBy()) # WP custom data slug = getSafeString( getCustomWPMetaDataAttribute(pubMetaData, u"wp_slug") ) #$NON-NLS-1$ self.wpPostSlugTextCtrl.SetValue(slug) # WP password s = getSafeString( getCustomWPMetaDataAttribute(pubMetaData, u"wp_password") ) #$NON-NLS-1$ self.wpPasswordTextCtrl.SetValue(s) # WP pub status self.wpPublishStatusValue = ZPubMetaDataView.WP_PUBLISHED s = getSafeString( getCustomWPMetaDataAttribute(pubMetaData, u"post_status") ) #$NON-NLS-1$ if s == u"pending": #$NON-NLS-1$ self.wpPublishStatusValue = ZPubMetaDataView.WP_PENDING elif s == u"private": #$NON-NLS-1$ self.wpPublishStatusValue = ZPubMetaDataView.WP_PRIVATE elif s == u"draft" or pubMetaData.isPublishAsDraft(): #$NON-NLS-1$ self.wpPublishStatusValue = ZPubMetaDataView.WP_DRAFT self.wpPubStatusCombo.SetSelection(self.wpPublishStatusValue) # end setPubMetaData def updatePubMetaData(self, pubMetaData): # Flushes the UI data to the pubMetaData object. pubMetaData.setAddPoweredBy(self.poweredByZoundryCB.IsChecked()) pubMetaData.setForceReUploadImages(self.forceUploadCB.IsChecked()) pubMetaData.setAddLightbox(self.lightboxCB.IsChecked()) pubMetaData.setPublishAsDraft(self.draftCB.IsChecked()) pubMetaData.setPublishTime(None) if self.overridePubTimeCB.IsChecked(): pubTime = self.dateCtrl.getDateTime() pubMetaData.setPublishTime(pubTime) pubMetaData.setUploadTNsOnly(self.thumbnailsOnlyCB.IsChecked()) # WP custom data slug = getNoneString(self.wpPostSlugTextCtrl.GetValue() ) setCustomWPMetaDataAttribute(pubMetaData, u"wp_slug", slug) #$NON-NLS-1$ # password pw = getNoneString(self.wpPasswordTextCtrl.GetValue() ) setCustomWPMetaDataAttribute(pubMetaData, u"wp_password", pw) #$NON-NLS-1$ pubstatus = None if self.wpPublishStatusValue == ZPubMetaDataView.WP_PUBLISHED: pubstatus = u"publish" #$NON-NLS-1$ elif self.wpPublishStatusValue == ZPubMetaDataView.WP_DRAFT: pubstatus = u"draft" #$NON-NLS-1$ elif self.wpPublishStatusValue == ZPubMetaDataView.WP_PENDING: pubstatus = u"pending" #$NON-NLS-1$ elif self.wpPublishStatusValue == ZPubMetaDataView.WP_PRIVATE: pubstatus = u"private" #$NON-NLS-1$ if pubstatus: setCustomWPMetaDataAttribute(pubMetaData, u"post_status", pubstatus) #$NON-NLS-1$
class ZPubMetaDataView(ZTransparentPanel): WP_PUBLISHED = 0 WP_PENDING = 1 WP_DRAFT = 2 WP_PRIVATE = 3 def __init__(self, parent): ZTransparentPanel.__init__(self, parent, wx.ID_ANY) self.wpPublishStatusValue = ZPubMetaDataView.WP_PUBLISHED self._createWidgets() self._layoutWidgets() self._bindWidgetEvents() # end __init__() def _createWidgets(self): self.draftCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.PublishAsDraft")) #$NON-NLS-1$ self.overridePubTimeCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.OverridePubTime")) #$NON-NLS-1$ self.dateCtrl = ZDateTimeChooser(self, None) self.dateCtrl.Enable(False) self.thumbnailsOnlyCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.UploadOnlyTNs")) #$NON-NLS-1$ self.forceUploadCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.ReUpload")) #$NON-NLS-1$ self.lightboxCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.AddLightbox")) #$NON-NLS-1$ self.poweredByZoundryCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.AddPoweredBy")) #$NON-NLS-1$ self.wpPostSlugLabel = wx.StaticText( self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPostSlug")) #$NON-NLS-1$ self.wpPostSlugTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size=wx.Size(200, -1), style=wx.TE_PROCESS_ENTER) self.wpPasswordLabel = wx.StaticText( self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPostPassword")) #$NON-NLS-1$ self.wpPasswordTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size=wx.Size(200, -1), style=wx.TE_PROCESS_ENTER) self.wpPubStatusLabel = wx.StaticText( self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPublishStatus")) #$NON-NLS-1$ choices = self._getWpPublishChoices() self.wpPubStatusCombo = wx.ComboBox( self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpPublishStatus_published"), style=wx.CB_READONLY, choices=choices) #$NON-NLS-1$ # end _createWidgets() def _getWpPublishChoices(self): return [ _extstr(u"pubdatawidgets.WpPublishStatus_published"), #$NON-NLS-1$ _extstr(u"pubdatawidgets.WpPublishStatus_pending"), #$NON-NLS-1$ _extstr( u"pubdatawidgets.WpPublishStatus_unpublished"), #$NON-NLS-1$ _extstr(u"pubdatawidgets.WpPublishStatus_private") #$NON-NLS-1$ ] # end _getWpPublishChoices() def _layoutWidgets(self): vbox = wx.BoxSizer(wx.VERTICAL) # 'Publishing' section (draft, date/time override) sbSizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.Publishing")), wx.VERTICAL) #$NON-NLS-1$ sbSizer.Add(self.draftCB, 0, wx.ALL, 3) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.overridePubTimeCB, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) hbox.Add(self.dateCtrl, 0, wx.LEFT, 3) sbSizer.AddSizer(hbox, 0, wx.ALL, 3) vbox.AddSizer(sbSizer, 0, wx.ALL, 3) # 'Image Upload' section (thumbnails only, force upload) sbSizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.ImageUpload")), wx.VERTICAL) #$NON-NLS-1$ sbSizer.Add(self.thumbnailsOnlyCB, 0, wx.EXPAND | wx.ALL, 3) sbSizer.Add(self.forceUploadCB, 0, wx.EXPAND | wx.ALL, 3) sbSizer.Add(self.lightboxCB, 0, wx.EXPAND | wx.ALL, 3) vbox.AddSizer(sbSizer, 0, wx.ALL, 3) # 'Other' section (powered by Zoundry) sbSizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.OtherOptions")), wx.VERTICAL) #$NON-NLS-1$ sbSizer.Add(self.poweredByZoundryCB, 0, wx.EXPAND | wx.ALL, 3) vbox.AddSizer(sbSizer, 0, wx.ALL, 3) # 'WP' section sbSizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, _extstr(u"pubdatawidgets.WpOptions")), wx.VERTICAL) #$NON-NLS-1$ hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.wpPubStatusLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) hbox.Add(self.wpPubStatusCombo, 1, wx.LEFT, 3) sbSizer.AddSizer(hbox, 0, wx.ALL, 3) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.wpPostSlugLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) hbox.Add(self.wpPostSlugTextCtrl, 1, wx.LEFT, 3) sbSizer.AddSizer(hbox, 0, wx.ALL, 3) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.wpPasswordLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3) hbox.Add(self.wpPasswordTextCtrl, 1, wx.LEFT, 3) sbSizer.AddSizer(hbox, 0, wx.ALL, 3) vbox.AddSizer(sbSizer, 0, wx.ALL, 3) self.SetSizer(vbox) self.SetAutoLayout(True) self.Layout() # end _layoutWidgets() def _bindWidgetEvents(self): self.Bind(wx.EVT_CHECKBOX, self.onOverridePubTime, self.overridePubTimeCB) self.Bind(wx.EVT_CHECKBOX, self.onDraftMode, self.draftCB) self.Bind(wx.EVT_COMBOBOX, self.onWpPubStatusCombo, self.wpPubStatusCombo) # end _bindWidgetEvents() def onWpPubStatusCombo(self, event): idx = self.wpPubStatusCombo.GetSelection() self.wpPublishStatusValue = idx self.draftCB.SetValue(idx == ZPubMetaDataView.WP_DRAFT) self.Layout() event.Skip() # end onWpPubStatusCombo() def onDraftMode(self, event): if not event.IsChecked( ) and self.wpPublishStatusValue == ZPubMetaDataView.WP_DRAFT: self.wpPublishStatusValue = ZPubMetaDataView.WP_PUBLISHED self.wpPubStatusCombo.SetSelection(self.wpPublishStatusValue) elif event.IsChecked( ) and self.wpPublishStatusValue != ZPubMetaDataView.WP_DRAFT: self.wpPublishStatusValue = ZPubMetaDataView.WP_DRAFT self.wpPubStatusCombo.SetSelection(self.wpPublishStatusValue) self.Layout() event.Skip() # end onDraftMode( def onOverridePubTime(self, event): self.dateCtrl.Enable(event.IsChecked()) self.Layout() event.Skip() # end onOverridePubTime() def enableDraftCheckbox(self, enabled): self.draftCB.Enable(enabled) # end enableDraftCheckbox() def setPubMetaData(self, pubMetaData): # Updates the UI controls based on the data in pubMetaData self.draftCB.SetValue(pubMetaData.isPublishAsDraft()) pubTime = pubMetaData.getPublishTime() if pubTime is not None: self.overridePubTimeCB.SetValue(True) self.dateCtrl.Enable(True) self.dateCtrl.setDateTime(pubTime) self.thumbnailsOnlyCB.SetValue(pubMetaData.isUploadTNsOnly()) self.forceUploadCB.SetValue(pubMetaData.isForceReUploadImages()) self.lightboxCB.SetValue(pubMetaData.isAddLightbox()) self.poweredByZoundryCB.SetValue(pubMetaData.isAddPoweredBy()) # WP custom data slug = getSafeString( getCustomWPMetaDataAttribute(pubMetaData, u"wp_slug")) #$NON-NLS-1$ self.wpPostSlugTextCtrl.SetValue(slug) # WP password s = getSafeString( getCustomWPMetaDataAttribute(pubMetaData, u"wp_password")) #$NON-NLS-1$ self.wpPasswordTextCtrl.SetValue(s) # WP pub status self.wpPublishStatusValue = ZPubMetaDataView.WP_PUBLISHED s = getSafeString( getCustomWPMetaDataAttribute(pubMetaData, u"post_status")) #$NON-NLS-1$ if s == u"pending": #$NON-NLS-1$ self.wpPublishStatusValue = ZPubMetaDataView.WP_PENDING elif s == u"private": #$NON-NLS-1$ self.wpPublishStatusValue = ZPubMetaDataView.WP_PRIVATE elif s == u"draft" or pubMetaData.isPublishAsDraft(): #$NON-NLS-1$ self.wpPublishStatusValue = ZPubMetaDataView.WP_DRAFT self.wpPubStatusCombo.SetSelection(self.wpPublishStatusValue) # end setPubMetaData def updatePubMetaData(self, pubMetaData): # Flushes the UI data to the pubMetaData object. pubMetaData.setAddPoweredBy(self.poweredByZoundryCB.IsChecked()) pubMetaData.setForceReUploadImages(self.forceUploadCB.IsChecked()) pubMetaData.setAddLightbox(self.lightboxCB.IsChecked()) pubMetaData.setPublishAsDraft(self.draftCB.IsChecked()) pubMetaData.setPublishTime(None) if self.overridePubTimeCB.IsChecked(): pubTime = self.dateCtrl.getDateTime() pubMetaData.setPublishTime(pubTime) pubMetaData.setUploadTNsOnly(self.thumbnailsOnlyCB.IsChecked()) # WP custom data slug = getNoneString(self.wpPostSlugTextCtrl.GetValue()) setCustomWPMetaDataAttribute(pubMetaData, u"wp_slug", slug) #$NON-NLS-1$ # password pw = getNoneString(self.wpPasswordTextCtrl.GetValue()) setCustomWPMetaDataAttribute(pubMetaData, u"wp_password", pw) #$NON-NLS-1$ pubstatus = None if self.wpPublishStatusValue == ZPubMetaDataView.WP_PUBLISHED: pubstatus = u"publish" #$NON-NLS-1$ elif self.wpPublishStatusValue == ZPubMetaDataView.WP_DRAFT: pubstatus = u"draft" #$NON-NLS-1$ elif self.wpPublishStatusValue == ZPubMetaDataView.WP_PENDING: pubstatus = u"pending" #$NON-NLS-1$ elif self.wpPublishStatusValue == ZPubMetaDataView.WP_PRIVATE: pubstatus = u"private" #$NON-NLS-1$ if pubstatus: setCustomWPMetaDataAttribute(pubMetaData, u"post_status", pubstatus) #$NON-NLS-1$