removed icon from mac windows
This commit is contained in:
parent
ee3f4de6a5
commit
a46a1dff23
5 changed files with 53 additions and 35 deletions
|
@ -4,15 +4,9 @@ import os, sys, pickle, subprocess, shutil, json
|
|||
from PyQt4 import QtCore, QtGui, QtWebKit, QtNetwork
|
||||
from sys import platform as _platform
|
||||
|
||||
RUNNING_LOCAL = os.path.basename(sys.argv[0]) == "Bungloo.py"
|
||||
RUNNING_ON_WINDOWS = os.name == "nt"
|
||||
RUNNING_ON_OSX = _platform == "darwin"
|
||||
|
||||
print sys.argv[0]
|
||||
|
||||
if RUNNING_LOCAL or RUNNING_ON_WINDOWS:
|
||||
try:
|
||||
import Windows, Helper, SingleApplication
|
||||
else:
|
||||
except:
|
||||
from bungloo import Windows, Helper, SingleApplication
|
||||
|
||||
class Bungloo():
|
||||
|
@ -37,7 +31,7 @@ class Bungloo():
|
|||
self.authentification_succeded()
|
||||
|
||||
def resources_path(self):
|
||||
if RUNNING_LOCAL and not RUNNING_ON_OSX:
|
||||
if Helper.Helper.is_local() and not Helper.Helper.is_mac():
|
||||
return os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))
|
||||
else:
|
||||
return Helper.Helper.get_resource_path()
|
||||
|
@ -320,7 +314,7 @@ Options:
|
|||
"""
|
||||
sys.exit(1)
|
||||
|
||||
if RUNNING_ON_WINDOWS and not RUNNING_LOCAL:
|
||||
if Helper.Helper.is_windows() and not Helper.Helper.is_local():
|
||||
import sys
|
||||
from os import path, environ, makedirs
|
||||
appdata = path.join(environ["TMP"], key)
|
||||
|
|
31
Qt/Helper.py
31
Qt/Helper.py
|
@ -6,21 +6,34 @@ from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkRepl
|
|||
from PyQt4.QtWebKit import QWebView
|
||||
from sys import platform as _platform
|
||||
|
||||
import os, sys
|
||||
|
||||
import array
|
||||
import os, sys, array
|
||||
|
||||
class Helper:
|
||||
@classmethod
|
||||
def get_resource_path(cls):
|
||||
|
||||
if os.name == "nt":
|
||||
if Helper.is_windows():
|
||||
return os.path.dirname(sys.argv[0])
|
||||
elif _platform == "darwin":
|
||||
elif Helper.is_mac():
|
||||
return os.path.dirname(sys.argv[0])
|
||||
else:
|
||||
return os.path.dirname(__file__)
|
||||
|
||||
@classmethod
|
||||
def is_local(cls):
|
||||
return os.path.basename(sys.argv[0]) == "Bungloo.py"
|
||||
|
||||
@classmethod
|
||||
def is_mac(cls):
|
||||
return _platform == "darwin"
|
||||
|
||||
@classmethod
|
||||
def is_windows(cls):
|
||||
return os.name == "nt"
|
||||
|
||||
@classmethod
|
||||
def is_linux(cls):
|
||||
return not (Helper.is_windows() or Helper.is_mac())
|
||||
|
||||
class WebPage(QtWebKit.QWebPage):
|
||||
def __init__(self, parent=0, app=None):
|
||||
super(QtWebKit.QWebPage, self).__init__(parent)
|
||||
|
@ -95,9 +108,9 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
frame = self.page().mainFrame()
|
||||
if self.is_local:
|
||||
os_type = "linux"
|
||||
if os.name == "nt":
|
||||
if Helper.is_windows:
|
||||
os_type = "windows"
|
||||
elif _platform == "darwin":
|
||||
elif Helper.is_mac:
|
||||
os_type = "osx"
|
||||
frame.evaluateJavaScript("var OS_TYPE = '" + os_type + "';")
|
||||
|
||||
|
@ -115,7 +128,7 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
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)
|
||||
if Helper.is_windows: # 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)
|
||||
|
|
|
@ -16,13 +16,13 @@ class Preferences:
|
|||
|
||||
# image view
|
||||
image = QtGui.QPixmap(self.app.resources_path() + "/images/Icon.png")
|
||||
print self.app.resources_path() + "/images/Icon.png"
|
||||
image_view = QtGui.QLabel(self.window)
|
||||
image_view.setGeometry(20, 20, 146, 146)
|
||||
image_view.setPixmap(image)
|
||||
image_view.setScaledContents(True)
|
||||
|
||||
self.window.setWindowIcon(QtGui.QIcon(image))
|
||||
if not Helper.Helper.is_mac():
|
||||
self.window.setWindowIcon(QtGui.QIcon(image))
|
||||
|
||||
# info text
|
||||
info_text = QtGui.QLabel(self.window)
|
||||
|
@ -85,7 +85,9 @@ class Timeline:
|
|||
|
||||
self.window = Helper.RestorableWindow(action, self.app)
|
||||
self.window.setWindowTitle(title)
|
||||
self.window.setWindowIcon(QtGui.QIcon(self.app.resources_path() + "/images/Icon.png"))
|
||||
|
||||
if not Helper.Helper.is_mac():
|
||||
self.window.setWindowIcon(QtGui.QIcon(self.app.resources_path() + "/images/Icon.png"))
|
||||
|
||||
self.webView = Helper.WebViewCreator(self.app, True, self.window)
|
||||
self.webView.load_local(self.load_finished)
|
||||
|
@ -341,7 +343,8 @@ class NewPost(Helper.RestorableWindow):
|
|||
self.activateWindow()
|
||||
self.raise_()
|
||||
|
||||
self.setWindowIcon(QtGui.QIcon(self.app.resources_path() + "/images/Icon.png"))
|
||||
if not Helper.Helper.is_mac():
|
||||
self.setWindowIcon(QtGui.QIcon(self.app.resources_path() + "/images/Icon.png"))
|
||||
|
||||
self.webView = Helper.WebViewCreator(self.app, True, self)
|
||||
self.webView.load_local(self.load_finished)
|
||||
|
|
Reference in a new issue