4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to define guards for patches. |
7 Module implementing a dialog to define guards for patches. |
8 """ |
8 """ |
9 |
|
10 import os |
|
11 |
9 |
12 from PyQt5.QtCore import pyqtSlot, Qt, QCoreApplication |
10 from PyQt5.QtCore import pyqtSlot, Qt, QCoreApplication |
13 from PyQt5.QtWidgets import ( |
11 from PyQt5.QtWidgets import ( |
14 QDialog, QDialogButtonBox, QAbstractButton, QListWidgetItem |
12 QDialog, QDialogButtonBox, QAbstractButton, QListWidgetItem |
15 ) |
13 ) |
78 else: |
76 else: |
79 self.__dirtyList = False |
77 self.__dirtyList = False |
80 |
78 |
81 e.accept() |
79 e.accept() |
82 |
80 |
83 def start(self, path): |
81 def start(self): |
84 """ |
82 """ |
85 Public slot to start the list command. |
83 Public slot to start the list command. |
86 |
84 """ |
87 @param path name of directory to be listed (string) |
|
88 """ |
|
89 dname, fname = self.vcs.splitPath(path) |
|
90 |
|
91 # find the root of the repo |
|
92 repodir = dname |
|
93 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
94 repodir = os.path.dirname(repodir) |
|
95 if os.path.splitdrive(repodir)[1] == os.sep: |
|
96 return |
|
97 |
|
98 self.__repodir = repodir |
|
99 self.on_patchSelector_activated("") |
85 self.on_patchSelector_activated("") |
100 |
86 |
101 @pyqtSlot(str) |
87 @pyqtSlot(str) |
102 def on_patchSelector_activated(self, patch): |
88 def on_patchSelector_activated(self, patch): |
103 """ |
89 """ |
123 |
109 |
124 self.guardsList.clear() |
110 self.guardsList.clear() |
125 self.patchNameLabel.setText("") |
111 self.patchNameLabel.setText("") |
126 |
112 |
127 self.guardCombo.clear() |
113 self.guardCombo.clear() |
128 guardsList = self.extension.getGuardsList(self.__repodir) |
114 guardsList = self.extension.getGuardsList() |
129 self.guardCombo.addItems(guardsList) |
115 self.guardCombo.addItems(guardsList) |
130 self.guardCombo.setEditText("") |
116 self.guardCombo.setEditText("") |
131 |
117 |
132 args = self.vcs.initCommand("qguard") |
118 args = self.vcs.initCommand("qguard") |
133 if patch: |
119 if patch: |