Changeset b297ba9 in sasmodels for sasmodels/rst2html.py
- Timestamp:
- Mar 20, 2019 5:03:50 PM (5 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 4e28511
- Parents:
- 0d362b7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/rst2html.py
r1fbadb2 rb297ba9 142 142 143 143 def load_rst_as_html(filename): 144 # type: (str) -> str 145 """Load rst from file and convert to html""" 144 146 from os.path import expanduser 145 147 with open(expanduser(filename)) as fid: … … 149 151 150 152 def wxview(html, url="", size=(850, 540)): 153 # type: (str, str, Tuple[int, int]) -> "wx.Frame" 154 """View HTML in a wx dialog""" 151 155 import wx 152 156 from wx.html2 import WebView … … 158 162 159 163 def view_html_wxapp(html, url=""): 164 # type: (str, str) -> None 165 """HTML viewer app in wx""" 160 166 import wx # type: ignore 161 167 app = wx.App() … … 164 170 165 171 def view_url_wxapp(url): 172 # type: (str) -> None 173 """URL viewer app in wx""" 166 174 import wx # type: ignore 167 175 from wx.html2 import WebView … … 174 182 175 183 def qtview(html, url=""): 184 # type: (str, str) -> "QWebView" 185 """View HTML in a Qt dialog""" 176 186 try: 177 187 from PyQt5.QtWebKitWidgets import QWebView … … 186 196 187 197 def view_html_qtapp(html, url=""): 198 # type: (str, str) -> None 199 """HTML viewer app in Qt""" 188 200 import sys 189 201 try: … … 196 208 197 209 def view_url_qtapp(url): 210 # type: (str) -> None 211 """URL viewer app in Qt""" 198 212 import sys 199 213 try: … … 217 231 218 232 def can_use_qt(): 233 # type: () -> bool 219 234 """ 220 235 Return True if QWebView exists. … … 233 248 234 249 def view_help(filename, qt=False): 250 # type: (str, bool) -> None 251 """View rst or html file. If *qt* use q viewer, otherwise use wx.""" 235 252 import os 236 253 … … 252 269 253 270 def main(): 271 # type: () -> None 272 """Command line interface to rst or html viewer.""" 254 273 import sys 255 274 view_help(sys.argv[1], qt=False)
Note: See TracChangeset
for help on using the changeset viewer.