Merge pull request #104 from Roejames12/master

Issue #154, and a few others
1.3
Ariya Hidayat 2011-07-03 14:01:18 -07:00
commit 89e4e59d07
9 changed files with 145 additions and 134 deletions

View File

@ -49,7 +49,7 @@ window.WebPage = function() {
operation: arguments[1],
data: arguments[2]
}, this.settings);
return;
return;
} else if (arguments.length === 4) {
this.onLoadFinished = arguments[3];
this.openUrl(arguments[0], {
@ -78,6 +78,10 @@ window.WebPage = function() {
this._appendScriptElement(scriptUrl);
};
page.destroy = function() {
phantom._destroy(page);
};
return page;
};

View File

@ -703,22 +703,6 @@ class FileSystem(QObject):
# drive letter first
return os.path.isabs(path)
@pyqtSlot(str, result=bool)
def isBlock(self, path):
try:
return stat.S_ISBLK(os.stat(path).st_mode)
except OSError as (t, e):
qDebug('FileSystem.isBlock - %s: \'%s\'' % (e, path))
return False
@pyqtSlot(str, result=bool)
def isCharacter(self, path):
try:
return stat.S_ISCHR(os.stat(path).st_mode)
except OSError as (t, e):
qDebug('FileSystem.isCharacter - %s: \'%s\'' % (e, path))
return False
@pyqtSlot(str, result=bool)
def isDirectory(self, path):
return os.path.isdir(path)
@ -727,14 +711,6 @@ class FileSystem(QObject):
def isExecutable(self, path):
return os.access(path, os.X_OK)
@pyqtSlot(str, result=bool)
def isFifo(self, path):
try:
return stat.S_ISFIFO(os.stat(path).st_mode)
except OSError as (t, e):
qDebug('FileSystem.isFifo - %s: \'%s\'' % (e, path))
return False
@pyqtSlot(str, result=bool)
def isFile(self, path):
return os.path.isfile(path)
@ -751,26 +727,10 @@ class FileSystem(QObject):
def isReadable(self, path):
return os.access(path, os.R_OK)
@pyqtSlot(str, result=bool)
def isRegular(self, path):
try:
return stat.S_ISREG(os.stat(path).st_mode)
except OSError as (t, e):
qDebug('FileSystem.isRegular - %s: \'%s\'' % (e, path))
return False
@pyqtSlot(str, result=bool)
def isWritable(self, path):
return os.access(path, os.W_OK)
@pyqtSlot(str, result=bool)
def isSocket(self, path):
try:
return stat.S_ISSOCK(os.stat(path).st_mode)
except OSError as (t, e):
qDebug('FileSystem.isSocket - %s: \'%s\'' % (e, path))
return False
@pyqtSlot(str, result=bool)
def linkExists(self, path):
return os.path.lexists(path)

View File

@ -105,6 +105,11 @@ class Phantom(QObject):
# Properties and methods exposed to JavaScript
##
@pyqtSlot(WebPage)
def _destroy(self, page):
self.m_pages.remove(page)
sip.delete(page)
@pyqtProperty('QStringList')
def args(self):
return self.m_args
@ -128,12 +133,13 @@ class Phantom(QObject):
self.m_terminated = True
self.m_returnValue = code
# stop javascript execution in start script
# and delete all the pages C++ objects,
# then delete the Python references
# stop javascript execution in start script;
# delete all the pages C++ objects, then clear
# the page list, and empty the Phantom page
for page in self.m_pages:
sip.delete(page)
del self.m_page, self.m_pages
del self.m_pages[:]
self.m_page = None
QApplication.instance().exit(code)

View File

@ -2,7 +2,7 @@
# Resource object code
#
# Created: Wed Jun 29 02:06:36 2011
# Created: Fri Jul 1 22:57:05 2011
# by: The Resource Compiler for PyQt (Qt v4.7.2)
#
# WARNING! All changes made in this file will be lost!
@ -10,7 +10,7 @@
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x0c\x28\
\x00\x00\x0c\x64\
\x2f\
\x2f\x20\x54\x68\x69\x73\x20\x61\x6c\x6c\x6f\x77\x73\x20\x63\x72\
\x65\x61\x74\x69\x6e\x67\x20\x61\x20\x6e\x65\x77\x20\x77\x65\x62\
@ -129,84 +129,88 @@ qt_resource_data = "\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7d\
\x2c\x20\x74\x68\x69\x73\x2e\x73\x65\x74\x74\x69\x6e\x67\x73\x29\
\x3b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x72\x65\
\x74\x75\x72\x6e\x3b\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x20\x65\x6c\x73\x65\
\x20\x69\x66\x20\x28\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x2e\x6c\
\x65\x6e\x67\x74\x68\x20\x3d\x3d\x3d\x20\x34\x29\x20\x7b\x0a\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x74\x68\x69\x73\x2e\
\x6f\x6e\x4c\x6f\x61\x64\x46\x69\x6e\x69\x73\x68\x65\x64\x20\x3d\
\x20\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x5b\x33\x5d\x3b\x0a\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x74\x68\x69\x73\x2e\
\x6f\x70\x65\x6e\x55\x72\x6c\x28\x61\x72\x67\x75\x6d\x65\x6e\x74\
\x73\x5b\x30\x5d\x2c\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x70\x65\x72\x61\x74\x69\x6f\
\x6e\x3a\x20\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x5b\x31\x5d\x2c\
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x64\x61\x74\x61\x3a\x20\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\
\x5b\x32\x5d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x7d\x2c\x20\x74\x68\x69\x73\x2e\x73\x65\x74\x74\
\x69\x6e\x67\x73\x29\x3b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x72\x65\x74\x75\x72\x6e\x3b\x0a\x20\x20\x20\x20\x20\
\x20\x20\x20\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x74\x68\x72\
\x6f\x77\x20\x22\x57\x72\x6f\x6e\x67\x20\x75\x73\x65\x20\x6f\x66\
\x20\x57\x65\x62\x50\x61\x67\x65\x23\x6f\x70\x65\x6e\x22\x3b\x0a\
\x20\x20\x20\x20\x7d\x3b\x0a\x0a\x20\x20\x20\x20\x70\x61\x67\x65\
\x2e\x69\x6e\x63\x6c\x75\x64\x65\x4a\x73\x20\x3d\x20\x66\x75\x6e\
\x63\x74\x69\x6f\x6e\x28\x73\x63\x72\x69\x70\x74\x55\x72\x6c\x2c\
\x20\x6f\x6e\x53\x63\x72\x69\x70\x74\x4c\x6f\x61\x64\x65\x64\x29\
\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x2f\x2f\x20\x52\x65\
\x67\x69\x73\x74\x65\x72\x20\x74\x65\x6d\x70\x6f\x72\x61\x72\x79\
\x20\x73\x69\x67\x6e\x61\x6c\x20\x68\x61\x6e\x64\x6c\x65\x72\x20\
\x66\x6f\x72\x20\x27\x61\x6c\x65\x72\x74\x28\x29\x27\x0a\x20\x20\
\x20\x20\x20\x20\x20\x20\x74\x68\x69\x73\x2e\x6a\x61\x76\x61\x53\
\x63\x72\x69\x70\x74\x41\x6c\x65\x72\x74\x53\x65\x6e\x74\x2e\x63\
\x6f\x6e\x6e\x65\x63\x74\x28\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\
\x6d\x73\x67\x46\x72\x6f\x6d\x41\x6c\x65\x72\x74\x29\x20\x7b\x0a\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x69\x66\x20\x28\
\x20\x6d\x73\x67\x46\x72\x6f\x6d\x41\x6c\x65\x72\x74\x20\x3d\x3d\
\x3d\x20\x73\x63\x72\x69\x70\x74\x55\x72\x6c\x20\x29\x20\x7b\x0a\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x2f\x2f\x20\x52\x65\x73\x6f\x75\x72\x63\x65\x20\x6c\x6f\x61\x64\
\x65\x64\x2c\x20\x74\x69\x6d\x65\x20\x74\x6f\x20\x66\x69\x72\x65\
\x20\x74\x68\x65\x20\x63\x61\x6c\x6c\x62\x61\x63\x6b\x0a\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x6e\
\x53\x63\x72\x69\x70\x74\x4c\x6f\x61\x64\x65\x64\x28\x73\x63\x72\
\x69\x70\x74\x55\x72\x6c\x29\x3b\x0a\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2f\x2f\x20\x41\x6e\x64\x20\
\x64\x69\x73\x63\x6f\x6e\x6e\x65\x63\x74\x20\x74\x68\x65\x20\x73\
\x69\x67\x6e\x61\x6c\x20\x68\x61\x6e\x64\x6c\x65\x72\x0a\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x74\x72\
\x79\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x74\x68\x69\x73\x2e\x6a\x61\x76\
\x61\x53\x63\x72\x69\x70\x74\x41\x6c\x65\x72\x74\x53\x65\x6e\x74\
\x2e\x64\x69\x73\x63\x6f\x6e\x6e\x65\x63\x74\x28\x61\x72\x67\x75\
\x6d\x65\x6e\x74\x73\x2e\x63\x61\x6c\x6c\x65\x65\x29\x3b\x0a\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7d\
\x20\x63\x61\x74\x63\x68\x20\x28\x65\x29\x20\x7b\x7d\x0a\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x0a\x20\x20\x20\x20\
\x20\x20\x20\x20\x7d\x29\x3b\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\
\x20\x2f\x2f\x20\x41\x70\x70\x65\x6e\x64\x20\x74\x68\x65\x20\x73\
\x63\x72\x69\x70\x74\x20\x74\x61\x67\x20\x74\x6f\x20\x74\x68\x65\
\x20\x62\x6f\x64\x79\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x74\x68\
\x69\x73\x2e\x5f\x61\x70\x70\x65\x6e\x64\x53\x63\x72\x69\x70\x74\
\x45\x6c\x65\x6d\x65\x6e\x74\x28\x73\x63\x72\x69\x70\x74\x55\x72\
\x6c\x29\x3b\x0a\x20\x20\x20\x20\x7d\x3b\x0a\x0a\x20\x20\x20\x20\
\x72\x65\x74\x75\x72\x6e\x20\x70\x61\x67\x65\x3b\x0a\x7d\x3b\x0a\
\x0a\x2f\x2f\x20\x4d\x61\x6b\x65\x20\x22\x66\x73\x2e\x6f\x70\x65\
\x6e\x22\x20\x74\x68\x72\x6f\x77\x20\x61\x6e\x20\x65\x78\x63\x65\
\x70\x74\x69\x6f\x6e\x20\x69\x6e\x20\x63\x61\x73\x65\x20\x69\x74\
\x20\x66\x61\x69\x6c\x73\x0a\x77\x69\x6e\x64\x6f\x77\x2e\x66\x73\
\x2e\x6f\x70\x65\x6e\x20\x3d\x20\x66\x75\x6e\x63\x74\x69\x6f\x6e\
\x28\x70\x61\x74\x68\x2c\x20\x6d\x6f\x64\x65\x29\x20\x7b\x0a\x20\
\x20\x20\x20\x76\x61\x72\x20\x66\x69\x6c\x65\x20\x3d\x20\x77\x69\
\x6e\x64\x6f\x77\x2e\x66\x73\x2e\x5f\x6f\x70\x65\x6e\x28\x70\x61\
\x74\x68\x2c\x20\x6d\x6f\x64\x65\x29\x3b\x0a\x20\x20\x20\x20\x69\
\x66\x20\x28\x66\x69\x6c\x65\x29\x20\x7b\x0a\x20\x20\x20\x20\x20\
\x20\x20\x20\x72\x65\x74\x75\x72\x6e\x20\x66\x69\x6c\x65\x3b\x0a\
\x20\x20\x20\x20\x7d\x0a\x20\x20\x20\x20\x74\x68\x72\x6f\x77\x20\
\x22\x55\x6e\x61\x62\x6c\x65\x20\x74\x6f\x20\x6f\x70\x65\x6e\x20\
\x66\x69\x6c\x65\x20\x27\x22\x2b\x20\x70\x61\x74\x68\x20\x2b\x22\
\x27\x22\x3b\x0a\x7d\x3b\x0a\
\x74\x75\x72\x6e\x3b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x20\
\x65\x6c\x73\x65\x20\x69\x66\x20\x28\x61\x72\x67\x75\x6d\x65\x6e\
\x74\x73\x2e\x6c\x65\x6e\x67\x74\x68\x20\x3d\x3d\x3d\x20\x34\x29\
\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x74\
\x68\x69\x73\x2e\x6f\x6e\x4c\x6f\x61\x64\x46\x69\x6e\x69\x73\x68\
\x65\x64\x20\x3d\x20\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x5b\x33\
\x5d\x3b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x74\
\x68\x69\x73\x2e\x6f\x70\x65\x6e\x55\x72\x6c\x28\x61\x72\x67\x75\
\x6d\x65\x6e\x74\x73\x5b\x30\x5d\x2c\x20\x7b\x0a\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x70\x65\x72\
\x61\x74\x69\x6f\x6e\x3a\x20\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\
\x5b\x31\x5d\x2c\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x64\x61\x74\x61\x3a\x20\x61\x72\x67\x75\x6d\
\x65\x6e\x74\x73\x5b\x32\x5d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x2c\x20\x74\x68\x69\x73\x2e\
\x73\x65\x74\x74\x69\x6e\x67\x73\x29\x3b\x0a\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x72\x65\x74\x75\x72\x6e\x3b\x0a\x20\
\x20\x20\x20\x20\x20\x20\x20\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\
\x20\x74\x68\x72\x6f\x77\x20\x22\x57\x72\x6f\x6e\x67\x20\x75\x73\
\x65\x20\x6f\x66\x20\x57\x65\x62\x50\x61\x67\x65\x23\x6f\x70\x65\
\x6e\x22\x3b\x0a\x20\x20\x20\x20\x7d\x3b\x0a\x0a\x20\x20\x20\x20\
\x70\x61\x67\x65\x2e\x69\x6e\x63\x6c\x75\x64\x65\x4a\x73\x20\x3d\
\x20\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x73\x63\x72\x69\x70\x74\
\x55\x72\x6c\x2c\x20\x6f\x6e\x53\x63\x72\x69\x70\x74\x4c\x6f\x61\
\x64\x65\x64\x29\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x2f\
\x2f\x20\x52\x65\x67\x69\x73\x74\x65\x72\x20\x74\x65\x6d\x70\x6f\
\x72\x61\x72\x79\x20\x73\x69\x67\x6e\x61\x6c\x20\x68\x61\x6e\x64\
\x6c\x65\x72\x20\x66\x6f\x72\x20\x27\x61\x6c\x65\x72\x74\x28\x29\
\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x74\x68\x69\x73\x2e\x6a\
\x61\x76\x61\x53\x63\x72\x69\x70\x74\x41\x6c\x65\x72\x74\x53\x65\
\x6e\x74\x2e\x63\x6f\x6e\x6e\x65\x63\x74\x28\x66\x75\x6e\x63\x74\
\x69\x6f\x6e\x28\x6d\x73\x67\x46\x72\x6f\x6d\x41\x6c\x65\x72\x74\
\x29\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x69\x66\x20\x28\x20\x6d\x73\x67\x46\x72\x6f\x6d\x41\x6c\x65\x72\
\x74\x20\x3d\x3d\x3d\x20\x73\x63\x72\x69\x70\x74\x55\x72\x6c\x20\
\x29\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x2f\x2f\x20\x52\x65\x73\x6f\x75\x72\x63\x65\x20\
\x6c\x6f\x61\x64\x65\x64\x2c\x20\x74\x69\x6d\x65\x20\x74\x6f\x20\
\x66\x69\x72\x65\x20\x74\x68\x65\x20\x63\x61\x6c\x6c\x62\x61\x63\
\x6b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x6f\x6e\x53\x63\x72\x69\x70\x74\x4c\x6f\x61\x64\x65\x64\
\x28\x73\x63\x72\x69\x70\x74\x55\x72\x6c\x29\x3b\x0a\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2f\x2f\x20\
\x41\x6e\x64\x20\x64\x69\x73\x63\x6f\x6e\x6e\x65\x63\x74\x20\x74\
\x68\x65\x20\x73\x69\x67\x6e\x61\x6c\x20\x68\x61\x6e\x64\x6c\x65\
\x72\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x74\x72\x79\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x74\x68\x69\x73\
\x2e\x6a\x61\x76\x61\x53\x63\x72\x69\x70\x74\x41\x6c\x65\x72\x74\
\x53\x65\x6e\x74\x2e\x64\x69\x73\x63\x6f\x6e\x6e\x65\x63\x74\x28\
\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x2e\x63\x61\x6c\x6c\x65\x65\
\x29\x3b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
\x20\x20\x20\x7d\x20\x63\x61\x74\x63\x68\x20\x28\x65\x29\x20\x7b\
\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x0a\
\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x29\x3b\x0a\x0a\x20\x20\x20\
\x20\x20\x20\x20\x20\x2f\x2f\x20\x41\x70\x70\x65\x6e\x64\x20\x74\
\x68\x65\x20\x73\x63\x72\x69\x70\x74\x20\x74\x61\x67\x20\x74\x6f\
\x20\x74\x68\x65\x20\x62\x6f\x64\x79\x0a\x20\x20\x20\x20\x20\x20\
\x20\x20\x74\x68\x69\x73\x2e\x5f\x61\x70\x70\x65\x6e\x64\x53\x63\
\x72\x69\x70\x74\x45\x6c\x65\x6d\x65\x6e\x74\x28\x73\x63\x72\x69\
\x70\x74\x55\x72\x6c\x29\x3b\x0a\x20\x20\x20\x20\x7d\x3b\x0a\x0a\
\x20\x20\x20\x20\x70\x61\x67\x65\x2e\x64\x65\x73\x74\x72\x6f\x79\
\x20\x3d\x20\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x29\x20\x7b\x0a\
\x20\x20\x20\x20\x20\x20\x20\x20\x70\x68\x61\x6e\x74\x6f\x6d\x2e\
\x5f\x64\x65\x73\x74\x72\x6f\x79\x28\x70\x61\x67\x65\x29\x3b\x0a\
\x20\x20\x20\x20\x7d\x3b\x0a\x0a\x20\x20\x20\x20\x72\x65\x74\x75\
\x72\x6e\x20\x70\x61\x67\x65\x3b\x0a\x7d\x3b\x0a\x0a\x2f\x2f\x20\
\x4d\x61\x6b\x65\x20\x22\x66\x73\x2e\x6f\x70\x65\x6e\x22\x20\x74\
\x68\x72\x6f\x77\x20\x61\x6e\x20\x65\x78\x63\x65\x70\x74\x69\x6f\
\x6e\x20\x69\x6e\x20\x63\x61\x73\x65\x20\x69\x74\x20\x66\x61\x69\
\x6c\x73\x0a\x77\x69\x6e\x64\x6f\x77\x2e\x66\x73\x2e\x6f\x70\x65\
\x6e\x20\x3d\x20\x66\x75\x6e\x63\x74\x69\x6f\x6e\x28\x70\x61\x74\
\x68\x2c\x20\x6d\x6f\x64\x65\x29\x20\x7b\x0a\x20\x20\x20\x20\x76\
\x61\x72\x20\x66\x69\x6c\x65\x20\x3d\x20\x77\x69\x6e\x64\x6f\x77\
\x2e\x66\x73\x2e\x5f\x6f\x70\x65\x6e\x28\x70\x61\x74\x68\x2c\x20\
\x6d\x6f\x64\x65\x29\x3b\x0a\x20\x20\x20\x20\x69\x66\x20\x28\x66\
\x69\x6c\x65\x29\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x72\
\x65\x74\x75\x72\x6e\x20\x66\x69\x6c\x65\x3b\x0a\x20\x20\x20\x20\
\x7d\x0a\x20\x20\x20\x20\x74\x68\x72\x6f\x77\x20\x22\x55\x6e\x61\
\x62\x6c\x65\x20\x74\x6f\x20\x6f\x70\x65\x6e\x20\x66\x69\x6c\x65\
\x20\x27\x22\x2b\x20\x70\x61\x74\x68\x20\x2b\x22\x27\x22\x3b\x0a\
\x7d\x3b\x0a\
\x00\x00\x56\x27\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
@ -4349,8 +4353,8 @@ qt_resource_struct = "\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x00\x1e\x00\x02\x00\x00\x00\x02\x00\x00\x00\x03\
\x00\x00\x00\x64\x00\x01\x00\x00\x00\x01\x00\x00\x62\x57\
\x00\x00\x00\x36\x00\x00\x00\x00\x00\x01\x00\x00\x0c\x2c\
\x00\x00\x00\x64\x00\x01\x00\x00\x00\x01\x00\x00\x62\x93\
\x00\x00\x00\x36\x00\x00\x00\x00\x00\x01\x00\x00\x0c\x68\
"
def qInitResources():

View File

@ -0,0 +1,29 @@
#!/usr/bin/env python
'''
This file is part of the PyPhantomJS project.
Copyright (C) 2011 James Roe <roejames12@hotmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
from runpy import run_module
# automatically convert Qt types by using api 2
import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)
if __name__ == '__main__':
run_module('pyphantomjs.pyphantomjs', run_name='__main__')

View File

@ -46,16 +46,14 @@ setup(
version=__version__,
description='Minimalistic, headless, WebKit-based, JavaScript-driven tool',
long_description=README,
url = 'https://github.com/Roejames12/phantomjs',
license = 'GNU General Public License (GPL)',
author='James Roe',
author_email='roejames12@hotmail.com',
packages=find_packages(),
include_package_data=True,
install_requires=['argparse'],
entry_points = {
'console_scripts' : [
'pyphantomjs = pyphantomjs.pyphantomjs:main',
],
},
scripts = ['pyphantomjs/tools/pyphantomjs'],
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
@ -65,5 +63,5 @@ setup(
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP :: Browsers'
],
zip_safe=False,
zip_safe=False
)

View File

@ -49,7 +49,7 @@ window.WebPage = function() {
operation: arguments[1],
data: arguments[2]
}, this.settings);
return;
return;
} else if (arguments.length === 4) {
this.onLoadFinished = arguments[3];
this.openUrl(arguments[0], {
@ -78,6 +78,10 @@ window.WebPage = function() {
this._appendScriptElement(scriptUrl);
};
page.destroy = function() {
phantom._destroy(page);
};
return page;
};

View File

@ -268,6 +268,11 @@ void Phantom::exit(int code)
QApplication::instance()->exit(code);
}
void Phantom::_destroy(QObject *page) {
m_pages.removeOne((WebPage*)page);
delete page;
}
// private slots:
void Phantom::printConsoleMessage(const QString &message, int lineNumber, const QString &source)
{

View File

@ -68,6 +68,7 @@ public slots:
QObject *createWebPage();
bool injectJs(const QString &jsFilePath);
void exit(int code = 0);
void _destroy(QObject *page);
private slots:
void printConsoleMessage(const QString &msg, int lineNumber, const QString &source);