diff -r 82b608e352ec -r 2bbec88047dd eric6/HexEdit/HexEditMainWindow.py --- a/eric6/HexEdit/HexEditMainWindow.py Wed Apr 21 17:56:12 2021 +0200 +++ b/eric6/HexEdit/HexEditMainWindow.py Wed Apr 21 19:40:50 2021 +0200 @@ -1045,10 +1045,11 @@ @return flag indicating success @rtype bool """ - if not self.__fileName: - ok = self.__saveHexFileAs() - else: - ok = self.__saveHexDataFile(self.__fileName) + ok = ( + self.__saveHexDataFile(self.__fileName) + if self.__fileName else + self.__saveHexFileAs() + ) if ok: self.__editor.undoStack().setClean() @@ -1186,10 +1187,11 @@ .format(fileName, file.errorString())) return - if selectionOnly: - readableData = self.__editor.selectionToReadableString() - else: - readableData = self.__editor.toReadableString() + readableData = ( + self.__editor.selectionToReadableString() + if selectionOnly else + self.__editor.toReadableString() + ) res = file.write(readableData.encode("latin1")) != -1 file.close() @@ -1235,10 +1237,11 @@ # insert filename into list of recently opened files self.__addToRecentList(fileName) - if not self.__fileName: - shownName = self.tr("Untitled") - else: - shownName = self.__strippedName(self.__fileName) + shownName = ( + self.tr("Untitled") + if not self.__fileName else + self.__strippedName(self.__fileName) + ) self.setWindowTitle(self.tr("{0}[*] - {1}") .format(shownName, self.tr("Hex Editor"))) @@ -1320,10 +1323,11 @@ """ self.__replaceWidget.hide() self.__gotoWidget.hide() - if self.__editor.hasSelection(): - txt = self.__editor.selectionToHexString() - else: - txt = "" + txt = ( + self.__editor.selectionToHexString() + if self.__editor.hasSelection() else + "" + ) self.__searchWidget.show(txt) def __replace(self): @@ -1332,10 +1336,11 @@ """ self.__searchWidget.hide() self.__gotoWidget.hide() - if self.__editor.hasSelection(): - txt = self.__editor.selectionToHexString() - else: - txt = "" + txt = ( + self.__editor.selectionToHexString() + if self.__editor.hasSelection() else + "" + ) self.__replaceWidget.show(txt) def __goto(self):