eric6/Plugins/VcsPlugins/vcsPySvn/SvnSwitchDialog.py

Sat, 10 Apr 2021 18:38:27 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 10 Apr 2021 18:38:27 +0200
changeset 8218
7c09585bd960
parent 7923
91e843545d9a
permissions
-rw-r--r--

Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).

# -*- coding: utf-8 -*-

# Copyright (c) 2003 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a dialog to enter the data for a switch operation.
"""

from PyQt5.QtWidgets import QDialog

from .Ui_SvnSwitchDialog import Ui_SvnSwitchDialog


class SvnSwitchDialog(QDialog, Ui_SvnSwitchDialog):
    """
    Class implementing a dialog to enter the data for a switch operation.
    """
    def __init__(self, taglist, reposURL, standardLayout, parent=None):
        """
        Constructor
        
        @param taglist list of previously entered tags (list of strings)
        @param reposURL repository path (string) or None
        @param standardLayout flag indicating the layout of the
            repository (boolean)
        @param parent parent widget (QWidget)
        """
        super().__init__(parent)
        self.setupUi(self)
       
        self.tagCombo.clear()
        self.tagCombo.addItems(sorted(taglist))
        
        if reposURL is not None and reposURL != "":
            self.tagCombo.setEditText(reposURL)
            
        if not standardLayout:
            self.TagTypeGroup.setEnabled(False)
        
        msh = self.minimumSizeHint()
        self.resize(max(self.width(), msh.width()), msh.height())
        
    def getParameters(self):
        """
        Public method to retrieve the tag data.
        
        @return tuple of string and int (tag, tag type)
        """
        tag = self.tagCombo.currentText()
        tagType = 0
        if self.regularButton.isChecked():
            tagType = 1
        elif self.branchButton.isChecked():
            tagType = 2
        if not tag:
            tagType = 4
        return (tag, tagType)

eric ide

mercurial