Пример #1
0
    def __init__(self, *args):
        apply(PanelWidget.__init__, (self,) + args)

        # set texts
        self.setCaption(i18n("Panel"))
        self.styleLabel.setText(i18n("Here, you can select a <b>style </b>for your desktop. <b>Pardus</b> provides some eye candy styles for you."))
        self.pix_style.setText(QString.null)
        self.styleButton.setText(i18n("Preview"))
        self.checkKickoff.setText(i18n("Use enhanced Kickoff style menu"))

        # set lang
        self.sysLang = KGlobal.locale().language()

        # set images
        self.setPaletteBackgroundPixmap(QPixmap(locate("data", "kaptan/pics/middleWithCorner.png")))

        # set signals
        self.connect(self.styleBox, SIGNAL("activated(int)"), self.styleSelected)
        self.connect(self.checkKickoff, SIGNAL("clicked()"), self.kickoffSelected)
        self.connect(self.styleButton, SIGNAL("clicked()"), self.applyStyle)

        # common Pardus settings for all themes
        config = KConfig("kdeglobals")
        config.setGroup("KDE")
        config.writeEntry("ShowIconsOnPushButtons", True)
        config.writeEntry("EffectAnimateCombo", True)
        config.sync()

        # add kaptan themes into resource pool
        KGlobal.dirs().addResourceType("themes", KStandardDirs.kde_default("data") + "kaptan/pics/themes/")

        themeNames = QStringList(KGlobal.dirs().findAllResources("themes", "*.desktop", True))
        themeNames.sort()

        self.panelNames = {}

        for theme in themeNames:
            parser = DesktopParser()
            parser.read(str(theme))
            try:
                self.panelNames[parser.get_locale('Panel', 'Name[%s]'%self.sysLang, '')] = parser.get_locale('Panel', 'Name', '')
            except:
                self.panelNames[parser.get_locale('Panel', 'Name'%self.sysLang, '')] = parser.get_locale('Panel', 'Name', '')


        sortedPanels = self.panelNames.keys()
        sortedPanels.sort()

        for panel in sortedPanels:
            self.styleBox.insertItem(panel)

        self.styleBox.setCurrentItem(0)
        self.styleSelected(0)
Пример #2
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_wallpaperWidget()
        self.ui.setupUi(self)
        # Get system locale
        self.catLang = KGlobal.locale().language()

        # Get screen resolution
        rect =  QtGui.QDesktopWidget().screenGeometry()

        # Get metadata.desktop files from shared wallpaper directory
        lst= KStandardDirs().findAllResources("wallpaper", "*metadata.desktop", KStandardDirs.Recursive)

        for desktopFiles in lst:
            parser = DesktopParser()
            parser.read(str(desktopFiles))

            try:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name[%s]'%self.catLang, '')
            except:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '')

            try:
                wallpaperDesc = parser.get_locale('Desktop Entry', 'X-KDE-PluginInfo-Author', '')
            except:
                wallpaperDesc = "Unknown"

            # Get all files in the wallpaper's directory
            thumbFolder = os.listdir(os.path.join(os.path.split(str(desktopFiles))[0], "contents"))

            """
            Appearantly the thumbnail names doesn't have a standart.
            So we get the file list from the contents folder and
            choose the file which has a name that starts with "scre".

            File names I've seen so far;
            screenshot.jpg, screnshot.jpg, screenshot.png, screnshot.png
            """

            wallpaperThumb = ""

            for thumb in thumbFolder:
                if thumb.startswith('scre'):
                    wallpaperThumb = os.path.join(os.path.split(str(desktopFiles))[0], "contents/" + thumb)

            wallpaperFile = os.path.split(str(desktopFiles))[0]

            # Insert wallpapers to listWidget.
            item = QtGui.QListWidgetItem(self.ui.listWallpaper)
            # Each wallpaper item is a widget. Look at widgets.py for more information.
            widget = WallpaperItemWidget(unicode(wallpaperTitle), unicode(wallpaperDesc), wallpaperThumb, self.ui.listWallpaper)
            item.setSizeHint(QSize(120,170))
            self.ui.listWallpaper.setItemWidget(item, widget)
            # Add a hidden value to each item for detecting selected wallpaper's path.
            item.setStatusTip(wallpaperFile)

        self.ui.listWallpaper.connect(self.ui.listWallpaper, SIGNAL("itemSelectionChanged()"), self.setWallpaper)
        self.ui.checkBox.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"), self.disableWidgets)
        self.ui.buttonChooseWp.connect(self.ui.buttonChooseWp, SIGNAL("clicked()"), self.selectWallpaper)
Пример #3
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_wallpaperWidget()
        self.ui.setupUi(self)
        # Get system locale
        self.catLang = KGlobal.locale().language()

        isWide = lambda x: float(x[0]) / float(x[1]) >= 1.6
        isSquare = lambda x: float(x[0]) / float(x[1]) < 1.6

        # Get screen resolution
        rect =  QtGui.QDesktopWidget().screenGeometry()

        # Get metadata.desktop files from shared wallpaper directory
        lst= KStandardDirs().findAllResources("wallpaper", "*metadata.desktop", KStandardDirs.Recursive)

        for desktopFiles in lst:
            parser = DesktopParser()
            parser.read(str(desktopFiles))

            try:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name[%s]'%self.catLang, '')
            except:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '')

            try:
                wallpaperDesc = parser.get_locale('Desktop Entry', 'X-KDE-PluginInfo-Author', '')
            except:
                wallpaperDesc = "Unknown"

            # Get all files in the wallpaper's directory
            l = os.listdir(os.path.join(os.path.split(str(desktopFiles))[0], "contents/images"))

            wallpaperFile = os.path.split(str(desktopFiles))[0]
            wallpaperThumb = os.path.join(os.path.split(str(desktopFiles))[0], "contents/screenshot.png")

            # Insert wallpapers to listWidget.
            item = QtGui.QListWidgetItem(self.ui.listWallpaper)
            # Each wallpaper item is a widget. Look at widgets.py for more information.
            widget = WallpaperItemWidget(unicode(wallpaperTitle), unicode(wallpaperDesc), wallpaperThumb, self.ui.listWallpaper)
            item.setSizeHint(QSize(38,110))
            self.ui.listWallpaper.setItemWidget(item, widget)
            # Add a hidden value to each item for detecting selected wallpaper's path.
            item.setStatusTip(wallpaperFile)

        self.ui.listWallpaper.connect(self.ui.listWallpaper, SIGNAL("itemSelectionChanged()"), self.setWallpaper)
        self.ui.checkBox.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"), self.disableWidgets)
        self.ui.buttonChooseWp.connect(self.ui.buttonChooseWp, SIGNAL("clicked()"), self.selectWallpaper)
Пример #4
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_styleWidget()
        self.ui.setupUi(self)

        self.styleDetails = {}
        self.catLang = KGlobal.locale().language()

        config = KConfig("kwinrc")
        group = config.group("Desktops")
        defaultDesktopNumber = int(group.readEntry('Number'))

        self.ui.spinBoxDesktopNumbers.setValue(defaultDesktopNumber)
        lst2 = glob.glob1("/usr/kde/4/share/apps/kaptan/gui/styles", "*.style")

        for desktopFiles in lst2:
            parser = DesktopParser()
            parser.read("/usr/kde/4/share/apps/kaptan/gui/styles/" +
                        str(desktopFiles))
            try:
                styleName = unicode(
                    parser.get_locale('Style', 'name[%s]' % self.catLang, ''))
            except:
                styleName = unicode(parser.get_locale('Style', 'name', ''))
            try:
                styleDesc = unicode(
                    parser.get_locale('Style',
                                      'description[%s]' % self.catLang, ''))
            except:
                styleDesc = unicode(
                    parser.get_locale('Style', 'description', ''))
            try:
                # TODO find a fallback values for these & handle exceptions seperately.
                #styleApplet = parser.get_locale('Style', 'applets', '')
                panelPosition = parser.get_locale('Style', 'panelPosition', '')
                #styleColorScheme = parser.get_locale('Style', 'colorScheme', '')
                widgetStyle = unicode(
                    parser.get_locale('Style', 'widgetStyle', ''))
                desktopTheme = unicode(
                    parser.get_locale('Style', 'desktopTheme', ''))
                colorScheme = unicode(
                    parser.get_locale('Style', 'colorScheme', ''))
                iconTheme = unicode(parser.get_locale('Style', 'iconTheme',
                                                      ''))
                windowDecoration = unicode(
                    parser.get_locale('Style', 'windowDecoration', ''))
                styleThumb = unicode(
                    os.path.join("/usr/kde/4/share/apps/kaptan/gui/styles/",
                                 parser.get_locale('Style', 'thumbnail', '')))

                colorDict = {}
                colorDir = "/usr/kde/4/share/apps/color-schemes/"
                self.Config = ConfigParser()
                self.Config.optionxform = str
                color = colorDir + colorScheme + ".colors"
                if not os.path.exists(color):
                    color = colorDir + "Oxygen.colors"

                self.Config.read(color)
                #colorConfig= KConfig("kdeglobals")
                for i in self.Config.sections():
                    #colorGroup = colorConfig.group(str(i))
                    colorDict[i] = {}
                    for key, value in self.ConfigSectionMap(i).items():
                        colorDict[i][key] = value
                        #colorGroup.writeEntry(str(key), str(value))

                self.styleDetails[styleName] = {
                    "description": styleDesc,
                    "widgetStyle": widgetStyle,
                    "colorScheme": colorDict,
                    "desktopTheme": desktopTheme,
                    "iconTheme": iconTheme,
                    "windowDecoration": windowDecoration,
                    "panelPosition": panelPosition
                }

                item = QtGui.QListWidgetItem(self.ui.listStyles)
                widget = StyleItemWidget(unicode(styleName),
                                         unicode(styleDesc), styleThumb,
                                         self.ui.listStyles)
                self.ui.listStyles.setItemWidget(item, widget)
                item.setSizeHint(QSize(120, 170))
                item.setStatusTip(styleName)
            except:
                print "Warning! Invalid syntax in ", desktopFiles

        self.ui.listStyles.connect(self.ui.listStyles,
                                   SIGNAL("itemSelectionChanged()"),
                                   self.setStyle)
        self.ui.comboBoxDesktopType.connect(
            self.ui.comboBoxDesktopType, SIGNAL("activated(const QString &)"),
            self.setDesktopType)
        self.ui.spinBoxDesktopNumbers.connect(
            self.ui.spinBoxDesktopNumbers,
            SIGNAL("valueChanged(const QString &)"), self.addDesktop)
Пример #5
0
    def __init__(self, *args):
        apply(WallpaperWidget.__init__, (self,) + args)

        # set texts
        self.checkAllWallpapers.setText(i18n("Show all resolutions."))
        self.currentText = QString(i18n("Old Wallpaper"))
        self.noneText = QString(i18n("No Wallpaper"))

        # set images
        self.setPaletteBackgroundPixmap(QPixmap(locate("data", "kaptan/pics/middleWithCorner.png")))
        self.nonePic = "kaptan/pics/no-wallpaper.jpg"

        # reverse sorting
        self.listWallpaper.setSorting(-1)

        # set/create variables
        self.tmpThumbDir = os.path.join(os.path.expanduser("~"), ".kde/share/apps/kaptan/kaptan-thumbs")

        self.catLang = KGlobal.locale().language()

        self.thumbSize = 150, 150
        self.wallpaperList = {}
        self.ultimateList = []
        self.wideList = {}
        self.topList = {}
        lst = {}

        # create temp directory for wallpaper thumbnails
        if not os.path.exists(self.tmpThumbDir):
            os.makedirs(self.tmpThumbDir)

        # detect if screen is wide or not
        self.isWide = False
        rect = QApplication.desktop().screenGeometry()

        if float(rect.width()) / float(rect.height()) >= 1.6:
            self.isWide = True

        # get .desktop files from global resources
        lst = KGlobal.dirs().findAllResources("wallpaper", "*.desktop", False, True)

        for desktopFiles in lst:
            # eliminate svgz files
            if not desktopFiles.endsWith(".svgz.desktop"):
                # parse .desktop file
                parser = DesktopParser()
                parser.read(str(desktopFiles))

                try:
                    # FYI: there must have been a Resolution=Wide tag in wallpaper file.
                    resolution = parser.get_locale("Wallpaper", "Resolution", "")
                except ConfigParser.NoOptionError:
                    resolution = False

                try:
                    isOnTop = parser.get_locale("Wallpaper", "OnTop", "")
                except ConfigParser.NoOptionError:
                    isOnTop = False

                try:
                    try:
                        wallpaperTitle = parser.get_locale("Wallpaper", "Name[%s]" % self.catLang, "")
                    except:
                        wallpaperTitle = parser.get_locale("Wallpaper", "Name", "")

                    wallpaperTitle = QString(i18n(wallpaperTitle))

                    wallpaperFile = "/usr/kde/3.5/share/wallpapers/" + parser.get_locale("Wallpaper", "File", "")

                    # get wide wallpapers
                    if resolution == "Wide":
                        self.wideList[wallpaperFile] = wallpaperTitle

                    # list the exclusive wallpapers
                    if isOnTop:
                        self.topList[wallpaperFile] = wallpaperTitle

                    # get normal size wallpapers
                    self.wallpaperList[wallpaperFile] = wallpaperTitle
                except ConfigParser.NoOptionError, e:
                    logging.debug("No Option Error: " + str(e))
Пример #6
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_styleWidget()
        self.ui.setupUi(self)

        self.styleDetails = {}
        self.catLang = KGlobal.locale().language()

        config = KConfig("kwinrc")
        group = config.group("Desktops")
        defaultDesktopNumber = int(group.readEntry('Number'))

        self.ui.spinBoxDesktopNumbers.setValue(defaultDesktopNumber)
        lst2 = glob.glob1("/usr/kde/4/share/apps/kaptan/gui/styles", "*.style")

        for desktopFiles in lst2:
            parser = DesktopParser()
            parser.read("/usr/kde/4/share/apps/kaptan/gui/styles/" +str(desktopFiles))
            try:
                styleName = unicode(parser.get_locale('Style', 'name[%s]'%self.catLang, ''))
            except:
                styleName = unicode(parser.get_locale('Style', 'name', ''))
            try:
                styleDesc = unicode(parser.get_locale('Style', 'description[%s]'%self.catLang, ''))
            except:
                styleDesc = unicode(parser.get_locale('Style', 'description', ''))
            try:
                # TODO find a fallback values for these & handle exceptions seperately.
                #styleApplet = parser.get_locale('Style', 'applets', '')
                panelPosition = parser.get_locale('Style', 'panelPosition', '')
                #styleColorScheme = parser.get_locale('Style', 'colorScheme', '')
                widgetStyle = unicode(parser.get_locale('Style', 'widgetStyle', ''))
                desktopTheme = unicode(parser.get_locale('Style', 'desktopTheme', ''))
                colorScheme = unicode(parser.get_locale('Style', 'colorScheme', ''))
                iconTheme = unicode(parser.get_locale('Style', 'iconTheme', ''))
                windowDecoration = unicode(parser.get_locale('Style', 'windowDecoration', ''))
                styleThumb = unicode(os.path.join("/usr/kde/4/share/apps/kaptan/gui/styles/",  parser.get_locale('Style', 'thumbnail','')))

                colorDict = {}
                colorDir = "/usr/kde/4/share/apps/color-schemes/"
                self.Config = ConfigParser()
                self.Config.optionxform = str
                color = colorDir + colorScheme + ".colors"
                if not os.path.exists(color):
                    color = colorDir + "Oxygen.colors"

                self.Config.read(color)
                #colorConfig= KConfig("kdeglobals")
                for i in self.Config.sections():
                    #colorGroup = colorConfig.group(str(i))
                    colorDict[i] = {}
                    for key, value in self.ConfigSectionMap(i).items():
                        colorDict[i][key] = value
                        #colorGroup.writeEntry(str(key), str(value))

                self.styleDetails[styleName] = {
                        "description": styleDesc, 
                        "widgetStyle": widgetStyle, 
                        "colorScheme": colorDict, 
                        "desktopTheme": desktopTheme, 
                        "iconTheme": iconTheme, 
                        "windowDecoration": windowDecoration, 
                        "panelPosition": panelPosition
                        }

                item = QtGui.QListWidgetItem(self.ui.listStyles)
                widget = StyleItemWidget(unicode(styleName), unicode(styleDesc), styleThumb, self.ui.listStyles)
                self.ui.listStyles.setItemWidget(item, widget)
                item.setSizeHint(QSize(38,110))
                item.setStatusTip(styleName)
            except:
                print "Warning! Invalid syntax in ", desktopFiles

        self.ui.listStyles.connect(self.ui.listStyles, SIGNAL("itemSelectionChanged()"), self.setStyle)
        self.ui.comboBoxDesktopType.connect(self.ui.comboBoxDesktopType, SIGNAL("activated(const QString &)"), self.setDesktopType)
        self.ui.spinBoxDesktopNumbers.connect(self.ui.spinBoxDesktopNumbers, SIGNAL("valueChanged(const QString &)"), self.addDesktop)
Пример #7
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_wallpaperWidget()
        self.ui.setupUi(self)
        # Get system locale
        self.catLang = KGlobal.locale().language()

        isWide = lambda x: float(x[0]) / float(x[1]) >= 1.6
        isSquare = lambda x: float(x[0]) / float(x[1]) < 1.6

        # Get screen resolution
        rect = QtGui.QDesktopWidget().screenGeometry()

        # Get metadata.desktop files from shared wallpaper directory
        lst = KStandardDirs().findAllResources("wallpaper",
                                               "*metadata.desktop",
                                               KStandardDirs.Recursive)

        for desktopFiles in lst:
            parser = DesktopParser()
            parser.read(str(desktopFiles))

            try:
                wallpaperTitle = parser.get_locale('Desktop Entry',
                                                   'Name[%s]' % self.catLang,
                                                   '')
            except:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '')

            try:
                wallpaperDesc = parser.get_locale('Desktop Entry',
                                                  'X-KDE-PluginInfo-Author',
                                                  '')
            except:
                wallpaperDesc = "Unknown"

            # Get all files in the wallpaper's directory
            l = os.listdir(
                os.path.join(
                    os.path.split(str(desktopFiles))[0], "contents/images"))

            wallpaperFile = os.path.split(str(desktopFiles))[0]
            wallpaperThumb = os.path.join(
                os.path.split(str(desktopFiles))[0], "contents/screenshot.png")

            # Insert wallpapers to listWidget.
            item = QtGui.QListWidgetItem(self.ui.listWallpaper)
            # Each wallpaper item is a widget. Look at widgets.py for more information.
            widget = WallpaperItemWidget(unicode(wallpaperTitle),
                                         unicode(wallpaperDesc),
                                         wallpaperThumb, self.ui.listWallpaper)
            item.setSizeHint(QSize(38, 110))
            self.ui.listWallpaper.setItemWidget(item, widget)
            # Add a hidden value to each item for detecting selected wallpaper's path.
            item.setStatusTip(wallpaperFile)

        self.ui.listWallpaper.connect(self.ui.listWallpaper,
                                      SIGNAL("itemSelectionChanged()"),
                                      self.setWallpaper)
        self.ui.checkBox.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"),
                                 self.disableWidgets)
        self.ui.buttonChooseWp.connect(self.ui.buttonChooseWp,
                                       SIGNAL("clicked()"),
                                       self.selectWallpaper)
Пример #8
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_wallpaperWidget()
        self.ui.setupUi(self)
        # Get system locale
        self.catLang = KGlobal.locale().language()

        # Get screen resolution
        rect = QtGui.QDesktopWidget().screenGeometry()

        # Get metadata.desktop files from shared wallpaper directory
        lst = KStandardDirs().findAllResources("wallpaper",
                                               "*metadata.desktop",
                                               KStandardDirs.Recursive)

        for desktopFiles in lst:
            parser = DesktopParser()
            parser.read(str(desktopFiles))

            try:
                wallpaperTitle = parser.get_locale('Desktop Entry',
                                                   'Name[%s]' % self.catLang,
                                                   '')
            except:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '')

            try:
                wallpaperDesc = parser.get_locale('Desktop Entry',
                                                  'X-KDE-PluginInfo-Author',
                                                  '')
            except:
                wallpaperDesc = "Unknown"

            # Get all files in the wallpaper's directory
            thumbFolder = os.listdir(
                os.path.join(os.path.split(str(desktopFiles))[0], "contents"))
            """
            Appearantly the thumbnail names doesn't have a standart.
            So we get the file list from the contents folder and
            choose the file which has a name that starts with "scre".

            File names I've seen so far;
            screenshot.jpg, screnshot.jpg, screenshot.png, screnshot.png
            """

            wallpaperThumb = ""

            for thumb in thumbFolder:
                if thumb.startswith('scre'):
                    wallpaperThumb = os.path.join(
                        os.path.split(str(desktopFiles))[0],
                        "contents/" + thumb)

            wallpaperFile = os.path.split(str(desktopFiles))[0]

            # Insert wallpapers to listWidget.
            item = QtGui.QListWidgetItem(self.ui.listWallpaper)
            # Each wallpaper item is a widget. Look at widgets.py for more information.
            widget = WallpaperItemWidget(unicode(wallpaperTitle),
                                         unicode(wallpaperDesc),
                                         wallpaperThumb, self.ui.listWallpaper)
            item.setSizeHint(QSize(120, 170))
            self.ui.listWallpaper.setItemWidget(item, widget)
            # Add a hidden value to each item for detecting selected wallpaper's path.
            item.setStatusTip(wallpaperFile)

        self.ui.listWallpaper.connect(self.ui.listWallpaper,
                                      SIGNAL("itemSelectionChanged()"),
                                      self.setWallpaper)
        self.ui.checkBox.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"),
                                 self.disableWidgets)
        self.ui.buttonChooseWp.connect(self.ui.buttonChooseWp,
                                       SIGNAL("clicked()"),
                                       self.selectWallpaper)
Пример #9
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_wallpaperWidget()
        self.ui.setupUi(self)
        # Get system locale
        self.catLang = KGlobal.locale().language()

        # Get screen resolution
        # rect = QtGui.QDesktopWidget().screenGeometry() FIXME: where could
        # this be needed?

        # Get metadata.desktop files from shared wallpaper directory
        lst = KStandardDirs().findAllResources("wallpaper", "*metadata.desktop", KStandardDirs.Recursive)

        for desktopFiles in lst:
            parser = DesktopParser()
            parser.read(str(desktopFiles))

            try:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name[%s]' % self.catLang, '')
            except:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '')

            try:
                wallpaperDesc = parser.get_locale('Desktop Entry', 'X-KDE-PluginInfo-Author', '')
            except:
                wallpaperDesc = "Unknown"

            # Get all files in the wallpaper's directory
            try:
                thumbFolder = os.listdir(os.path.join(os.path.split(str(desktopFiles))[0], "contents"))
            except OSError:
                thumbFolder = os.listdir(os.path.join(os.path.split(str(desktopFiles))[0], "content"))

            """
            Appearantly the thumbnail names doesn't have a standard.
            So we get the file list from the contents folder and
            choose the file which has a name that starts with "scre".

            File names I've seen so far;
            screenshot.jpg, screnshot.jpg, screenshot.png, screnshot.png
            """

            wallpaperThumb = ""

            for thumb in thumbFolder:
                if thumb.startswith('scre'):
                    wallpaperThumb = os.path.join(os.path.split(str(desktopFiles))[0], "contents/" + thumb)

            if not wallpaperThumb:
            	    wallpaperThumb = os.path.join(os.path.split(str(desktopFiles))[0], "contents/images/1024x768.png")
            	    if not os.path.exists(wallpaperThumb):
            		wallpaperThumb = os.path.join("./module_gui/pics/logo2010.png")
            		print "Thumbnail missed swtitch to default:",wallpaperThumb

            wallpaperFile = os.path.split(str(desktopFiles))[0]

            # Insert wallpapers to listWidget.
            item = QtGui.QListWidgetItem(self.ui.listWallpaper)
            # Each wallpaper item is a widget. Look at widgets.py for more information.
            widget = WallpaperItemWidget(unicode(wallpaperTitle, "utf8", "replace"), unicode(wallpaperDesc, "utf8", "replace"), wallpaperThumb, self.ui.listWallpaper)
            item.setSizeHint(QSize(150, 180))
            self.ui.listWallpaper.setItemWidget(item, widget)
            # Add a hidden value to each item for detecting selected wallpaper's path.
            item.setStatusTip(wallpaperFile)

        self.ui.listWallpaper.itemSelectionChanged.connect(self.setWallpaper)
        self.ui.checkBox.stateChanged.connect(self.disableWidgets)
        self.ui.buttonChooseWp.clicked.connect(self.selectWallpaper)