def refreshcontent(self): markdownpageinstance = getattr(self.parent, 'MarkdownPage') frame = markdownpageinstance.view.page().mainFrame() mdhtml = unicode(frame.evaluateJavaScript("$('#preview').html()")) if not os.path.exists(os.sep.join([os.getcwd(), 'doc'])): os.mkdir(os.sep.join([os.getcwd(), 'doc'])) htmlfile = os.sep.join([os.getcwd(), 'doc', 'preview.html']) self.theme = "evernote" self.html = mdhtmlcomplete( mdhtml, windowsoptions['markdownthemes']['theme%s' % self.theme], htmlfile, 'templateDef_evernote') url = QtCore.QUrl('file:///' + htmlfile) self.view.load(url)
def settheme(self): theme = self.sender().objectName()[5:-6] self.theme = theme markdownpageinstance = getattr(self.parent, 'MarkdownPage') frame = markdownpageinstance.view.page().mainFrame() mdhtml = unicode(frame.evaluateJavaScript("$('#preview').html()")) if theme == "evernote": self.html = mdhtmlcomplete( mdhtml, windowsoptions['markdownthemes']['themeevernote'], template='templateDef_evernote') elif theme == "jeklyy": self.html = mdhtmlcomplete( mdhtml, windowsoptions['markdownthemes']['themejeklyy'], template='templateDef_jeklyy') else: self.html = mdhtmlcomplete( mdhtml, windowsoptions['markdownthemes']['theme%s' % theme]) self.view.setHtml(self.html, QtCore.QUrl(os.getcwd()))
def loadfromlocal(self): html = self.auto_html(templateDef_absolute) url = QtCore.QUrl('file:///' + os.sep.join( [os.getcwd(), 'webjscss', 'MaDeEditor', 'MaDeEditor.html'])) self.view.load(url) self.view.setFocus()
def loadfromlocal(self): html = self.auto_html(templateDef_absolute) self.view.setHtml(html, QtCore.QUrl(os.getcwd()))