class Widget(QtGui.QWidget, Screen): title = ki18n("Packages") desc = ki18n("Install / Remove Programs") # min update time updateTime = 12 def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_packageWidget() self.ui.setupUi(self) # set updateTime self.ui.updateInterval.setValue(self.updateTime) # set initial states self.ui.checkUpdate.setChecked(True) self.ui.showTray.setChecked(True) # set signals self.ui.showTray.connect(self.ui.showTray, SIGNAL("toggled(bool)"), self.enableCheckTime) self.ui.checkUpdate.connect(self.ui.checkUpdate, SIGNAL("toggled(bool)"), self.updateSelected) def enableCheckTime(self): if self.ui.showTray.isChecked(): self.ui.checkUpdate.setVisible(True) self.ui.updateInterval.setVisible(True) else: self.ui.checkUpdate.setChecked(False) self.ui.checkUpdate.setVisible(False) self.ui.checkUpdate.setCheckState(Qt.Unchecked) self.ui.updateInterval.setVisible(False) def updateSelected(self): if self.ui.checkUpdate.isChecked(): self.ui.updateInterval.setEnabled(True) else: self.ui.updateInterval.setEnabled(False) def applySettings(self): # write selected configurations to future package-managerrc config = PMConfig() config.setSystemTray(QVariant(self.ui.showTray.isChecked())) config.setUpdateCheck(QVariant(self.ui.checkUpdate.isChecked())) config.setUpdateCheckInterval( QVariant(self.ui.updateInterval.value() * 60)) if self.ui.showTray.isChecked(): p = subprocess.Popen(["package-manager"], stdout=subprocess.PIPE) def shown(self): pass def execute(self): self.applySettings() return True
class Widget(QtGui.QWidget, Screen): title = ki18n("Packages") desc = ki18n("Install / Remove Programs") # min update time updateTime = 12 def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_packageWidget() self.ui.setupUi(self) # set updateTime self.ui.updateInterval.setValue(self.updateTime) # set initial states self.ui.checkUpdate.setChecked(True) self.ui.showTray.setChecked(True) # set signals self.ui.showTray.connect(self.ui.showTray, SIGNAL("toggled(bool)"), self.enableCheckTime) self.ui.checkUpdate.connect(self.ui.checkUpdate, SIGNAL("toggled(bool)"), self.updateSelected) def enableCheckTime(self): if self.ui.showTray.isChecked(): self.ui.checkUpdate.setVisible(True) self.ui.updateInterval.setVisible(True) else: self.ui.checkUpdate.setChecked(False) self.ui.checkUpdate.setVisible(False) self.ui.checkUpdate.setCheckState(Qt.Unchecked) self.ui.updateInterval.setVisible(False) def updateSelected(self): if self.ui.checkUpdate.isChecked(): self.ui.updateInterval.setEnabled(True) else: self.ui.updateInterval.setEnabled(False) def applySettings(self): # write selected configurations to future package-managerrc config = PMConfig() config.setSystemTray(QVariant(self.ui.showTray.isChecked())) config.setUpdateCheck(QVariant(self.ui.checkUpdate.isChecked())) config.setUpdateCheckInterval(QVariant(self.ui.updateInterval.value() * 60)) if self.ui.showTray.isChecked(): p = subprocess.Popen(["package-manager"], stdout=subprocess.PIPE) def shown(self): pass def execute(self): self.applySettings() return True
def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_packageWidget() self.ui.setupUi(self) # set initial checkbox visibility self.ui.checkUpdate.setVisible(False) self.ui.updateInterval.setVisible(False) # set signals self.ui.showTray.connect(self.ui.showTray, SIGNAL("toggled(bool)"), self.enableCheckTime) self.ui.checkUpdate.connect(self.ui.checkUpdate, SIGNAL("toggled(bool)"), self.updateSelected)
def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_packageWidget() self.ui.setupUi(self) # set updateTime self.ui.updateInterval.setValue(self.updateTime) # set initial states self.ui.checkUpdate.setChecked(True) self.ui.showTray.setChecked(True) # set signals self.ui.showTray.connect(self.ui.showTray, SIGNAL("toggled(bool)"), self.enableCheckTime) self.ui.checkUpdate.connect(self.ui.checkUpdate, SIGNAL("toggled(bool)"), self.updateSelected)
def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_packageWidget() self.ui.setupUi(self) # set initial checkbox visibility self.ui.checkUpdate.setVisible(False) self.ui.updateInterval.setVisible(False) # set signals self.ui.showTray.connect(self.ui.showTray, SIGNAL("toggled(bool)"), self.enableCheckTime) self.ui.checkUpdate.connect(self.ui.checkUpdate, SIGNAL("toggled(bool)"), self.updateSelected)
def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_packageWidget() self.ui.setupUi(self) # set updateTime self.ui.updateInterval.setValue(self.updateTime) # set initial states self.ui.checkUpdate.setChecked(True) self.ui.showTray.setChecked(True) # set signals self.ui.showTray.connect(self.ui.showTray, SIGNAL("toggled(bool)"), self.enableCheckTime) self.ui.checkUpdate.connect(self.ui.checkUpdate, SIGNAL("toggled(bool)"), self.updateSelected)