src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnCopyDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
20 class SvnCopyDialog(QDialog, Ui_SvnCopyDialog): 20 class SvnCopyDialog(QDialog, Ui_SvnCopyDialog):
21 """ 21 """
22 Class implementing a dialog to enter the data for a copy or rename 22 Class implementing a dialog to enter the data for a copy or rename
23 operation. 23 operation.
24 """ 24 """
25
25 def __init__(self, source, parent=None, move=False, force=False): 26 def __init__(self, source, parent=None, move=False, force=False):
26 """ 27 """
27 Constructor 28 Constructor
28 29
29 @param source name of the source file/directory (string) 30 @param source name of the source file/directory (string)
30 @param parent parent widget (QWidget) 31 @param parent parent widget (QWidget)
31 @param move flag indicating a move operation (boolean) 32 @param move flag indicating a move operation (boolean)
32 @param force flag indicating a forced operation (boolean) 33 @param force flag indicating a forced operation (boolean)
33 """ 34 """
34 super().__init__(parent) 35 super().__init__(parent)
35 self.setupUi(self) 36 self.setupUi(self)
36 37
37 self.source = source 38 self.source = source
38 if os.path.isdir(self.source): 39 if os.path.isdir(self.source):
39 self.targetPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) 40 self.targetPicker.setMode(EricPathPickerModes.DIRECTORY_MODE)
40 else: 41 else:
41 self.targetPicker.setMode(EricPathPickerModes.SAVE_FILE_MODE) 42 self.targetPicker.setMode(EricPathPickerModes.SAVE_FILE_MODE)
42 43
43 if move: 44 if move:
44 self.setWindowTitle(self.tr('Subversion Move')) 45 self.setWindowTitle(self.tr("Subversion Move"))
45 else: 46 else:
46 self.forceCheckBox.setEnabled(False) 47 self.forceCheckBox.setEnabled(False)
47 self.forceCheckBox.setChecked(force) 48 self.forceCheckBox.setChecked(force)
48 49
49 self.sourceEdit.setText(source) 50 self.sourceEdit.setText(source)
50 51
51 self.buttonBox.button( 52 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
52 QDialogButtonBox.StandardButton.Ok).setEnabled(False) 53
53
54 msh = self.minimumSizeHint() 54 msh = self.minimumSizeHint()
55 self.resize(max(self.width(), msh.width()), msh.height()) 55 self.resize(max(self.width(), msh.width()), msh.height())
56 56
57 def getData(self): 57 def getData(self):
58 """ 58 """
59 Public method to retrieve the copy data. 59 Public method to retrieve the copy data.
60 60
61 @return the target name (string) and a flag indicating 61 @return the target name (string) and a flag indicating
62 the operation should be enforced (boolean) 62 the operation should be enforced (boolean)
63 """ 63 """
64 target = self.targetPicker.text() 64 target = self.targetPicker.text()
65 if not os.path.isabs(target): 65 if not os.path.isabs(target):
66 sourceDir = os.path.dirname(self.sourceEdit.text()) 66 sourceDir = os.path.dirname(self.sourceEdit.text())
67 target = os.path.join(sourceDir, target) 67 target = os.path.join(sourceDir, target)
68 return (target, self.forceCheckBox.isChecked()) 68 return (target, self.forceCheckBox.isChecked())
69 69
70 @pyqtSlot(str) 70 @pyqtSlot(str)
71 def on_targetPicker_textChanged(self, txt): 71 def on_targetPicker_textChanged(self, txt):
72 """ 72 """
73 Private slot to handle changes of the target. 73 Private slot to handle changes of the target.
74 74
75 @param txt contents of the target edit (string) 75 @param txt contents of the target edit (string)
76 """ 76 """
77 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( 77 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
78 os.path.isabs(txt) or os.path.dirname(txt) == "") 78 os.path.isabs(txt) or os.path.dirname(txt) == ""
79 )

eric ide

mercurial