Allow scriptLookupDir to be set for phantom object

This commit is contained in:
IceArmy
2011-06-12 14:38:34 -07:00
parent 25ac6d35ca
commit 309d3b5aaa
3 changed files with 28 additions and 2 deletions
+11 -1
View File
@@ -65,6 +65,8 @@ class Phantom(QObject):
self.m_defaultPageSettings['userAgent'] = self.m_page.userAgent()
self.m_page.applySettings(self.m_defaultPageSettings)
self.scriptLookupDir = os.path.dirname(os.path.abspath(self.m_scriptFile))
# inject our properties and slots into javascript
self.m_page.mainFrame().addToJavaScriptWindowObject('phantom', self)
@@ -118,7 +120,15 @@ class Phantom(QObject):
@pyqtSlot(str, result=bool)
def injectJs(self, filePath):
return injectJsInFrame(filePath, os.path.dirname(os.path.abspath(self.m_scriptFile)), self.m_page.mainFrame())
return injectJsInFrame(filePath, self.scriptLookupDir, self.m_page.mainFrame())
@pyqtProperty(str)
def scriptLookupDir(self):
return self.m_page.scriptLookupDir
@scriptLookupDir.setter
def scriptLookupDir(self, dirPath):
self.m_page.scriptLookupDir = dirPath
@pyqtProperty('QVariantMap')
def version(self):