def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_summaryWidget() self.ui.setupUi(self)
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Welcome") desc = ki18n("Welcome to Profiler") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_summaryWidget() self.ui.setupUi(self) def shown(self): self.wallpaperSettings = wallpaperWidget.Widget.screenSettings self.mouseSettings = mouseWidget.Widget.screenSettings self.menuSettings = menuWidget.Widget.screenSettings self.searchSettings = searchWidget.Widget.screenSettings self.styleSettings = styleWidget.Widget.screenSettings # self.smoltSettings = smoltWidget.Widget.screenSettings subject = "<p><li><b>%s</b></li><ul>" item = "<li>%s</li>" end = "</ul></p>" content = QString("") content.append("""<html><body><ul>""") # Mouse Settings content.append(subject % ki18n("Mouse Settings").toString()) content.append( item % ki18n("Selected Mouse configuration: <b>%s</b>").toString() % self.mouseSettings["summaryMessage"]["selectedMouse"].toString() ) # content.append(item % ki18n("Selected clicking behavior: <b>%s</b>") % self.mouseSettings["summaryMessage"]["clickBehavior"]) content.append( item % ki18n("Selected clicking behaviour: <b>%s</b>").toString() % self.mouseSettings["summaryMessage"]["clickBehavior"].toString() ) content.append(end) # Menu Settings content.append(subject % ki18n("Menu Settings").toString()) content.append( item % ki18n("Selected Menu: <b>%s</b>").toString() % self.menuSettings["summaryMessage"].toString() ) content.append(end) # Wallpaper Settings content.append(subject % ki18n("Wallpaper Settings").toString()) if self.wallpaperSettings["hasChanged"] == False: content.append(item % ki18n("You haven't selected any wallpaper.").toString()) else: content.append( item % ki18n("Selected Wallpaper: <b>%s</b>").toString() % os.path.basename(str(self.wallpaperSettings["selectedWallpaper"])) ) content.append(end) # Style Settings content.append(subject % ki18n("Style Settings").toString()) if self.styleSettings["hasChanged"] == False: content.append(item % ki18n("You haven't selected any style.").toString()) else: content.append( item % ki18n("Selected Style: <b>%s</b>").toString() % unicode(self.styleSettings["summaryMessage"]) ) content.append(end) # Search Settings content.append(subject % ki18n("Search Settings").toString()) content.append( item % ki18n("Desktop search: <b>%s</b>").toString() % self.searchSettings["summaryMessage"].toString() ) content.append(end) # Smolt Settings try: if self.smoltSettings["summaryMessage"]: content.append(subject % ki18n("Smolt Settings").toString()) content.append( item % ki18n("Send my profile: <b>%s</b>").toString() % self.smoltSettings["summaryMessage"] ) # content.append(ki18n("(<i><u>Warning:</u> Sending profile requires to set up communication with Smolt server and can take between 30 seconds to a minute. Profiler may freeze during this time.</i>)").toString()) content.append(end) except: print "WARNING: Your Smolt profile is already sent." content.append("""</ul></body></html>""") self.ui.textSummary.setHtml(content) def killPlasma(self): p = subprocess.Popen(["pidof", "-s", "plasma-desktop"], stdout=subprocess.PIPE) out, err = p.communicate() pidOfPlasma = int(out) try: os.kill(pidOfPlasma, 15) except OSError, e: print "WARNING: failed os.kill: %s" % e print "Trying SIGKILL" os.kill(pidOfPlasma, 9) finally: