Merge branch 'windows'
This commit is contained in:
commit
4935a9940f
23 changed files with 146 additions and 17 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -4,4 +4,5 @@ dsa_priv.pem
|
|||
*.pyc
|
||||
.DS_Store
|
||||
*~
|
||||
Linux/build/
|
||||
Linux/dist
|
||||
Windows/bungloo
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
VERSION="1.3.0"
|
||||
DEPLOYPATH="bungloo-${VERSION}"
|
||||
LINUXPATH=".."
|
||||
SHAREDPATH="../.."
|
||||
QTPATH="../Qt"
|
||||
SHAREDPATH=".."
|
||||
DISTPATH=dist
|
||||
|
||||
rm -rf $DEPLOYPATH
|
||||
|
@ -14,8 +14,8 @@ mkdir -p $DEPLOYPATH/bin
|
|||
mkdir -p $DEPLOYPATH/bungloo
|
||||
touch $DEPLOYPATH/bungloo/__init__.py
|
||||
|
||||
cp $LINUXPATH/Bungloo.py $DEPLOYPATH/bin/bungloo
|
||||
cp $LINUXPATH/Helper.py $LINUXPATH/Windows.py $DEPLOYPATH/bungloo
|
||||
cp $QTPATH/Bungloo.py $DEPLOYPATH/bin/bungloo
|
||||
cp $QTPATH/Helper.py $QTPATH/Windows.py $DEPLOYPATH/bungloo
|
||||
cat setup.py.exmp | sed -e "s/{VERSION}/${VERSION}/g" > $DEPLOYPATH/setup.py
|
||||
cat Makefile.exmp | sed -e "s/{VERSION}/${VERSION}/g" > $DEPLOYPATH/Makefile
|
||||
cat bungloo.desktop.exmp | sed -e "s/{VERSION}/${VERSION}/g" > $DEPLOYPATH/bungloo.desktop
|
|
@ -1,11 +1,12 @@
|
|||
#!/usr/bin/env python2
|
||||
|
||||
import os, sys, pickle, subprocess, shutil
|
||||
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||
from PyQt4 import QtCore, QtGui, QtWebKit, QtNetwork
|
||||
|
||||
RUNNING_LOCAL = os.path.basename(__file__) == "Bungloo.py"
|
||||
RUNNING_LOCAL = os.path.basename(sys.argv[0]) == "Bungloo.py"
|
||||
RUNNING_ON_WINDOWS = os.name == "nt"
|
||||
|
||||
if RUNNING_LOCAL:
|
||||
if RUNNING_LOCAL or RUNNING_ON_WINDOWS:
|
||||
import Windows, Helper
|
||||
else:
|
||||
from bungloo import Windows, Helper
|
||||
|
@ -13,6 +14,11 @@ else:
|
|||
class Bungloo:
|
||||
|
||||
def __init__(self):
|
||||
|
||||
sslConfig = QtNetwork.QSslConfiguration.defaultConfiguration()
|
||||
sslConfig.setProtocol(QtNetwork.QSsl.TlsV1)
|
||||
QtNetwork.QSslConfiguration.setDefaultConfiguration(sslConfig)
|
||||
|
||||
self.app = QtGui.QApplication(sys.argv)
|
||||
self.new_message_windows = []
|
||||
self.controller = Controller(self)
|
||||
|
@ -30,7 +36,7 @@ class Bungloo:
|
|||
|
||||
def resources_path(self):
|
||||
if RUNNING_LOCAL:
|
||||
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
||||
return os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))
|
||||
else:
|
||||
return Helper.Helper.get_resource_path()
|
||||
|
|
@ -2,17 +2,17 @@ from PyQt4 import QtCore, QtGui, QtWebKit
|
|||
|
||||
from PyQt4.QtCore import QTimer, QVariant, SIGNAL
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
|
||||
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply, QSslSocket
|
||||
from PyQt4.QtWebKit import QWebView
|
||||
|
||||
import os
|
||||
import os, sys
|
||||
|
||||
import array
|
||||
|
||||
class Helper:
|
||||
@classmethod
|
||||
def get_resource_path(cls):
|
||||
return os.path.dirname(__file__)
|
||||
@classmethod
|
||||
def get_resource_path(cls):
|
||||
return os.path.dirname(sys.argv[0])
|
||||
|
||||
class WebPage(QtWebKit.QWebPage):
|
||||
def __init__(self, parent=0, app=None):
|
||||
|
@ -43,6 +43,8 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
self.customContextMenuRequested.connect(self.context_menu_requested)
|
||||
self.actions = []
|
||||
|
||||
self.page().networkAccessManager().sslErrors.connect(lambda reply, errors: self.handleSslErrors(reply, errors))
|
||||
|
||||
def copy_link():
|
||||
self.page().triggerAction(QtWebKit.QWebPage.CopyLinkToClipboard)
|
||||
self.action_copy_link = QtGui.QAction('Copy Lin&k', self, triggered=copy_link)
|
||||
|
@ -85,7 +87,10 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
def load_finished(self, ok, callback=None):
|
||||
frame = self.page().mainFrame()
|
||||
if self.is_local:
|
||||
frame.evaluateJavaScript("var OS_TYPE = 'linux';")
|
||||
os_type = "linux"
|
||||
if os.name == "nt":
|
||||
os_type = "windows"
|
||||
frame.evaluateJavaScript("var OS_TYPE = '" + os_type + "';")
|
||||
|
||||
js_plugin_path = os.path.expanduser('~/.config/bungloo/Plugin.js')
|
||||
if os.access(js_plugin_path, os.R_OK):
|
||||
|
@ -100,6 +105,12 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
if callback:
|
||||
callback(ok)
|
||||
|
||||
def handleSslErrors(self, reply, errors):
|
||||
if os.name == "nt": # ignore SSL errors on Windows (yes a uggly workaround, don't know how to fix it yet)
|
||||
for error in errors:
|
||||
print error.errorString()
|
||||
reply.ignoreSslErrors(errors)
|
||||
|
||||
|
||||
class NetworkAccessManager(QNetworkAccessManager):
|
||||
|
||||
|
@ -113,6 +124,7 @@ class NetworkAccessManager(QNetworkAccessManager):
|
|||
self.setCookieJar(old_manager.cookieJar())
|
||||
self.setProxy(old_manager.proxy())
|
||||
self.setProxyFactory(old_manager.proxyFactory())
|
||||
self.sslErrors.connect(lambda reply, errors: old_manager.sslErrors)
|
||||
|
||||
def createRequest(self, operation, request, data):
|
||||
if request.url().scheme() != "bungloo":
|
|
@ -1,5 +1,5 @@
|
|||
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||
import Helper, urllib, urllib2
|
||||
import Helper, urllib, urllib2, os
|
||||
|
||||
class Preferences:
|
||||
|
||||
|
@ -224,8 +224,10 @@ class Oauth:
|
|||
old_manager = self.auth_view.page().networkAccessManager()
|
||||
new_manager = Helper.NetworkAccessManager(old_manager, self.bungloo_callback)
|
||||
new_manager.authenticationRequired.connect(self.authentication_required)
|
||||
new_manager.sslErrors.connect(lambda reply, errors: self.handleSslErrors(reply, errors))
|
||||
self.auth_view.page().setNetworkAccessManager(new_manager)
|
||||
self.auth_view.show()
|
||||
|
||||
self.auth_view.load_url(url)
|
||||
return False
|
||||
|
||||
|
@ -250,6 +252,13 @@ class Oauth:
|
|||
if hasattr(self, "auth_view"):
|
||||
self.auth_view.hide()
|
||||
|
||||
def handleSslErrors(self, reply, errors):
|
||||
if os.name == "nt": # ignore SSL errors on Windows (yes a uggly workaround, don't know how to fix it yet)
|
||||
for error in errors:
|
||||
print error.errorString()
|
||||
reply.ignoreSslErrors(errors)
|
||||
|
||||
|
||||
|
||||
class Login(QtGui.QDialog):
|
||||
def __init__(self):
|
|
@ -129,7 +129,10 @@ define(function() {
|
|||
}
|
||||
|
||||
HostApp.osType = function() {
|
||||
return OS_TYPE == "mac" ? "OS X" : "Linux";
|
||||
var os_name = "OS X";
|
||||
if (OS_TYPE == "windows") os_name = "Windows";
|
||||
if (OS_TYPE == "linux") os_name = "Linux"
|
||||
return os_name;
|
||||
}
|
||||
|
||||
HostApp.notificateViewsAboutDeletedPost = function(postId, entity) {
|
||||
|
|
12
Windows/deploy.ps1
Normal file
12
Windows/deploy.ps1
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
mkdir bungloo
|
||||
Copy-Item ../Qt/* bungloo -Recurse
|
||||
Copy-Item ../WebKit bungloo -Recurse
|
||||
Copy-Item ../images bungloo -Recurse
|
||||
Copy-Item setup.py bungloo
|
||||
touch bungloo/__init__.py
|
||||
Copy-Item msvcp90.dll bungloo
|
||||
cd bungloo
|
||||
python setup.py py2exe
|
||||
cd ..
|
||||
rm bungloo
|
55
Windows/installer.iss
Normal file
55
Windows/installer.iss
Normal file
|
@ -0,0 +1,55 @@
|
|||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "Bungloo"
|
||||
#define MyAppVersion "1.3.0"
|
||||
#define MyAppPublisher "Jabs Nu"
|
||||
#define MyAppURL "http://jabs.nu/bungloo"
|
||||
#define MyAppExeName "Bungloo.exe"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application.
|
||||
; Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppId={{5E44EE00-8ECE-40C8-AF6F-70397DD1DBFE}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
;AppVerName={#MyAppName} {#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={pf}\{#MyAppName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
AllowNoIcons=yes
|
||||
LicenseFile=C:\Users\Jeena\Documents\GitHub\Bungloo\LICENCE.txt
|
||||
OutputBaseFilename=setup
|
||||
SetupIconFile=C:\Users\Jeena\Documents\GitHub\Bungloo\images\Icon.ico
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
|
||||
|
||||
[Files]
|
||||
Source: "C:\Users\Jeena\Documents\GitHub\Bungloo\Windows\bungloo\dist\Bungloo.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "C:\Users\Jeena\Documents\GitHub\Bungloo\Windows\bungloo\dist\library.zip"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "C:\Users\Jeena\Documents\GitHub\Bungloo\Windows\bungloo\dist\python27.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "C:\Users\Jeena\Documents\GitHub\Bungloo\Windows\bungloo\dist\w9xpopen.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "C:\Users\Jeena\Documents\GitHub\Bungloo\Windows\bungloo\dist\images\*"; DestDir: "{app}\images"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "C:\Users\Jeena\Documents\GitHub\Bungloo\Windows\bungloo\dist\WebKit\*"; DestDir: "{app}\WebKit"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
||||
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
BIN
Windows/msvcp90.dll
Normal file
BIN
Windows/msvcp90.dll
Normal file
Binary file not shown.
31
Windows/setup.py
Normal file
31
Windows/setup.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python2
|
||||
|
||||
import os
|
||||
from distutils.core import setup
|
||||
import py2exe
|
||||
|
||||
files = []
|
||||
for dirname, dirnames, filenames in os.walk('WebKit'):
|
||||
for filename in filenames:
|
||||
files += [(dirname, [os.path.join(dirname, filename)])]
|
||||
|
||||
for dirname, dirnames, filenames in os.walk('images'):
|
||||
for filename in filenames:
|
||||
files += [(dirname, [os.path.join(dirname, filename)])]
|
||||
|
||||
setup(
|
||||
name = "Bungloo",
|
||||
version = "1.3.0",
|
||||
author = "Jeena Paradies",
|
||||
author_email = "spam@jeenaparadies.net",
|
||||
url = "http://jabs.nu/bungloo",
|
||||
license = "BSD license",
|
||||
data_files = files,
|
||||
windows = ["Bungloo.py"],
|
||||
options = {
|
||||
"py2exe": {
|
||||
"includes": ["sip", "ssl", "PyQt4.QtCore", "PyQt4.QtGui", "PyQt4.QtNetwork"],
|
||||
"bundle_files": 2
|
||||
}
|
||||
}
|
||||
)
|
BIN
images/Icon.ico
Normal file
BIN
images/Icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
BIN
images/Icon16.png
Normal file
BIN
images/Icon16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 966 B |
BIN
images/Icon248.png
Normal file
BIN
images/Icon248.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
BIN
images/Icon32.png
Normal file
BIN
images/Icon32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
images/Icon48.png
Normal file
BIN
images/Icon48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Reference in a new issue