@@ -113,14 +113,12 @@ def initUI(self):
113113 self .list = QListView ()
114114 self .list .setModel (self .model )
115115 self .list .resize (640 , 480 )
116- self .list .activated .connect (self ._getPathActivated )
117116 self .list .setAlternatingRowColors (True )
118117 self .list .hide ()
119118
120119 self .table = QTableView ()
121120 self .table .setModel (self .model )
122121 self .table .resize (640 , 480 )
123- self .table .activated .connect (self ._getPathActivated )
124122 self .table .setAlternatingRowColors (True )
125123
126124 header = self .table .horizontalHeader ()
@@ -283,6 +281,8 @@ def listClicked(self, index):
283281 self .currentPath = dir_path
284282 self .textLine .setText (self .currentPath )
285283 return
284+ else :
285+ self .currentPath = None
286286 root_index = self .model .setRootPath (dir_path )
287287 self .list .setRootIndex (root_index )
288288 self .table .setRootIndex (root_index )
@@ -353,7 +353,7 @@ def _getPathActivated(self):
353353 row = self .list .selectionModel ().currentIndex ()
354354 else :
355355 row = self .table .selectionModel ().currentIndex ()
356- self .listClicked (row )
356+ self .listClicked (row )
357357
358358 fname = self .currentPath
359359 if fname is None :
@@ -514,6 +514,8 @@ def connectSelection(self):
514514 try :
515515 self .list .disconnect ()
516516 self .table .disconnect ()
517+ self .list .activated .connect (self ._getPathActivated )
518+ self .table .activated .connect (self ._getPathActivated )
517519 except :
518520 pass
519521 # choose double click or single click for folder selection
0 commit comments