|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2014 - 2017 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter the data of a remote repository. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from PyQt5.QtCore import pyqtSlot |
|
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
|
14 |
|
15 from .Ui_GitAddRemoteDialog import Ui_GitAddRemoteDialog |
|
16 |
|
17 |
|
18 class GitAddRemoteDialog(QDialog, Ui_GitAddRemoteDialog): |
|
19 """ |
|
20 Class implementing a dialog to enter the data of a remote repository. |
|
21 """ |
|
22 def __init__(self, parent=None): |
|
23 """ |
|
24 Constructor |
|
25 |
|
26 @param parent reference to the parent widget (QWidget) |
|
27 """ |
|
28 super(GitAddRemoteDialog, self).__init__(parent) |
|
29 self.setupUi(self) |
|
30 |
|
31 self.__updateOK() |
|
32 |
|
33 def __updateOK(self): |
|
34 """ |
|
35 Private method to update the status of the OK button. |
|
36 """ |
|
37 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( |
|
38 self.nameEdit.text() != "" and |
|
39 self.urlEdit.text() != "") |
|
40 |
|
41 @pyqtSlot(str) |
|
42 def on_nameEdit_textChanged(self, txt): |
|
43 """ |
|
44 Private slot handling changes of the entered name. |
|
45 |
|
46 @param txt current text (string) |
|
47 """ |
|
48 self.__updateOK() |
|
49 |
|
50 @pyqtSlot(str) |
|
51 def on_urlEdit_textChanged(self, txt): |
|
52 """ |
|
53 Private slot handling changes of the entered URL. |
|
54 |
|
55 @param txt current text (string) |
|
56 """ |
|
57 self.__updateOK() |
|
58 |
|
59 def getData(self): |
|
60 """ |
|
61 Public method to get the entered data. |
|
62 |
|
63 @return tuple with the name (string) and URL (string) of |
|
64 the remote repository |
|
65 """ |
|
66 return self.nameEdit.text(), self.urlEdit.text() |