コード例 #1
0
ファイル: aboutdialog.py プロジェクト: mpm2050/Raven
    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
コード例 #2
0
ファイル: deserializers.py プロジェクト: mpm2050/Raven
    def _deserializeStandardAttributes(self, backgroundTask,
                                       backgroundTaskElem):
        standardAttrs = {}
        nodes = backgroundTaskElem.selectNodes(
            u"zns:task-attributes/zns:attribute")  #$NON-NLS-1$
        for node in nodes:
            standardAttrs[node.getAttribute(
                u"name")] = node.getText()  #$NON-NLS-1$

        name = standardAttrs[u"name"]  #$NON-NLS-1$
        startTime = ZSchemaDateTime(standardAttrs[u"start-time"])  #$NON-NLS-1$
        endTime = None
        if u"end-time" in standardAttrs:  #$NON-NLS-1$
            endTime = ZSchemaDateTime(standardAttrs[u"end-time"])  #$NON-NLS-1$
        numWorkUnits = string.atoi(
            standardAttrs[u"total-work-units"])  #$NON-NLS-1$
        numCompletedWorkUnits = string.atoi(
            standardAttrs[u"completed-work-units"])  #$NON-NLS-1$
        cancelled = standardAttrs[
            u"cancelled"] == u"true"  #$NON-NLS-2$ #$NON-NLS-1$

        backgroundTask.setName(name)
        backgroundTask.setStartTime(startTime)
        backgroundTask.setEndTime(endTime)
        backgroundTask.setNumWorkUnits(numWorkUnits)
        backgroundTask.setNumCompletedWorkUnits(numCompletedWorkUnits)
        backgroundTask.setCancelled(cancelled)
コード例 #3
0
ファイル: templatesvcimpl.py プロジェクト: mpm2050/Raven
 def createTemplate(self):
     guid = generate()
     templateDir = self._getDirForNewTemplate(guid)
     template = ZTemplate(templateDir, guid)
     template.setCreationTime(ZSchemaDateTime())
     template.setLastModifiedTime(ZSchemaDateTime())
     return template
コード例 #4
0
ファイル: splash.py プロジェクト: Tidosho/zoundryraven
    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
コード例 #5
0
ファイル: mediastoragereg.py プロジェクト: mpm2050/Raven
    def _load(self):
        if not self.registryFile or not os.path.exists(self.registryFile):
            return

        mediaStorageDir = os.path.basename(self.registryFile)

        dom = ZDom()
        dom.load(self.registryFile)
        # Legacy handling - old registry file format
        for fileElem in dom.selectNodes(u"/registry/file"):  #$NON-NLS-1$
            fileName = fileElem.getText()
            size = int(fileElem.getAttribute(u"size"))  #$NON-NLS-1$
            timestamp = ZSchemaDateTime(
                fileElem.getAttribute(u"timestamp"))  #$NON-NLS-1$
            url = fileElem.getAttribute(u"url")  #$NON-NLS-1$
            self.addFile(fileName, size, timestamp, url)
        # New registry file format
        for entryElem in dom.selectNodes(u"/registry/entry"):  #$NON-NLS-1$
            size = int(entryElem.getAttribute(u"size"))  #$NON-NLS-1$
            timestamp = ZSchemaDateTime(
                entryElem.getAttribute(u"timestamp"))  #$NON-NLS-1$
            relativeFileName = entryElem.selectSingleNodeText(
                u"file")  #$NON-NLS-1$
            fileName = resolveRelativePath(mediaStorageDir, relativeFileName)
            url = entryElem.selectSingleNodeText(u"url")  #$NON-NLS-1$
            embedFragment = entryElem.selectSingleNode(
                u"embed/*")  #$NON-NLS-1$
            metaData = entryElem.selectSingleNode(u"metaData/*")  #$NON-NLS-1$
            uploadResponse = ZUploadResponse(url, embedFragment, metaData)
            self.addFileEntry(fileName, size, timestamp, uploadResponse)
コード例 #6
0
ファイル: datectrl.py プロジェクト: Tidosho/zoundryraven
 def setDateTime(self, dateTime):
     # Stop listening to text events until after we are done setting the value
     self.Unbind(wx.EVT_TEXT, self.dateTimeControl)
     if dateTime is None:
         dateTime = ZSchemaDateTime()
     dtStr = dateTime.toString(u"%m/%d/%Y %I:%M %p", True) #$NON-NLS-1$
     self.dateTimeControl.SetValue(dtStr)
     self.Bind(wx.EVT_TEXT, self.onDateTimeText, self.dateTimeControl)
コード例 #7
0
 def setDateTime(self, dateTime):
     # Stop listening to text events until after we are done setting the value
     self.Unbind(wx.EVT_TEXT, self.dateTimeControl)
     if dateTime is None:
         dateTime = ZSchemaDateTime()
     dtStr = dateTime.toString(u"%m/%d/%Y %I:%M %p", True)  #$NON-NLS-1$
     self.dateTimeControl.SetValue(dtStr)
     self.Bind(wx.EVT_TEXT, self.onDateTimeText, self.dateTimeControl)
コード例 #8
0
ファイル: dateutil.py プロジェクト: mpm2050/Raven
def getRangeForYesterday():
    u"""getRangeForYesterday() -> ZDateRange
    Gets the date range that defines 'yesterday'.  See the
    documentation for "getRangeForDate()" for more details.""" #$NON-NLS-1$
    now = ZSchemaDateTime()
    dt = now.getDateTime(True)
    delta = datetime.timedelta(days = 1)
    yesterdayDt = dt - delta
    yesterday = ZSchemaDateTime(yesterdayDt)
    return getRangeForDate(yesterday)
コード例 #9
0
ファイル: dateutil.py プロジェクト: mpm2050/Raven
def getRangeForDate(schemaTime):
    u"""getRangeForDate(IZSchemaDateTime) -> ZDateRange
    Gets the date range that defines the single day represented by
    the given input.  In other words, this function always returns
    a date range that spans a single day, from midnight AM to
    midnight PM.""" #$NON-NLS-1$
    dt = schemaTime.getDateTime(True)
    startDate = createStartDate(dt.year, dt.month, dt.day)
    endDate = createEndDate(dt.year, dt.month, dt.day)
    return ZDateRange(ZSchemaDateTime(startDate), ZSchemaDateTime(endDate))
コード例 #10
0
ファイル: dateutil.py プロジェクト: mpm2050/Raven
def getContainingMonthDateRange(schemaTime):
    u"""getContainingMonthDateRange() -> ZDateRange
    Gets the date range that defines the 28, 29, 30, or 31 day
    month containing the given date.  For example, if the input
    is Dec 20, 2006, the return value would be the range
    beginning Dec 1, 2006 and ending Dec 31, 2006.""" #$NON-NLS-1$
    dt = schemaTime.getDateTime()
    (_notused, numDaysInMonth) = calendar.monthrange(dt.year, dt.month)
    startDate = createStartDate(dt.year, dt.month, 1)
    endDate = createEndDate(dt.year, dt.month, numDaysInMonth)
    return ZDateRange(ZSchemaDateTime(startDate), ZSchemaDateTime(endDate))
コード例 #11
0
ファイル: postactions.py プロジェクト: mpm2050/Raven
 def runAction(self, actionContext):
     docIDO = actionContext.getDocumentIDO()
     docId = docIDO.getId()
     document = self._getDataStore().getDocument(docId)
     document.setId(None)
     document.setCreationTime(ZSchemaDateTime())
     document.setLastModifiedTime(ZSchemaDateTime())
     document.setPubMetaDataList([])
     document.setBlogInfoList([])
     editorWindow = getEditorWindow()
     editorWindow.openDocument(document)
     editorWindow.Show()
コード例 #12
0
ファイル: datastore.py プロジェクト: mpm2050/Raven
    def addDocument(self, document):
        if document.getId():
            self.saveDocument(document)
            return

        document.setId(guid.generate())
        if document.getCreationTime() is None:
            document.setCreationTime(ZSchemaDateTime())
        if document.getLastModifiedTime() is None:
            document.setLastModifiedTime(ZSchemaDateTime())

        documentXmlPath = self._getDocumentPath( document.getId() )
        saveDocument(document, documentXmlPath)
        self._fireDocumentAddedEvent(document)
コード例 #13
0
ファイル: templatesampledoc.py プロジェクト: mpm2050/Raven
    def __init__(self):
        ZBlogDocument.__init__(self)

        self.setId(u"_template_preview_document_")  #$NON-NLS-1$
        self.setTitle(
            u"Proin tincidunt. Sed sapien libero, feugiat eu, tristique."
        )  #$NON-NLS-1$
        self.setCreationTime(ZSchemaDateTime())
        self.setLastModifiedTime(ZSchemaDateTime())

        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(self._createXHtmlDocument())
        self.setContent(content)
コード例 #14
0
ファイル: dateutil.py プロジェクト: mpm2050/Raven
def createSchemaDateTime(year, month, day, hour, min, secs, localTz = True):
    if localTz:
        tz = ZLocalTimezone()
    else:
        tz = UTC_TIMEZONE
    dt = createDateTime(year, month, day, hour, min, secs, tz)
    return ZSchemaDateTime(dt)
コード例 #15
0
ファイル: dateutil.py プロジェクト: mpm2050/Raven
def getIso8601Date(dateString):
    if not dateString:
        return None
    # check GMT time match YYYYMMDD:HHMMZ sent by some xml-rpc servers (wordpress 2.2+)
    m = re.match(XMLRPC_UTC_DATE_PATTERN, dateString)
    if m:
        (year, month, day, h, m, s) = m.groups()
        return ZSchemaDateTime(createDateTime(int(year), int(month), int(day), int(h), int(m), int(s), UTC_TIMEZONE))
    
    # check local time match YYYYMMDD:HHMM sent by some xml-rpc servers.
    m = re.match(XMLRPC_LOCAL_DATE_PATTERN, dateString)
    if m:
        (year, month, day, h, m, s) = m.groups()
        return ZSchemaDateTime(createDateTime(int(year), int(month), int(day), int(h), int(m), int(s), ZLocalTimezone()))
    else:
        return ZSchemaDateTime(dateString)
コード例 #16
0
ファイル: dateutil.py プロジェクト: mpm2050/Raven
def getRangeForThisWeek():
    u"""getRangeForThisWeek() -> ZDateRange
    Gets the date range that defines this week.  See the
    documentation in getContainingWeekDateRange() for more
    details.""" #$NON-NLS-1$
    now = ZSchemaDateTime()
    return getContainingWeekDateRange(now)
コード例 #17
0
    def _createDocument(self):
        document = ZBlogDocument()
        document.setTitle(u"RAVEN_TEMPLATE_FETCH_TITLE")  #$NON-NLS-1$
        document.setCreationTime(ZSchemaDateTime())
        document.setLastModifiedTime(ZSchemaDateTime())

        xhtmlDoc = loadXhtmlDocumentFromString(
            u"<p id='_raven_template_body'>RAVEN_TEMPLATE_FETCH_BODY</p>"
        )  #$NON-NLS-1$
        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(xhtmlDoc)
        document.setContent(content)

        return document
コード例 #18
0
 def _createRavenPubInfo(self, zblog, serverEntry):
     # published info
     zpubinfo = ZPublishInfo()
     # copy attrs
     self._copyAttrsFromServerToRaven(serverEntry, zpubinfo)
     id = self._createEntryQId(zblog.getId(), serverEntry.getId())
     zpubinfo.setBlogEntryId(id)
     zpubinfo.setDraft(serverEntry.isDraft())  #
     schemaDt = ZSchemaDateTime(serverEntry.getUtcDateTime())
     zpubinfo.setPublishedTime(schemaDt)
     zpubinfo.setSynchTime(ZSchemaDateTime())
     # FIXME (PJ) also set  updated-date
     if serverEntry.getUrl():
         zpubinfo.setUrl(serverEntry.getUrl())
     # TODO (PJ) zpubinfo.addTrackback()
     return zpubinfo
コード例 #19
0
ファイル: blogeditordocument.py プロジェクト: mpm2050/Raven
    def __init__(self, title, xhtmlDoc):
        self.title = title
        self.xhtmlDoc = xhtmlDoc

        ZBlogDocument.__init__(self)

        self.setId(u"_blog_post_editor_preview_document_")  #$NON-NLS-1$
        self.setTitle(self.title)
        self.setCreationTime(ZSchemaDateTime())
        self.setLastModifiedTime(ZSchemaDateTime())

        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(self.xhtmlDoc)
        self.setContent(content)
コード例 #20
0
    def getAttributeDate(self, name, namespace=None, dflt=None):
        val = self.getAttribute(name, namespace)
        if val is None:
            return dflt

        if isinstance(val, ZSchemaDateTime):
            return val
        else:
            return ZSchemaDateTime(val)
コード例 #21
0
ファイル: aboutdialog.py プロジェクト: Tidosho/zoundryraven
    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
コード例 #22
0
def tempFileFilter(filePath):
    if os.path.isfile(filePath):
        (shortFileName, absolutePath, fileSize,
         timeStamp) = getFileMetaData(filePath)  #@UnusedVariable
        today = ZSchemaDateTime()
        today.setHour(0)
        today.setMinutes(0)
        today.setSeconds(0)
        return timeStamp < today
    else:
        return False
コード例 #23
0
ファイル: dateutil.py プロジェクト: mpm2050/Raven
def getContainingWeekDateRange(schemaTime):
    u"""getContainingWeekDateRange(IZSchemaDateTime) -> ZDateRange
    Gets the date range that defines the 7 day week (from Sunday to
    Saturday) containing the given date.  For example, if the
    input is Wed Nov 22, 2006, the return value would be the range
    beginning Sun Nov 19, 2006 and ending Sat Nov 25, 2006.""" #$NON-NLS-1$
    dt = schemaTime.getDateTime()
    weekDay = calendar.weekday(dt.year, dt.month, dt.day)
    # Note: The calendar module returns 0 for Monday, 6 for Sunday
    startDiffDays = (weekDay + 1) % 7
    # Note: -1 mod 7 == 6
    endDiffDays = (6 - (weekDay + 1)) % 7
    startDelta = datetime.timedelta(days = startDiffDays)
    endDelta = datetime.timedelta(days = endDiffDays)
    startDate = dt - startDelta
    endDate = dt + endDelta
    startDate = createStartDate(startDate.year, startDate.month, startDate.day)
    endDate = createEndDate(endDate.year, endDate.month, endDate.day)
    return ZDateRange(ZSchemaDateTime(startDate), ZSchemaDateTime(endDate))
コード例 #24
0
 def _fireStopEvent(self):
     try:
         if not self.isComplete():
             self.listeners.doCallback(u"onStop", [self])  #$NON-NLS-1$
         self.running = False
     finally:
         if self.logFile is not None:
             self._writeToLog(u"Task stopped: %s" %
                              (unicode(ZSchemaDateTime())))  #$NON-NLS-1$
             self.logFile.close()
コード例 #25
0
    def _deserializeTemplate(self, template, templateDom):
        rootNode = templateDom.selectSingleNode(
            u"/zns:template/zns:root")  #$NON-NLS-1$
        nameNode = templateDom.selectSingleNode(
            u"/zns:template/zns:name")  #$NON-NLS-1$
        sourceNode = templateDom.selectSingleNode(
            u"/zns:template/zns:source")  #$NON-NLS-1$
        allFileNode = templateDom.selectSingleNode(
            u"/zns:template/zns:allFile")  #$NON-NLS-1$
        titleAndBodyFileNode = templateDom.selectSingleNode(
            u"/zns:template/zns:bodyAndTitleFile")  #$NON-NLS-1$
        bodyOnlyFileNode = templateDom.selectSingleNode(
            u"/zns:template/zns:bodyOnlyFile")  #$NON-NLS-1$
        creationTimeNode = templateDom.selectSingleNode(
            u"/zns:template/zns:creationTime")  #$NON-NLS-1$
        lastModifiedTimeNode = templateDom.selectSingleNode(
            u"/zns:template/zns:lastModifiedTime")  #$NON-NLS-1$

        root = rootNode.getText()
        if nameNode:
            name = nameNode.getText()
        else:
            name = u"Unnamed Template"  #$NON-NLS-1$

        if sourceNode:
            source = sourceNode.getText()
        else:
            source = u"Zoundry Raven Alpha"  #$NON-NLS-1$
        allFile = allFileNode.getText()
        titleAndBodyFile = titleAndBodyFileNode.getText()
        bodyOnlyFile = bodyOnlyFileNode.getText()
        creationTime = creationTimeNode.getText()
        lastModifiedTime = lastModifiedTimeNode.getText()

        template.setRootFileName(root)
        template.setName(name)
        template.setSource(source)
        template.setAllFileName(allFile)
        template.setTitleAndBodyFileName(titleAndBodyFile)
        template.setBodyOnlyFileName(bodyOnlyFile)
        template.setCreationTime(ZSchemaDateTime(creationTime))
        template.setLastModifiedTime(ZSchemaDateTime(lastModifiedTime))
コード例 #26
0
ファイル: startup.py プロジェクト: Tidosho/zoundryraven
def tempFileFilter(filePath):
    if os.path.isfile(filePath):
        (shortFileName, absolutePath, fileSize, timeStamp) = getFileMetaData(filePath) #@UnusedVariable
        today = ZSchemaDateTime()
        today.setHour(0)
        today.setMinutes(0)
        today.setSeconds(0)
        return timeStamp < today
    else:
        return False
コード例 #27
0
ファイル: datastore.py プロジェクト: mpm2050/Raven
    def saveDocument(self, document, metaDataOnly = False):
        if not document.getId():
            self.addDocument(document)
            return

        if not metaDataOnly:
            document.setLastModifiedTime(ZSchemaDateTime())

        documentXmlPath = self._getDocumentPath( document.getId() )
        saveDocument(document, documentXmlPath)
        self.logger.debug(u"Saved document id=%s" % document.getId()) #$NON-NLS-1$
        self._fireDocumentChangedEvent(document, metaDataOnly)
コード例 #28
0
 def _raiseError(self, errorMessage, errorDetails):
     self.logger.error(errorMessage)
     self.error = (errorMessage, errorDetails)
     self.listeners.doCallback(
         u"onError", [self, errorMessage, errorDetails])  #$NON-NLS-1$
     self._writeToLog(
         _extstr(u"backgroundtaskimpl.ErrorInTask") %
         errorMessage)  #$NON-NLS-1$
     self._writeToLog(errorDetails)
     self.endTime = ZSchemaDateTime()
     self.stopped = True
     self.cancelled = True
コード例 #29
0
    def run(self):
        self._writeToLog(
            u"[bgtask.%s] Task started: %s" %
            (self.getName(), unicode(ZSchemaDateTime())))  #$NON-NLS-1$
        # Send the 'onStarted' event.
        self._fireStartEvent()

        # Run the actual task logic here.
        try:
            self._run()
        except ZException, ze:
            self._reportException(ze)
コード例 #30
0
ファイル: splash.py プロジェクト: mpm2050/Raven
    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
コード例 #31
0
    def _incrementWork(self, message, amount=1, logMessage=True):
        if self.isCancelled():
            return
        self.lastMessage = message
        self.numCompletedWorkUnits = self.numCompletedWorkUnits + amount
        self.listeners.doCallback(u"onWorkDone",
                                  [self, amount, message])  #$NON-NLS-1$
        if logMessage:
            self._writeToLog(message)

        if self.numCompletedWorkUnits == self.numWorkUnits:
            self.stopped = True
            self.endTime = ZSchemaDateTime()
            self.listeners.doCallback(u"onComplete", [self])  #$NON-NLS-1$
コード例 #32
0
 def _sendTrackbacks(self, trackbackUrlList):
     blog = self._getContext().getBlog()
     blogName = getNoneString(blog.getName())
     id = blog.getUrl()
     title = self._getContext().getTitle()
     if blogName is None:
         blogName = title
     # get the post entry url.
     postUrl = getNoneString(self._getContext().getUrl())
     if not postUrl:
         pass
         #log error and return
     if not id:
         id = postUrl
     # post summary
     excerpt = self._getContext().getXhtmlDocument().getSummary(500)
     pinger = ZTrackbackPinger()
     sentCount = 0
     for pingUrl in trackbackUrlList:
         if self.isCancelled():
             return
         s = u"Sending trackback to %s" % pingUrl  #$NON-NLS-1$
         self._getContext().logInfo(self, s)
         self._getContext().notifyProgress(self, s, 1, False)
         ok = False
         msg = u""  #$NON-NLS-1$
         try:
             response = pinger.ping(pingUrl, id, postUrl, title, blogName,
                                    excerpt)
             ok = response.isSuccessful()
             msg = getSafeString(response.getMessage())
         except Exception, e:
             ok = False
             msg = unicode(e)
         if ok:
             trackback = ZTrackback()
             trackback.setUrl(pingUrl)  #$NON-NLS-1$
             trackback.setSentDate(ZSchemaDateTime())
             pubInfo = self._getPubInfo()
             if pubInfo:
                 pubInfo.addTrackback(trackback)
             sentCount = sentCount + 1
             s = u"Trackback sent successfully: %s" % msg  #$NON-NLS-1$
             self._getContext().logInfo(self, s)
             self._getContext().notifyProgress(self, s, 0, False)
         else:
             s = u"Trackback failed: %s" % msg  #$NON-NLS-1$
             self._getContext().logError(self, s)
             self._getContext().notifyProgress(self, s, 0, False)
コード例 #33
0
ファイル: zbwimporter.py プロジェクト: Tidosho/zoundryraven
 def _getRegistryEntries(self, joeyBlogId):
     # returns list of maps, where is map contains registry entry information url, filepath, filesize, and time.
     rval = []
     localFileDom = self._getJoeyLocalFilesDom()
     if not localFileDom:
         return rval
     remoteFileDom = self._getJoeyRemoteFilesDom()
     if not remoteFileDom:
         return rval
     # build map of file id:url of uploaded images
     xpath = None
     if joeyBlogId is not None:
         xpath = u"""//blog[@id="%s"]/store[@type='xmlrpc']/file""" % joeyBlogId #$NON-NLS-1$
     else:
         xpath = u"//store[@type='ftp']/file" #$NON-NLS-1$
     nodeList = remoteFileDom.selectNodes(xpath)
     if not nodeList or len(nodeList) == 0:
         return
     remoteEntries = []
     for node in nodeList:
         id = node.getAttribute(u"id") #$NON-NLS-1$
         url = node.getText()
         if id and url:
             remoteEntries.append( (id, url) )
     # get local file path, size and time
     for (id, url) in remoteEntries:
         node = localFileDom.selectSingleNode(u"""//file[@id="%s"]""" % id) #$NON-NLS-1$
         if node:
             fileTime = ZSchemaDateTime( long(node.getAttribute(u"time")) ) #$NON-NLS-1$
             regEntry = {}
             regEntry[u"url"] = url #$NON-NLS-1$
             regEntry[u"timestamp"] = fileTime.__str__() #$NON-NLS-1$
             regEntry[u"size"] = node.getAttribute(u"size") #$NON-NLS-1$ #$NON-NLS-2$
             regEntry[u"path"] = node.getText() #$NON-NLS-1$
             rval.append(regEntry)
     return rval
コード例 #34
0
ファイル: fileutil.py プロジェクト: mpm2050/Raven
def getFileMetaData(fileName):
    u"""getFileMetaData(string) -> (string, string, int, ZSchemaDateTime)
    Called to get meta information about a file.  Pass in the file
    name and get back a tuple of information:  (shortFileName, abs
    file name, file size, timestamp).""" #$NON-NLS-1$

    if not os.path.isfile(fileName):
        raise ZException(_extstr(u"fileutil.NotAValidFileError") %
                         fileName)  #$NON-NLS-1$
    shortName = os.path.basename(fileName)
    absPath = os.path.abspath(fileName)
    status = os.lstat(absPath)
    size = status[stat.ST_SIZE]
    modEpoch = status[stat.ST_MTIME]
    modifiedTimeDT = getDateTimeFromEpoch(modEpoch)
    return (shortName, absPath, size, ZSchemaDateTime(modifiedTimeDT))
コード例 #35
0
 def __init__(self):
     self.id = None
     self.name = None
     self.startTime = ZSchemaDateTime()
     self.endTime = None
     self.error = None
     self.numWorkUnits = 0
     self.numCompletedWorkUnits = 0
     self.logLocation = None
     self.logFile = None
     self.running = False
     self.stopped = True
     self.cancelled = False
     self.lastMessage = None
     self.listeners = ZListenerSet()
     self.logger = getLoggerService()