Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py

Thu, 25 Jul 2013 19:05:41 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 25 Jul 2013 19:05:41 +0200
changeset 2821
459cc954bea8
parent 2820
642c1f3c23c8
child 2847
1843ef6e2656
child 2962
d6c9d1ca2da4
permissions
-rw-r--r--

Made the file completer of the Mercurial archive dialog sensitive to the selected file type.

2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2013 Detlev Offenbach <detlev@die-offenbachs.de>
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to enter the archive data.
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt4.QtCore import pyqtSlot, QFileInfo
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt4.QtGui import QDialog, QDialogButtonBox
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from E5Gui import E5FileDialog
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from .Ui_HgArchiveDialog import Ui_HgArchiveDialog
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import Utilities
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 class HgArchiveDialog(QDialog, Ui_HgArchiveDialog):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Class implementing a dialog to enter the archive data.
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 def __init__(self, vcs, parent=None):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Constructor
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param vcs reference to the Mercurial object (Hg)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @param parent reference to the parent widget (QWidget)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 super().__init__(parent)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setupUi(self)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.__archiveFileCompleter = E5FileCompleter()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.__archiveDirCompleter = E5DirCompleter()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.__activeCompleter = self.__archiveFileCompleter
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.archiveEdit.setCompleter(self.__activeCompleter)
2821
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
39 self.__activeCompleter.model().setNameFilters([])
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.typeComboBox.addItem(self.trUtf8("Detect Automatically"), "")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.typeComboBox.addItem(self.trUtf8("Directory of Files"), "files")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.typeComboBox.addItem(self.trUtf8("Uncompressed TAR-Archive"), "tar")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.typeComboBox.addItem(self.trUtf8("Bzip2 compressed TAR-Archive"), "tbz2")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.typeComboBox.addItem(self.trUtf8("Gzip compressed TAR-Archive"), "tgz")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.typeComboBox.addItem(self.trUtf8("Uncompressed ZIP-Archive"), "uzip")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.typeComboBox.addItem(self.trUtf8("Compressed ZIP-Archive"), "zip")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.__unixFileFilters = [
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.trUtf8("Bzip2 compressed TAR-Archive (*.tar.bz2)"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.trUtf8("Gzip compressed TAR-Archive (*.tar.gz)"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.trUtf8("Uncompressed TAR-Archive (*.tar)"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 ]
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.__windowsFileFilters = [
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.trUtf8("Compressed ZIP-Archive (*.zip)"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.trUtf8("Uncompressed ZIP-Archive (*.uzip)")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 ]
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 if Utilities.isWindowsPlatform():
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.__fileFilters = ";;".join(
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.__windowsFileFilters + self.__unixFileFilters)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 else:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.__fileFilters = ";;".join(
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.__unixFileFilters + self.__windowsFileFilters)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 self.__fileFilters += ";;" + self.trUtf8("All Files (*)")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
2821
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
66 self.__typeFilters = {
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
67 "tar": ["*.tar"],
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
68 "tbz2": ["*.tar.bz2", "*.tbz2"],
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
69 "tgz": ["*.tar.gz", "*.tgz"],
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
70 "uzip": ["*.uzip", "*.zip"],
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
71 "zip": ["*.zip"],
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
72 }
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
73
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.subReposCheckBox.setEnabled(vcs.hasSubrepositories())
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.__projectPath = \
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 vcs.getPlugin().getProjectHelper().getProject().getProjectPath()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 @pyqtSlot(str)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 def on_archiveEdit_textChanged(self, archive):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 Private slot to handle changes of the archive name.
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(archive != "")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 @pyqtSlot()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 def on_archiveButton_clicked(self):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 Private slot to select the archive name via a file selection dialog.
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 type_ = self.typeComboBox.itemData(self.typeComboBox.currentIndex())
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 archive = Utilities.fromNativeSeparators(self.archiveEdit.text())
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 if not archive:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 archive = self.__projectPath
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 if type_ == "files":
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 archive = E5FileDialog.getExistingDirectory(
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 self,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 self.trUtf8("Select Archive Directory"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 archive,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 else:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 archive, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 self,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.trUtf8("Select Archive File"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 archive,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 self.__fileFilters,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 None,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 if archive:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 ext = QFileInfo(archive).suffix()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 if not ext:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 ex = selectedFilter.split("(*")[1].split(")")[0]
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 if ex:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 archive += ex
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 if archive:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 self.archiveEdit.setText(Utilities.toNativeSeparators(archive))
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 @pyqtSlot(int)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 def on_typeComboBox_activated(self, index):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 Private slot to react on changes of the selected archive type.
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 @param index index of the selected type (integer)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 type_ = self.typeComboBox.itemData(index)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 if type_ == "files":
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 if self.__activeCompleter != self.__archiveDirCompleter:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 self.__activeCompleter = self.__archiveDirCompleter
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 self.archiveEdit.setCompleter(self.__activeCompleter)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 else:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 if self.__activeCompleter != self.__archiveFileCompleter:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 self.__activeCompleter = self.__archiveFileCompleter
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 self.archiveEdit.setCompleter(self.__activeCompleter)
2821
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
139 if type_ in self.__typeFilters:
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
140 self.__activeCompleter.model().setNameFilters(self.__typeFilters[type_])
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
141 else:
459cc954bea8 Made the file completer of the Mercurial archive dialog sensitive to the selected file type.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2820
diff changeset
142 self.__activeCompleter.model().setNameFilters([])
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 def getData(self):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 Public method to retrieve the data.
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 @return tuple giving the archive name (string), the archive type (string),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 the directory prefix 8string) and a flag indicating to recurse into
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 subrepositories (boolean)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 return (
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 self.archiveEdit.text(),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 self.typeComboBox.itemData(self.typeComboBox.currentIndex()),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 self.prefixEdit.text(),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 self.subReposCheckBox.isChecked(),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 )

eric ide

mercurial