Esempio n. 1
0
 def _createWidgets(self):
     self.generalHtmlBox = ZHTMLControl(self,
                                        style=wx.SIMPLE_BORDER
                                        | HW_NO_SELECTION)
     # FIXME (PJ / EPW) re-use ZWhereFoundBlogPostListView (and model).
     self.postPropertiesListView = ZListView(self.postPropsContentProvider,
                                             self)
Esempio n. 2
0
    def _createContentWidgets(self, parent):
        htmlPath = getResourceRegistry().getResourcePath(
            u"html/perspectives/standard/contextinfo/getting_started.html"
        )  #$NON-NLS-1$
        logoPath = getResourceRegistry().getResourcePath(
            u"images/perspectives/standard/contextinfo/logo.png")  #$NON-NLS-1$
        params = {
            u"getting_started":
            _extstr(u"welcome.GettingStarted"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"zoundry_raven":
            _extstr(u"ZoundryRaven"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"welcome_to_raven":
            _extstr(u"welcome.WelcomeToRaven"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"create_account":
            _extstr(u"welcome.CreateAnAccount"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"create_account_desc":
            _extstr(u"welcome.CreateAccountDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"write_post":
            _extstr(u"welcome.WritePost"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"write_post_desc":
            _extstr(u"welcome.WritePostDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"publish": _extstr(u"welcome.Publish"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"publish_desc":
            _extstr(u"welcome.PublishDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"logo": logoPath,  #$NON-NLS-1$
        }
        html = loadStaticHtml(htmlPath, params)

        self.htmlWidget = ZHTMLControl(parent, style=wx.NO_BORDER)
        self.htmlWidget.SetBorders(0)
        self.htmlWidget.SetPage(html)
Esempio n. 3
0
    def _createContentWidgets(self, parent):
        htmlPath = getResourceRegistry().getResourcePath(
            u"html/perspectives/standard/contextinfo/dashboard.html"
        )  #$NON-NLS-1$
        logoPath = getResourceRegistry().getResourcePath(
            u"images/perspectives/standard/contextinfo/logo.png")  #$NON-NLS-1$
        params = {
            u"dashboard":
            _extstr(u"dashboard.Dashboard"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"zoundry_raven":
            _extstr(u"ZoundryRaven"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_account":
            _extstr(u"dashboard.NewBlogAccount"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_account_desc":
            _extstr(
                u"dashboard.NewBlogAccountDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_media_storage":
            _extstr(u"dashboard.NewMediaStorage"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_media_storage_desc":
            _extstr(
                u"dashboard.NewMediaStorageDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"settings":
            _extstr(u"dashboard.Settings"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"settings_desc":
            _extstr(u"dashboard.SettingsDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"logo":
            logoPath,  #$NON-NLS-1$
            u"newaccount_imgpath":
            getResourceRegistry().getResourcePath(
                u"images/perspectives/standard/contextinfo/dashboard/new_account.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
            u"newstorage_imgpath":
            getResourceRegistry().getResourcePath(
                u"images/perspectives/standard/contextinfo/dashboard/new_storage.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
            u"settings_imgpath":
            getResourceRegistry().getResourcePath(
                u"images/perspectives/standard/contextinfo/dashboard/settings.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
        }
        html = loadStaticHtml(htmlPath, params)

        self.htmlWidget = ZHTMLControl(parent, style=wx.NO_BORDER)
        self.htmlWidget.SetBorders(0)
        self.htmlWidget.SetPage(html)
Esempio n. 4
0
class ZDashboardView(ZBoxedView):
    def __init__(self, parent):
        ZBoxedView.__init__(self, parent)

        actionReg = getApplicationModel().getActionRegistry()
        self.newAccountAction = actionReg.findAction(
            IZBlogAppActionIDs.NEW_BLOG_ACCOUNT_ACTION)
        self.newStorageAction = actionReg.findAction(
            IZBlogAppActionIDs.NEW_MEDIA_STORAGE_ACTION)
        self.settingsAction = actionReg.findAction(
            IZBlogAppActionIDs.SETTINGS_ACTION)

    # end __init__()

    def _getHeaderBitmap(self):
        return getResourceRegistry().getBitmap(
            u"images/perspectives/standard/dashboard.png")  #$NON-NLS-1$

    # end _getHeaderBitmap()

    def _getHeaderLabel(self):
        return _extstr(u"dashboard.Dashboard")  #$NON-NLS-1$

    # end _getHeaderLabel()

    def _createHeaderWidgets(self, parent, widgetList):
        pass

    # end _createHeaderWidgets()

    def _createContentWidgets(self, parent):
        htmlPath = getResourceRegistry().getResourcePath(
            u"html/perspectives/standard/contextinfo/dashboard.html"
        )  #$NON-NLS-1$
        logoPath = getResourceRegistry().getResourcePath(
            u"images/perspectives/standard/contextinfo/logo.png")  #$NON-NLS-1$
        params = {
            u"dashboard":
            _extstr(u"dashboard.Dashboard"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"zoundry_raven":
            _extstr(u"ZoundryRaven"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_account":
            _extstr(u"dashboard.NewBlogAccount"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_account_desc":
            _extstr(
                u"dashboard.NewBlogAccountDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_media_storage":
            _extstr(u"dashboard.NewMediaStorage"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_media_storage_desc":
            _extstr(
                u"dashboard.NewMediaStorageDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"settings":
            _extstr(u"dashboard.Settings"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"settings_desc":
            _extstr(u"dashboard.SettingsDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"logo":
            logoPath,  #$NON-NLS-1$
            u"newaccount_imgpath":
            getResourceRegistry().getResourcePath(
                u"images/perspectives/standard/contextinfo/dashboard/new_account.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
            u"newstorage_imgpath":
            getResourceRegistry().getResourcePath(
                u"images/perspectives/standard/contextinfo/dashboard/new_storage.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
            u"settings_imgpath":
            getResourceRegistry().getResourcePath(
                u"images/perspectives/standard/contextinfo/dashboard/settings.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
        }
        html = loadStaticHtml(htmlPath, params)

        self.htmlWidget = ZHTMLControl(parent, style=wx.NO_BORDER)
        self.htmlWidget.SetBorders(0)
        self.htmlWidget.SetPage(html)

    # end _createContentWidgets()

    def _layoutContentWidgets(self):
        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(self.htmlWidget, 1, wx.EXPAND)
        return box

    # end _layoutContentWidgets()

    def onCreateAccount(self):
        context = ZMenuActionContext(self)
        self.newAccountAction.runAction(context)

    # end onCreateAccount()

    def onNewMediaStorage(self):
        context = ZMenuActionContext(self)
        self.newStorageAction.runAction(context)

    # end onNewMediaStorage()

    def onSettings(self):
        context = ZMenuActionContext(self)
        self.settingsAction.runAction(context)
Esempio n. 5
0
class ZWelcomeView(ZBoxedView):
    def __init__(self, parent):
        ZBoxedView.__init__(self, parent)

        actionReg = getApplicationModel().getActionRegistry()
        self.newAccountAction = actionReg.findAction(
            IZBlogAppActionIDs.NEW_BLOG_ACCOUNT_ACTION)
        self.writePostAction = actionReg.findAction(
            IZBlogAppActionIDs.NEW_BLOG_POST_ACTION)

    # end __init__()

    def _getHeaderBitmap(self):
        return getResourceRegistry().getBitmap(
            u"images/perspectives/standard/welcome.png")  #$NON-NLS-1$

    # end _getHeaderBitmap()

    def _getHeaderLabel(self):
        return _extstr(u"welcome.GettingStarted")  #$NON-NLS-1$

    # end _getHeaderLabel()

    def _createHeaderWidgets(self, parent, widgetList):
        pass

    # end _createHeaderWidgets()

    def _createContentWidgets(self, parent):
        htmlPath = getResourceRegistry().getResourcePath(
            u"html/perspectives/standard/contextinfo/getting_started.html"
        )  #$NON-NLS-1$
        logoPath = getResourceRegistry().getResourcePath(
            u"images/perspectives/standard/contextinfo/logo.png")  #$NON-NLS-1$
        params = {
            u"getting_started":
            _extstr(u"welcome.GettingStarted"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"zoundry_raven":
            _extstr(u"ZoundryRaven"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"welcome_to_raven":
            _extstr(u"welcome.WelcomeToRaven"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"create_account":
            _extstr(u"welcome.CreateAnAccount"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"create_account_desc":
            _extstr(u"welcome.CreateAccountDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"write_post":
            _extstr(u"welcome.WritePost"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"write_post_desc":
            _extstr(u"welcome.WritePostDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"publish": _extstr(u"welcome.Publish"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"publish_desc":
            _extstr(u"welcome.PublishDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"logo": logoPath,  #$NON-NLS-1$
        }
        html = loadStaticHtml(htmlPath, params)

        self.htmlWidget = ZHTMLControl(parent, style=wx.NO_BORDER)
        self.htmlWidget.SetBorders(0)
        self.htmlWidget.SetPage(html)

    # end _createContentWidgets()

    def _layoutContentWidgets(self):
        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(self.htmlWidget, 1, wx.EXPAND)
        return box

    # end _layoutContentWidgets()

    def onCreateAccount(self):
        context = ZMenuActionContext(self)
        self.newAccountAction.runAction(context)

    # end onCreateAccount()

    def onWritePost(self):
        context = ZMenuActionContext(self)
        self.writePostAction.runAction(context)
Esempio n. 6
0
 def _createContentWidgets(self, parent):
     self.htmlWidget = ZHTMLControl(parent, style=wx.NO_BORDER)
     self.htmlWidget.SetBorders(0)
     self.htmlWidget.SetPage(u"<html />")  #$NON-NLS-1$
Esempio n. 7
0
class ZContextInfoBlogSummaryView(ZBoxedView):
    def __init__(self, parent):
        self.accountStore = getApplicationModel().getService(
            IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
        self.blog = None

        ZBoxedView.__init__(self, parent)

    # end __init__()

    def _getHeaderBitmap(self):
        return getResourceRegistry().getBitmap(
            u"images/perspectives/standard/blog_summary.png")  #$NON-NLS-1$

    # end _getHeaderBitmap()

    def _getHeaderLabel(self):
        return _extstr(u"blogsummary.BlogSummary")  #$NON-NLS-1$

    # end _getHeaderLabel()

    def _createHeaderWidgets(self, parent, widgetList):
        pass

    # end _createHeaderWidgets()

    def _createContentWidgets(self, parent):
        self.htmlWidget = ZHTMLControl(parent, style=wx.NO_BORDER)
        self.htmlWidget.SetBorders(0)
        self.htmlWidget.SetPage(u"<html />")  #$NON-NLS-1$

    # end _createContentWidgets()

    def _layoutContentWidgets(self):
        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(self.htmlWidget, 1, wx.EXPAND)
        return box

    # end _layoutContentWidgets()

    def refreshContent(self, selection):
        (accountId, blogId) = selection.getData()
        account = self.accountStore.getAccountById(accountId)
        self.blog = account.getBlogById(blogId)
        self._populateWidgets()

    # end refreshContent()

    def _bindWidgetEvents(self):
        ZBoxedView._bindWidgetEvents(self)

        self.Bind(ZEVT_VIEW_SELECTION_CHANGED, self.onSelectionChanged)

    # end _bindWidgetEvents()

    def _populateWidgets(self):
        params = {
            u"blog_summary":
            _extstr(u"blogsummary.BlogSummary"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"zoundry_raven":
            _extstr(u"ZoundryRaven"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"configure_blog":
            _extstr(u"blogsummary.ConfigureBlog"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"configure_blog_desc":
            _extstr(
                u"blogsummary.ConfigureBlogDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_post":
            _extstr(u"blogsummary.NewPost"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"new_post_desc":
            _extstr(u"blogsummary.NewPostDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"view_blog":
            _extstr(u"blogsummary.ViewBlog"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"view_blog_desc":
            _extstr(u"blogsummary.ViewBlogDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"blog_name":
            self.blog.getName(),  #$NON-NLS-1$
            u"configure_imgpath":
            getResourceRegistry().getImagePath(
                u"images/perspectives/standard/contextinfo/blog_summary/configure.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
            u"newpost_imgpath":
            getResourceRegistry().getImagePath(
                u"images/perspectives/standard/contextinfo/blog_summary/newpost.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
            u"viewblog_imgpath":
            getResourceRegistry().getImagePath(
                u"images/perspectives/standard/contextinfo/blog_summary/viewblog.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
        }

        htmlPath = getResourceRegistry().getResourcePath(
            u"html/perspectives/standard/contextinfo/blog_summary.html"
        )  #$NON-NLS-1$
        html = loadStaticHtml(htmlPath, params)
        #$NON-NLS-1$
        self.htmlWidget.SetPage(html)

    # end _populateWidgets()

    def onSelectionChanged(self, event):
        selection = event.getSelection()
        if selection.getType() == IZViewSelectionTypes.BLOG_SELECTION:
            self.refreshContent(selection)

    # end onSelectionChanged()

    def onNewPost(self):
        self._runBlogAction(IZBlogAppActionIDs.BLOG_NEW_BLOG_POST_ACTION)

    # end onNewPost()

    def onConfigure(self):
        self._runBlogAction(IZBlogAppActionIDs.CONFIGURE_BLOG_ACTION)

    # end onConfigure()

    def onViewBlog(self):
        self._runBlogAction(IZBlogAppActionIDs.VIEW_BLOG_ACTION)

    # end onViewBlog()

    def _runBlogAction(self, actionId):
        action = getApplicationModel().getActionRegistry().findAction(actionId)
        context = ZBlogMenuActionContext(self, self.blog)
        action.runAction(context)
Esempio n. 8
0
 def _createContentWidgets(self, parent):
     self.htmlWidget = ZHTMLControl(parent, style=wx.NO_BORDER)
     self.htmlWidget.SetBorders(0)
Esempio n. 9
0
class ZContextInfoAccountSummaryView(ZBoxedView):
    def __init__(self, parent):
        self.accountStore = getApplicationModel().getService(
            IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)
        self.account = None

        ZBoxedView.__init__(self, parent)

    # end __init__()

    def _getHeaderBitmap(self):
        return getResourceRegistry().getBitmap(
            u"images/perspectives/standard/account_summary.png")  #$NON-NLS-1$

    # end _getHeaderBitmap()

    def _getHeaderLabel(self):
        return _extstr(u"acctsummary.AccountSummary")  #$NON-NLS-1$

    # end _getHeaderLabel()

    def _createHeaderWidgets(self, parent, widgetList):
        pass

    # end _createHeaderWidgets()

    def _createContentWidgets(self, parent):
        self.htmlWidget = ZHTMLControl(parent, style=wx.NO_BORDER)
        self.htmlWidget.SetBorders(0)

    # end _createContentWidgets()

    def _layoutContentWidgets(self):
        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(self.htmlWidget, 1, wx.EXPAND)
        return box

    # end _layoutContentWidgets()

    def refreshContent(self, selection):
        accountId = selection.getData()
        self.account = self.accountStore.getAccountById(accountId)
        self._populateWidgets()

    # end refreshContent()

    def _bindWidgetEvents(self):
        ZBoxedView._bindWidgetEvents(self)

        self.Bind(ZEVT_VIEW_SELECTION_CHANGED, self.onSelectionChanged)

    # end _bindWidgetEvents()

    def onSelectionChanged(self, event):
        selection = event.getSelection()
        if selection.getType() == IZViewSelectionTypes.ACCOUNT_SELECTION:
            self.refreshContent(selection)

    # end onSelectionChanged()

    def _populateWidgets(self):
        params = {
            u"account_summary":
            _extstr(u"acctsummary.AccountSummary"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"zoundry_raven":
            _extstr(u"ZoundryRaven"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"view_settings_desc":
            _extstr(
                u"acctsummary.ViewSettingsDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"refresh_account":
            _extstr(u"acctsummary.RefreshDesc"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"view_settings":
            _extstr(u"acctsummary.ViewSettings"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"refresh":
            _extstr(u"acctsummary.Refresh"),  #$NON-NLS-1$ #$NON-NLS-2$
            u"account_name":
            self.account.getName(),  #$NON-NLS-1$
            u"settings_imgpath":
            getResourceRegistry().getImagePath(
                u"images/perspectives/standard/contextinfo/account_summary/settings.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
            u"refresh_imgpath":
            getResourceRegistry().getImagePath(
                u"images/perspectives/standard/contextinfo/account_summary/synch.png"
            ),  #$NON-NLS-1$ #$NON-NLS-2$
        }

        htmlPath = getResourceRegistry().getResourcePath(
            u"html/perspectives/standard/contextinfo/account_summary.html"
        )  #$NON-NLS-1$
        html = loadStaticHtml(htmlPath, params)
        #$NON-NLS-1$

        self.htmlWidget.SetPage(html)

    # end _populateWidgets()

    def onViewSettings(self):
        dialog = ZAccountManagerDialog(self, self.account)
        dialog.ShowModal()
        dialog.Destroy()

    # end onViewSettings()

    def onOnlineSync(self):
        ZPublisherSiteSynchUiUtil().synchronizeAccount(self, self.account)
Esempio n. 10
0
class ZGeneralBlogPostDetailsPanel(ZAbstractDetailsPanel):

    GENERAL_HTML_TEMPLATE = u"""
       <html>
         <body>
           <font size="-1">
           <table width="100%%" cellspacing="0" cellpadding="2">
             <tr><td width="1%%"><b>Title:  </b></td><td>%(title)s</td></tr>
             <tr><td><b>Modified:  </b></td><td>%(modified)s</td></tr>
             <tr><td><b>Created:  </b></td><td>%(created)s</td></tr>
             <tr><td><b>Entry ID:  </b></td><td>%(entryid)s</td></tr>
           </table>
           </font>
         </body>
       </html>
    """ #$NON-NLS-1$

    def __init__(self, parent):
        self.postPropsContentProvider = ZBlogPostPropertiesListViewContentProvider(
        )

        ZAbstractDetailsPanel.__init__(self, parent)

    # end __init__()

    def _createWidgets(self):
        self.generalHtmlBox = ZHTMLControl(self,
                                           style=wx.SIMPLE_BORDER
                                           | HW_NO_SELECTION)
        # FIXME (PJ / EPW) re-use ZWhereFoundBlogPostListView (and model).
        self.postPropertiesListView = ZListView(self.postPropsContentProvider,
                                                self)

    # end _createWidgets()

    def _bindWidgetEvents(self):
        pass

    # end _bindWidgetEvents()

    def _layoutWidgets(self):
        generalSBSizer = wx.BoxSizer(wx.HORIZONTAL)
        generalSBSizer.Add(self.generalHtmlBox, 1, wx.EXPAND)
        postPropertiesSBSizer = wx.BoxSizer(wx.HORIZONTAL)
        postPropertiesSBSizer.Add(self.postPropertiesListView, 1, wx.EXPAND)

        box = wx.BoxSizer(wx.VERTICAL)
        box.AddSizer(generalSBSizer, 1, wx.EXPAND | wx.ALL, 5)
        box.AddSizer(postPropertiesSBSizer, 1, wx.EXPAND | wx.ALL, 5)
        self.SetAutoLayout(True)
        self.SetSizer(box)

    # end _layoutWidgets()

    def _formatHtml(self, document):
        title = document.getTitle()
        modified = document.getLastModifiedTime()
        created = document.getCreationTime()
        id = document.getId()
        args = {
            u"title": title,  #$NON-NLS-1$
            u"modified": formatLocalDateAndTime(modified),  #$NON-NLS-1$
            u"created": formatLocalDateAndTime(created),  #$NON-NLS-1$
            u"entryid": id  #$NON-NLS-1$
        }
        return ZGeneralBlogPostDetailsPanel.GENERAL_HTML_TEMPLATE % args

    # end _formatHtml()

    def onSelectionChanged(self, document):
        self.generalHtmlBox.SetPage(self._formatHtml(document))
        self.postPropsContentProvider.setDocument(document)
        self.postPropertiesListView.refresh()
Esempio n. 11
0
 def _createHeaderHTMLControl(self):
     html = ZHTMLControl(self.panel, size = wx.Size(-1, 64), style = HW_SCROLLBAR_NEVER | HW_NO_SELECTION)
     html.SetBorders(1)
     return html