Plugins/VcsPlugins/vcsMercurial/HgCopyDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3366
6084bb3c3911
child 3656
441956d8fce5
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
18 from E5Gui import E5FileDialog 18 from E5Gui import E5FileDialog
19 19
20 from .Ui_HgCopyDialog import Ui_HgCopyDialog 20 from .Ui_HgCopyDialog import Ui_HgCopyDialog
21 21
22 import Utilities 22 import Utilities
23 import UI.PixmapCache
23 24
24 25
25 class HgCopyDialog(QDialog, Ui_HgCopyDialog): 26 class HgCopyDialog(QDialog, Ui_HgCopyDialog):
26 """ 27 """
27 Class implementing a dialog to enter the data for a copy or rename 28 Class implementing a dialog to enter the data for a copy or rename
28 operation. 29 operation.
29 """ 30 """
30 def __init__(self, source, parent=None, move=False, force=False): 31 def __init__(self, source, parent=None, move=False):
31 """ 32 """
32 Constructor 33 Constructor
33 34
34 @param source name of the source file/directory (string) 35 @param source name of the source file/directory (string)
35 @param parent parent widget (QWidget) 36 @param parent parent widget (QWidget)
36 @param move flag indicating a move operation (boolean) 37 @param move flag indicating a move operation (boolean)
37 @param force flag indicating a forced operation (boolean)
38 """ 38 """
39 super(HgCopyDialog, self).__init__(parent) 39 super(HgCopyDialog, self).__init__(parent)
40 self.setupUi(self) 40 self.setupUi(self)
41
42 self.dirButton.setIcon(UI.PixmapCache.getIcon("open.png"))
41 43
42 self.source = source 44 self.source = source
43 if os.path.isdir(self.source): 45 if os.path.isdir(self.source):
44 self.targetCompleter = E5DirCompleter(self.targetEdit) 46 self.targetCompleter = E5DirCompleter(self.targetEdit)
45 else: 47 else:
46 self.targetCompleter = E5FileCompleter(self.targetEdit) 48 self.targetCompleter = E5FileCompleter(self.targetEdit)
47 49
48 if move: 50 if move:
49 self.setWindowTitle(self.trUtf8('Mercurial Move')) 51 self.setWindowTitle(self.tr('Mercurial Move'))
50 else: 52 else:
51 self.forceCheckBox.setEnabled(False) 53 self.forceCheckBox.setEnabled(False)
52 self.forceCheckBox.setChecked(force)
53 54
54 self.sourceEdit.setText(source) 55 self.sourceEdit.setText(source)
55 56
56 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) 57 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
58
59 msh = self.minimumSizeHint()
60 self.resize(max(self.width(), msh.width()), msh.height())
57 61
58 def getData(self): 62 def getData(self):
59 """ 63 """
60 Public method to retrieve the copy data. 64 Public method to retrieve the copy data.
61 65
76 selection dialog. 80 selection dialog.
77 """ 81 """
78 if os.path.isdir(self.source): 82 if os.path.isdir(self.source):
79 target = E5FileDialog.getExistingDirectory( 83 target = E5FileDialog.getExistingDirectory(
80 self, 84 self,
81 self.trUtf8("Select target"), 85 self.tr("Select target"),
82 self.targetEdit.text(), 86 self.targetEdit.text(),
83 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) 87 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
84 else: 88 else:
85 target = E5FileDialog.getSaveFileName( 89 target = E5FileDialog.getSaveFileName(
86 self, 90 self,
87 self.trUtf8("Select target"), 91 self.tr("Select target"),
88 self.targetEdit.text(), 92 self.targetEdit.text(),
89 "", 93 "",
90 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) 94 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
91 95
92 if target: 96 if target:

eric ide

mercurial