|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2003 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter the data for a switch operation. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from PyQt5.QtWidgets import QDialog |
|
13 |
|
14 from .Ui_SvnSwitchDialog import Ui_SvnSwitchDialog |
|
15 |
|
16 |
|
17 class SvnSwitchDialog(QDialog, Ui_SvnSwitchDialog): |
|
18 """ |
|
19 Class implementing a dialog to enter the data for a switch operation. |
|
20 """ |
|
21 def __init__(self, taglist, reposURL, standardLayout, parent=None): |
|
22 """ |
|
23 Constructor |
|
24 |
|
25 @param taglist list of previously entered tags (list of strings) |
|
26 @param reposURL repository path (string) or None |
|
27 @param standardLayout flag indicating the layout of the |
|
28 repository (boolean) |
|
29 @param parent parent widget (QWidget) |
|
30 """ |
|
31 super(SvnSwitchDialog, self).__init__(parent) |
|
32 self.setupUi(self) |
|
33 |
|
34 self.tagCombo.clear() |
|
35 self.tagCombo.addItems(sorted(taglist)) |
|
36 |
|
37 if reposURL is not None and reposURL != "": |
|
38 self.tagCombo.setEditText(reposURL) |
|
39 |
|
40 if not standardLayout: |
|
41 self.TagTypeGroup.setEnabled(False) |
|
42 |
|
43 msh = self.minimumSizeHint() |
|
44 self.resize(max(self.width(), msh.width()), msh.height()) |
|
45 |
|
46 def getParameters(self): |
|
47 """ |
|
48 Public method to retrieve the tag data. |
|
49 |
|
50 @return tuple of string and int (tag, tag type) |
|
51 """ |
|
52 tag = self.tagCombo.currentText() |
|
53 tagType = 0 |
|
54 if self.regularButton.isChecked(): |
|
55 tagType = 1 |
|
56 elif self.branchButton.isChecked(): |
|
57 tagType = 2 |
|
58 if not tag: |
|
59 tagType = 4 |
|
60 return (tag, tagType) |