Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py

Sun, 29 Nov 2015 17:25:42 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 29 Nov 2015 17:25:42 +0100
changeset 4590
9fdd473c68fb
parent 4180
50fa3b7454e2
child 4631
5c1a96925da4
permissions
-rw-r--r--

Fixed an issue in the file dialog wizard.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
4021
195a471c327b Updated copyright for 2015.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3858
diff changeset
3 # Copyright (c) 2003 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the file dialog wizard dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3142
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
11
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
14 from PyQt5.QtCore import pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
15 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog, \
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
16 QButtonGroup
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
18 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
20 from .Ui_FileDialogWizardDialog import Ui_FileDialogWizardDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
22 import Globals
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
23
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
24
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 class FileDialogWizardDialog(QDialog, Ui_FileDialogWizardDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Class implementing the color dialog wizard dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 It displays a dialog for entering the parameters
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 for the QFileDialog code generator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
32 def __init__(self, pyqtVariant, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
36 @param pyqtVariant variant of PyQt (integer; 0, 4 or 5)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @param parent parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
39 super(FileDialogWizardDialog, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
42 self.eStartWithCompleter = E5FileCompleter(self.eStartWith)
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
43 self.eWorkDirCompleter = E5DirCompleter(self.eWorkDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
45 self.__pyqtVariant = pyqtVariant
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
46
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
47 self.__typeButtonsGroup = QButtonGroup(self)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
48 self.__typeButtonsGroup.setExclusive(True)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
49 self.__typeButtonsGroup.addButton(self.rOpenFile, 1)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
50 self.__typeButtonsGroup.addButton(self.rOpenFiles, 2)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
51 self.__typeButtonsGroup.addButton(self.rSaveFile, 3)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
52 self.__typeButtonsGroup.addButton(self.rfOpenFile, 11)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
53 self.__typeButtonsGroup.addButton(self.rfOpenFiles, 12)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
54 self.__typeButtonsGroup.addButton(self.rfSaveFile, 13)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
55 self.__typeButtonsGroup.addButton(self.rDirectory, 20)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
56 self.__typeButtonsGroup.buttonClicked[int].connect(
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
57 self.__toggleInitialFilterAndResult)
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
58 self.__toggleInitialFilterAndResult(1)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
59
3858
4f4684967fee Fixed a few little issues in eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
60 self.pyqtComboBox.addItems(["PyQt4", "PyQt5"])
4180
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
61 self.__pyqtVariant = pyqtVariant
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
62 if self.__pyqtVariant == 5:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
63 self.pyqtComboBox.setCurrentIndex(1)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
64 else:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
65 self.pyqtComboBox.setCurrentIndex(0)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
66
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
67 self.rSaveFile.toggled[bool].connect(self.__toggleConfirmCheckBox)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
68 self.rfSaveFile.toggled[bool].connect(self.__toggleConfirmCheckBox)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
69 self.rDirectory.toggled[bool].connect(self.__toggleGroupsAndTest)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
70 self.cStartWith.toggled[bool].connect(self.__toggleGroupsAndTest)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
71 self.cWorkDir.toggled[bool].connect(self.__toggleGroupsAndTest)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
72 self.cFilters.toggled[bool].connect(self.__toggleGroupsAndTest)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
74 self.bTest = self.buttonBox.addButton(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
75 self.tr("Test"), QDialogButtonBox.ActionRole)
3366
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
76
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
77 msh = self.minimumSizeHint()
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
78 self.resize(max(self.width(), msh.width()), msh.height())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
79
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
80 def __adjustOptions(self, options):
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
81 """
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
82 Private method to adjust the file dialog options.
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
83
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
84 @param options file dialog options (QFileDialog.Options)
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
85 @return modified options (QFileDialog.Options)
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
86 """
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
87 if Globals.isLinuxPlatform():
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
88 options |= QFileDialog.DontUseNativeDialog
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
89 return options
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
90
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
91 @pyqtSlot(str)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
92 def on_pyqtComboBox_currentIndexChanged(self, txt):
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
93 """
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
94 Private slot to setup the dialog for the selected PyQt variant.
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
95
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
96 @param txt text of the selected combo box entry (string)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
97 """
4180
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
98 self.rfOpenFile.setEnabled(txt == "PyQt4")
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
99 self.rfOpenFiles.setEnabled(txt == "PyQt4")
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
100 self.rfSaveFile.setEnabled(txt == "PyQt4")
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
101
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
102 if txt == "PyQt5":
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
103 if self.rfOpenFile.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
104 self.rOpenFile.setChecked(True)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
105 elif self.rfOpenFiles.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
106 self.rOpenFiles.setChecked(True)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
107 elif self.rfSaveFile.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
108 self.rSaveFile.setChecked(True)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
109
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
110 self.__pyqtVariant = 5 if txt == "PyQt5" else 4
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
111
3171
2c37b9a37b2d Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
112 self.__toggleInitialFilterAndResult(
2c37b9a37b2d Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
113 self.__typeButtonsGroup.checkedId())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
114
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 def on_buttonBox_clicked(self, button):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 Private slot called by a button of the button box clicked.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 @param button button that was clicked (QAbstractButton)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 if button == self.bTest:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.on_bTest_clicked()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 def on_bTest_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 Private method to test the selected options.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 options = QFileDialog.Options()
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
134 options = self.__adjustOptions(options)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
135 if self.rOpenFile.isChecked() and self.__pyqtVariant == 4:
4180
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
136 try:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
137 QFileDialog.getOpenFileName(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
138 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
139 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
140 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
141 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
142 options)
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
143 except TypeError:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
144 QFileDialog.getOpenFileName(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
145 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
146 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
147 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
148 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
149 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
150 options)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
151 else:
4180
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
152 try:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
153 QFileDialog.getOpenFileNameAndFilter(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
154 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
155 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
156 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
157 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
158 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
159 options)
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
160 except AttributeError:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
161 QFileDialog.getOpenFileName(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
162 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
163 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
164 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
165 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
166 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
167 options)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 options = QFileDialog.Options()
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
173 options = self.__adjustOptions(options)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
174 if self.rOpenFiles.isChecked() and self.__pyqtVariant == 4:
4180
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
175 try:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
176 QFileDialog.getOpenFileNames(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
177 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
178 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
179 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
180 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
181 options)
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
182 except TypeError:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
183 QFileDialog.getOpenFileNames(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
184 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
185 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
186 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
187 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
188 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
189 options)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
190 else:
4180
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
191 try:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
192 QFileDialog.getOpenFileNamesAndFilter(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
193 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
194 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
195 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
196 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
197 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
198 options)
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
199 except AttributeError:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
200 QFileDialog.getOpenFileNames(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
201 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
202 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
203 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
204 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
205 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
206 options)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 options = QFileDialog.Options()
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
212 options = self.__adjustOptions(options)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
213 if self.rSaveFile.isChecked() and self.__pyqtVariant == 4:
4180
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
214 try:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
215 QFileDialog.getSaveFileName(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
216 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
217 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
218 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
219 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
220 options)
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
221 except TypeError:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
222 QFileDialog.getSaveFileName(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
223 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
224 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
225 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
226 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
227 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
228 options)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
229 else:
4180
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
230 try:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
231 QFileDialog.getSaveFileNameAndFilter(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
232 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
233 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
234 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
235 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
236 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
237 options)
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
238 except AttributeError:
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
239 QFileDialog.getSaveFileName(
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
240 None,
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
241 self.eCaption.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
242 self.eStartWith.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
243 self.eFilters.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
244 self.eInitialFilter.text(),
50fa3b7454e2 Fixed a serious bug in the QFileDialog wizard causing the Test function to raise a traceback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
245 options)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 elif self.rDirectory.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 options = QFileDialog.Options()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 options |= QFileDialog.Options(QFileDialog.DontResolveSymlinks)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 if self.cDirOnly.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 options |= QFileDialog.Options(QFileDialog.ShowDirsOnly)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 options |= QFileDialog.Options(QFileDialog.Option(0))
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
254 options = self.__adjustOptions(options)
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
255 QFileDialog.getExistingDirectory(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 None,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 self.eCaption.text(),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 self.eWorkDir.text(),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 options)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
260
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 def __toggleConfirmCheckBox(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 Private slot to enable/disable the confirmation check box.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 self.cConfirmOverwrite.setEnabled(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 self.rSaveFile.isChecked() or self.rfSaveFile.isChecked())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
267
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 def __toggleGroupsAndTest(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 Private slot to enable/disable certain groups and the test button.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 if self.rDirectory.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 self.filePropertiesGroup.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 self.dirPropertiesGroup.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 self.bTest.setDisabled(self.cWorkDir.isChecked())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 self.filePropertiesGroup.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 self.dirPropertiesGroup.setEnabled(False)
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
279 self.bTest.setDisabled(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 self.cStartWith.isChecked() or self.cFilters.isChecked())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
281
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
282 def __toggleInitialFilterAndResult(self, id):
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
283 """
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
284 Private slot to enable/disable the initial filter elements and the
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
285 results entries.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
287 @param id id of the clicked button (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 """
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
289 if (self.__pyqtVariant == 4 and id in [11, 12, 13]) or \
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
290 (self.__pyqtVariant == 5 and id in [1, 2, 3]):
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
291 enable = True
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
292 else:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
293 enable = False
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
294 self.lInitialFilter.setEnabled(enable)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
295 self.eInitialFilter.setEnabled(enable)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
296 self.cInitialFilter.setEnabled(enable)
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
297
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
298 self.lFilterVariable.setEnabled(enable)
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
299 self.eFilterVariable.setEnabled(enable)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
300
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
301 def getCode(self, indLevel, indString):
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
302 """
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
303 Public method to get the source code for Qt4 and Qt5.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 @param indLevel indentation level (int)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 @param indString string used for indentation (space or tab) (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 @return generated code (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 # calculate our indentation level and the indentation string
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 il = indLevel + 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 istring = il * indString
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
312 estring = os.linesep + indLevel * indString
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 # now generate the code
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
315 if self.parentSelf.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
316 parent = "self"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
317 elif self.parentNone.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
318 parent = "None"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
319 elif self.parentOther.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
320 parent = self.parentEdit.text()
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
321 if parent == "":
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
322 parent = "None"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
323
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
324 # prepare the result variables
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
325 nameVariable = self.eNameVariable.text()
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
326 if not nameVariable:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
327 if self.__typeButtonsGroup.checkedButton() in [
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
328 self.rOpenFile, self.rfOpenFile,
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
329 self.rSaveFile, self.rfSaveFile]:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
330 nameVariable = "fileName"
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
331 elif self.__typeButtonsGroup.checkedButton() in [
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
332 self.rOpenFiles, self.rfOpenFiles]:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
333 nameVariable = "fileNames"
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
334 elif self.__typeButtonsGroup.checkedButton() == self.rDirectory:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
335 nameVariable = "dirName"
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
336 else:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
337 nameVariable = "res"
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
338 filterVariable = self.eFilterVariable.text()
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
339 if not filterVariable:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
340 if (self.__pyqtVariant == 4 and
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
341 self.__typeButtonsGroup.checkedButton() in [
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
342 self.rfOpenFile, self.rfOpenFiles, self.rfSaveFile]) or \
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
343 (self.__pyqtVariant == 5 and
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
344 self.__typeButtonsGroup.checkedButton() in [
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
345 self.rOpenFile, self.rOpenFiles, self.rSaveFile]):
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
346 filterVariable = ", selectedFilter"
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
347 else:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
348 filterVariable = ""
4590
9fdd473c68fb Fixed an issue in the file dialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4180
diff changeset
349 else:
9fdd473c68fb Fixed an issue in the file dialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4180
diff changeset
350 filterVariable = ", " + filterVariable
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
351
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
352 code = '{0}{1} = QFileDialog.'.format(nameVariable, filterVariable)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 if self.rOpenFile.isChecked():
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
355 code += 'getOpenFileName({0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 else:
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
357 code += 'getOpenFileNameAndFilter({0}{1}'.format(
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
358 os.linesep, istring)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
359 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 if not self.eCaption.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
361 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
363 code += 'self.tr("{0}"),{1}{2}'.format(
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
364 self.eCaption.text(), os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 if not self.eStartWith.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
366 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 if self.cStartWith.isChecked():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
369 fmt = '{0},{1}{2}'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
371 fmt = 'self.tr("{0}"),{1}{2}'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
372 code += fmt.format(self.eStartWith.text(), os.linesep, istring)
147
33830c229cc1 Fixed a bug in the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
373 if self.eFilters.text() == "":
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 code += '""'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 else:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
376 if self.cFilters.isChecked():
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
377 fmt = '{0}'
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
378 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
379 fmt = 'self.tr("{0}")'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
380 code += fmt.format(self.eFilters.text())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
381 if self.rfOpenFile.isChecked() or self.__pyqtVariant == 5:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
382 if self.eInitialFilter.text() == "":
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
383 filter = "None"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
384 else:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
385 if self.cInitialFilter.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
386 fmt = '{0}'
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
387 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
388 fmt = 'self.tr("{0}")'
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
389 filter = fmt.format(self.eInitialFilter.text())
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
390 code += ',{0}{1}{2}'.format(os.linesep, istring, filter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 if not self.cSymlinks.isChecked():
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
392 code += \
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
393 ',{0}{1}QFileDialog.Options(' \
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
394 'QFileDialog.DontResolveSymlinks)' \
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
395 .format(os.linesep, istring)
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
396 code += '){0}'.format(estring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 if self.rOpenFiles.isChecked():
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
399 code += 'getOpenFileNames({0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 else:
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
401 code += 'getOpenFileNamesAndFilter({0}{1}'.format(
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
402 os.linesep, istring)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
403 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 if not self.eCaption.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
405 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
407 code += 'self.tr("{0}"),{1}{2}'.format(
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
408 self.eCaption.text(), os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 if not self.eStartWith.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
410 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 if self.cStartWith.isChecked():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
413 fmt = '{0},{1}{2}'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
415 fmt = 'self.tr("{0}"),{1}{2}'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
416 code += fmt.format(self.eStartWith.text(), os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 if not self.eFilters.text():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 code += '""'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 else:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
420 if self.cFilters.isChecked():
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
421 fmt = '{0}'
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
422 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
423 fmt = 'self.tr("{0}")'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
424 code += fmt.format(self.eFilters.text())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
425 if self.rfOpenFiles.isChecked() or self.__pyqtVariant == 5:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
426 if self.eInitialFilter.text() == "":
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
427 filter = "None"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
428 else:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
429 if self.cInitialFilter.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
430 fmt = '{0}'
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
431 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
432 fmt = 'self.tr("{0}")'
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
433 filter = fmt.format(self.eInitialFilter.text())
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
434 code += ',{0}{1}{2}'.format(os.linesep, istring, filter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 if not self.cSymlinks.isChecked():
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
436 code += \
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
437 ',{0}{1}QFileDialog.Options(' \
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
438 'QFileDialog.DontResolveSymlinks)' \
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
439 .format(os.linesep, istring)
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
440 code += '){0}'.format(estring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 if self.rSaveFile.isChecked():
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
443 code += 'getSaveFileName({0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 else:
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
445 code += 'getSaveFileNameAndFilter({0}{1}'.format(
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
446 os.linesep, istring)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
447 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 if not self.eCaption.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
449 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
451 code += 'self.tr("{0}"),{1}{2}'.format(
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
452 self.eCaption.text(), os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 if not self.eStartWith.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
454 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 if self.cStartWith.isChecked():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
457 fmt = '{0},{1}{2}'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
459 fmt = 'self.tr("{0}"),{1}{2}'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
460 code += fmt.format(self.eStartWith.text(), os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 if not self.eFilters.text():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 code += '""'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 else:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
464 if self.cFilters.isChecked():
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
465 fmt = '{0}'
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
466 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
467 fmt = 'self.tr("{0}")'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
468 code += fmt.format(self.eFilters.text())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
469 if self.rfSaveFile.isChecked() or self.__pyqtVariant == 5:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
470 if self.eInitialFilter.text() == "":
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
471 filter = "None"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
472 else:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
473 if self.cInitialFilter.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
474 fmt = '{0}'
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
475 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
476 fmt = 'self.tr("{0}")'
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
477 filter = fmt.format(self.eInitialFilter.text())
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
478 code += ',{0}{1}{2}'.format(os.linesep, istring, filter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 if (not self.cSymlinks.isChecked()) or \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 (not self.cConfirmOverwrite.isChecked()):
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
481 code += ',{0}{1}QFileDialog.Options('.format(
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
482 os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 code += 'QFileDialog.DontResolveSymlinks'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 if (not self.cSymlinks.isChecked()) and \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 (not self.cConfirmOverwrite.isChecked()):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 code += ' | '
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 if not self.cConfirmOverwrite.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 code += 'QFileDialog.DontConfirmOverwrite'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 code += ')'
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
491 code += '){0}'.format(estring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 elif self.rDirectory.isChecked():
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
493 code += 'getExistingDirectory({0}{1}'.format(os.linesep, istring)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
494 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 if not self.eCaption.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
496 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
498 code += 'self.tr("{0}"),{1}{2}'.format(
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
499 self.eCaption.text(), os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 if not self.eWorkDir.text():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 code += '""'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 if self.cWorkDir.isChecked():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
504 fmt = '{0}'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
506 fmt = 'self.tr("{0}")'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
507 code += fmt.format(self.eWorkDir.text())
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
508 code += ',{0}{1}QFileDialog.Options('.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 code += 'QFileDialog.DontResolveSymlinks | '
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 if self.cDirOnly.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 code += 'QFileDialog.ShowDirsOnly'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 code += 'QFileDialog.Option(0)'
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
515 code += ')){0}'.format(estring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 return code

eric ide

mercurial