Exemplo n.º 1
0
 def on_pushButtonRemove_clicked(self):
     repo = self.listWidgetRepos.currentItem().text()
     answer = QtWidgets.QMessageBox.question(
         self, 'Remove repository',
         'Are you sure you want to remove repository: %s?' % repo)
     if answer == QtWidgets.QMessageBox.Yes:
         self.listWidgetRepos.takeItem(self.listWidgetRepos.currentRow())
         settings = Settings()
         repos = settings.repositories
         try:
             repos.remove(repo)
         except ValueError:
             pass
         settings.repositories = repos
Exemplo n.º 2
0
 def on_pushButtonAdd_clicked(self):
     path = QtWidgets.QFileDialog.getExistingDirectory(
         self, 'Select a repository')
     settings = Settings()
     if path and path not in settings.repositories:
         if os.path.exists(os.path.join(path, '.git')):
             repos = settings.repositories
             repos.append(path)
             settings.repositories = repos
             item = QtWidgets.QListWidgetItem()
             item.setText(path)
             item.setIcon(get_status_icon())
             item.setData(QtCore.Qt.UserRole, (False, RemoteStatus.up_to_date))
             self.listWidgetRepos.addItem(item)
             self.on_refresh_requested()
         else:
             QtWidgets.QMessageBox.warning(
                 self, 'Not a git repository',
                 'The chosen directory is not a git repository')