23 |
23 |
24 class LfConvertDataDialog(QDialog, Ui_LfConvertDataDialog): |
24 class LfConvertDataDialog(QDialog, Ui_LfConvertDataDialog): |
25 """ |
25 """ |
26 Class implementing a dialog to enter the data for the repo conversion. |
26 Class implementing a dialog to enter the data for the repo conversion. |
27 """ |
27 """ |
|
28 |
28 def __init__(self, currentPath, mode, parent=None): |
29 def __init__(self, currentPath, mode, parent=None): |
29 """ |
30 """ |
30 Constructor |
31 Constructor |
31 |
32 |
32 @param currentPath directory name of the current project (string) |
33 @param currentPath directory name of the current project (string) |
33 @param mode dialog mode (string, one of 'largefiles' or 'normal') |
34 @param mode dialog mode (string, one of 'largefiles' or 'normal') |
34 @param parent reference to the parent widget (QWidget) |
35 @param parent reference to the parent widget (QWidget) |
35 """ |
36 """ |
36 super().__init__(parent) |
37 super().__init__(parent) |
37 self.setupUi(self) |
38 self.setupUi(self) |
38 |
39 |
39 self.newProjectPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
40 self.newProjectPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
40 |
41 |
41 self.__defaults = getDefaults() |
42 self.__defaults = getDefaults() |
42 self.__currentPath = Utilities.toNativeSeparators(currentPath) |
43 self.__currentPath = Utilities.toNativeSeparators(currentPath) |
43 |
44 |
44 self.currentProjectLabel.setPath(currentPath) |
45 self.currentProjectLabel.setPath(currentPath) |
45 self.newProjectPicker.setText(os.path.dirname(currentPath)) |
46 self.newProjectPicker.setText(os.path.dirname(currentPath)) |
46 |
47 |
47 self.lfFileSizeSpinBox.setValue(self.__defaults["minsize"]) |
48 self.lfFileSizeSpinBox.setValue(self.__defaults["minsize"]) |
48 self.lfFilePatternsEdit.setText(" ".join(self.__defaults["pattern"])) |
49 self.lfFilePatternsEdit.setText(" ".join(self.__defaults["pattern"])) |
49 |
50 |
50 if mode == 'normal': |
51 if mode == "normal": |
51 self.lfFileSizeSpinBox.setEnabled(False) |
52 self.lfFileSizeSpinBox.setEnabled(False) |
52 self.lfFilePatternsEdit.setEnabled(False) |
53 self.lfFilePatternsEdit.setEnabled(False) |
53 |
54 |
54 msh = self.minimumSizeHint() |
55 msh = self.minimumSizeHint() |
55 self.resize(max(self.width(), msh.width()), msh.height()) |
56 self.resize(max(self.width(), msh.width()), msh.height()) |
56 |
57 |
57 @pyqtSlot(str) |
58 @pyqtSlot(str) |
58 def on_newProjectPicker_textChanged(self, txt): |
59 def on_newProjectPicker_textChanged(self, txt): |
59 """ |
60 """ |
60 Private slot to handle editing of the new project directory. |
61 Private slot to handle editing of the new project directory. |
61 |
62 |
62 @param txt new project directory name (string) |
63 @param txt new project directory name (string) |
63 """ |
64 """ |
64 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
65 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
65 txt and Utilities.toNativeSeparators(txt) != os.path.dirname( |
66 txt |
66 self.__currentPath)) |
67 and Utilities.toNativeSeparators(txt) != os.path.dirname(self.__currentPath) |
67 |
68 ) |
|
69 |
68 def getData(self): |
70 def getData(self): |
69 """ |
71 """ |
70 Public method to retrieve the entered data. |
72 Public method to retrieve the entered data. |
71 |
73 |
72 @return tuple containing the new project directory name (string), |
74 @return tuple containing the new project directory name (string), |
73 minimum file size (integer) and file patterns (list of string) |
75 minimum file size (integer) and file patterns (list of string) |
74 """ |
76 """ |
75 patterns = self.lfFilePatternsEdit.text().split() |
77 patterns = self.lfFilePatternsEdit.text().split() |
76 if set(patterns) == set(self.__defaults["pattern"]): |
78 if set(patterns) == set(self.__defaults["pattern"]): |
77 patterns = [] |
79 patterns = [] |
78 |
80 |
79 return ( |
81 return ( |
80 self.newProjectPicker.text(), |
82 self.newProjectPicker.text(), |
81 self.lfFileSizeSpinBox.value(), |
83 self.lfFileSizeSpinBox.value(), |
82 patterns, |
84 patterns, |
83 ) |
85 ) |