src/eric7/PipInterface/PipPackagesWidget.py

branch
eric7
changeset 9573
9960d19d66b5
parent 9569
b888d5495c1b
child 9581
f0428ceedb41
equal deleted inserted replaced
9572:3b46c662a004 9573:9960d19d66b5
966 else: 966 else:
967 EricMessageBox.warning( 967 EricMessageBox.warning(
968 self, 968 self,
969 self.tr("Search PyPI"), 969 self.tr("Search PyPI"),
970 self.tr( 970 self.tr(
971 """<p>There were no more results for""" """ <b>{0}</b>.</p>""" 971 """<p>There were no more results for <b>{0}</b>.</p>"""
972 ).format(searchTerm), 972 ).format(searchTerm),
973 ) 973 )
974 lastItem = None 974 lastItem = None
975 975
976 wrapper = textwrap.TextWrapper(width=80) 976 wrapper = textwrap.TextWrapper(width=80)
1454 cfgDir = os.path.dirname(cfgFile) 1454 cfgDir = os.path.dirname(cfgFile)
1455 if not cfgDir: 1455 if not cfgDir:
1456 EricMessageBox.critical( 1456 EricMessageBox.critical(
1457 None, 1457 None,
1458 self.tr("Edit Configuration"), 1458 self.tr("Edit Configuration"),
1459 self.tr("""No valid configuration path determined.""" """ Aborting"""), 1459 self.tr("""No valid configuration path determined. Aborting"""),
1460 ) 1460 )
1461 return 1461 return
1462 1462
1463 try: 1463 try:
1464 if not os.path.isdir(cfgDir): 1464 if not os.path.isdir(cfgDir):
1465 os.makedirs(cfgDir) 1465 os.makedirs(cfgDir)
1466 except OSError: 1466 except OSError:
1467 EricMessageBox.critical( 1467 EricMessageBox.critical(
1468 None, 1468 None,
1469 self.tr("Edit Configuration"), 1469 self.tr("Edit Configuration"),
1470 self.tr("""No valid configuration path determined.""" """ Aborting"""), 1470 self.tr("""No valid configuration path determined. Aborting"""),
1471 ) 1471 )
1472 return 1472 return
1473 1473
1474 if not os.path.exists(cfgFile): 1474 if not os.path.exists(cfgFile):
1475 with contextlib.suppress(OSError), open(cfgFile, "w") as f: 1475 with contextlib.suppress(OSError), open(cfgFile, "w") as f:
1478 # check, if the destination is writeable 1478 # check, if the destination is writeable
1479 if not os.access(cfgFile, os.W_OK): 1479 if not os.access(cfgFile, os.W_OK):
1480 EricMessageBox.critical( 1480 EricMessageBox.critical(
1481 None, 1481 None,
1482 self.tr("Edit Configuration"), 1482 self.tr("Edit Configuration"),
1483 self.tr("""No valid configuration path determined.""" """ Aborting"""), 1483 self.tr("""No valid configuration path determined. Aborting"""),
1484 ) 1484 )
1485 return 1485 return
1486 1486
1487 self.__editor = MiniEditor(cfgFile, "Properties") 1487 self.__editor = MiniEditor(cfgFile, "Properties")
1488 self.__editor.show() 1488 self.__editor.show()

eric ide

mercurial