diff --git a/manuskript/converters/markdownConverter.py b/manuskript/converters/markdownConverter.py index f0e577b..1b2883a 100644 --- a/manuskript/converters/markdownConverter.py +++ b/manuskript/converters/markdownConverter.py @@ -26,7 +26,7 @@ class markdownConverter(abstractConverter): @classmethod def isValid(self): - return MD is not None + return MD != None @classmethod def convert(self, markdown): diff --git a/manuskript/exporter/manuskript/HTML.py b/manuskript/exporter/manuskript/HTML.py index 9f89087..89c0dcf 100644 --- a/manuskript/exporter/manuskript/HTML.py +++ b/manuskript/exporter/manuskript/HTML.py @@ -24,7 +24,7 @@ class HTML(markdown): exportDefaultSuffix = ".html" def isValid(self): - return MD is not None + return MD != None def settingsWidget(self): w = markdownSettings(self) diff --git a/manuskript/exporter/manuskript/plainText.py b/manuskript/exporter/manuskript/plainText.py index 250f6bf..4eac456 100644 --- a/manuskript/exporter/manuskript/plainText.py +++ b/manuskript/exporter/manuskript/plainText.py @@ -51,10 +51,10 @@ class plainText(basicFormat): def getExportFilename(self, settingsWidget, varName=None, filter=None): - if varName is None: + if varName == None: varName = self.exportVarName - if filter is None: + if filter == None: filter = self.exportFilter settings = settingsWidget.getSettings() diff --git a/manuskript/exporter/pandoc/PDF.py b/manuskript/exporter/pandoc/PDF.py index 5adf485..7e67c42 100644 --- a/manuskript/exporter/pandoc/PDF.py +++ b/manuskript/exporter/pandoc/PDF.py @@ -31,7 +31,7 @@ class PDF(abstractOutput): def isValid(self): path = shutil.which("pdflatex") or shutil.which("xelatex") - return path is not None + return path != None def output(self, settingsWidget, outputfile=None): args = settingsWidget.runnableSettings() diff --git a/manuskript/exporter/pandoc/abstractPlainText.py b/manuskript/exporter/pandoc/abstractPlainText.py index 5cfea99..9dcfd8f 100644 --- a/manuskript/exporter/pandoc/abstractPlainText.py +++ b/manuskript/exporter/pandoc/abstractPlainText.py @@ -75,7 +75,7 @@ class pandocSetting: """Return whether the specific setting is active with the given format.""" # Empty formats means all - if self.formats is "": + if self.formats == "": return True # "html" in "html markdown latex" diff --git a/manuskript/functions/spellchecker.py b/manuskript/functions/spellchecker.py index d3b9014..1458890 100644 --- a/manuskript/functions/spellchecker.py +++ b/manuskript/functions/spellchecker.py @@ -111,7 +111,7 @@ class Spellchecker: (lib, name) = values try: d = Spellchecker.dictionaries.get(dictionary, None) - if d is None: + if d == None: for impl in Spellchecker.implementations: if impl.isInstalled() and lib == impl.getLibraryName(): d = impl(name) @@ -267,7 +267,7 @@ class EnchantDictionary(BasicDictionary): @staticmethod def isInstalled(): - return enchant is not None + return enchant != None @staticmethod def availableDictionaries(): @@ -284,9 +284,9 @@ class EnchantDictionary(BasicDictionary): if default_locale and not enchant.dict_exists(default_locale): default_locale = None - if default_locale is None: + if default_locale == None: default_locale = QLocale.system().name() - if default_locale is None: + if default_locale == None: default_locale = self.availableDictionaries()[0] return default_locale @@ -330,7 +330,7 @@ class PySpellcheckerDictionary(BasicDictionary): @staticmethod def isInstalled(): - return pyspellchecker is not None + return pyspellchecker != None @staticmethod def availableDictionaries(): @@ -350,7 +350,7 @@ class PySpellcheckerDictionary(BasicDictionary): default_locale = QLocale.system().name() if default_locale: default_locale = default_locale[0:2] - if default_locale is None: + if default_locale == None: default_locale = "en" return default_locale @@ -415,7 +415,7 @@ class SymSpellDictionary(BasicDictionary): @staticmethod def isInstalled(): - return symspellpy is not None + return symspellpy != None @classmethod def availableDictionaries(cls): @@ -524,7 +524,7 @@ class LanguageToolDictionary(BasicDictionary): @staticmethod def isInstalled(): - if languagetool is not None: + if languagetool != None: # This check, if Java is installed, is necessary to # make sure LanguageTool can be run without problems. @@ -550,9 +550,9 @@ class LanguageToolDictionary(BasicDictionary): if default_locale and not default_locale in languagetool.get_languages(): default_locale = None - if default_locale is None: + if default_locale == None: default_locale = QLocale.system().name() - if default_locale is None: + if default_locale == None: default_locale = self.availableDictionaries()[0] return default_locale diff --git a/manuskript/importer/mindMapImporter.py b/manuskript/importer/mindMapImporter.py index 31155c9..7999bdf 100644 --- a/manuskript/importer/mindMapImporter.py +++ b/manuskript/importer/mindMapImporter.py @@ -47,7 +47,7 @@ class mindMapImporter(abstractImporter): node = root.find("node") items = [] - if node is not None: + if node != None: items.extend(self.parseItems(node, parentItem)) ret = True @@ -97,7 +97,7 @@ class mindMapImporter(abstractImporter): # Rich text content content = "" content = underElement.find("richcontent") - if content is not None: + if content != None: # In Freemind, can be note or node # Note: it's a note # Node: it's the title of the node, in rich text @@ -130,7 +130,7 @@ class mindMapImporter(abstractImporter): children = underElement.findall('node') # Process children - if children is not None and len(children) > 0: + if children != None and len(children) > 0: for c in children: items.extend(self.parseItems(c, item)) diff --git a/manuskript/importer/opmlImporter.py b/manuskript/importer/opmlImporter.py index e434cd5..79d871e 100644 --- a/manuskript/importer/opmlImporter.py +++ b/manuskript/importer/opmlImporter.py @@ -52,10 +52,10 @@ class opmlImporter(abstractImporter): bodyNode = opmlNode.find("body") items = [] - if bodyNode is not None: + if bodyNode != None: outlineEls = bodyNode.findall("outline") - if outlineEls is not None: + if outlineEls != None: for element in outlineEls: items.extend(cls.parseItems(element, parentItem)) ret = True @@ -74,19 +74,20 @@ class opmlImporter(abstractImporter): def parseItems(cls, underElement, parentItem=None): items = [] title = underElement.get('text') - if title is not None: - + if title != None: card = outlineItem(parent=parentItem, title=title) items.append(card) body = "" note = underElement.get('_note') - if note is not None and not cls.isWhitespaceOnly(note): + + if note != None and not cls.isWhitespaceOnly(note): #body = cls.restoreNewLines(note) body = note children = underElement.findall('outline') - if children is not None and len(children) > 0: + + if children != None and len(children) > 0: for el in children: items.extend(cls.parseItems(el, card)) else: @@ -121,4 +122,4 @@ class opmlImporter(abstractImporter): s = cls.restoreNewLines(inString) s = ''.join(s.split()) - return len(s) is 0 + return len(s) == 0 diff --git a/manuskript/importer/pandocImporters.py b/manuskript/importer/pandocImporters.py index 6e281cc..9a0e99d 100644 --- a/manuskript/importer/pandocImporters.py +++ b/manuskript/importer/pandocImporters.py @@ -38,7 +38,7 @@ class pandocImporter(abstractImporter): r = pandocExporter().run(args) - if r is None: + if r == None: return None if formatTo == "opml": diff --git a/manuskript/load_save/version_1.py b/manuskript/load_save/version_1.py index 9e76a00..a5e9626 100644 --- a/manuskript/load_save/version_1.py +++ b/manuskript/load_save/version_1.py @@ -107,7 +107,7 @@ def saveProject(zip=None): settings. @return: True if successful, False otherwise. """ - if zip is None: + if zip == None: zip = settings.saveToZip log("\n\nSaving to:", "zip" if zip else "folder") @@ -124,7 +124,7 @@ def saveProject(zip=None): project = mw.currentProject # Sanity check (see PR-583): make sure we actually have a current project. - if project is None: + if project == None: print("Error: cannot save project because there is no current project in the UI.") return False @@ -198,7 +198,7 @@ def saveProject(zip=None): # We skip the first row, which is empty and transparent for i in range(1, mdl.rowCount()): color = "" - if mdl.data(mdl.index(i, 0), Qt.DecorationRole) is not None: + if mdl.data(mdl.index(i, 0), Qt.DecorationRole) != None: color = iconColor(mdl.data(mdl.index(i, 0), Qt.DecorationRole)).name(QColor.HexRgb) color = color if color != "#ff000000" else "#00000000" @@ -901,7 +901,7 @@ def addTextItems(mdl, odict, parent=None): @param odict: OrderedDict @return: nothing """ - if parent is None: + if parent == None: parent = mdl.rootItem for k in odict: diff --git a/manuskript/main.py b/manuskript/main.py index 63bc9cf..48921d4 100644 --- a/manuskript/main.py +++ b/manuskript/main.py @@ -101,7 +101,7 @@ def prepare(tests=False): def respectSystemDarkThemeSetting(): """Adjusts the Qt theme to match the OS 'dark theme' setting configured by the user.""" - if platform.system() is not 'Windows': + if platform.system() != 'Windows': return # Basic Windows 10 Dark Theme support. @@ -168,7 +168,7 @@ def prepare(tests=False): def launch(app, MW = None): - if MW is None: + if MW == None: from manuskript.functions import mainWindow MW = mainWindow() @@ -176,7 +176,7 @@ def launch(app, MW = None): # Support for IPython Jupyter QT Console as a debugging aid. # Last argument must be --console to enable it - # Code reference : + # Code reference : # https://github.com/ipython/ipykernel/blob/master/examples/embedding/ipkernel_qtapp.py # https://github.com/ipython/ipykernel/blob/master/examples/embedding/internal_ipkernel.py if len(sys.argv) > 1 and sys.argv[-1] == "--console": @@ -188,7 +188,7 @@ def launch(app, MW = None): # Create IPython kernel within our application kernel = IPKernelApp.instance() - + # Initialize it and use matplotlib for main event loop integration with QT kernel.initialize(['python', '--matplotlib=qt']) diff --git a/manuskript/mainWindow.py b/manuskript/mainWindow.py index 3782fd8..8772a88 100644 --- a/manuskript/mainWindow.py +++ b/manuskript/mainWindow.py @@ -270,7 +270,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.mainEditor ] - while new is not None: + while new != None: if new in targets: self._lastFocus = new break @@ -838,7 +838,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): # risk a scenario where the timer somehow triggers a new save while saving. self.saveTimerNoChanges.stop() - if self.currentProject is None: + if self.currentProject == None: # No UI feedback here as this code path indicates a race condition that happens # after the user has already closed the project through some way. But in that # scenario, this code should not be reachable to begin with. @@ -1095,7 +1095,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): # disconnect only removes one connection at a time. while True: try: - if oldHandler is not None: + if oldHandler != None: signal.disconnect(oldHandler) else: signal.disconnect() @@ -1375,7 +1375,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): dictionaries = Spellchecker.availableDictionaries() # Set first run dictionary - if settings.dict is None: + if settings.dict == None: settings.dict = Spellchecker.getDefaultDictionary() # Check if project dict is unavailable on this machine @@ -1586,7 +1586,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): w.cmbPOV.setVisible(val) # POV in outline view - if val is None and Outline.POV in settings.outlineViewColumns: + if val == None and Outline.POV in settings.outlineViewColumns: settings.outlineViewColumns.remove(Outline.POV) from manuskript.ui.views.outlineView import outlineView diff --git a/manuskript/models/abstractItem.py b/manuskript/models/abstractItem.py index f3fa049..a6e6096 100644 --- a/manuskript/models/abstractItem.py +++ b/manuskript/models/abstractItem.py @@ -39,7 +39,7 @@ class abstractItem(): self._data[self.enum.title] = title self._data[self.enum.type] = _type - if xml is not None: + if xml != None: self.setFromXML(xml) if ID: diff --git a/manuskript/models/abstractModel.py b/manuskript/models/abstractModel.py index a536084..828643d 100644 --- a/manuskript/models/abstractModel.py +++ b/manuskript/models/abstractModel.py @@ -131,7 +131,7 @@ class abstractModel(QAbstractItemModel): # Check whether the parent is the root, or is otherwise invalid. # That is to say: no parent or the parent lacks a parent. if (parentItem == self.rootItem) or \ - (parentItem is None) or (parentItem.parent() is None): + (parentItem == None) or (parentItem.parent() == None): return QModelIndex() return self.createIndex(parentItem.row(), 0, parentItem) @@ -283,7 +283,7 @@ class abstractModel(QAbstractItemModel): # # Gets encoded mime data to retrieve the item items = self.decodeMimeData(data) - if items is None: + if items == None: return False # We check if parent is not a child of one of the items @@ -321,7 +321,7 @@ class abstractModel(QAbstractItemModel): return None encodedData = bytes(data.data("application/xml")).decode() root = ET.XML(encodedData) - if root is None: + if root == None: return None if root.tag != "outlineItems": @@ -381,7 +381,7 @@ class abstractModel(QAbstractItemModel): items = self.decodeMimeData(data) - if items is None: + if items == None: return False if column > 0: diff --git a/manuskript/models/characterModel.py b/manuskript/models/characterModel.py index f2bfd7a..5cd3948 100644 --- a/manuskript/models/characterModel.py +++ b/manuskript/models/characterModel.py @@ -153,7 +153,7 @@ class characterModel(QAbstractItemModel): return r def getCharacterByID(self, ID): - if ID is not None: + if ID != None: ID = str(ID) for c in self.characters: if c.ID() == ID: diff --git a/manuskript/models/references.py b/manuskript/models/references.py index 17696c8..c54e290 100644 --- a/manuskript/models/references.py +++ b/manuskript/models/references.py @@ -187,7 +187,7 @@ def infos(ref): elif _type == CharacterLetter: m = mainWindow().mdlCharacter c = m.getCharacterByID(int(_ref)) - if c is None: + if c == None: return qApp.translate("references", "Unknown reference: {}.").format(ref) index = c.index() diff --git a/manuskript/models/worldModel.py b/manuskript/models/worldModel.py index 5d883ca..eeb6d1e 100644 --- a/manuskript/models/worldModel.py +++ b/manuskript/models/worldModel.py @@ -189,7 +189,7 @@ class worldModel(QStandardItemModel): for index in indexes: item = self.itemFromIndex(index) parent = item.parent() - if parent is None: + if parent == None: parent = self.invisibleRootItem() row_indexes.append((parent, item.row())) diff --git a/manuskript/tests/conftest.py b/manuskript/tests/conftest.py index 09629e4..ff212ba 100644 --- a/manuskript/tests/conftest.py +++ b/manuskript/tests/conftest.py @@ -12,7 +12,7 @@ def MW(): """ from manuskript import functions as F MW = F.mainWindow() - assert MW is not None + assert MW != None assert MW == F.MW return MW @@ -23,7 +23,7 @@ def MWNoProject(MW): Take the MainWindow and close andy possibly open project. """ MW.closeProject() - assert MW.currentProject is None + assert MW.currentProject == None return MW @pytest.fixture @@ -35,9 +35,9 @@ def MWEmptyProject(MW): tf = tempfile.NamedTemporaryFile(suffix=".msk") MW.closeProject() - assert MW.currentProject is None + assert MW.currentProject == None MW.welcome.createFile(tf.name, overwrite=True) - assert MW.currentProject is not None + assert MW.currentProject != None return MW # If using with: @pytest.fixture(scope='session', autouse=True) @@ -67,6 +67,6 @@ def MWSampleProject(MW): shutil.copyfile(src, tf.name) shutil.copytree(src[:-4], tf.name[:-4]) MW.loadProject(tf.name) - assert MW.currentProject is not None + assert MW.currentProject != None return MW diff --git a/manuskript/tests/models/test_outlineItem.py b/manuskript/tests/models/test_outlineItem.py index cc681c0..c7fb7df 100644 --- a/manuskript/tests/models/test_outlineItem.py +++ b/manuskript/tests/models/test_outlineItem.py @@ -130,9 +130,9 @@ def test_modelStuff(outlineModelBasic): folder.setModel(k) assert folder.columnCount() == len(folder.enum) text1 = text2.copy() - assert text1.ID() is None + assert text1.ID() == None folder.appendChild(text1) - assert text1.ID() is not None + assert text1.ID() != None assert folder.childCountRecursive() == 2 assert text1.path() == "Folder > Text" assert len(text1.pathID()) == 2 diff --git a/manuskript/tests/models/test_references.py b/manuskript/tests/models/test_references.py index c49e5a5..b9fb2d0 100644 --- a/manuskript/tests/models/test_references.py +++ b/manuskript/tests/models/test_references.py @@ -39,7 +39,7 @@ def test_references(MWSampleProject): assert "\n" in Ref.infos(Ref.plotReference(plotID)) assert "Not a ref" in Ref.infos("") assert "Unknown" in Ref.infos(Ref.plotReference("999")) - assert Ref.shortInfos(Ref.plotReference(plotID)) is not None + assert Ref.shortInfos(Ref.plotReference(plotID)) != None assert Ref.shortInfos(Ref.plotReference("999")) == None assert Ref.shortInfos("") == -1 @@ -50,7 +50,7 @@ def test_references(MWSampleProject): charID = IDs[0] assert "\n" in Ref.infos(Ref.characterReference(charID)) assert "Unknown" in Ref.infos(Ref.characterReference("999")) - assert Ref.shortInfos(Ref.characterReference(charID)) is not None + assert Ref.shortInfos(Ref.characterReference(charID)) != None assert Ref.shortInfos(Ref.characterReference("999")) == None assert Ref.shortInfos("") == -1 @@ -62,7 +62,7 @@ def test_references(MWSampleProject): assert "\n" in Ref.infos(Ref.textReference(textID)) assert "Unknown" in Ref.infos(Ref.textReference("999")) - assert Ref.shortInfos(Ref.textReference(textID)) is not None + assert Ref.shortInfos(Ref.textReference(textID)) != None assert Ref.shortInfos(Ref.textReference("999")) == None assert Ref.shortInfos("") == -1 @@ -73,7 +73,7 @@ def test_references(MWSampleProject): assert "\n" in Ref.infos(Ref.worldReference(worldID)) assert "Unknown" in Ref.infos(Ref.worldReference("999")) - assert Ref.shortInfos(Ref.worldReference(worldID)) is not None + assert Ref.shortInfos(Ref.worldReference(worldID)) != None assert Ref.shortInfos(Ref.worldReference("999")) == None assert Ref.shortInfos("") == -1 @@ -84,9 +84,9 @@ def test_references(MWSampleProject): # Titles for ref in refs: - assert Ref.title(ref) is not None - assert Ref.title("") is None - assert Ref.title(Ref.plotReference("999")) is None + assert Ref.title(ref) != None + assert Ref.title("") == None + assert Ref.title(Ref.plotReference("999")) == None # Other stuff assert Ref.type(Ref.plotReference(plotID)) == Ref.PlotLetter @@ -94,10 +94,10 @@ def test_references(MWSampleProject): assert "Unknown" in Ref.tooltip(Ref.worldReference("999")) assert "Not a ref" in Ref.tooltip("") for ref in refs: - assert Ref.tooltip(ref) is not None + assert Ref.tooltip(ref) != None # Links - assert Ref.refToLink("") is None + assert Ref.refToLink("") == None assert Ref.refToLink(Ref.plotReference("999")) == Ref.plotReference("999") assert Ref.refToLink(Ref.characterReference("999")) == Ref.characterReference("999") assert Ref.refToLink(Ref.textReference("999")) == Ref.textReference("999") @@ -106,7 +106,7 @@ def test_references(MWSampleProject): assert "") is None + assert Ref.open("") == None assert Ref.open(Ref.plotReference("999")) == False assert Ref.open(Ref.characterReference("999")) == False assert Ref.open(Ref.textReference("999")) == False diff --git a/manuskript/tests/test_functions.py b/manuskript/tests/test_functions.py index fbea5ab..8fb9fa4 100644 --- a/manuskript/tests/test_functions.py +++ b/manuskript/tests/test_functions.py @@ -46,8 +46,8 @@ def test_several(): assert F.iconColor(icon).name().lower() == "#ff0000" # themeIcon - assert F.themeIcon("text") is not None - assert F.themeIcon("nonexistingname") is not None + assert F.themeIcon("text") != None + assert F.themeIcon("nonexistingname") != None # randomColor c1 = F.randomColor() @@ -75,10 +75,10 @@ def test_outlineItemColors(): def test_paths(): - assert F.appPath() is not None - assert F.writablePath is not None + assert F.appPath() != None + assert F.writablePath != None assert len(F.allPaths("suffix")) == 2 - assert F.tempFile("yop") is not None + assert F.tempFile("yop") != None f = F.findBackground("spacedreams.jpg") assert "resources/backgrounds/spacedreams.jpg" in f assert len(F.customIcons()) > 1 @@ -87,8 +87,8 @@ def test_mainWindow(): from PyQt5.QtWidgets import QWidget, QLCDNumber - assert F.mainWindow() is not None - assert F.MW is not None + assert F.mainWindow() != None + assert F.MW != None F.statusMessage("Test") F.printObjects() diff --git a/manuskript/tests/test_settingsWindow.py b/manuskript/tests/test_settingsWindow.py index 8edc6f3..71ed09f 100644 --- a/manuskript/tests/test_settingsWindow.py +++ b/manuskript/tests/test_settingsWindow.py @@ -55,7 +55,7 @@ def test_general(MWSampleProject): state = settings() assert chk.isChecked() == state chk.setChecked(not state) - assert chk.isChecked() is not state + assert chk.isChecked() != state # Loading and Saving SW.txtAutoSave.setText("0") @@ -86,7 +86,7 @@ def test_general(MWSampleProject): SW.chkOutlineTitle.setChecked(Qt.Unchecked) SW.chkOutlineTitle.setChecked(Qt.Checked) # Can't test because of the dialog - # assert SW.setCorkColor() is None + # assert SW.setCorkColor() == None SW.sldTreeIconSize.setValue(SW.sldTreeIconSize.value() + 1) SW.rdoCorkNewStyle.toggled.emit(True) SW.cmbCorkImage.currentIndexChanged.emit(0) @@ -98,7 +98,7 @@ def test_general(MWSampleProject): # Test editor switchCheckBoxAndAssert(SW.chkEditorBackgroundTransparent, lambda: S.textEditor["backgroundTransparent"]) - assert SW.restoreEditorColors() is None + assert SW.restoreEditorColors() == None switchCheckBoxAndAssert(SW.chkEditorNoBlinking, lambda: S.textEditor["cursorNotBlinking"]) # Twice on purpose: set and restore @@ -108,7 +108,7 @@ def test_general(MWSampleProject): SW.updateAllWidgets() # Labels - assert SW.updateLabelColor(MW.mdlLabels.item(1).index()) is None + assert SW.updateLabelColor(MW.mdlLabels.item(1).index()) == None rc = MW.mdlLabels.rowCount() SW.addLabel() SW.lstLabels.setCurrentIndex( @@ -150,7 +150,7 @@ def test_general(MWSampleProject): for i in range(4): SW.updateLineSpacing(i) SW.updateUIFromTheme() # No time to wait on timer - assert SW._editingTheme is not None + assert SW._editingTheme != None SW.resize(SW.geometry().size()) # resizeEvent #TODO: other edit test (see SW.loadTheme SW.saveTheme() diff --git a/manuskript/ui/collapsibleDockWidgets.py b/manuskript/ui/collapsibleDockWidgets.py index 08c7331..5d2f18a 100644 --- a/manuskript/ui/collapsibleDockWidgets.py +++ b/manuskript/ui/collapsibleDockWidgets.py @@ -96,7 +96,7 @@ class collapsibleDockWidgets(QToolBar): def setCurrentGroup(self, group): self.currentGroup = group for btn, action, widget, grp in self.otherWidgets: - if not grp == group or grp is None: + if not grp == group or grp == None: action.setVisible(False) else: action.setVisible(True) diff --git a/manuskript/ui/editors/blockUserData.py b/manuskript/ui/editors/blockUserData.py index 7f39c2c..44340f5 100644 --- a/manuskript/ui/editors/blockUserData.py +++ b/manuskript/ui/editors/blockUserData.py @@ -8,7 +8,7 @@ class blockUserData(QTextBlockUserData): def getUserData(block): """Returns userData if it exists, or a blank one.""" data = block.userData() - if data is None: + if data == None: data = blockUserData() return data diff --git a/manuskript/ui/editors/fullScreenEditor.py b/manuskript/ui/editors/fullScreenEditor.py index 712d241..b2cc75e 100644 --- a/manuskript/ui/editors/fullScreenEditor.py +++ b/manuskript/ui/editors/fullScreenEditor.py @@ -338,8 +338,8 @@ class fullScreenEditor(QWidget): item = self._index.internalPointer() previousItem = self.previousTextItem(item) nextItem = self.nextTextItem(item) - self.btnPrevious.setEnabled(previousItem is not None) - self.btnNext.setEnabled(nextItem is not None) + self.btnPrevious.setEnabled(previousItem != None) + self.btnNext.setEnabled(nextItem != None) self.wPath.setItem(item) def updateStatusBar(self): @@ -572,11 +572,11 @@ class myPanel(QWidget): def addWidgetSetting(self, label, config_name, widgets): setting = (label, config_name, widgets) self._settings.append(setting) - if settings.fullscreenSettings.get(config_name, None) is not None: + if settings.fullscreenSettings.get(config_name, None) != None: self._setSettingValue(setting, settings.fullscreenSettings[config_name]) def addSetting(self, label, config_name, default=True): - if settings.fullscreenSettings.get(config_name, None) is None: + if settings.fullscreenSettings.get(config_name, None) == None: self._setConfig(config_name, default) self.addWidgetSetting(label, config_name, None) @@ -651,7 +651,7 @@ class myPath(QWidget): if i == item: a.setIcon(QIcon.fromTheme("stock_yes")) a.setEnabled(False) - elif self.editor.firstTextItem(i) is None: + elif self.editor.firstTextItem(i) == None: a.setEnabled(False) else: a.triggered.connect(gen_cb(i)) diff --git a/manuskript/ui/editors/locker.py b/manuskript/ui/editors/locker.py index d9a648e..2a007a3 100644 --- a/manuskript/ui/editors/locker.py +++ b/manuskript/ui/editors/locker.py @@ -105,6 +105,6 @@ class locker(QWidget, Ui_locker): text)) # Word locked - elif self._target is not None: + elif self._target != None: self.btnLock.setText(self.tr("{} words remaining").format( self._target - self._words)) diff --git a/manuskript/ui/editors/mainEditor.py b/manuskript/ui/editors/mainEditor.py index 882292e..8b629aa 100644 --- a/manuskript/ui/editors/mainEditor.py +++ b/manuskript/ui/editors/mainEditor.py @@ -120,7 +120,7 @@ class mainEditor(QWidget, Ui_mainEditor): return self.tabSplitter.tab def currentEditor(self, tabWidget=None): - if tabWidget is None: + if tabWidget == None: tabWidget = self.currentTabWidget() return tabWidget.currentWidget() # return self.tab.currentWidget() @@ -153,7 +153,7 @@ class mainEditor(QWidget, Ui_mainEditor): def allTabs(self, tabWidget=None): """Returns all the tabs from the given tabWidget. If tabWidget is None, from the current tabWidget.""" - if tabWidget is None: + if tabWidget == None: tabWidget = self.currentTabWidget() return [tabWidget.widget(i) for i in range(tabWidget.count())] @@ -205,7 +205,7 @@ class mainEditor(QWidget, Ui_mainEditor): title = self.getIndexTitle(index) - if tabWidget is None: + if tabWidget == None: tabWidget = self.currentTabWidget() # Checking if tab is already opened diff --git a/manuskript/ui/editors/tabSplitter.py b/manuskript/ui/editors/tabSplitter.py index 13adfaf..0ba8750 100644 --- a/manuskript/ui/editors/tabSplitter.py +++ b/manuskript/ui/editors/tabSplitter.py @@ -145,8 +145,8 @@ class tabSplitter(QWidget, Ui_tabSplitter): def split(self, toggled=None, state=None): - if state is None and self.splitState == 0 or state == 1: - if self.secondTab is None: + if state == None and self.splitState == 0 or state == 1: + if self.secondTab == None: self.addSecondTab() self.splitState = 1 @@ -155,8 +155,8 @@ class tabSplitter(QWidget, Ui_tabSplitter): self.btnSplit.setIcon(QIcon.fromTheme("split-vertical")) self.btnSplit.setToolTip(self.tr("Split horizontally")) - elif state is None and self.splitState == 1 or state == 2: - if self.secondTab is None: + elif state == None and self.splitState == 1 or state == 2: + if self.secondTab == None: self.addSecondTab() self.splitter.setOrientation(Qt.Vertical) @@ -212,7 +212,7 @@ class tabSplitter(QWidget, Ui_tabSplitter): # self.btnSplit.setGeometry(QRect(0, 0, 24, 24)) def focusChanged(self, old, new): - if self.secondTab is None or new is None: + if self.secondTab == None or new == None: return oldFT = self.focusTab diff --git a/manuskript/ui/highlighters/markdownHighlighter.py b/manuskript/ui/highlighters/markdownHighlighter.py index 4d873b4..3a1564e 100644 --- a/manuskript/ui/highlighters/markdownHighlighter.py +++ b/manuskript/ui/highlighters/markdownHighlighter.py @@ -713,7 +713,7 @@ class MarkdownHighlighter(BasicHighlighter): # FIXME: TypeError: could not convert 'TextBlockData' to 'QTextBlockUserData' # blockData = self.currentBlockUserData() - # if blockData is None: + # if blockData == None: # blockData = TextBlockData(self.document(), self.currentBlock()) # # self.setCurrentBlockUserData(blockData) diff --git a/manuskript/ui/views/characterTreeView.py b/manuskript/ui/views/characterTreeView.py index a88bd25..ea5798c 100644 --- a/manuskript/ui/views/characterTreeView.py +++ b/manuskript/ui/views/characterTreeView.py @@ -66,7 +66,7 @@ class characterTreeView(QTreeWidget): for child in range(item.childCount()): sub = item.child(child) ID = sub.data(0, Qt.UserRole) - if ID is not None: + if ID != None: # Update name c = self._model.getCharacterByID(ID) name = c.name() @@ -124,8 +124,8 @@ class characterTreeView(QTreeWidget): curr_importance = 0 # check if an item is selected - if curr_item is not None: - if curr_item.parent() is None: + if curr_item != None: + if curr_item.parent() == None: # this is a top-level category, so find its importance # get the current text, then look up the importance level text = curr_item.text(0) diff --git a/manuskript/ui/views/lineEditView.py b/manuskript/ui/views/lineEditView.py index 0366016..b61042f 100644 --- a/manuskript/ui/views/lineEditView.py +++ b/manuskript/ui/views/lineEditView.py @@ -31,7 +31,7 @@ class lineEditView(QLineEdit): self._index = index self._model = index.model() # self.item = index.internalPointer() - if self._placeholderText is not None: + if self._placeholderText != None: self.setPlaceholderText(self._placeholderText) self.textEdited.connect(self.submit) self.updateText() diff --git a/manuskript/ui/views/textEditView.py b/manuskript/ui/views/textEditView.py index ea58ed8..d5ece2b 100644 --- a/manuskript/ui/views/textEditView.py +++ b/manuskript/ui/views/textEditView.py @@ -34,7 +34,7 @@ class textEditView(QTextEdit): self._themeData = None self._highlighterClass = BasicHighlighter - if spellcheck is None: + if spellcheck == None: spellcheck = settings.spellcheck self.spellcheck = spellcheck diff --git a/manuskript/ui/views/treeView.py b/manuskript/ui/views/treeView.py index 3fa7271..2655808 100644 --- a/manuskript/ui/views/treeView.py +++ b/manuskript/ui/views/treeView.py @@ -69,7 +69,7 @@ class treeView(QTreeView, dndView, outlineBasics): return menu def expandCurrentIndex(self, index=None): - if index is None or type(index) == bool: + if index == None or type(index) == bool: index = self._indexesToOpen[0] # self.currentIndex() self.expand(index) @@ -78,7 +78,7 @@ class treeView(QTreeView, dndView, outlineBasics): self.expandCurrentIndex(index=idx) def collapseCurrentIndex(self, index=None): - if index is None or type(index) == bool: + if index == None or type(index) == bool: index = self._indexesToOpen[0] # self.currentIndex() self.collapse(index) diff --git a/manuskript/ui/welcome.py b/manuskript/ui/welcome.py index 8055c3a..ba2ef53 100644 --- a/manuskript/ui/welcome.py +++ b/manuskript/ui/welcome.py @@ -371,7 +371,7 @@ class welcome(QWidget, Ui_welcome): Qt.FindChildrenRecursively): # Update self.template to reflect the changed name values templateIndex = t.property("templateIndex") - if templateIndex is not None : + if templateIndex != None : self.template[1][templateIndex] = ( self.template[1][templateIndex][0], t.text())