Compare commits
	
		
			2 commits
		
	
	
		
			c6a7d839d9
			...
			97db0946da
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 97db0946da | ||
|   | 12ff9b924e | 
					 4 changed files with 41 additions and 43 deletions
				
			
		|  | @ -62,10 +62,10 @@ for the PyQt ```app.exec``` and the exiting of the program. | ||||||
| We've decided to use the best of the shims that merge the Python | We've decided to use the best of the shims that merge the Python | ||||||
| ```asyncio``` and Qt event loops: | ```asyncio``` and Qt event loops: | ||||||
| [qasyc](https://github.com/CabbageDevelopment/qasync). This is seen as | [qasyc](https://github.com/CabbageDevelopment/qasync). This is seen as | ||||||
| the successor to the sorta abandoned[quamash](https://github.com/harvimt/quamash). | the successor to the sorta abandoned [quamash](https://github.com/harvimt/quamash). | ||||||
| The code is based on a | The code is based on a | ||||||
| [comment](https://github.com/CabbageDevelopment/qasync/issues/35#issuecomment-1315060043) | [comment](https://github.com/CabbageDevelopment/qasync/issues/35#issuecomment-1315060043) | ||||||
| by [Alex Marcha](https://github.com/hosaka) who's excellent code helped me. | by [Alex March](https://github.com/hosaka) who's excellent code helped me. | ||||||
| As this is my first use of ```asyncio``` and ```qasync``` I may have | As this is my first use of ```asyncio``` and ```qasync``` I may have | ||||||
| introduced some errors and it may be improved on, but it works, and | introduced some errors and it may be improved on, but it works, and | ||||||
| it not a monolithic Qt program, so it can be used as a library. | it not a monolithic Qt program, so it can be used as a library. | ||||||
|  |  | ||||||
|  | @ -3,15 +3,15 @@ | ||||||
| 
 | 
 | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
| import qasync |  | ||||||
| import asyncio | import asyncio | ||||||
| import time | import time | ||||||
| import random | import random | ||||||
| 
 | 
 | ||||||
| from PyQt5 import QtWidgets | # let qasync figure out what Qt we are using - we dont care | ||||||
| from PyQt5.QtWidgets import (QProgressBar, QWidget, QVBoxLayout) | from qasync import QApplication, QtWidgets, QEventLoop | ||||||
| 
 | 
 | ||||||
| from phantompy import Render | from phantompy import Render | ||||||
|  | # if you want an example of looking for things in downloaded HTML: | ||||||
| # from lookupdns import LookFor as Render | # from lookupdns import LookFor as Render | ||||||
| from support_phantompy import vsetup_logging, omain_argparser | from support_phantompy import vsetup_logging, omain_argparser | ||||||
| 
 | 
 | ||||||
|  | @ -28,7 +28,7 @@ class Widget(QtWidgets.QWidget): | ||||||
|         box = QtWidgets.QHBoxLayout() |         box = QtWidgets.QHBoxLayout() | ||||||
|         self.setLayout(box) |         self.setLayout(box) | ||||||
|         box.addWidget(self._label) |         box.addWidget(self._label) | ||||||
|         self.progress = QProgressBar() |         self.progress = QtWidgets.QProgressBar() | ||||||
|         self.progress.setRange(0, 99) |         self.progress.setRange(0, 99) | ||||||
|         box.addWidget(self.progress) |         box.addWidget(self.progress) | ||||||
| 
 | 
 | ||||||
|  | @ -80,7 +80,7 @@ def iMain(largs): | ||||||
|         vsetup_logging(oargs.log_level, logfile='', stream=sys.stderr) |         vsetup_logging(oargs.log_level, logfile='', stream=sys.stderr) | ||||||
|     except: pass |     except: pass | ||||||
| 
 | 
 | ||||||
|     app = QtWidgets.QApplication([]) |     app = QApplication([]) | ||||||
|     app.lstart = [] |     app.lstart = [] | ||||||
|     if bgui: |     if bgui: | ||||||
|         widget = Widget() |         widget = Widget() | ||||||
|  | @ -89,7 +89,7 @@ def iMain(largs): | ||||||
|     else: |     else: | ||||||
|         widget = None |         widget = None | ||||||
| 
 | 
 | ||||||
|     loop = qasync.QEventLoop(app) |     loop = QEventLoop(app) | ||||||
|     asyncio.set_event_loop(loop) |     asyncio.set_event_loop(loop) | ||||||
| 
 | 
 | ||||||
|     url = oargs.html_url |     url = oargs.html_url | ||||||
|  |  | ||||||
							
								
								
									
										66
									
								
								setup.py
									
										
									
									
									
								
							
							
						
						
									
										66
									
								
								setup.py
									
										
									
									
									
								
							|  | @ -1,4 +1,4 @@ | ||||||
| # -*- coding: utf-8 -*- | # -*-mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -* | ||||||
| 
 | 
 | ||||||
| from setuptools import setup | from setuptools import setup | ||||||
| 
 | 
 | ||||||
|  | @ -8,36 +8,34 @@ long_description = "\n\n".join([ | ||||||
|     open("README.md").read(), |     open("README.md").read(), | ||||||
|     ]) |     ]) | ||||||
| 
 | 
 | ||||||
| setup( | if __name__ == '__main__': | ||||||
|     name="pahntompy", |     setup( | ||||||
|     version=__version__, |         name="phantompy", | ||||||
|     description="""A simple replacement for phantomjs using PyQt""", |         version=__version__, | ||||||
|     long_description=long_description, |         description="""A simple replacement for phantomjs using PyQt""", | ||||||
|     author="Michael Franzl (originally) Goebel", |         long_description=long_description, | ||||||
|     author_email='', |         author="Michael Franzl (originally)", | ||||||
|     license="1clause BSD", |         author_email='', | ||||||
|     packages=['phantompy'], |         license="1clause BSD", | ||||||
|     # url="", |         packages=['phantompy'], | ||||||
|     # These are for reference only, pip is not able to download packages |         # url="", | ||||||
|     # from github because the archives do not include the project-name. |         # download_url="https://", | ||||||
|     download_url="https://github.com/debops/yaml2rst/releases", |         keywords=['JavaScript', 'phantomjs'], | ||||||
|     keywords=['JavaScript', 'phantomjs'], |         # maybe less - nothing fancy | ||||||
|     python_requires=">=3.6", |         python_requires=">=3.6", | ||||||
|     # probably works on PyQt6 and PySide2 but untested |         # probably works on PyQt6 and PySide2 but untested | ||||||
|     install_requires=['qasync', 'PyQt5'], |         # https://github.com/CabbageDevelopment/qasync/ | ||||||
|     entry_points={ |         install_requires=['qasync', 'PyQt5'], | ||||||
|         'console_scripts': [ |         entry_points={ | ||||||
|             'phantompy = phantompy.__main__:iMain', |             'console_scripts': ['phantompy = phantompy.__main__:iMain', ]}, | ||||||
|         ] |         classifiers=[ | ||||||
|     }, |                      'Development Status :: 4 - Beta', | ||||||
|     classifiers=[ |                      'Environment :: Console', | ||||||
|         'Development Status :: 4 - Beta', |                      'Intended Audience :: Developers', | ||||||
|         'Environment :: Console', |                      'Intended Audience :: Web Developers', | ||||||
|         'Intended Audience :: Developers', |                      'Natural Language :: English', | ||||||
|         'Intended Audience :: Web Developers', |                      'Operating System :: OS Independent', | ||||||
|         'Natural Language :: English', |                      'Programming Language :: Python :: 3', | ||||||
|         'Operating System :: OS Independent', |                      'Topic :: Software Development :: Documentation', | ||||||
|         'Programming Language :: Python :: 3', |                      ], | ||||||
|         'Topic :: Software Development :: Documentation', |                      ) | ||||||
|     ], |  | ||||||
| ) |  | ||||||
|  |  | ||||||
|  | @ -108,7 +108,7 @@ def omain_argparser(_=None): | ||||||
|                         help="Write loaded and javascripted result to a HTML file") |                         help="Write loaded and javascripted result to a HTML file") | ||||||
|     parser.add_argument('--pdf_output', type=str, default='', |     parser.add_argument('--pdf_output', type=str, default='', | ||||||
|                         help="Write loaded and javascripted result to a PDF file") |                         help="Write loaded and javascripted result to a PDF file") | ||||||
|     parser.add_argument('--show_gui', type=bool, default=False, store_action=True), |     parser.add_argument('--show_gui', type=bool, default=False, store_action=True, | ||||||
|                         help="show a progress meter that doesn't work") |                         help="show a progress meter that doesn't work") | ||||||
|     parser.add_argument('html_url', type=str, nargs='?', |     parser.add_argument('html_url', type=str, nargs='?', | ||||||
|                         required=True, |                         required=True, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue