7 Module implementing a dialog to enter options for a submodule update command. |
7 Module implementing a dialog to enter options for a submodule update command. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtWidgets import QDialog |
10 from PyQt6.QtWidgets import QDialog |
11 |
11 |
12 from .Ui_GitSubmodulesUpdateOptionsDialog import ( |
12 from .Ui_GitSubmodulesUpdateOptionsDialog import Ui_GitSubmodulesUpdateOptionsDialog |
13 Ui_GitSubmodulesUpdateOptionsDialog |
|
14 ) |
|
15 |
13 |
16 |
14 |
17 class GitSubmodulesUpdateOptionsDialog(QDialog, |
15 class GitSubmodulesUpdateOptionsDialog(QDialog, Ui_GitSubmodulesUpdateOptionsDialog): |
18 Ui_GitSubmodulesUpdateOptionsDialog): |
|
19 """ |
16 """ |
20 Class implementing a dialog to enter options for a submodule update |
17 Class implementing a dialog to enter options for a submodule update |
21 command. |
18 command. |
22 """ |
19 """ |
|
20 |
23 def __init__(self, submodulePaths, parent=None): |
21 def __init__(self, submodulePaths, parent=None): |
24 """ |
22 """ |
25 Constructor |
23 Constructor |
26 |
24 |
27 @param submodulePaths list of submodule paths |
25 @param submodulePaths list of submodule paths |
28 @type list of str |
26 @type list of str |
29 @param parent reference to the parent widget |
27 @param parent reference to the parent widget |
30 @type QWidget |
28 @type QWidget |
31 """ |
29 """ |
32 super().__init__(parent) |
30 super().__init__(parent) |
33 self.setupUi(self) |
31 self.setupUi(self) |
34 |
32 |
35 self.submodulesList.addItems(sorted(submodulePaths)) |
33 self.submodulesList.addItems(sorted(submodulePaths)) |
36 |
34 |
37 def getData(self): |
35 def getData(self): |
38 """ |
36 """ |
39 Public method to get the entered data. |
37 Public method to get the entered data. |
40 |
38 |
41 @return tuple containing the update procedure, a flag indicating an |
39 @return tuple containing the update procedure, a flag indicating an |
42 init, a flag indicating an update with remote, a flag indicating |
40 init, a flag indicating an update with remote, a flag indicating |
43 not to fetch the remote, a flag indicating an enforced operation |
41 not to fetch the remote, a flag indicating an enforced operation |
44 and a list of selected submodules. |
42 and a list of selected submodules. |
45 @rtype tuple of (int, bool, bool, bool, bool, list of str) |
43 @rtype tuple of (int, bool, bool, bool, bool, list of str) |
46 """ |
44 """ |
47 submodulePaths = [] |
45 submodulePaths = [] |
48 for itm in self.submodulesList.selectedItems(): |
46 for itm in self.submodulesList.selectedItems(): |
49 submodulePaths.append(itm.text()) |
47 submodulePaths.append(itm.text()) |
50 |
48 |
51 if self.checkoutButton.isChecked(): |
49 if self.checkoutButton.isChecked(): |
52 procedure = "--checkout" |
50 procedure = "--checkout" |
53 elif self.rebaseButton.isChecked(): |
51 elif self.rebaseButton.isChecked(): |
54 procedure = "--rebase" |
52 procedure = "--rebase" |
55 else: |
53 else: |
56 procedure = "--merge" |
54 procedure = "--merge" |
57 |
55 |
58 nofetch = (self.remoteCheckBox.isChecked() and |
56 nofetch = self.remoteCheckBox.isChecked() and self.nofetchCheckBox.isChecked() |
59 self.nofetchCheckBox.isChecked()) |
57 |
60 |
|
61 return ( |
58 return ( |
62 procedure, |
59 procedure, |
63 self.initCheckBox.isChecked(), |
60 self.initCheckBox.isChecked(), |
64 self.remoteCheckBox.isChecked(), |
61 self.remoteCheckBox.isChecked(), |
65 nofetch, |
62 nofetch, |