1515os .environ ['QT_API' ] = 'pyqt4'
1616try :
1717 from pyqode .qt import QtCore
18- except :
18+ except BaseException :
1919 pass
2020
2121from PyQt4 import QtGui , QtCore
2424
2525try :
2626 from OCC .Display .pyqt4Display import qtViewer3d
27- except :
27+ except BaseException :
2828 import OCC .Display
2929
3030 try :
3131 import OCC .Display .backend
32- except :
32+ except BaseException :
3333 pass
3434
3535 try :
3636 OCC .Display .backend .get_backend ("qt-pyqt4" )
37- except :
37+ except BaseException :
3838 OCC .Display .backend .load_backend ("qt-pyqt4" )
3939
4040 from OCC .Display .qtDisplay import qtViewer3d
4141
42-
4342from .main import settings , iterator
4443from .occ_utils import display_shape
4544
@@ -58,10 +57,11 @@ def __init__(self):
5857 try :
5958 import ConfigParser
6059 Cfg = ConfigParser .RawConfigParser
61- except :
60+ except BaseException :
6261 import configparser
6362
64- def Cfg (): return configparser .ConfigParser (interpolation = None )
63+ def Cfg ():
64+ return configparser .ConfigParser (interpolation = None )
6565
6666 conf_file = os .path .expanduser (os .path .join ("~" , ".ifcopenshell" , "app" , "snippets.conf" ))
6767 if conf_file .startswith ("~" ):
@@ -114,7 +114,6 @@ def options(self, s):
114114
115115
116116class application (QtGui .QApplication ):
117-
118117 """A pythonOCC, PyQt based IfcOpenShell application
119118 with two tree views and a graphical 3d view"""
120119
@@ -165,7 +164,8 @@ def select(self, product):
165164 itm = self .product_to_item .get (product )
166165 if itm is None :
167166 return
168- self .selectionModel ().setCurrentIndex (itm , QtGui .QItemSelectionModel .SelectCurrent | QtGui .QItemSelectionModel .Rows )
167+ self .selectionModel ().setCurrentIndex (itm ,
168+ QtGui .QItemSelectionModel .SelectCurrent | QtGui .QItemSelectionModel .Rows )
169169
170170 class decomposition_treeview (abstract_treeview ):
171171
@@ -233,6 +233,7 @@ def add(t):
233233 itm = items [t2 ] = QtGui .QTreeWidgetItem (items .get (s2 , self ), [t2 ])
234234 itm .setData (0 , QtCore .Qt .UserRole , t2 )
235235 self .children [s2 ].append (t2 )
236+
236237 add (t )
237238
238239 for p in products :
@@ -379,6 +380,7 @@ def yield_shapes():
379380 shp = OCC .AIS .Handle_AIS_Shape .DownCast (li .Value (i + 1 ))
380381 if not shp .IsNull ():
381382 yield shp
383+
382384 return tuple (shp .HashCode (1 << 24 ) for shp in yield_shapes ())
383385
384386 def __init__ (self , widget ):
@@ -528,6 +530,7 @@ def handler(inst):
528530 for c in self .components :
529531 if c != component :
530532 c .select (inst )
533+
531534 return handler
532535
533536 def __init__ (self , settings = None ):
@@ -582,7 +585,8 @@ def start(self):
582585 sys .exit (self .exec_ ())
583586
584587 def browse (self ):
585- filename = QtGui .QFileDialog .getOpenFileName (self .window , 'Open file' , "." , "Industry Foundation Classes (*.ifc)" )
588+ filename = QtGui .QFileDialog .getOpenFileName (self .window , 'Open file' , "." ,
589+ "Industry Foundation Classes (*.ifc)" )
586590 self .load (filename )
587591
588592 def clear (self ):
0 commit comments