Logo Search packages:      
Sourcecode: guidance-power-manager version File versions

def guidance-power-manager::PowerManager::_addBatteryWidgets (   self  )  [private]

Adds progressbars to show battery status to the tooltip.

Definition at line 742 of file guidance-power-manager.py.

00742                                 :
        """ Adds progressbars to show battery status to the tooltip."""
        BattLayout = QHBoxLayout(None)

        self.BattPixmap = QLabel(self.tooltip)
        self.BattPixmap.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed))
        self.BattPixmap.setPixmap(BarIcon(self.icon))
        self.BattPixmap.setScaledContents(1)
        BattLayout.addWidget(self.BattPixmap)
        self.BattMainLabel = QLabel(self.tooltip)
        self.BattMainLabel.setText(i18n("<b>Battery:</b>"))
        BattLayout.addWidget(self.BattMainLabel)

        # Add to tooltip
        self.tooltip.layout().addLayout(BattLayout)

        # Create a progressbar and a label for every battery found, and add it to tooltip
        self.BattLabel = {}
        self.BattLayout = {}
        self.BattProgress = {}
        i = 1
        for batt in self.powermanager.batteries:
            self.BattLayout[batt] = QHBoxLayout(None)
            self.BattLabel[batt] = QLabel(self.tooltip)
            if len(self.powermanager.batteries) > 1:
                self.BattLabel[batt].setText(i18n("Battery %i" % i))
            self.BattLayout[batt].addWidget(self.BattLabel[batt])
            self.BattProgress[batt] = QProgressBar(self.tooltip)
            self.BattProgress[batt].setMinimumSize(QSize(200,0))
            self.BattLayout[batt].addWidget(self.BattProgress[batt])
            self.tooltip.layout().addLayout(self.BattLayout[batt])
            i += 1

    def _updateBatteryWidget(self, batt, state, level, remain, rate):


Generated by  Doxygen 1.6.0   Back to index