Skip to content

Commit

Permalink
add pyside2-uic to possible uic exec candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSJohnson committed Aug 16, 2024
1 parent 86a8732 commit 06c7214
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions modules/pymol/Qt/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from pymol.Qt import *

import shutil
import subprocess

class UpdateLock:
"""
Expand Down Expand Up @@ -286,11 +288,18 @@ def loadUi(uifile, widget):
else:
import pysideuic

def find_valid_uic_exe(execs):
for exe in execs:
if shutil.which(exe):
return exe

if pysideuic is None:
import subprocess
p = subprocess.Popen(['uic', '-g', 'python', uifile],
uic_exec = find_valid_uic_exe(('uic', 'pyside2-uic'))
if uic_exec is None:
raise RuntimeError('uic not found')
p = subprocess.Popen([uic_exec, '-g', 'python', uifile],
stdout=subprocess.PIPE)
source = p.communicate()[0]
source, _ = p.communicate()
# workaround for empty retranslateUi bug
source += b'\n' + b' ' * 8 + b'pass'
else:
Expand Down

0 comments on commit 06c7214

Please sign in to comment.