Commits

Mathias Panzenböck  committed 844484a

fixed strange crash when refresing player list

  • Participants
  • Parent commits 311c999

Comments (0)

Files changed (1)

File contents/code/main.py

 		self.frame.setImagePath("widgets/viewitem")
 		self.frame.setCacheAllRenderedFrames(True)
 		self.frame.setElementPrefix("selected")
-
+	
 	def paint(self,painter,option,widget):
 		applet = self.applet()
 		if applet and applet._selected is self:
 		while self.scroll_layout.count() > 0:
 			layout_item = self.scroll_layout.itemAt(0)
 			icon_widget = layout_item.graphicsItem()
+			icon_widget.setParent(None)
 			self.scroll_layout.removeItem(layout_item)
-			icon_widget.setParent(None)
+			del layout_item, icon_widget
 		self._selected = None
-
+		
 		default_icon = KIcon("applications-multimedia")
 		for name, player in players:
 			icon = None
 			if not icon:
 				icon = default_icon
 
-			icon_widget = PlayerIcon(icon,name,self,player)
+			icon_widget = PlayerIcon(icon,name,self,player,self.scroller)
 			icon_widget.resize(64,64)
 			icon_widget.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed))
 			icon_widget.clicked.connect(self._icon_click(icon_widget))
-			icon_widget.setOwnedByLayout(True)
 			self.scroll_layout.addItem(icon_widget)
 			
 			if self._selected is not None:
 					print >> sys.stderr, e
 			elif current == player.name:
 				self._selected = icon_widget
-
 		if self._selected is None and self.scroll_layout.count() > 0:
 			self._selected = self.scroll_layout.itemAt(0).graphicsItem()