Skip to content

Instantly share code, notes, and snippets.

@eerne
Created June 26, 2011 14:15
Show Gist options
  • Save eerne/1047647 to your computer and use it in GitHub Desktop.
Save eerne/1047647 to your computer and use it in GitHub Desktop.
PySide testing python setup.py py2app
#!/usr/bin/env python
import sys
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import *
app = QApplication(sys.argv)
view = QWebView(
url = 'content.html'
)
settings = QWebSettings.globalSettings()
#settings.setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
settings.setAttribute(QWebSettings.LocalContentCanAccessRemoteUrls, True)
# http://www.pyside.org/docs/pyside/PySide/QtWebKit/QWebSecurityOrigin.html
# QWebSecurityOrigin.addLocalScheme('mydomain')
# print QWebSecurityOrigin.localSchemes()
view.setWindowTitle('App')
# view.showFullScreen()
# view.showNormal()
view.resize(380, 240)
fileMenu = QMenu('&file')
aboutAction = fileMenu.addAction('&About')
aboutQtAction = fileMenu.addAction('&About Qt')
aboutQtAction.triggered.connect(app.aboutQt)
openAction = fileMenu.addAction('&Open...')
openAction.setShortcut('Ctrl+O')
saveAction = fileMenu.addAction('&Save...')
saveAction.setShortcut('Ctrl+S')
fileMenu.addSeparator()
quitAction = fileMenu.addAction('&Quit...')
quitAction.setShortcut('Ctrl+Q')
quitAction.triggered.connect(app.quit)
menu = QMenuBar()
menu.addMenu(fileMenu)
app.setQuitOnLastWindowClosed(True)
# app.lastWindowClosed.connect(app.quit)
#app.connect(app, SIGNAL('lastWindowClosed()'),
# app, SLOT('quit()'))
#page = view.page()
#settings = page.settings()
view.show()
sys.exit(app.exec_())
from setuptools import setup
setup(
app = ['app.py'],
options = {
'py2app': {
'argv_emulation': 0,
#'plist': {
# 'LSPrefersPPC': False,
#},
'includes': ['PySide.QtCore', 'PySide.QtGui', 'PySide.QtWebKit', 'PySide.QtNetwork'],
}
},
data_files = ['content.html'],
setup_requires = ['py2app'],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment