Exemple #1
0
    def showBasket(self):

        if self.basket.isVisible():
            return

        waitCursor()
        self.statusUpdater.wait()

        if self.currentState == self.state.ALL:
            action = {self.__remove_action:self.state.REMOVE,
                      self.__install_action:self.state.INSTALL}.get(self.sender(), self.state.INSTALL)
            if action:
                if action == self.state.REMOVE:
                    installed_packages = self.state.iface.getInstalledPackages()
                    filtered_packages = filter(lambda x: x not in installed_packages, self.basket.model.selectedPackages())
                    if filtered_packages == self.basket.model.selectedPackages():
                        restoreCursor()
                        QMessageBox(i18n("Select packages"),
                                    i18n("You must select at least one installed package"),
                                    QMessageBox.Information, QMessageBox.Ok, 0, 0).exec_()
                        return
                    self.packageList.model().sourceModel().selectPackages(filtered_packages, state = False)
                self.state.state = action

        self.basket._show()
        restoreCursor()
Exemple #2
0
 def showWebdialog(self):
     packageName = unicode(self.morewidgets.randomPackageList.currentItem().text())
     print packageName
     waitCursor()
     self.morewidgets._hide()
     self.webdialog._show()
     restoreCursor()
Exemple #3
0
 def groupFilter(self):
     waitCursor()
     self.packageList.resetMoreInfoRow()
     packages = self.state.groupPackages(self.groupList.currentGroup())
     self.packageList.model().setFilterRole(GroupRole)
     self.packageList.model().setFilterPackages(packages)
     self.packageList.scrollToTop()
     self.packageList.select_all.setChecked(self.groupList.currentGroup() in self._selectedGroups)
     restoreCursor()
Exemple #4
0
 def groupFilter(self):
     waitCursor()
     self.packageList.resetMoreInfoRow()
     packages = self.state.groupPackages(self.groupList.currentGroup())
     self.packageList.model().setFilterRole(GroupRole)
     self.packageList.model().setFilterPackages(packages)
     self.packageList.scrollToTop()
     self.packageList.select_all.setChecked(
         self.groupList.currentGroup() in self._selectedGroups)
     restoreCursor()
Exemple #5
0
 def initialize(self):
     waitCursor()
     self._last_packages = None
     self.state.reset()
     self.initializeUpdateTypeList()
     self.initializePackageList()
     self.initializeGroupList()
     self.initializeStatusUpdater()
     self.statusChanged()
     self._selectedGroups = []
     self.selectAll.setChecked(False)
     restoreCursor()
     QTimer.singleShot(1, self.initializeBasket)
Exemple #6
0
 def searchActivated(self):
     self.packageList.resetMoreInfoRow()
     waitCursor()
     searchText  = str(self.searchLine.text()).split()
     if searchText:
         sourceModel = self.packageList.model().sourceModel()
         self.state.cached_packages = sourceModel.search(searchText)
         self.groupList.lastSelected = None
         self.searchUsed = True
     else:
         self.state.cached_packages = None
         self.state.packages()
         self.searchUsed = False
     self.initializeGroupList()
     restoreCursor()
Exemple #7
0
    def showWebdialog(self):
        packageName = str(unicode(self.morewidgets.randomPackageList.currentItem().text()))
        liste = []
        liste.append(packageName)
        print liste
        waitCursor()
        self.morewidgets._hide()
        #self.webdialog._show()
        restoreCursor()



        #self.packageList.setPackages(liste)
        self.packageList.selectAll(liste)
        #self.packageList.setItemDelegate(PackageDelegate(self, self, showDetailsButton=True))
        #self.packageList.setColumnWidth(0, 32)
        
        
        self.operation = OperationManager(self.state)
        reinstall = False
        answer = True
        actions = self.state.checkInstallActions(liste)
        if actions:
            answer = askForActions(actions,
                   i18n("Selected packages are already installed.<br>"
                        "If you continue, the packages will be reinstalled"),
                   i18n("Already Installed Packages"),
                   i18n("Installed Packages"))

        if not answer:
            self.initializePackageList()
            self.initializeBasket()            
            self.initializeStatusUpdater()  
            self.state.state = self.parent.cw.currentState
            self.parent.cw.initialize()     
            return

        if actions:
            reinstall = True
            
        if reinstall == False:
            self.initializeStatusUpdater() 
            self.initializeBasket()
            self.statusUpdated()
           
        self.showBasket()
        self.initializeBasket()    
        self.initializeStatusUpdater()    
Exemple #8
0
 def initialize(self):
     waitCursor()
     self.searchLine.clear()
     self._started = False
     self._last_packages = None
     self.state.reset()
     self.initializePackageList()
     self.initializeGroupList()
     self.initializeStatusUpdater()
     self.statusChanged()
     self._selectedGroups = []
     self.packageList.select_all.setChecked(False)
     self.initializeBasket()
     self.searchLine.setFocus(True)
     if self.currentState == self.state.UPGRADE:
         if self.groupList.count() == 0:
             QTimer.singleShot(0, \
             lambda: self.pdsMessageBox.showMessage(i18n("All packages are up to date"), icon = "games-endturn"))
     if self.groupList.count() > 0:
         if self.state.inUpgrade():
             self.pdsMessageBox.hideMessage(force = True)
     restoreCursor()
Exemple #9
0
 def initialize(self):
     waitCursor()
     self.searchLine.clear()
     self._started = False
     self._last_packages = None
     self.state.reset()
     self.initializePackageList()
     self.initializeGroupList()
     self.initializeStatusUpdater()
     self.statusChanged()
     self._selectedGroups = []
     self.packageList.select_all.setChecked(False)
     self.initializeBasket()
     self.searchLine.setFocus(True)
     if self.currentState == self.state.UPGRADE:
         if self.groupList.count() == 0:
             QTimer.singleShot(0, \
             lambda: self.pdsMessageBox.showMessage(i18n("All packages are up to date"), icon = "games-endturn"))
     if self.groupList.count() > 0:
         if self.state.inUpgrade():
             self.pdsMessageBox.hideMessage(force=True)
     restoreCursor()
Exemple #10
0
    def showBasket(self):

        if self.basket.isVisible():
            return

        waitCursor()
        self.statusUpdater.wait()

        if self.currentState == self.state.ALL:
            action = {
                self.__remove_action: self.state.REMOVE,
                self.__install_action: self.state.INSTALL
            }.get(self.sender(), self.state.INSTALL)
            if action:
                if action == self.state.REMOVE:
                    installed_packages = self.state.iface.getInstalledPackages(
                    )
                    filtered_packages = filter(
                        lambda x: x not in installed_packages,
                        self.basket.model.selectedPackages())
                    if filtered_packages == self.basket.model.selectedPackages(
                    ):
                        restoreCursor()
                        QMessageBox(
                            i18n("Select packages"),
                            i18n(
                                "You must select at least one installed package"
                            ), QMessageBox.Information, QMessageBox.Ok, 0,
                            0).exec_()
                        return
                    self.packageList.model().sourceModel().selectPackages(
                        filtered_packages, state=False)
                self.state.state = action

        self.basket._show()
        restoreCursor()
Exemple #11
0
 def showMoreWidgets(self):
     if self.morewidgets.isVisible():
         return
     waitCursor()
     self.morewidgets._show()
     restoreCursor()
Exemple #12
0
 def initializeBasket(self):
     waitCursor()
     self.basket.setModel(self.packageList.model().sourceModel())
     restoreCursor()
Exemple #13
0
 def initializeBasket(self):
     waitCursor()
     self.basket.setModel(self.packageList.model().sourceModel())
     restoreCursor()
Exemple #14
0
 def showBasket(self):
     waitCursor()
     self.statusUpdater.wait()
     self.basket.show()
     restoreCursor()