Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3366
6084bb3c3911
child 3656
441956d8fce5
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
16 from E5Gui import E5FileDialog 16 from E5Gui import E5FileDialog
17 17
18 from .Ui_HgArchiveDialog import Ui_HgArchiveDialog 18 from .Ui_HgArchiveDialog import Ui_HgArchiveDialog
19 19
20 import Utilities 20 import Utilities
21 import UI.PixmapCache
21 22
22 23
23 class HgArchiveDialog(QDialog, Ui_HgArchiveDialog): 24 class HgArchiveDialog(QDialog, Ui_HgArchiveDialog):
24 """ 25 """
25 Class implementing a dialog to enter the archive data. 26 Class implementing a dialog to enter the archive data.
32 @param parent reference to the parent widget (QWidget) 33 @param parent reference to the parent widget (QWidget)
33 """ 34 """
34 super(HgArchiveDialog, self).__init__(parent) 35 super(HgArchiveDialog, self).__init__(parent)
35 self.setupUi(self) 36 self.setupUi(self)
36 37
38 self.archiveButton.setIcon(UI.PixmapCache.getIcon("open.png"))
39
37 self.__archiveFileCompleter = E5FileCompleter() 40 self.__archiveFileCompleter = E5FileCompleter()
38 self.__archiveDirCompleter = E5DirCompleter() 41 self.__archiveDirCompleter = E5DirCompleter()
39 self.__activeCompleter = self.__archiveFileCompleter 42 self.__activeCompleter = self.__archiveFileCompleter
40 self.archiveEdit.setCompleter(self.__activeCompleter) 43 self.archiveEdit.setCompleter(self.__activeCompleter)
41 self.__activeCompleter.model().setNameFilters([]) 44 self.__activeCompleter.model().setNameFilters([])
42 45
43 self.typeComboBox.addItem( 46 self.typeComboBox.addItem(
44 self.trUtf8("Detect Automatically"), "") 47 self.tr("Detect Automatically"), "")
45 self.typeComboBox.addItem( 48 self.typeComboBox.addItem(
46 self.trUtf8("Directory of Files"), "files") 49 self.tr("Directory of Files"), "files")
47 self.typeComboBox.addItem( 50 self.typeComboBox.addItem(
48 self.trUtf8("Uncompressed TAR-Archive"), "tar") 51 self.tr("Uncompressed TAR-Archive"), "tar")
49 self.typeComboBox.addItem( 52 self.typeComboBox.addItem(
50 self.trUtf8("Bzip2 compressed TAR-Archive"), "tbz2") 53 self.tr("Bzip2 compressed TAR-Archive"), "tbz2")
51 self.typeComboBox.addItem( 54 self.typeComboBox.addItem(
52 self.trUtf8("Gzip compressed TAR-Archive"), "tgz") 55 self.tr("Gzip compressed TAR-Archive"), "tgz")
53 self.typeComboBox.addItem( 56 self.typeComboBox.addItem(
54 self.trUtf8("Uncompressed ZIP-Archive"), "uzip") 57 self.tr("Uncompressed ZIP-Archive"), "uzip")
55 self.typeComboBox.addItem( 58 self.typeComboBox.addItem(
56 self.trUtf8("Compressed ZIP-Archive"), "zip") 59 self.tr("Compressed ZIP-Archive"), "zip")
57 60
58 self.__unixFileFilters = [ 61 self.__unixFileFilters = [
59 self.trUtf8("Bzip2 compressed TAR-Archive (*.tar.bz2)"), 62 self.tr("Bzip2 compressed TAR-Archive (*.tar.bz2)"),
60 self.trUtf8("Gzip compressed TAR-Archive (*.tar.gz)"), 63 self.tr("Gzip compressed TAR-Archive (*.tar.gz)"),
61 self.trUtf8("Uncompressed TAR-Archive (*.tar)"), 64 self.tr("Uncompressed TAR-Archive (*.tar)"),
62 ] 65 ]
63 self.__windowsFileFilters = [ 66 self.__windowsFileFilters = [
64 self.trUtf8("Compressed ZIP-Archive (*.zip)"), 67 self.tr("Compressed ZIP-Archive (*.zip)"),
65 self.trUtf8("Uncompressed ZIP-Archive (*.uzip)") 68 self.tr("Uncompressed ZIP-Archive (*.uzip)")
66 ] 69 ]
67 if Utilities.isWindowsPlatform(): 70 if Utilities.isWindowsPlatform():
68 self.__fileFilters = ";;".join( 71 self.__fileFilters = ";;".join(
69 self.__windowsFileFilters + self.__unixFileFilters) 72 self.__windowsFileFilters + self.__unixFileFilters)
70 else: 73 else:
71 self.__fileFilters = ";;".join( 74 self.__fileFilters = ";;".join(
72 self.__unixFileFilters + self.__windowsFileFilters) 75 self.__unixFileFilters + self.__windowsFileFilters)
73 self.__fileFilters += ";;" + self.trUtf8("All Files (*)") 76 self.__fileFilters += ";;" + self.tr("All Files (*)")
74 77
75 self.__typeFilters = { 78 self.__typeFilters = {
76 "tar": ["*.tar"], 79 "tar": ["*.tar"],
77 "tbz2": ["*.tar.bz2", "*.tbz2"], 80 "tbz2": ["*.tar.bz2", "*.tbz2"],
78 "tgz": ["*.tar.gz", "*.tgz"], 81 "tgz": ["*.tar.gz", "*.tgz"],
84 87
85 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) 88 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
86 89
87 self.__projectPath = \ 90 self.__projectPath = \
88 vcs.getPlugin().getProjectHelper().getProject().getProjectPath() 91 vcs.getPlugin().getProjectHelper().getProject().getProjectPath()
92
93 msh = self.minimumSizeHint()
94 self.resize(max(self.width(), msh.width()), msh.height())
89 95
90 @pyqtSlot(str) 96 @pyqtSlot(str)
91 def on_archiveEdit_textChanged(self, archive): 97 def on_archiveEdit_textChanged(self, archive):
92 """ 98 """
93 Private slot to handle changes of the archive name. 99 Private slot to handle changes of the archive name.
108 archive = self.__projectPath 114 archive = self.__projectPath
109 115
110 if type_ == "files": 116 if type_ == "files":
111 archive = E5FileDialog.getExistingDirectory( 117 archive = E5FileDialog.getExistingDirectory(
112 self, 118 self,
113 self.trUtf8("Select Archive Directory"), 119 self.tr("Select Archive Directory"),
114 archive, 120 archive,
115 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) 121 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
116 else: 122 else:
117 archive, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( 123 archive, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
118 self, 124 self,
119 self.trUtf8("Select Archive File"), 125 self.tr("Select Archive File"),
120 archive, 126 archive,
121 self.__fileFilters, 127 self.__fileFilters,
122 None, 128 None,
123 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) 129 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
124 if archive: 130 if archive:

eric ide

mercurial