Changeset f2f5413 in sasmodels
- Timestamp:
- Apr 14, 2017 6:48:18 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3a45c2c, 630156b
- Parents:
- 63a7fe8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/rst2html.py
rc4e3215 rf2f5413 155 155 return frame 156 156 157 def view_html_wxapp(html, url=""): 158 import wx # type: ignore 159 app = wx.App() 160 frame = wxview(html, url) 161 app.MainLoop() 162 163 def view_url_wxapp(url): 164 import wx # type: ignore 165 from wx.html2 import WebView 166 app = wx.App() 167 frame = wx.Frame(None, -1, size=(850, 540)) 168 view = WebView.New(frame) 169 view.LoadURL(url) 170 frame.Show() 171 app.MainLoop() 172 157 173 def qtview(html, url=""): 158 174 try: … … 167 183 return helpView 168 184 169 def view_html_wxapp(html, url=""):170 import wx # type: ignore171 app = wx.App()172 frame = wxview(html, url)173 app.MainLoop()174 175 185 def view_html_qtapp(html, url=""): 176 186 import sys … … 183 193 sys.exit(app.exec_()) 184 194 185 def view_rst_app(filename, qt=False): 195 def view_url_qtapp(url): 196 import sys 197 try: 198 from PyQt5.QtWidgets import QApplication 199 except ImportError: 200 from PyQt4.QtGui import QApplication 201 app = QApplication([]) 202 try: 203 from PyQt5.QtWebKitWidgets import QWebView 204 from PyQt5.QtCore import QUrl 205 except ImportError: 206 from PyQt4.QtWebkit import QWebView 207 from PyQt4.QtCore import QUrl 208 frame = QWebView() 209 frame.load(QUrl(url)) 210 frame.show() 211 sys.exit(app.exec_()) 212 213 def view_help(filename, qt=False): 186 214 import os 187 html = load_rst_as_html(filename) 188 url="file://"+os.path.abspath(filename)+"/" 189 if qt: 190 view_html_qtapp(html, url) 215 url="file:///"+os.path.abspath(filename).replace("\\","/") 216 if filename.endswith('.rst'): 217 html = load_rst_as_html(filename) 218 if qt: 219 view_html_qtapp(html, url) 220 else: 221 view_html_wxapp(html, url) 191 222 else: 192 view_html_wxapp(html, url) 223 if qt: 224 view_url_qtapp(url) 225 else: 226 view_url_wxapp(url) 193 227 194 228 if __name__ == "__main__": 195 229 import sys 196 view_ rst_app(sys.argv[1], qt=True)197 230 view_help(sys.argv[1], qt=True) 231
Note: See TracChangeset
for help on using the changeset viewer.