Exemplo n.º 1
0
    def selectIcon(self,  parent = None):

        dialog = DialogSelectFile(self)
        dialog.setWindowTitle("Select Icon")

        progress = QtGui.QProgressDialog("Please wait while loading icons", "Hide", 0, 100, parent)
        progress.setWindowModality(QtCore.Qt.WindowModal)
        progress.setAutoReset(True)
        progress.setAutoClose(True)
        progress.setMinimum(0)
        progress.setMaximum(100)
        progress.setWindowTitle("Loading...")
        progress.show()

        progress.setValue(0)

        directoryLocal = QDir(self.IconpathLocal)
        directoryLocal.setFilter(QDir.Files | QDir.Hidden | QDir.NoSymLinks);
        directoryLocal.setNameFilters(QStringList("*.png"))

        directoryGlobal = QDir(self.IconpathGlobal)
        directoryGlobal.setFilter(QDir.Files | QDir.Hidden | QDir.NoSymLinks);
        directoryGlobal.setNameFilters(QStringList("*.png"))

        for file in directoryLocal.entryList():
            icon = QIcon(self.IconpathLocal + file)
            part = string.split(file, '.png')[0]
            listItem = QListWidgetItem(icon,  part,  dialog.listFile,  QListWidgetItem.UserType)

        progress.setValue(50)

        for file in directoryGlobal.entryList():
            icon = QIcon(self.IconpathGlobal + file)
            part = string.split(file, '.png')[0]
            listItem = QListWidgetItem(icon,  part,   dialog.listFile,  QListWidgetItem.UserType)


        dialog.listFile.sortItems()
        progress.setValue(100)
#        progress.hide()

        dialog.show()
        dialog.exec_()

        selected = self.selFile
        self.selFile = ""
        return selected
Exemplo n.º 2
0
    def selectFile(self):

        dialog = DialogSelectFile(self)

        self.readFilenames()
        for index in self.nameref:
#            dialog.listFile.addItem(QString.fromUtf8(index))
            listItem = QListWidgetItem(index,  dialog.listFile,  QListWidgetItem.UserType)

        dialog.listFile.sortItems()

        dialog.show()
        dialog.exec_()

        selected = self.selFile
        self.selFile = ""
        return selected
Exemplo n.º 3
0
    def selectApp(self,  parent = None):
        self.readAllApps()
        dialog = DialogSelectFile(self)
        dialog.setWindowTitle("Select Application")
        dialog.listFile.setSelectionMode(QAbstractItemView.MultiSelection)

        progress = QtGui.QProgressDialog("Please wait while loading icons", "Hide", 0, 100, parent)
        progress.setWindowModality(QtCore.Qt.WindowModal)
        progress.setAutoReset(True)
        progress.setAutoClose(True)
        progress.setMinimum(0)
        progress.setMaximum(100)
        progress.setWindowTitle("Loading...")
        progress.show()

        progress.setValue(0)

        for app in self.allapps:
            if not self.allapps[app]["icon"]  == None:
                icon = QIcon.fromTheme(self.allapps[app]["icon"])
                if not icon.hasThemeIcon(self.allapps[app]["icon"]):
                    icon = QIcon("/usr/share/pixmaps/" + self.allapps[app]["icon"])
                listItem = QListWidgetItem(icon,  app,  dialog.listFile,  QListWidgetItem.UserType)
            else:
                listItem = QListWidgetItem(app,  dialog.listFile,  QListWidgetItem.UserType)

        dialog.listFile.sortItems()

        progress.setValue(100)

        dialog.show()
        dialog.exec_()

        selected = self.selFiles
        self.selFiles = {}
        return selected