pymol_qt_gui.py (pymol-open-source-2.2.0) | : | pymol_qt_gui.py (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 340 | skipping to change at line 340 | |||
# menu | # menu | |||
for _, label, data in self.get_menudata(cmd): | for _, label, data in self.get_menudata(cmd): | |||
assert _ == 'menu' | assert _ == 'menu' | |||
menu = menubar.addMenu(label) | menu = menubar.addMenu(label) | |||
self.menudict[label] = menu | self.menudict[label] = menu | |||
_addmenu(data, menu) | _addmenu(data, menu) | |||
# hack for macOS to hide "Edit > Start Dictation" | # hack for macOS to hide "Edit > Start Dictation" | |||
# https://bugreports.qt.io/browse/QTBUG-43217 | # https://bugreports.qt.io/browse/QTBUG-43217 | |||
if sys.platform == 'darwin': | if pymol.IS_MACOS: | |||
self.menudict['Edit'].setTitle('Edit_') | self.menudict['Edit'].setTitle('Edit_') | |||
QtCore.QTimer.singleShot(10, lambda: | QtCore.QTimer.singleShot(10, lambda: | |||
self.menudict['Edit'].setTitle('Edit')) | self.menudict['Edit'].setTitle('Edit')) | |||
# recent files menu | # recent files menu | |||
if self.open_recent_menu: | if self.open_recent_menu: | |||
@self.open_recent_menu.aboutToShow.connect | @self.open_recent_menu.aboutToShow.connect | |||
def _(): | def _(): | |||
self.open_recent_menu.clear() | self.open_recent_menu.clear() | |||
for fname in self.recent_filenames: | for fname in self.recent_filenames: | |||
skipping to change at line 1120 | skipping to change at line 1120 | |||
def make_pymol_qicon(): | def make_pymol_qicon(): | |||
icons_dir = os.path.expandvars('$PYMOL_DATA/pymol/icons') | icons_dir = os.path.expandvars('$PYMOL_DATA/pymol/icons') | |||
return QtGui.QIcon(os.path.join(icons_dir, 'icon2.svg')) | return QtGui.QIcon(os.path.join(icons_dir, 'icon2.svg')) | |||
def execapp(): | def execapp(): | |||
''' | ''' | |||
Run PyMOL as a Qt application | Run PyMOL as a Qt application | |||
''' | ''' | |||
global window | global window | |||
global pymol | ||||
# don't let exceptions stop PyMOL | # don't let exceptions stop PyMOL | |||
import traceback | import traceback | |||
sys.excepthook = traceback.print_exception | sys.excepthook = traceback.print_exception | |||
# use QT_OPENGL=desktop (auto-detection may fail on Windows) | ||||
if hasattr(Qt, 'AA_UseDesktopOpenGL') and pymol.IS_WINDOWS: | ||||
QtCore.QCoreApplication.setAttribute(Qt.AA_UseDesktopOpenGL) | ||||
# enable 4K scaling on Windows and Linux | # enable 4K scaling on Windows and Linux | |||
if hasattr(Qt, 'AA_EnableHighDpiScaling') and not any( | if hasattr(Qt, 'AA_EnableHighDpiScaling') and not any( | |||
v in os.environ | v in os.environ | |||
for v in ['QT_SCALE_FACTOR', 'QT_SCREEN_SCALE_FACTORS']): | for v in ['QT_SCALE_FACTOR', 'QT_SCREEN_SCALE_FACTORS']): | |||
QtCore.QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) | QtCore.QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) | |||
# fix Windows taskbar icon | # fix Windows taskbar icon | |||
if sys.platform.startswith('win'): | if pymol.IS_WINDOWS: | |||
import ctypes | import ctypes | |||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( | ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( | |||
u'com.schrodinger.pymol') | u'com.schrodinger.pymol') | |||
app = PyMOLApplication(['PyMOL']) | app = PyMOLApplication(['PyMOL']) | |||
app.setWindowIcon(make_pymol_qicon()) | app.setWindowIcon(make_pymol_qicon()) | |||
window = PyMOLQtGUI() | window = PyMOLQtGUI() | |||
window.setWindowTitle("PyMOL") | window.setWindowTitle("PyMOL") | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added |