Plugins/WizardPlugins/FileDialogWizard/FileDialogWizardDialog.py

changeset 882
34b86be88bf0
parent 880
52ed20236a1c
child 945
8cd4d08fa9f6
child 1510
e75ecf2bd9dd
equal deleted inserted replaced
881:ff23d907f87b 882:34b86be88bf0
13 from PyQt4.QtGui import * 13 from PyQt4.QtGui import *
14 14
15 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter 15 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter
16 16
17 from .Ui_FileDialogWizardDialog import Ui_FileDialogWizardDialog 17 from .Ui_FileDialogWizardDialog import Ui_FileDialogWizardDialog
18
19 import Globals
18 20
19 class FileDialogWizardDialog(QDialog, Ui_FileDialogWizardDialog): 21 class FileDialogWizardDialog(QDialog, Ui_FileDialogWizardDialog):
20 """ 22 """
21 Class implementing the color dialog wizard dialog. 23 Class implementing the color dialog wizard dialog.
22 24
43 self.cFilters.toggled[bool].connect(self.__toggleGroupsAndTest) 45 self.cFilters.toggled[bool].connect(self.__toggleGroupsAndTest)
44 46
45 self.bTest = \ 47 self.bTest = \
46 self.buttonBox.addButton(self.trUtf8("Test"), QDialogButtonBox.ActionRole) 48 self.buttonBox.addButton(self.trUtf8("Test"), QDialogButtonBox.ActionRole)
47 49
50 def __adjustOptions(self, options):
51 """
52 Private method to adjust the file dialog options.
53
54 @param options file dialog options (QFileDialog.Options)
55 @return modified options (QFileDialog.Options)
56 """
57 if Globals.isLinuxPlatform():
58 options |= QFileDialog.DontUseNativeDialog
59 return options
60
48 def on_buttonBox_clicked(self, button): 61 def on_buttonBox_clicked(self, button):
49 """ 62 """
50 Private slot called by a button of the button box clicked. 63 Private slot called by a button of the button box clicked.
51 64
52 @param button button that was clicked (QAbstractButton) 65 @param button button that was clicked (QAbstractButton)
62 if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked(): 75 if self.rOpenFile.isChecked() or self.rfOpenFile.isChecked():
63 if not self.cSymlinks.isChecked(): 76 if not self.cSymlinks.isChecked():
64 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) 77 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
65 else: 78 else:
66 options = QFileDialog.Options() 79 options = QFileDialog.Options()
67 options |= QFileDialog.Options(QFileDialog.DontUseNativeDialog) 80 options = self.__adjustOptions(options)
68 QFileDialog.getOpenFileName( 81 QFileDialog.getOpenFileName(
69 None, 82 None,
70 self.eCaption.text(), 83 self.eCaption.text(),
71 self.eStartWith.text(), 84 self.eStartWith.text(),
72 self.eFilters.text(), 85 self.eFilters.text(),
74 elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked(): 87 elif self.rOpenFiles.isChecked() or self.rfOpenFiles.isChecked():
75 if not self.cSymlinks.isChecked(): 88 if not self.cSymlinks.isChecked():
76 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) 89 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
77 else: 90 else:
78 options = QFileDialog.Options() 91 options = QFileDialog.Options()
79 options |= QFileDialog.Options(QFileDialog.DontUseNativeDialog) 92 options = self.__adjustOptions(options)
80 QFileDialog.getOpenFileNames( 93 QFileDialog.getOpenFileNames(
81 None, 94 None,
82 self.eCaption.text(), 95 self.eCaption.text(),
83 self.eStartWith.text(), 96 self.eStartWith.text(),
84 self.eFilters.text(), 97 self.eFilters.text(),
86 elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked(): 99 elif self.rSaveFile.isChecked() or self.rfSaveFile.isChecked():
87 if not self.cSymlinks.isChecked(): 100 if not self.cSymlinks.isChecked():
88 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks) 101 options = QFileDialog.Options(QFileDialog.DontResolveSymlinks)
89 else: 102 else:
90 options = QFileDialog.Options() 103 options = QFileDialog.Options()
91 options |= QFileDialog.Options(QFileDialog.DontUseNativeDialog) 104 options = self.__adjustOptions(options)
92 QFileDialog.getSaveFileName( 105 QFileDialog.getSaveFileName(
93 None, 106 None,
94 self.eCaption.text(), 107 self.eCaption.text(),
95 self.eStartWith.text(), 108 self.eStartWith.text(),
96 self.eFilters.text(), 109 self.eFilters.text(),
101 options |= QFileDialog.Options(QFileDialog.DontResolveSymlinks) 114 options |= QFileDialog.Options(QFileDialog.DontResolveSymlinks)
102 if self.cDirOnly.isChecked(): 115 if self.cDirOnly.isChecked():
103 options |= QFileDialog.Options(QFileDialog.ShowDirsOnly) 116 options |= QFileDialog.Options(QFileDialog.ShowDirsOnly)
104 else: 117 else:
105 options |= QFileDialog.Options(QFileDialog.Option(0)) 118 options |= QFileDialog.Options(QFileDialog.Option(0))
106 options |= QFileDialog.Options(QFileDialog.DontUseNativeDialog) 119 options = self.__adjustOptions(options)
107 QFileDialog.getExistingDirectory( 120 QFileDialog.getExistingDirectory(
108 None, 121 None,
109 self.eCaption.text(), 122 self.eCaption.text(),
110 self.eWorkDir.text(), 123 self.eWorkDir.text(),
111 options) 124 options)

eric ide

mercurial