Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py

Wed, 01 Jan 2014 14:39:32 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 01 Jan 2014 14:39:32 +0100
branch
Py2 comp.
changeset 3161
06f57a834adf
parent 3145
a9de05d4a22f
child 3178
f25fc1364c88
permissions
-rw-r--r--

Updated copyright for 2014.

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
3161
06f57a834adf Updated copyright for 2014.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3145
diff changeset
3 # Copyright (c) 2013 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
2820
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
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3057
diff changeset
10 from __future__ import unicode_literals
2847
1843ef6e2656 Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2821
diff changeset
11
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt4.QtCore import pyqtSlot, QFileInfo
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt4.QtGui import QDialog, QDialogButtonBox
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from E5Gui import E5FileDialog
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 from .Ui_HgArchiveDialog import Ui_HgArchiveDialog
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 import Utilities
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
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 HgArchiveDialog(QDialog, Ui_HgArchiveDialog):
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 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
26 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 def __init__(self, vcs, parent=None):
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 Constructor
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @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
32 @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
33 """
2847
1843ef6e2656 Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2821
diff changeset
34 super(HgArchiveDialog, self).__init__(parent)
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.setupUi(self)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.__archiveFileCompleter = E5FileCompleter()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.__archiveDirCompleter = E5DirCompleter()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.__activeCompleter = self.__archiveFileCompleter
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 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
41 self.__activeCompleter.model().setNameFilters([])
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
43 self.typeComboBox.addItem(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
44 self.trUtf8("Detect Automatically"), "")
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
45 self.typeComboBox.addItem(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
46 self.trUtf8("Directory of Files"), "files")
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
47 self.typeComboBox.addItem(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
48 self.trUtf8("Uncompressed TAR-Archive"), "tar")
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
49 self.typeComboBox.addItem(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
50 self.trUtf8("Bzip2 compressed TAR-Archive"), "tbz2")
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
51 self.typeComboBox.addItem(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
52 self.trUtf8("Gzip compressed TAR-Archive"), "tgz")
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
53 self.typeComboBox.addItem(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
54 self.trUtf8("Uncompressed ZIP-Archive"), "uzip")
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
55 self.typeComboBox.addItem(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
56 self.trUtf8("Compressed ZIP-Archive"), "zip")
2820
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 self.__unixFileFilters = [
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 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
60 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
61 self.trUtf8("Uncompressed TAR-Archive (*.tar)"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 ]
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.__windowsFileFilters = [
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 self.trUtf8("Compressed ZIP-Archive (*.zip)"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.trUtf8("Uncompressed ZIP-Archive (*.uzip)")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 ]
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 if Utilities.isWindowsPlatform():
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.__fileFilters = ";;".join(
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__windowsFileFilters + self.__unixFileFilters)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 else:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.__fileFilters = ";;".join(
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.__unixFileFilters + self.__windowsFileFilters)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.__fileFilters += ";;" + self.trUtf8("All Files (*)")
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
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
75 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
76 "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
77 "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
78 "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
79 "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
80 "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
81 }
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
82
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.subReposCheckBox.setEnabled(vcs.hasSubrepositories())
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 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
86
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self.__projectPath = \
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 vcs.getPlugin().getProjectHelper().getProject().getProjectPath()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 @pyqtSlot(str)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 def on_archiveEdit_textChanged(self, archive):
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 Private slot to handle changes of the archive name.
2962
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2821
diff changeset
94
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2821
diff changeset
95 @param archive name of the archive (string)
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 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
98
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 @pyqtSlot()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 def on_archiveButton_clicked(self):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 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
103 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 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
105
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 archive = Utilities.fromNativeSeparators(self.archiveEdit.text())
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 if not archive:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 archive = self.__projectPath
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 if type_ == "files":
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 archive = E5FileDialog.getExistingDirectory(
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 self,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 self.trUtf8("Select Archive Directory"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 archive,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 else:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 archive, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 self,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 self.trUtf8("Select Archive File"),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 archive,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 self.__fileFilters,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 None,
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 if archive:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 ext = QFileInfo(archive).suffix()
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 if not ext:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 ex = selectedFilter.split("(*")[1].split(")")[0]
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 if ex:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 archive += ex
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 if archive:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 self.archiveEdit.setText(Utilities.toNativeSeparators(archive))
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 @pyqtSlot(int)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 def on_typeComboBox_activated(self, index):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 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
138
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 @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
140 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 type_ = self.typeComboBox.itemData(index)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 if type_ == "files":
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 if self.__activeCompleter != self.__archiveDirCompleter:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 self.__activeCompleter = self.__archiveDirCompleter
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 self.archiveEdit.setCompleter(self.__activeCompleter)
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 else:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 if self.__activeCompleter != self.__archiveFileCompleter:
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 self.__activeCompleter = self.__archiveFileCompleter
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 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
150 if type_ in self.__typeFilters:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
151 self.__activeCompleter.model().setNameFilters(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
152 self.__typeFilters[type_])
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
153 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
154 self.__activeCompleter.model().setNameFilters([])
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 def getData(self):
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 Public method to retrieve the data.
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
160 @return tuple giving the archive name (string), the archive type
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
161 (string), the directory prefix 8string) and a flag indicating
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
162 to recurse into subrepositories (boolean)
2820
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 """
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 return (
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 self.archiveEdit.text(),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 self.typeComboBox.itemData(self.typeComboBox.currentIndex()),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 self.prefixEdit.text(),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 self.subReposCheckBox.isChecked(),
642c1f3c23c8 Started implementing support for the Mercurial archive function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 )

eric ide

mercurial