Skip to content

Commit 4bb0cab

Browse files
committed
config: PyQt4 compat 2.
1 parent b9258be commit 4bb0cab

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

config.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
import os
99
import sys
1010

11-
from PySide import QtCore, QtGui, QtUiTools
12-
11+
try:
12+
from PySide import QtCore, QtGui, QtUiTools
13+
except ImportError:
14+
from PyQt4 import QtCore, QtGui, uic
1315

1416
# Python 3 compatibility
1517
try:
@@ -29,12 +31,10 @@ def __init__(self, *args, **kwargs):
2931

3032
self.config = col.OrderedDict()
3133

32-
#self.setLayout(QtGui.QVBoxLayout())
33-
self.ui = QtUiTools.QUiLoader().load("config.ui")
34-
#self.layout().addWidget(self.ui)
35-
36-
print(dir(self))
37-
print(dir(self.ui))
34+
try:
35+
self.ui = QtUiTools.QUiLoader().load("config.ui")
36+
except NameError:
37+
self.ui = uic.loadUi("config.ui")
3838

3939
btn_box = self.ui.buttonBox
4040
ok_btn = btn_box.button(
@@ -73,8 +73,6 @@ def main(*argv):
7373
app = QtGui.QApplication(sys.argv)
7474
window = Config()
7575
window.show()
76-
window.activateWindow()
77-
window.raise_()
7876
return app.exec_()
7977

8078
if __name__ == "__main__":

0 commit comments

Comments
 (0)