eric6/Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py

Tue, 03 Sep 2019 19:31:20 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 03 Sep 2019 19:31:20 +0200
branch
without_py2_and_pyqt4
changeset 7207
4ba7a9b26020
parent 7198
684261ef2165
child 7229
53054eb5b15a
permissions
-rw-r--r--

QFileDialog Wizard:
- added support for the QFileDialog.get...Url() methods
- added support for E5FileDialog

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
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
3 # Copyright (c) 2003 - 2019 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
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
14 from PyQt5.QtCore import pyqtSlot, QUrl
3656
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
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
29 It displays a dialog for entering the parameters for the
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
30 E5FileDialog or QFileDialog code generator.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
32 def __init__(self, dialogVariant, 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
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
36 @param dialogVariant variant of the file dialog to be generated
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
37 (-1 = E5FileDialog, 0 = unknown, 4 = PyQt4, 5 = PyQt5)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
38 @type int
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
39 @param parent parent widget
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
40 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
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
42 super(FileDialogWizardDialog, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
45 self.eStartWithCompleter = E5FileCompleter(self.eStartWith)
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
46 self.eWorkDirCompleter = E5DirCompleter(self.eWorkDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
48 self.__dialogVariant = dialogVariant
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
49
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
50 self.__typeButtonsGroup = QButtonGroup(self)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
51 self.__typeButtonsGroup.setExclusive(True)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
52 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
53 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
54 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
55 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
56 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
57 self.__typeButtonsGroup.addButton(self.rfSaveFile, 13)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
58 self.__typeButtonsGroup.addButton(self.rOpenFileUrl, 21)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
59 self.__typeButtonsGroup.addButton(self.rOpenFileUrls, 22)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
60 self.__typeButtonsGroup.addButton(self.rSaveFileUrl, 23)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
61 self.__typeButtonsGroup.addButton(self.rDirectory, 30)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
62 self.__typeButtonsGroup.addButton(self.rDirectoryUrl, 31)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
63 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
64 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
65 self.__toggleInitialFilterAndResult(1)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
66
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
67 self.__dialogVariant = dialogVariant
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
68 if self.__dialogVariant == -1:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
69 self.pyqtComboBox.addItems(["eric"])
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
70 self.setWindowTitle(self.tr("E5FileDialog Wizard"))
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
71 self.pyqtComboBox.setCurrentIndex(0)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
72 self.pyqtComboBox.setEnabled(False)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
73 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
74 self.pyqtComboBox.addItems(["PyQt5", "PyQt4"])
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
75 self.setWindowTitle(self.tr("QFileDialog Wizard"))
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
76 if self.__dialogVariant == 5:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
77 self.pyqtComboBox.setCurrentIndex(0)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
78 elif self.__dialogVariant == 4:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
79 self.pyqtComboBox.setCurrentIndex(1)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
80 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
81 self.pyqtComboBox.setCurrentIndex(0)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
82
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
83 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
84 self.rfSaveFile.toggled[bool].connect(self.__toggleConfirmCheckBox)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
85 self.rSaveFileUrl.toggled[bool].connect(self.__toggleConfirmCheckBox)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
86 self.rDirectory.toggled[bool].connect(self.__toggleGroupsAndTest)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
87 self.rDirectoryUrl.toggled[bool].connect(self.__toggleGroupsAndTest)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 446
diff changeset
88 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
89 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
90 self.cFilters.toggled[bool].connect(self.__toggleGroupsAndTest)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
92 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
93 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
94
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
95 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
96 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
97
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
98 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
99 """
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
100 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
101
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
102 @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
103 @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
104 """
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
105 if Globals.isLinuxPlatform():
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
106 options |= QFileDialog.DontUseNativeDialog
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
107 return options
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
108
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
109 @pyqtSlot(str)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
110 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
111 """
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
112 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
113
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
114 @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
115 """
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
116 self.rfOpenFile.setEnabled(txt in ("eric", "PyQt4"))
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
117 self.rfOpenFiles.setEnabled(txt in ("eric", "PyQt4"))
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
118 self.rfSaveFile.setEnabled(txt in ("eric", "PyQt4"))
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
119
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
120 self.rOpenFileUrl.setEnabled(txt == "PyQt5")
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
121 self.rOpenFileUrls.setEnabled(txt == "PyQt5")
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
122 self.rSaveFileUrl.setEnabled(txt == "PyQt5")
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
123 self.rDirectoryUrl.setEnabled(txt == "PyQt5")
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
124
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
125 if txt == "PyQt5":
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
126 if self.rfOpenFile.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
127 self.rOpenFile.setChecked(True)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
128 elif self.rfOpenFiles.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
129 self.rOpenFiles.setChecked(True)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
130 elif self.rfSaveFile.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
131 self.rSaveFile.setChecked(True)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
132 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
133 if self.rOpenFileUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
134 self.rOpenFile.setChecked(True)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
135 if self.rOpenFileUrls.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
136 self.rOpenFiles.setChecked(True)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
137 if self.rSaveFileUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
138 self.rSaveFile.setChecked(True)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
139 if self.rDirectoryUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
140 self.rDirectory.setChecked(True)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
141
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
142 if txt == "eric":
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
143 self.__dialogVariant = -1
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
144 elif txt == "PyQt5":
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
145 self.__dialogVariant = 5
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
146 elif txt == "PyQt4":
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
147 self.__dialogVariant = 4
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
148 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
149 # default is PyQt5
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
150 self.__dialogVariant = 5
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
151
3171
2c37b9a37b2d Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
152 self.__toggleInitialFilterAndResult(
2c37b9a37b2d Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
153 self.__typeButtonsGroup.checkedId())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
154
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 def on_buttonBox_clicked(self, button):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 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
158
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 @param button button that was clicked (QAbstractButton)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 if button == self.bTest:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 self.on_bTest_clicked()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 def on_bTest_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 Private method to test the selected options.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 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
174 options = self.__adjustOptions(options)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
175 QFileDialog.getOpenFileName(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
176 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
177 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
178 self.eStartWith.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
179 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
180 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
181 options)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
182 elif self.rOpenFileUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
183 if not self.cSymlinks.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
184 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
185 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
186 options = QFileDialog.Options()
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
187 options = self.__adjustOptions(options)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
188 try:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
189 QFileDialog.getOpenFileUrl(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
190 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
191 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
192 QUrl(self.eStartWith.text()),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
193 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
194 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
195 options,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
196 self.schemesEdit.text().split())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
197 except TypeError:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
198 # PyQt5 < 5.13.0 contains an error
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
199 QFileDialog.getOpenFileUrl(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
200 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
201 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
202 self.eStartWith.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
203 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
204 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
205 options,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
206 self.schemesEdit.text().split())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 elif self.rOpenFiles.isChecked() or self.rfOpenFiles.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)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
213 QFileDialog.getOpenFileNames(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
214 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
215 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
216 self.eStartWith.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
217 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
218 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
219 options)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
220 elif self.rOpenFileUrls.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
221 if not self.cSymlinks.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
222 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
223 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
224 options = QFileDialog.Options()
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
225 options = self.__adjustOptions(options)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
226 try:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
227 QFileDialog.getOpenFileUrls(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
228 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
229 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
230 QUrl(self.eStartWith.text()),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
231 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
232 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
233 options,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
234 self.schemesEdit.text().split())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
235 except TypeError:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
236 # PyQt5 < 5.13.0 contains an error
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
237 QFileDialog.getOpenFileUrls(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
238 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
239 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
240 self.eStartWith.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
241 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
242 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
243 options,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
244 self.schemesEdit.text().split())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 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
250 options = self.__adjustOptions(options)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
251 QFileDialog.getSaveFileName(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
252 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
253 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
254 self.eStartWith.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
255 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
256 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
257 options)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
258 elif self.rSaveFileUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
259 if not self.cSymlinks.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
260 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
261 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
262 options = QFileDialog.Options()
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
263 options = self.__adjustOptions(options)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
264 try:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
265 QFileDialog.getSaveFileUrl(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
266 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
267 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
268 QUrl(self.eStartWith.text()),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
269 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
270 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
271 options,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
272 self.schemesEdit.text().split())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
273 except TypeError:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
274 # PyQt5 < 5.13.0 contains an error
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
275 QFileDialog.getSaveFileUrl(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
276 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
277 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
278 self.eStartWith.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
279 self.eFilters.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
280 self.eInitialFilter.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
281 options,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
282 self.schemesEdit.text().split())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 elif self.rDirectory.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 options = QFileDialog.Options()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 if not self.cSymlinks.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 options |= QFileDialog.Options(QFileDialog.DontResolveSymlinks)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 if self.cDirOnly.isChecked():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 options |= QFileDialog.Options(QFileDialog.ShowDirsOnly)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 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
291 options = self.__adjustOptions(options)
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
292 QFileDialog.getExistingDirectory(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 None,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 self.eCaption.text(),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 self.eWorkDir.text(),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 options)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
297 elif self.rDirectoryUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
298 options = QFileDialog.Options()
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
299 if not self.cSymlinks.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
300 options |= QFileDialog.Options(QFileDialog.DontResolveSymlinks)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
301 if self.cDirOnly.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
302 options |= QFileDialog.Options(QFileDialog.ShowDirsOnly)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
303 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
304 options |= QFileDialog.Options(QFileDialog.Option(0))
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
305 options = self.__adjustOptions(options)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
306 try:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
307 QFileDialog.getExistingDirectoryUrl(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
308 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
309 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
310 QUrl(self.eWorkDir.text()),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
311 options,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
312 self.schemesEdit.text().split())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
313 except TypeError:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
314 # PyQt5 < 5.13.0 contains an error
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
315 QFileDialog.getExistingDirectoryUrl(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
316 None,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
317 self.eCaption.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
318 self.eWorkDir.text(),
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
319 options,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
320 self.schemesEdit.text().split())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
321
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 def __toggleConfirmCheckBox(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 Private slot to enable/disable the confirmation check box.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 self.cConfirmOverwrite.setEnabled(
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
327 self.rSaveFile.isChecked() or self.rfSaveFile.isChecked() or
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
328 self.rSaveFileUrl.isChecked())
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
329
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 def __toggleGroupsAndTest(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 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
333 """
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
334 if self.rDirectory.isChecked() or self.rDirectoryUrl.isChecked():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 self.filePropertiesGroup.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 self.dirPropertiesGroup.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 self.bTest.setDisabled(self.cWorkDir.isChecked())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 self.filePropertiesGroup.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 self.dirPropertiesGroup.setEnabled(False)
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
341 self.bTest.setDisabled(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 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
343
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
344 def __toggleInitialFilterAndResult(self, checkedId):
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
345 """
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 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
347 results entries.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
349 @param checkedId id of the clicked button (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 """
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
351 enable = (
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
352 (self.__dialogVariant in (-1, 4) and checkedId in [11, 12, 13]) or
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
353 (self.__dialogVariant == 5 and checkedId in [1, 2, 3, 21, 22, 23])
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
354 )
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
355
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
356 self.lInitialFilter.setEnabled(enable)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
357 self.eInitialFilter.setEnabled(enable)
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
358 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
359
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
360 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
361 self.eFilterVariable.setEnabled(enable)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
362
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
363 self.urlPropertiesGroup.setEnabled(checkedId in (21, 22, 23, 31))
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
364
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
365 def getCode(self, indLevel, indString):
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
366 """
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
367 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
368
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 @param indLevel indentation level (int)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 @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
371 @return generated code (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 # calculate our indentation level and the indentation string
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 il = indLevel + 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 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
376 estring = os.linesep + indLevel * indString
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 # now generate the code
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
379 if self.parentSelf.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
380 parent = "self"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
381 elif self.parentNone.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
382 parent = "None"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
383 elif self.parentOther.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
384 parent = self.parentEdit.text()
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
385 if parent == "":
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
386 parent = "None"
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
387
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
388 # 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
389 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
390 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
391 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
392 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
393 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
394 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
395 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
396 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
397 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
398 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
399 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
400 else:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
401 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
402 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
403 if not filterVariable:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
404 if (self.__dialogVariant in (-1, 4) and
3124
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
405 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
406 self.rfOpenFile, self.rfOpenFiles, self.rfSaveFile]) or \
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
407 (self.__dialogVariant == 5 and
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
408 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
409 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
410 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
411 else:
a01e410893ac Extended the dialog wizards to generate code for the result variable(s).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3122
diff changeset
412 filterVariable = ""
4590
9fdd473c68fb Fixed an issue in the file dialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4180
diff changeset
413 else:
9fdd473c68fb Fixed an issue in the file dialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4180
diff changeset
414 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
415
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
416 if self.__dialogVariant == -1:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
417 dialogType = "E5FileDialog"
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
418 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
419 dialogType = "QFileDialog"
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
420
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
421 code = '{0}{1} = {2}.'.format(nameVariable, filterVariable, dialogType)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
422 if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked() or \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
423 self.rOpenFileUrl.isChecked():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 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
425 code += 'getOpenFileName({0}{1}'.format(os.linesep, istring)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
426 elif self.rOpenFileUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
427 code += 'getOpenFileUrl({0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 else:
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
429 code += 'getOpenFileNameAndFilter({0}{1}'.format(
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
430 os.linesep, istring)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
431 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
432 if not self.eCaption.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
433 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
435 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
436 self.eCaption.text(), os.linesep, istring)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
437 if self.rOpenFileUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
438 if not self.eStartWith.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
439 code += 'QUrl(),{0}{1}'.format(os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
440 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
441 if self.cStartWith.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
442 fmt = '{0},{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
443 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
444 fmt = 'QUrl("{0}"),{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
445 code += fmt.format(self.eStartWith.text(), os.linesep,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
446 istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
448 if not self.eStartWith.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
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:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
451 if self.cStartWith.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
452 fmt = '{0},{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
453 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
454 fmt = '"{0}",{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
455 code += fmt.format(self.eStartWith.text(), os.linesep,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
456 istring)
147
33830c229cc1 Fixed a bug in the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
457 if self.eFilters.text() == "":
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 code += '""'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 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
460 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
461 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
462 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
463 fmt = 'self.tr("{0}")'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
464 code += fmt.format(self.eFilters.text())
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
465 if self.rfOpenFile.isChecked() or self.__dialogVariant == 5:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
466 if self.eInitialFilter.text() == "":
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
467 initialFilter = "None"
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
468 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
469 if self.cInitialFilter.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
470 fmt = '{0}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
471 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
472 fmt = 'self.tr("{0}")'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
473 initialFilter = fmt.format(self.eInitialFilter.text())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
474 code += ',{0}{1}{2}'.format(os.linesep, istring, initialFilter)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
475 if not self.cSymlinks.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
476 code += \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
477 ',{0}{1}{2}.Options(' \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
478 '{2}.DontResolveSymlinks)' \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
479 .format(os.linesep, istring, dialogType)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
480 if self.rOpenFileUrl.isChecked() and bool(self.schemesEdit.text()):
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
481 code += \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
482 ',{0}{1}{2}'.format(os.linesep, istring,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
483 self.__prepareSchemesList())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
484 code += '){0}'.format(estring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
485 elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked() or \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
486 self.rOpenFileUrls.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
487 if self.rOpenFiles.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
488 code += 'getOpenFileNames({0}{1}'.format(os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
489 elif self.rOpenFileUrls.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
490 code += 'getOpenFileUrls({0}{1}'.format(os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
491 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
492 code += 'getOpenFileNamesAndFilter({0}{1}'.format(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
493 os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
494 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
495 if not self.eCaption.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
496 code += '"",{0}{1}'.format(os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
497 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
498 code += 'self.tr("{0}"),{1}{2}'.format(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
499 self.eCaption.text(), os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
500 if self.rOpenFileUrls.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
501 if not self.eStartWith.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
502 code += 'QUrl(),{0}{1}'.format(os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
503 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
504 if self.cStartWith.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
505 fmt = '{0},{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
506 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
507 fmt = 'QUrl("{0}"),{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
508 code += fmt.format(self.eStartWith.text(), os.linesep,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
509 istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
510 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
511 if not self.eStartWith.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
512 code += '"",{0}{1}'.format(os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
513 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
514 if self.cStartWith.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
515 fmt = '{0},{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
516 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
517 fmt = '"{0}",{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
518 code += fmt.format(self.eStartWith.text(), os.linesep,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
519 istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
520 if not self.eFilters.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
521 code += '""'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
522 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
523 if self.cFilters.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
524 fmt = '{0}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
525 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
526 fmt = 'self.tr("{0}")'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
527 code += fmt.format(self.eFilters.text())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
528 if self.rfOpenFiles.isChecked() or self.__dialogVariant == 5:
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
529 if self.eInitialFilter.text() == "":
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
530 initialFilter = "None"
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
531 else:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
532 if self.cInitialFilter.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
533 fmt = '{0}'
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
534 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
535 fmt = 'self.tr("{0}")'
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
536 initialFilter = fmt.format(self.eInitialFilter.text())
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
537 code += ',{0}{1}{2}'.format(os.linesep, istring, initialFilter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 if not self.cSymlinks.isChecked():
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
539 code += \
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
540 ',{0}{1}{2}.Options(' \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
541 '{2}.DontResolveSymlinks)' \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
542 .format(os.linesep, istring, dialogType)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
543 if self.rOpenFileUrls.isChecked() and \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
544 bool(self.schemesEdit.text()):
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
545 code += \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
546 ',{0}{1}{2}'.format(os.linesep, istring,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
547 self.__prepareSchemesList())
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
548 code += '){0}'.format(estring)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
549 elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked() or \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
550 self.rSaveFileUrl.isChecked():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 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
552 code += 'getSaveFileName({0}{1}'.format(os.linesep, istring)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
553 elif self.rSaveFileUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
554 code += 'getSaveFileUrl({0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 else:
2893
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
556 code += 'getSaveFileNameAndFilter({0}{1}'.format(
150de635fa29 Some changes to code generation wizards.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
557 os.linesep, istring)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
558 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
559 if not self.eCaption.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
560 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
562 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
563 self.eCaption.text(), os.linesep, istring)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
564 if self.rSaveFileUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
565 if not self.eStartWith.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
566 code += 'QUrl(),{0}{1}'.format(os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
567 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
568 if self.cStartWith.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
569 fmt = '{0},{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
570 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
571 fmt = 'QUrl("{0}"),{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
572 code += fmt.format(self.eStartWith.text(), os.linesep,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
573 istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
575 if not self.eStartWith.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
576 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
578 if self.cStartWith.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
579 fmt = '{0},{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
580 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
581 fmt = '"{0}",{1}{2}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
582 code += fmt.format(self.eStartWith.text(), os.linesep,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
583 istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 if not self.eFilters.text():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 code += '""'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586 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
587 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
588 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
589 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
590 fmt = 'self.tr("{0}")'
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
591 code += fmt.format(self.eFilters.text())
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
592 if self.rfSaveFile.isChecked() or self.__dialogVariant == 5:
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
593 if self.eInitialFilter.text() == "":
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
594 initialFilter = "None"
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
595 else:
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
596 if self.cInitialFilter.isChecked():
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
597 fmt = '{0}'
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
598 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
599 fmt = 'self.tr("{0}")'
5599
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
600 initialFilter = fmt.format(self.eInitialFilter.text())
033967644b1f Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
601 code += ',{0}{1}{2}'.format(os.linesep, istring, initialFilter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 if (not self.cSymlinks.isChecked()) or \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 (not self.cConfirmOverwrite.isChecked()):
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
604 code += ',{0}{1}{2}.Options('.format(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
605 os.linesep, istring, dialogType)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 if not self.cSymlinks.isChecked():
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
607 code += '{0}.DontResolveSymlinks'.format(dialogType)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 if (not self.cSymlinks.isChecked()) and \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 (not self.cConfirmOverwrite.isChecked()):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 code += ' | '
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 if not self.cConfirmOverwrite.isChecked():
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
612 code += '{0}.DontConfirmOverwrite'.format(dialogType)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 code += ')'
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
614 if self.rSaveFileUrl.isChecked() and \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
615 bool(self.schemesEdit.text()):
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
616 code += \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
617 ',{0}{1}{2}'.format(os.linesep, istring,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
618 self.__prepareSchemesList())
446
69aac6eeba9b Changed the wizards code generation to eliminate not needed backslashes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 425
diff changeset
619 code += '){0}'.format(estring)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
620 elif self.rDirectory.isChecked() or self.rDirectoryUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
621 if self.rDirectory.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
622 code += 'getExistingDirectory({0}{1}'.format(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
623 os.linesep, istring)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
624 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
625 code += 'getExistingDirectoryUrl({0}{1}'.format(
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
626 os.linesep, istring)
3122
4bcf6c0f4432 Added support for PyQt5 to the QFileDialog wizard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3118
diff changeset
627 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
628 if not self.eCaption.text():
425
ca5e65413fc5 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 147
diff changeset
629 code += '"",{0}{1}'.format(os.linesep, istring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3171
diff changeset
631 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
632 self.eCaption.text(), os.linesep, istring)
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
633 if self.rDirectoryUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
634 if not self.eWorkDir.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
635 code += 'QUrl()'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
636 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
637 if self.cWorkDir.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
638 fmt = '{0}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
639 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
640 fmt = 'QUrl("{0}")'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
641 code += fmt.format(self.eWorkDir.text())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
643 if not self.eWorkDir.text():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
644 code += '""'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
646 if self.cWorkDir.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
647 fmt = '{0}'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
648 else:
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
649 fmt = '"{0}"'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
650 code += fmt.format(self.eWorkDir.text())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
651 code += ',{0}{1}{2}.Options('.format(os.linesep, istring,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
652 dialogType)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 if not self.cSymlinks.isChecked():
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
654 code += '{0}.DontResolveSymlinks | '.format(dialogType)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 if self.cDirOnly.isChecked():
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
656 code += '{0}.ShowDirsOnly'.format(dialogType)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 else:
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
658 code += '{0}.Option(0)'.format(dialogType)
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
659 code += ')'
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
660 if self.rDirectoryUrl.isChecked():
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
661 code += \
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
662 ',{0}{1}{2}'.format(os.linesep, istring,
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
663 self.__prepareSchemesList())
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
664 code += '){0}'.format(estring)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 return code
7207
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
667
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
668 def __prepareSchemesList(self):
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
669 """
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
670 Private method to prepare the list of supported schemes.
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
671
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
672 @return string representation of the supported schemes
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
673 @rtype str
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
674 """
4ba7a9b26020 QFileDialog Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7198
diff changeset
675 return repr(self.schemesEdit.text().strip().split())

eric ide

mercurial