Python Plasma.PopupApplet revisited

Nate C nate1001 at gmail.com
Wed Jul 14 07:39:10 CEST 2010


I went through the same thing a few days ago. I found this first block
on web somewhere.  If the form factor is not planar then you know you
are in a panel. I did not have much luck with the popup extenders.
But, this will allow it to at least dock sensibly to a panel.

def init
if (self.formFactor() == Plasma.Planar):
 self.planar = True
 self.horizontal = False
elif (self.formFactor() == Plasma.Horizontal):
 self.planar = False
 self.horizontal = True
elif (self.formFactor() == Plasma.Vertical):
 self.planar = False
 self.horizontal = False

# panel icon
if not self.planar:
   self.icon = MbPanelIcon()
   layout = QGraphicsLinearLayout(Qt.Vertical)
   self.setLayout(layout)
   layout.addItem(self.icon)
   self.icon.updateIcon(self.geometry())
   return


--
Regards,
Nate Carson


More information about the Plasma-devel mailing list