src/eric7/PipInterface/PipFreezeDialog.py

branch
eric7
changeset 9740
90072e10ae9b
parent 9653
e67609152c5e
child 9971
773ad1f1ed22
equal deleted inserted replaced
9739:d527cfe919ae 9740:90072e10ae9b
53 53
54 self.__dialogMode = mode 54 self.__dialogMode = mode
55 if mode is PipFreezeDialogModes.Constraints: 55 if mode is PipFreezeDialogModes.Constraints:
56 self.constraintsCheckBox.setChecked(False) 56 self.constraintsCheckBox.setChecked(False)
57 self.constraintsCheckBox.setEnabled(False) 57 self.constraintsCheckBox.setEnabled(False)
58 58 self.__title = self.tr("Generate Constraints")
59 self.setWindowTitle(self.tr("Generate Constraints"))
60 59
61 elif mode is PipFreezeDialogModes.Requirements: 60 elif mode is PipFreezeDialogModes.Requirements:
62 self.setWindowTitle(self.tr("Generate Requirements")) 61 self.__title = self.tr("Generate Requirements")
62
63 self.setWindowTitle(self.__title)
63 64
64 self.__refreshButton = self.buttonBox.addButton( 65 self.__refreshButton = self.buttonBox.addButton(
65 self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole 66 self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole
66 ) 67 )
67 68
137 Private slot to refresh the displayed list. 138 Private slot to refresh the displayed list.
138 """ 139 """
139 ok = ( 140 ok = (
140 EricMessageBox.yesNo( 141 EricMessageBox.yesNo(
141 self, 142 self,
142 self.tr("Generate Requirements"), 143 self.__title,
143 self.tr( 144 self.tr(
144 """The requirements were changed. Do you want""" 145 """The requirements were changed. Do you want"""
145 """ to overwrite these changes?""" 146 """ to overwrite these changes?"""
146 ), 147 ),
147 ) 148 )
225 @type str 226 @type str
226 """ 227 """
227 if os.path.exists(fileName): 228 if os.path.exists(fileName):
228 ok = EricMessageBox.warning( 229 ok = EricMessageBox.warning(
229 self, 230 self,
230 self.tr("Generate Requirements"), 231 self.__title,
231 self.tr( 232 self.tr(
232 """The file <b>{0}</b> already exists. Do you want""" 233 """The file <b>{0}</b> already exists. Do you want"""
233 """ to overwrite it?""" 234 """ to overwrite it?"""
234 ).format(fileName), 235 ).format(fileName),
235 ) 236 )
243 with open(fileName, "w") as f: 244 with open(fileName, "w") as f:
244 f.write(txt) 245 f.write(txt)
245 except OSError as err: 246 except OSError as err:
246 EricMessageBox.critical( 247 EricMessageBox.critical(
247 self, 248 self,
248 self.tr("Generate Requirements"), 249 self.__title,
249 self.tr( 250 self.tr(
250 """<p>The requirements could not be written""" 251 """<p>The requirements could not be written"""
251 """ to <b>{0}</b>.</p><p>Reason: {1}</p>""" 252 """ to <b>{0}</b>.</p><p>Reason: {1}</p>"""
252 ).format(fileName, str(err)), 253 ).format(fileName, str(err)),
253 ) 254 )
265 """ 266 """
266 Private slot to write the requirements text to a new file. 267 Private slot to write the requirements text to a new file.
267 """ 268 """
268 fileName, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( 269 fileName, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
269 self, 270 self,
270 self.tr("Generate Requirements"), 271 self.__title,
271 os.path.expanduser("~"), 272 os.path.expanduser("~"),
272 self.tr("Text Files (*.txt);;All Files (*)"), 273 self.tr("Text Files (*.txt);;All Files (*)"),
273 None, 274 None,
274 EricFileDialog.DontConfirmOverwrite, 275 EricFileDialog.DontConfirmOverwrite,
275 ) 276 )

eric ide

mercurial