def _deleteMultiPublishedPost(self, parent, zblogDocument, blogInfos, blog): blogs = [] for blogInfo in blogInfos: b = getBlogFromBlogInfo(blogInfo) blogs.append(b) (rBool, alsoDeleteLocal, blogsToDeleteFrom) = ZShowConfirmDeletePostFromMultipleBlogsDialog( parent, zblogDocument, blog, blogs) if rBool: if not ZPublisherUiValidator().validateBlogs( parent, blogsToDeleteFrom): return if alsoDeleteLocal and not blogsToDeleteFrom: docStore = getApplicationModel().getService( IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID) docStore.removeDocument(zblogDocument.getId()) else: task = ZDeletePostBackgroundTask() task.initialize(blogsToDeleteFrom, zblogDocument, alsoDeleteLocal) title = _extstr( u"publisherutil.DeletingOnlinePost") #$NON-NLS-1$ desc = _extstr(u"publisherutil.DeletingPostFromBlogs") % ( zblogDocument.getTitle(), len(blogsToDeleteFrom) ) #$NON-NLS-1$ self._addBackgroundTask(task, parent, title, desc, None)
def _createNonHeaderWidgets(self): self.staticBox = wx.StaticBox(self, wx.ID_ANY, _extstr(u"accountblogs.BlogList")) #$NON-NLS-1$ self.blogListProvider = ZBlogCheckboxListContentProvider() self.blogListControl = ZCheckBoxListViewWithButtons(self.blogListProvider, self) self.blogListControl.SetSizeHints(-1, 150) self.refreshButton = wx.Button(self, wx.ID_ANY, _extstr(u"synchronizeaccountdialog.RefreshBlogList")) #$NON-NLS-1$ self.animateControl = ZProgressLabelCtrl(self)
def _createImportMenuModel(self): menuModel = ZMenuModel() zbwId = menuModel.addMenuItemWithAction(_extstr(u"manager.FromZBW"), 0, ZImportFromZBWAction(self, self.model), None) #$NON-NLS-1$ menuModel.setMenuItemBitmap(zbwId, getResourceRegistry().getBitmap(u"images/common/zbw/BlogWriter.ico")) #$NON-NLS-1$ wlwId = menuModel.addMenuItemWithAction(_extstr(u"manager.FromWLW"), 0, ZImportFromWLWAction(self, self.model), None) #$NON-NLS-1$ menuModel.setMenuItemBitmap(wlwId, getResourceRegistry().getBitmap(u"images/common/wlw/LiveWriter.png")) #$NON-NLS-1$ return menuModel
def _createTreeButtons(self, parent): self.addAccountButton = wx.Button(parent, wx.ID_ANY, _extstr(u"accountprefsdialog.AddAccount")) # $NON-NLS-1$ self.removeAccountButton = wx.Button( parent, wx.ID_ANY, _extstr(u"accountprefsdialog.RemoveAccount") ) # $NON-NLS-1$ self.removeAccountButton.Enable(False) return [self.addAccountButton, self.removeAccountButton]
def _doRun(self): service = getApplicationModel().getService( IZBlogAppServiceIDs.PRODUCTS_SERVICE_ID) userPrefs = getApplicationModel().getUserProfile().getPreferences() zoundryId = userPrefs.getUserPreference( IZBlogAppUserPrefsKeys.ZOUNDRY_ID, None) if not zoundryId: zoundryId = u"*****@*****.**" #$NON-NLS-1$ self.logger.debug( u"Converting link %s using zoundry id %s." % (unicode(self.url), unicode(zoundryId))) #$NON-NLS-1$ self._fireWorkDoneEvent( 1, _extstr( u"blogeditoractions.Invoking_Zoundry_Service")) #$NON-NLS-1$ newUrl = service.convertProductLink(self.url, zoundryId) if newUrl: self.logger.debug(u"Link successfully converted to %s" % unicode(newUrl)) #$NON-NLS-1$ self._fireWorkDoneEvent( 1, _extstr(u"blogeditoractions.SuccessfullyConvertedLink" )) #$NON-NLS-1$ if not self.isCancelled(): self.zoundryProductUrl = newUrl else: raise ZException(_extstr( u"blogeditoractions.FailedToConvertLink")) #$NON-NLS-1$
def _createRavenInfoPage(self): self.infoPanel = wx.Panel(self.notebook, wx.ID_ANY) self.infoPanel.SetBackgroundColour(wx.WHITE) self.aboutBmp = getResourceRegistry().getBitmap( u"images/about/about.png") #$NON-NLS-1$ self.aboutImage = ZStaticBitmap(self.infoPanel, self.aboutBmp) ver = version.ZVersion() verDate = ZSchemaDateTime(ver.getBuildDate()) self.versionLabelLabel = wx.StaticText( self.infoPanel, wx.ID_ANY, u"%s: " % _extstr(u"splash.Version")) #$NON-NLS-1$ #$NON-NLS-2$ self.versionLabelLabel.SetFont(getDefaultFontBold()) self.versionLabel = wx.StaticText(self.infoPanel, wx.ID_ANY, ver.getFullVersionString()) self.dateLabelLabel = wx.StaticText( self.infoPanel, wx.ID_ANY, u"%s: " % _extstr(u"splash.BuiltOn")) #$NON-NLS-1$ #$NON-NLS-2$ self.dateLabelLabel.SetFont(getDefaultFontBold()) self.dateLabel = wx.StaticText(self.infoPanel, wx.ID_ANY, verDate.toString(localTime=True)) return self.infoPanel
def _createWidgets(self): self.panel = wx.Panel(self, wx.ID_ANY) self.splashPanel = self._createSplashPanel(self.panel) self.staticLine = wx.StaticLine(self.panel) self.labelOne = wx.StaticText( self.panel, wx.ID_ANY, _extstr(u"splash.OverallProgress")) #$NON-NLS-1$ self.progressOne = wx.Gauge(self.panel, wx.ID_ANY, 100, size=(-1, 16), style=wx.GA_HORIZONTAL | wx.GA_SMOOTH) self.labelTwo = wx.StaticText( self.panel, wx.ID_ANY, _extstr(u"splash.CurrentProgress")) #$NON-NLS-1$ self.progressTwo = wx.Gauge(self.panel, wx.ID_ANY, 100, size=(-1, 16), style=wx.GA_HORIZONTAL | wx.GA_SMOOTH) box = wx.BoxSizer(wx.VERTICAL) box.Add(self.splashPanel, 0, wx.EXPAND) box.Add(self.staticLine, 0, wx.EXPAND) box.Add(self.labelOne, 0, wx.EXPAND | wx.ALL, 3) box.Add(self.progressOne, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 5) box.Add(self.labelTwo, 0, wx.EXPAND | wx.ALL, 3) box.Add(self.progressTwo, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 5) self.panel.SetAutoLayout(True) self.panel.SetSizer(box)
def doCommand(self): # if published, then delete online doc. if self.zblogDocument.isPublished(): self._notifyBegin(3) self._notifyActivity( _extstr(u"blogcommands.DeletingPostFromBlog") % self._getBlog().getName(), 1, True) #$NON-NLS-1$ if self._deleteOnlineEntry(): if not self.zblogDocument.isPublished(): self._notifyActivity( _extstr(u"blogcommands.DeletingLocalCopy"), 1, True) #$NON-NLS-1$ self._deleteLocalEntry() else: self._notifyActivity( _extstr(u"blogcommands.FailedToDeleteOnlinePost"), 1, True) #$NON-NLS-1$ else: self._notifyBegin(2) self._notifyActivity(_extstr(u"blogcommands.DeletingLocalCopy"), 1, True) #$NON-NLS-1$ self._deleteLocalEntry() self._notifyActivity(_extstr(u"blogcommands.PostDeleted"), 1, True) #$NON-NLS-1$ self._notifyEnd()
def runAction(self, actionContext): #@UnusedVariable try: dialog = ZImportZBWProfileDialog(self.manager, self.model) dialog.setProfileName( _extstr(u"importactions.ImportedZBWProfile")) #$NON-NLS-1$ dialog.setJoeyProfilePath(self._detectZBWProfilePath()) defaultProfilePath = self.manager._createProfilePath( u"ImportedProfileZBW") #$NON-NLS-1$ if not os.path.exists(defaultProfilePath): dialog.setProfilePath(defaultProfilePath) dialog.CentreOnParent() if dialog.ShowModal() == wx.ID_OK: profileInfo = dialog.getProfileInfo() joeyProfilePath = dialog.getPathToJoeyProfile() importer = ZBlogWriterProfileImporter( joeyProfilePath, profileInfo[1], self.manager.systemProfile) if ZShowProgressDialog( self.manager, _extstr(u"manager.ImportingZBW1XProfile"), importer) == wx.ID_OK: #$NON-NLS-1$ self.model.createProfile(profileInfo) self.manager.profilesListView.refresh() self.manager.profilesListView.Select( self.manager._getProfileIndex(profileInfo[0]), True) else: # Cancelled - remove any files we may have created. fileutil.deleteDirectory(profileInfo[1], False) dialog.Destroy() except Exception, e: ZShowExceptionMessage(self.manager, e)
def _createWindowWidgets(self, parent): self.headerPanel = self._createHeaderPanel(parent) self.headerStaticLine = wx.StaticLine(parent, wx.ID_ANY) self.splitterWindow = ZSplitterWindow(parent) self.splitterWindow.SetSizeHints(700, 600) self.topPanel = ZTransparentPanel(self.splitterWindow, wx.ID_ANY) self.topStaticBox = wx.StaticBox(self.topPanel, wx.ID_ANY, _extstr(u"templatemanager.Templates")) #$NON-NLS-1$ provider = ZTemplateListProvider(self.model) self.templateList = ZListViewEx(provider, self.topPanel) self.addButton = wx.Button(self.topPanel, wx.ID_ANY, _extstr(u"templatemanager.Add")) #$NON-NLS-1$ self.removeButton = wx.Button(self.topPanel, wx.ID_ANY, _extstr(u"templatemanager.Remove")) #$NON-NLS-1$ self.removeButton.Enable(False) self.preview = ZHTMLViewControl(self.splitterWindow, wx.ID_ANY, style = wx.NO_FULL_REPAINT_ON_RESIZE | wx.SIMPLE_BORDER) self.splitterWindow.SetSashSize(10) self.splitterWindow.SplitHorizontally(self.topPanel, self.preview, 150) self.splitterWindow.SetMinimumPaneSize(100) self.statusBar = self._createStatusBar() self.SetStatusBar(self.statusBar)
def _run(self): try: # First, load the plugins self.listener.rasStart(NUM_STARTUP_TASKS) pluginRegistry = ZPluginRegistry( self.applicationModel.getSystemProfile(), self.applicationModel.getUserProfile()) pluginRegistry.loadPlugins(self) self.applicationModel.setPluginRegistry(pluginRegistry) self.applicationModel.setActionRegistry(ZActionRegistry()) registerBlogAppActions(self.applicationModel.getActionRegistry()) # Next, create and start the engine engine = ZEngine(self.applicationModel) self.applicationModel.setEngine(engine) engine.start(self) self.applicationModel.setLogger( engine.getService(IZAppServiceIDs.LOGGER_SERVICE_ID)) # hook up logger with auth manager ZAuthenticationManager().setLogger( engine.getService(IZAppServiceIDs.LOGGER_SERVICE_ID)) except ZException, ze: ze.printStackTrace() self.startupErrors.append( _extstr(u"startup.ErrorDuringStartupMsg") % ze.getMessage()) #$NON-NLS-1$ self.logBuff.write( _extstr(u"startup.ErrorDuringStartupMsg") % ze.getStackTrace()) #$NON-NLS-1$
def runAction(self, actionContext): # @UnusedVariable try: dialog = ZImportZBWProfileDialog(self.manager, self.model) dialog.setProfileName(_extstr(u"importactions.ImportedZBWProfile")) # $NON-NLS-1$ dialog.setJoeyProfilePath(self._detectZBWProfilePath()) defaultProfilePath = self.manager._createProfilePath(u"ImportedProfileZBW") # $NON-NLS-1$ if not os.path.exists(defaultProfilePath): dialog.setProfilePath(defaultProfilePath) dialog.CentreOnParent() if dialog.ShowModal() == wx.ID_OK: profileInfo = dialog.getProfileInfo() joeyProfilePath = dialog.getPathToJoeyProfile() importer = ZBlogWriterProfileImporter(joeyProfilePath, profileInfo[1], self.manager.systemProfile) if ( ZShowProgressDialog(self.manager, _extstr(u"manager.ImportingZBW1XProfile"), importer) == wx.ID_OK ): # $NON-NLS-1$ self.model.createProfile(profileInfo) self.manager.profilesListView.refresh() self.manager.profilesListView.Select(self.manager._getProfileIndex(profileInfo[0]), True) else: # Cancelled - remove any files we may have created. fileutil.deleteDirectory(profileInfo[1], False) dialog.Destroy() except Exception, e: ZShowExceptionMessage(self.manager, e)
def _doImportFromWLW(self, context): if ZShowYesNoMessage(self.manager, _extstr(u"importactions.WLWDetectedMessage"), _extstr(u"importactions.WLWDetectedTitle") ): #$NON-NLS-2$ #$NON-NLS-1$ action = ZImportFromWLWAction(self.manager, self.model) action.runAction(context)
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$ ]
def buildModel(self): resourceReg = getResourceRegistry() # Image align imageAlignMenuModel = ZImageAlignMenuModelBuilder().createImageAlignMenuModel() toolId = self.addDropDownItemWithAction(_extstr(u"blogeditortoolbarmodel.Align"), 10, ZBlogPostImageAlignDropDownAction(imageAlignMenuModel)) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.Align_Image")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/image_align_left.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/image_align_left_disabled.png")) #$NON-NLS-1$ # Image border imageBorderMenuModel = ZImageBorderMenuModelBuilder().createImageBorderMenuModel() toolId = self.addDropDownItemWithAction(_extstr(u"blogeditortoolbarmodel.Border"), 20, ZBlogPostImageBorderDropDownAction(imageBorderMenuModel)) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.Image_border")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/image_border.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/image_border_disabled.png")) #$NON-NLS-1$ # Image thumbnail options tnMenuModel = ZImageThumbnailMenuModelBuilder().createImageThumbnailMenuModel() toolId = self.addDropDownItemWithAction(_extstr(u"blogeditortoolbarmodel.Thumbnail"), 30, ZBlogPostCreateThumbnailImageDropDownAction( tnMenuModel )) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.Create_Thumbnail")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/image_thumbnail.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/image_thumbnail_disabled.png")) #$NON-NLS-1$ self.addSeparator(35) # Format Html toolId = self.addDropDownItemWithAction(_extstr(u"blogeditortoolbarmodel.HtmlBlockTags"), 41, ZBlogPostFormatHtmlDropDownAction( ZFormatHtmlMenuModelBuilder(), True )) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.HtmlBlockTagsDescription")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_heading_1.png")) #$NON-NLS-1$ #self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/insert_html_disabled.png")) #$NON-NLS-1$ toolId = self.addDropDownItemWithAction(_extstr(u"blogeditortoolbarmodel.HtmlTags"), 42, ZBlogPostFormatHtmlDropDownAction( ZFormatHtmlMenuModelBuilder(), False )) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.HtmlTagsDescription")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/insert_html.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/insert_html_disabled.png")) #$NON-NLS-1$ self.addSeparator(45)
def createWidgets(self): self.staticBox = wx.StaticBox(self, wx.ID_ANY, _extstr(u"affiliatelinksprefpage.Affiliate_Links")) #$NON-NLS-1$ self.affiliateLinksCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"affiliatelinksprefpage.DontTouchLinks")) #$NON-NLS-1$ descPart1 = _extstr(u"affiliatelinksprefpage.AffiliateLinksDesc1") #$NON-NLS-1$ descPart2 = _extstr(u"affiliatelinksprefpage.AffiliateLinksDesc2") #$NON-NLS-1$ descPart3 = _extstr(u"affiliatelinksprefpage.AffiliateLinksDesc3") #$NON-NLS-1$ self.descriptionLabel = wx.StaticText(self, wx.ID_ANY, u"\n%s\n\n%s\n\n%s" % (descPart1, descPart2, descPart3)) #$NON-NLS-1$
def buildModel(self): resourceReg = getResourceRegistry() # Font toolId = self.addItemWithAction(_extstr(u"blogeditortoolbarmodel.Font"), 10, ZBlogPostFontSettingsAction()) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.Font_Settings")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_font.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_font_disabled.png")) #$NON-NLS-1$ self.addSeparator(15) # Bold, Italic, Underline, Strike toolId = self.addToggleItemWithAction(_extstr(u"blogeditortoolbarmodel.Bold"), 20, ZBlogRichTextFormatAction(IZRichTextEditControl.ZCAPABILITY_BOLD) ) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.Bold")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_bold.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_bold_disabled.png")) #$NON-NLS-1$ toolId = self.addToggleItemWithAction(_extstr(u"blogeditortoolbarmodel.Italic"), 25, ZBlogRichTextFormatAction(IZRichTextEditControl.ZCAPABILITY_ITALIC) ) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.Italic")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_italic.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_italic_disabled.png")) #$NON-NLS-1$ toolId = self.addToggleItemWithAction(_extstr(u"blogeditortoolbarmodel.Underline"), 30, ZBlogRichTextFormatAction(IZRichTextEditControl.ZCAPABILITY_UNDERLINE) ) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.Underline")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_underline.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_underline_disabled.png")) #$NON-NLS-1$ toolId = self.addToggleItemWithAction(_extstr(u"blogeditortoolbarmodel.Strikethrough"), 35, ZBlogRichTextFormatAction(IZRichTextEditControl.ZCAPABILITY_STRIKETHRU) ) #$NON-NLS-1$ self.setToolDescription(toolId, _extstr(u"blogeditortoolbarmodel.Strikethrough")) #$NON-NLS-1$ self.addToolBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_strikethrough.png")) #$NON-NLS-1$ self.addToolDisabledBitmap(toolId, 16, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/text_strikethrough_disabled.png")) #$NON-NLS-1$ self.addSeparator(40) if self.wysiwyg: self._buildWysiwygEditorModel(resourceReg) else: self._buildXhtmlEditorModel(resourceReg)
def __init__(self, parent, model): self.model = model title = _extstr(u"newtranslationdl.CreateNewTranslation") #$NON-NLS-1$ label = _extstr(u"newtranslationdl.LanguageLabel") #$NON-NLS-1$ ZDataEntryDialog.__init__(self, parent, title, label)
def buildInsertImageMenuItems(self, menuModel, gravity, parentId): #@UnusedVariable resourceReg = getResourceRegistry() mid = menuModel.addMenuItemWithAction(_extstr(u"blogcontenteditorimagemenumodel.InsertImageFile"), gravity+1, ZBlogPostInsertImageAction(), parentId ) #$NON-NLS-1$ menuModel.setMenuItemBitmap(mid, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/insert_link.png")) #$NON-NLS-1$ mid = menuModel.addMenuItemWithAction(_extstr(u"blogcontenteditorimagemenumodel.InsertImageTag"), gravity+2, ZBlogPostInsertImgTagAction(), parentId ) #$NON-NLS-1$ menuModel.setMenuItemBitmap(mid, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/insert_link.png")) #$NON-NLS-1$
def _createEditorWidgets(self): self._createAcceleratorTable() self.notebook = fnb.FlatNotebook(self, wx.ID_ANY, style = fnb.FNB_BOTTOM | fnb.FNB_NO_NAV_BUTTONS | fnb.FNB_NO_X_BUTTON | fnb.FNB_NODRAG) self.notebook.AddPage(self._createWysiwygPage(), _extstr(u"blogeditor.Design"), True, -1) #$NON-NLS-1$ self.notebook.AddPage(self._createXHTMLPage(), _extstr(u"blogeditor.XHTML"), False, -1) #$NON-NLS-1$ self.notebook.AddPage(self._createPreviewPage(), _extstr(u"blogeditor.Preview"), False, -1) #$NON-NLS-1$
def __init__(self, rvalMap, model, systemProfile): self.rvalMap = rvalMap self.model = model self.systemProfile = systemProfile self.selectedIndex = -1 self.importMenuModel = self._createImportMenuModel() title = _extstr(u"manager.WindowTitle") #$NON-NLS-1$ portable = _extstr(u"manager.Portable") #$NON-NLS-1$ if isPortableEnabled(): title = u"%s (%s)" % (title, portable) #$NON-NLS-1$ wx.Frame.__init__(self, None, wx.ID_ANY, title, size=wx.Size(400, 325), style = wx.DEFAULT_FRAME_STYLE) self._createWidgets() self._populateWidgets() self._layoutWidgets() self._bindWidgetEvents() self.CentreOnScreen() self.SetIcons(getResourceRegistry().getIconBundle(ICON_IMAGES)) self.Show(True) # Auto-select the 'default' profile. defaultName = self.model.getDefaultProfileName() if defaultName: self.profilesListView.Select(self._getProfileIndex(defaultName), True) # Now set focus on the profileListView self.profilesListView.SetFocus() # Fire a UI exec event - detect ZBW or WLW on startup fireUIExecEvent(ZMethodRunnable(self.onDetectImport), self)
def _createSplashPanel(self, parent): ver = version.ZVersion() verDate = ZSchemaDateTime(ver.getBuildDate()) panel = wx.Panel(parent, wx.ID_ANY) panel.SetBackgroundColour(wx.WHITE) splashFilename = u"splash.png" #$NON-NLS-1$ if isPortableEnabled(): splashFilename = u"splash_portable.png" #$NON-NLS-1$ bitmap = getResourceRegistry().getBitmap(u"images/splash/%s" % splashFilename) #$NON-NLS-1$ splashImage = ZStaticBitmap(panel, bitmap) versionLabelLabel = wx.StaticText(panel, wx.ID_ANY, u"%s: " % _extstr(u"splash.Version")) #$NON-NLS-1$ #$NON-NLS-2$ versionLabelLabel.SetFont(getDefaultFontBold()) versionLabel = wx.StaticText(panel, wx.ID_ANY, ver.getFullVersionString()) dateLabelLabel = wx.StaticText(panel, wx.ID_ANY, u"%s: " % _extstr(u"splash.BuiltOn")) #$NON-NLS-1$ #$NON-NLS-2$ dateLabelLabel.SetFont(getDefaultFontBold()) dateLabel = wx.StaticText(panel, wx.ID_ANY, verDate.toString(localTime = True)) verAndDateSizer = wx.BoxSizer(wx.HORIZONTAL) verAndDateSizer.Add(versionLabelLabel, 0, wx.EXPAND | wx.RIGHT, 2) verAndDateSizer.Add(versionLabel, 0, wx.EXPAND | wx.RIGHT, 10) verAndDateSizer.Add(dateLabelLabel, 0, wx.EXPAND | wx.RIGHT, 2) verAndDateSizer.Add(dateLabel, 0, wx.EXPAND) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(splashImage, 0, wx.EXPAND) sizer.AddSizer(verAndDateSizer, 0, wx.EXPAND | wx.ALL, 5) panel.SetSizer(sizer) panel.SetAutoLayout(True) return panel
def _createColumnInfo(self): cstyle = wx.LIST_FORMAT_LEFT columnInfo = [ (_extstr(u"translationeditor.BundleKey"), None, cstyle, ZListViewEx.COLUMN_RELATIVE, 40), #$NON-NLS-1$ (_extstr(u"translationeditor.TranslatedValue"), None, cstyle, ZListViewEx.COLUMN_RELATIVE, 60) #$NON-NLS-1$ ] return columnInfo
def _createNonHeaderWidgets(self): self.showOnlyCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"translationeditor.ShowOnlyUntranslated")) #$NON-NLS-1$ self.listProvider = ZStringBundleProvider(self.model) self.listBox = ZListViewEx(self.listProvider, self, wx.ID_ANY) bitmap = getFlagBitmapForLocale(u"en_US") #$NON-NLS-1$ self.englishFlag = ZStaticBitmap(self, bitmap) self.englishLabel = wx.StaticText( self, wx.ID_ANY, _extstr(u"translationeditor.EnglishValue")) #$NON-NLS-1$ bitmap = getFlagBitmapForLocale( self.model.getTranslation().getLocale().toString()) if bitmap is None: bitmap = getEmptyFlagBitmap() self.translationFlag = ZStaticBitmap(self, bitmap) self.translationLabel = wx.StaticText(self, wx.ID_ANY, self.translationDisplayName) self.englishText = wx.TextCtrl(self, wx.ID_ANY, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_BESTWRAP) self.translationText = wx.TextCtrl( self, wx.ID_ANY, style=wx.TE_MULTILINE | wx.TE_BESTWRAP | wx.TE_PROCESS_ENTER) self.translationText.Enable(False) self.staticLine = wx.StaticLine(self, wx.HORIZONTAL)
def _createWidgets(self): self.panel = wx.Panel(self.parent, wx.ID_ANY, style=wx.SIMPLE_BORDER) self.panel.SetBackgroundColour(u"#FFFFE6") #$NON-NLS-1$ self.filterLabel = wx.StaticText( self.panel, wx.ID_ANY, _extstr(u"blogselector.BlogName")) #$NON-NLS-1$ self.filterTextBox = wx.TextCtrl(self.panel, wx.ID_ANY, style=wx.TE_PROCESS_ENTER) self.filterTextBox.SetSizeHints( -1, getTextDimensions(u"Zoundry", self.filterTextBox)[1]) #$NON-NLS-1$ self.filterAcctLabel = wx.StaticText( self.panel, wx.ID_ANY, _extstr(u"blogselector.Account")) #$NON-NLS-1$ self.filterAccountCombo = wx.ComboBox(self.panel, wx.ID_ANY, style=wx.CB_READONLY) self.separator = wx.StaticLine(self.panel, wx.HORIZONTAL) self.contentProvider = ZBlogListContentProvider(self.model) self.blogListView = ZPopupListView(self.contentProvider, self.panel, style=wx.LC_VIRTUAL | wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.NO_BORDER | wx.LC_NO_HEADER) self.blogListView.SetBackgroundColour(u"#FFFFE6") #$NON-NLS-1$
def runSpellCheck(self, parentWindow, spellcheckContext): if spellcheckContext is None: ZShowInfoMessage(parentWindow, _extstr(u"spellcheckuiutil.SpellcheckNotSupported"), _extstr(u"spellcheckdialog.DialogTitle") ) #$NON-NLS-1$ #$NON-NLS-2$ return model = ZSpellCheckModel(spellcheckContext) if not model.isSpellcheckEnabled(): message = _extstr(u"spellcheckuiutil.SpellcheckNotEnabledQuestion") #$NON-NLS-1$ title = _extstr(u"spellcheckdialog.DialogTitle") #$NON-NLS-1$ if ZShowYesNoMessage(parentWindow, message, title ): showRavenSettingsDialog(parentWindow, u"zoundry.appframework.ui.preferences.prefpage.spelling") #$NON-NLS-1$ if not model.isSpellcheckEnabled(): return else: return # Init model model.initializeSpellcheckContext() # check first mispelled word\ spellcheckResult = model.checkNextWord() if spellcheckResult and not spellcheckResult.isFinished(): dialog = ZSpellCheckDialog(parentWindow, model) dialog.ShowModal() dialog.Destroy() spellcheckResult = model.checkNextWord() model.cleanupSpellcheckContext() if spellcheckResult and spellcheckResult.isFinished(): ZShowInfoMessage(parentWindow, _extstr(u"spellcheckuiutil.SpellcheckCompleted"), _extstr(u"spellcheckdialog.DialogTitle") ) #$NON-NLS-1$ #$NON-NLS-2$
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()
def _createColumnInfo(self): cstyle = wx.LIST_FORMAT_LEFT # FIXME (PJ / EPW) cols should be: Title, LastModified, Post/PublishedDate and CreatedDate (the post/published date is imported when viewing published entries) columnInfo = [ (_extstr(u"blogpostslist.Title"), None, cstyle, ZListViewEx.COLUMN_RELATIVE, 70), #$NON-NLS-1$ (_extstr(u"blogpostslist.Created"), None, cstyle, ZListViewEx.COLUMN_RELATIVE, 30) #$NON-NLS-1$ ] return columnInfo
def refresh(self): # Folders is list of tuples: (folderName, folderIcon, folderType) self.folders = [] if self.accountId == UNPUBLISHED_ACCOUNT_ID or self.blogId is not None: self.folders.append( (_extstr(u"foldersbrowser.Posts"), u"posts", IZViewSelectionTypes.BLOG_POSTS_SELECTION) ) #$NON-NLS-2$ #$NON-NLS-1$ self.folders.append( (_extstr(u"foldersbrowser.Links"), u"links", IZViewSelectionTypes.BLOG_LINKS_SELECTION) ) #$NON-NLS-2$ #$NON-NLS-1$ self.folders.append( (_extstr(u"foldersbrowser.Images"), u"images", IZViewSelectionTypes.BLOG_IMAGES_SELECTION) ) #$NON-NLS-2$ #$NON-NLS-1$ self.folders.append( (_extstr(u"foldersbrowser.Tags"), u"tags", IZViewSelectionTypes.BLOG_TAGS_SELECTION) ) #$NON-NLS-2$ #$NON-NLS-1$
def _createWidgets(self): self.blogsLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"metadata.Blogs")) #$NON-NLS-1$ self.blogsCtrl = ZBlogInfoChooser(self, self.model) self.titleLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"metadata.Title")) #$NON-NLS-1$ self.titleText = wx.TextCtrl(self, wx.ID_ANY) self.tagwordsLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"metadata.Tagwords")) #$NON-NLS-1$ self.tagwordsText = wx.TextCtrl(self, wx.ID_ANY) self.staticLine = wx.StaticLine(self, wx.HORIZONTAL)
def _updateCategories(self): if self.isCancelled(): return self._incrementWork(_extstr(u"publishersynch.updatingcategories"), 1, True) #$NON-NLS-1$ syncher = ZPublisherSiteSynchronizer() blogs = [ self.blog ] syncher.updateCategories(self.getAccount(), blogs, self) self._incrementWork(_extstr(u"publishersynch.updatingcategories"), 19, False) #$NON-NLS-1$
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$ ]
def _updateBlogList(self): if self.isCancelled(): return self._incrementWork(_extstr(u"publishersynch.updatingbloglist"), 1, True) #$NON-NLS-1$ syncher = ZPublisherSiteSynchronizer() syncher.updateBlogList( self.getAccount(), self.selectedBlogs, self ) syncher.createMediaStorages( self.getAccount(), self ) self._incrementWork(_extstr(u"publishersynch.updatingbloglist"), 9, False) #$NON-NLS-1$
def __init__(self): self.columns = [ (_extstr(u"pubdatawidgets.Service"), None, 0, ZListViewEx.COLUMN_RELATIVE, 40), #$NON-NLS-1$ (_extstr(u"pubdatawidgets.URL"), None, 0, ZListViewEx.COLUMN_RELATIVE, 60) #$NON-NLS-1$ ] publisherService = getApplicationModel().getService(IZBlogAppServiceIDs.PUBLISHING_SERVICE_ID) self.pingSites = publisherService.listWeblogPingSites() self.selectedPingSites = []
def updateFromError(self, error): # Log the error getLoggerService().exception(error) self.fileSize.SetLabel( _extstr(u"infodetailswidgets.Unavailable")) #$NON-NLS-1$ self.linkType.SetLabel( _extstr(u"infodetailswidgets.Unavailable")) #$NON-NLS-1$ self.Layout()
def _createNonHeaderWidgets(self): self.profileInfoStaticBox = wx.StaticBox(self, label = _extstr(u"newprofile.ProfileInfo")) #$NON-NLS-1$ self.profileNameLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"newprofile.Name:")) #$NON-NLS-1$ self.profileNameText = ZValidatingTextCtrl(ZProfileNameValidator(self.profilesModel), self, wx.ID_ANY, size = wx.Size(325, -1)) self.profileNameText.SetToolTipString(_extstr(u"newprofile.ProfileNameTooltip")) #$NON-NLS-1$ self.profilePathLabel = wx.StaticText(self, wx.ID_ANY, _extstr(u"newprofile.Path:")) #$NON-NLS-1$ self.profilePathCtrl = ZValidatingFileChooserCtrl(ZProfilePathValidator(), self, ZFCC_DIRECTORY_TYPE, _extstr(u"newprofile.ChooseAProfileLocation")) #$NON-NLS-1$ self.profilePathCtrl.SetToolTipString(_extstr(u"newprofile.ProfilePathTooltip")) #$NON-NLS-1$
def _downloadAltHtml(self, url): self.listener.grabFeedback(_extstr(u"templategrabber.DownloadingBlogContentForAnalysis")) #$NON-NLS-1$ request = ZSimpleXHtmlHTTPRequest(url) if not request.send(): return None xhtmlDoc = request.getResponse() self.listener.grabFeedback(_extstr(u"templategrabber.BlogContentDownloaded_Analysing")) #$NON-NLS-1$ return xhtmlDoc
def _isValid(self, value): if not value: return self._setReason(_extstr(u"mediastoragewizard.EmptyStoreNameError")) #$NON-NLS-1$ if self.model.mediaStoreExists(value): return self._setReason(_extstr(u"mediastoragewizard.StoreAlreadyExistsError") % value) #$NON-NLS-1$ return True
def __init__(self, model): self.model = model cstyle = wx.LIST_FORMAT_LEFT self.columnInfo = [ (_extstr(u"manager.Name"), None, cstyle, ZListViewEx.COLUMN_RELATIVE, 30), #$NON-NLS-1$ (_extstr(u"manager.Path"), None, cstyle, ZListViewEx.COLUMN_RELATIVE, 70) #$NON-NLS-1$ ]
def updateFromError(self, error): # Log the error getLoggerService().exception(error) self.fileSize.SetLabel(_extstr(u"infodetailswidgets.Unavailable")) #$NON-NLS-1$ self.imageWidth.SetLabel(_extstr(u"infodetailswidgets.Unavailable")) #$NON-NLS-1$ self.imageHeight.SetLabel(_extstr(u"infodetailswidgets.Unavailable")) #$NON-NLS-1$ self.imageType.SetLabel(_extstr(u"infodetailswidgets.Unavailable")) #$NON-NLS-1$ self.Layout()
def runAction(self, actionContext): store = actionContext.getMediaStorage() if ZShowYesNoMessage( actionContext.getParentWindow(), _extstr(u"mediastoragemanager.DeleteMediaStorage") % store.getName(), _extstr(u"mediastoragemanager.ConfirmDelete" )): #$NON-NLS-2$ #$NON-NLS-1$ actionContext.getModel().deleteStore(store)
def runAction(self, actionContext): store = actionContext.getMediaStorage() if ZShowYesNoMessage( actionContext.getParentWindow(), _extstr(u"mediastoragemanager.DeleteMediaStorage") % store.getName(), _extstr(u"mediastoragemanager.ConfirmDelete"), ): # $NON-NLS-2$ #$NON-NLS-1$ actionContext.getModel().deleteStore(store)
def onCancel(self, event): if self.model.isDirty() and ZShowYesNoMessage( self, _extstr(u"translationeditor.CancelTranslationMessage"), _extstr(u"translationeditor.CancelTranslationTitle") ): #$NON-NLS-2$ #$NON-NLS-1$ self.model.getTranslation().clear() event.Skip() elif not self.model.isDirty(): event.Skip()
def _deleteUnpublishedPost(self, parent, zblogDocument): question = _extstr(u"publisherutil.DeleteUnpublishedPostMessage" ) % zblogDocument.getTitle() #$NON-NLS-1$ title = _extstr( u"publisherutil.DeleteUnpublishedPostTitle") #$NON-NLS-1$ if ZShowYesNoMessage(parent, question, title): docStore = getApplicationModel().getService( IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID) docStore.removeDocument(zblogDocument.getId())
def buildEditObjectsMenuItems(self, menuModel, gravity, parentId): resourceReg = getResourceRegistry() label = _extstr(u"blogcontenteditorlinkmenumodel.EditLink") #$NON-NLS-1$ mid = menuModel.addMenuItemWithAction(u"%s\tCtrl+L" % label, gravity, ZBlogPostEditLinkAction(), parentId ) #$NON-NLS-1$ menuModel.setMenuItemBitmap(mid, resourceReg.getBitmap(u"images/editors/blogeditor/designer/toolbar/16x16/insert_link.png")) #$NON-NLS-1$ label = _extstr(u"blogcontenteditorlinkmenumodel.ConvertLink") #$NON-NLS-1$ mid = menuModel.addMenuItemWithAction(u"%s" % label, gravity+1, ZConvertProductLinkAction(), parentId ) #$NON-NLS-1$ menuModel.setMenuItemBitmap(mid, resourceReg.getBitmap(u"images/editors/blogeditor/menu/convert_link.png")) #$NON-NLS-1$
def _createTreeButtons(self, parent): self.addAccountButton = wx.Button( parent, wx.ID_ANY, _extstr(u"accountprefsdialog.AddAccount")) #$NON-NLS-1$ self.removeAccountButton = wx.Button( parent, wx.ID_ANY, _extstr(u"accountprefsdialog.RemoveAccount")) #$NON-NLS-1$ self.removeAccountButton.Enable(False) return [self.addAccountButton, self.removeAccountButton]
def _refreshPane(self, paneIdx): if not self._debugProgressCtrl(): return if paneIdx == 0: numTasks = self.model.getNumRunningTasks() progressText = u"%d %s" % (numTasks, _extstr(u"appstatusbar.RunningTasks")) #$NON-NLS-1$ #$NON-NLS-2$ if numTasks == 0: progressText = _extstr(u"appstatusbar.NoRunningTasks") #$NON-NLS-1$ self.progressCtrl.setLabel(progressText)
def createWidgets(self): self.staticBox = wx.StaticBox( self, wx.ID_ANY, _extstr(u"trayprefpage.TrayIcon")) #$NON-NLS-1$ self.alwaysShowTrayIconCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"trayprefpage.AlwaysShowTrayIcon")) #$NON-NLS-1$ self.hideAppWindowCB = wx.CheckBox( self, wx.ID_ANY, _extstr(u"trayprefpage.HideAppWindowOnMinimize")) #$NON-NLS-1$
def _createNonHeaderWidgets(self): self.blogLabel = wx.StaticText(self, wx.ID_ANY, u"%s:" % _extstr(u"templatedialogs.FromBlog")) #$NON-NLS-1$ #$NON-NLS-2$ self.blogPicker = ZValidatingBlogSelectorCombo(ZNonEmptySelectionValidator(_extstr(u"templatedialogs.ChooseABlog")), self.model, self) #$NON-NLS-1$ self.templateNameLabel = wx.StaticText(self, wx.ID_ANY, u"%s:" % _extstr(u"templatedialogs.TemplateName")) #$NON-NLS-1$ #$NON-NLS-2$ self.templateNameText = ZValidatingTextCtrl(ZTemplateNameValidator(self.model), self, wx.ID_ANY) self.templateNameText.SetToolTipString(_extstr(u"templatedialogs.PickAFriendlyTemplateName")) #$NON-NLS-1$ self.makeDefaultTemplateCB = wx.CheckBox(self, wx.ID_ANY, _extstr(u"templatedialogs.MakeThisTemplateTheDefault")) #$NON-NLS-1$ self.staticLine = wx.StaticLine(self, wx.HORIZONTAL)