2014-09-18 41 views
2

我建立與視網膜顯示器的MacBook Pro的pyside應用程序,這是我的安裝文件:cxfreeze生產上的MacBook Pro模糊GUI與視網膜顯示

import sys 
from cx_Freeze import setup, Executable 

# Dependencies are automatically detected, but it might need fine tuning. 
build_exe_options = {"packages": ["os", "sys", "PySide", "datetime", "subprocess"], "excludes": ["tkinter"]} 

# GUI applications require a different base on Windows (the default is for a 
# console application). 
base = None 
if sys.platform == "win32": 
    base = "Win32GUI" 


options = { 
    'build_exe': { 
     'includes': 'atexit' 
    } 
} 

executables = [ 
    Executable('countdown.py', base=base) 
] 

setup( name = "Countdown", 
     version = "0.1", 
     description = "Countdown timer", 
     options = options, 
     executables = executables) 

然後,我建我的應用程序:

python3.3 setup.py bdist_mac 

的countdown_0.1.app工作正常,除了GUI是一個有點模糊:

enter image description here

比直接執行countdown.py時:

enter image description here

我很奇怪,爲什麼他們看起來如此不同?

+0

這是奇異的。應用程序包中必須有一些元數據來控制它。 – 2014-09-18 21:36:01

回答

4

由cx_Freeze生成的包在其Info.plist文件中缺少布爾條目NSHighResolutionCapable [1],所以該應用程序以「放大」模式運行。

將現有Info.plist(您的情況爲Countdown-0.1.app/Contents/Info.plist)複製到您的setup.py所在的目錄。在這個例子中,修改後的Info.plist將被命名爲信息-highres.plist

公開信息,highres.plist用文本編輯器和將此條目添加到字典:如果你

<key>NSHighResolutionCapable</key> 
<true/> 

,或者更喜歡使用Xcode plist編輯器添加條目。

使用下面的設置命令,默認的Info.plist將被修改後的Info-highres.plist取代,您的應用將會是「視網膜準備就緒」。

python setup.py bdist_mac --custom-info-plist Info-highres.plist

您也可以插入custom_info_plist指令到你的setup.py腳本。見http://cx-freeze.readthedocs.org/en/latest/distutils.html#bdist-mac

[1] https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html(圖1-8)