mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 11:22:28 +12:00
Fix match and case syntax for python 3.9 and below
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
13486ad083
commit
1933d53c1c
|
@ -263,8 +263,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.actDelete,
|
||||
self.actRename]:
|
||||
i.setEnabled(tabIsEditor)
|
||||
match self.tabMain.currentIndex():
|
||||
case self.TabPersos:
|
||||
tabIndex = self.tabMain.currentIndex()
|
||||
|
||||
if tabIndex == self.TabPersos:
|
||||
selectedCharacters = self.lstCharacters.currentCharacters()
|
||||
characterSelectionIsEmpty = not any(selectedCharacters)
|
||||
|
||||
|
@ -275,13 +276,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
character = selectedCharacters[0]
|
||||
self.pushHistory(("character", character.ID()))
|
||||
self._previousSelectionEmpty = False
|
||||
|
||||
case self.TabPlots:
|
||||
elif tabIndex == self.TabPlots:
|
||||
id = self.lstPlots.currentPlotID()
|
||||
self.pushHistory(("plot", id))
|
||||
self._previousSelectionEmpty = id is None
|
||||
|
||||
case self.TabWorld:
|
||||
elif tabIndex == self.TabWorld:
|
||||
index = self.mdlWorld.selectedIndex()
|
||||
|
||||
if index.isValid():
|
||||
|
@ -291,8 +290,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
else:
|
||||
self.pushHistory(("world", None))
|
||||
self._previousSelectionEmpty = True
|
||||
|
||||
case self.TabOutline:
|
||||
elif tabIndex == self.TabOutline:
|
||||
index = self.treeOutlineOutline.selectionModel().currentIndex()
|
||||
if index.isValid():
|
||||
id = self.mdlOutline.ID(index)
|
||||
|
@ -301,8 +299,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
else:
|
||||
self.pushHistory(("outline", None))
|
||||
self._previousSelectionEmpty = False
|
||||
|
||||
case self.TabRedac:
|
||||
elif tabIndex == self.TabRedac:
|
||||
index = self.treeRedacOutline.selectionModel().currentIndex()
|
||||
if index.isValid():
|
||||
id = self.mdlOutline.ID(index)
|
||||
|
@ -311,8 +308,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
else:
|
||||
self.pushHistory(("redac", None))
|
||||
self._previousSelectionEmpty = False
|
||||
|
||||
case _:
|
||||
else:
|
||||
self.pushHistory(("main", self.tabMain.currentIndex()))
|
||||
self._previousSelectionEmpty = False
|
||||
|
||||
|
@ -841,8 +837,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
|
||||
def navigated(self, event):
|
||||
if event.entry:
|
||||
match event.entry[0]:
|
||||
case "character":
|
||||
first_entry = event.entry[0]
|
||||
|
||||
if first_entry == "character":
|
||||
if self.tabMain.currentIndex() != self.TabPersos:
|
||||
self.tabMain.setCurrentIndex(self.TabPersos)
|
||||
|
||||
|
@ -855,7 +852,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
if char != None:
|
||||
self.lstCharacters.clearSelection()
|
||||
self.lstCharacters.setCurrentItem(char)
|
||||
case "plot":
|
||||
elif first_entry == "plot":
|
||||
if self.tabMain.currentIndex() != self.TabPlots:
|
||||
self.tabMain.setCurrentIndex(self.TabPlots)
|
||||
|
||||
|
@ -867,7 +864,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
plot = self.lstPlots.getItemByID(event.entry[1])
|
||||
if plot != None:
|
||||
self.lstPlots.setCurrentItem(plot)
|
||||
case "world":
|
||||
elif first_entry == "world":
|
||||
if self.tabMain.currentIndex() != self.TabWorld:
|
||||
self.tabMain.setCurrentIndex(self.TabWorld)
|
||||
|
||||
|
@ -879,8 +876,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
world = self.mdlWorld.indexByID(event.entry[1])
|
||||
if world != None:
|
||||
self.treeWorld.setCurrentIndex(world)
|
||||
|
||||
case "outline":
|
||||
elif first_entry == "outline":
|
||||
if self.tabMain.currentIndex() != self.TabOutline:
|
||||
self.tabMain.setCurrentIndex(self.TabOutline)
|
||||
|
||||
|
@ -892,8 +888,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
outline = self.mdlOutline.getIndexByID(event.entry[1])
|
||||
if outline is not None:
|
||||
self.treeOutlineOutline.setCurrentIndex(outline)
|
||||
|
||||
case "redac":
|
||||
elif first_entry == "redac":
|
||||
if self.tabMain.currentIndex() != self.TabRedac:
|
||||
self.tabMain.setCurrentIndex(self.TabRedac)
|
||||
|
||||
|
@ -905,8 +900,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
outline = self.mdlOutline.getIndexByID(event.entry[1])
|
||||
if outline is not None:
|
||||
self.treeRedacOutline.setCurrentIndex(outline)
|
||||
|
||||
case "main":
|
||||
elif first_entry == "main":
|
||||
if self.tabMain.currentIndex() != event.entry[1]:
|
||||
self.lstTabs.setCurrentRow(event.entry[1])
|
||||
|
||||
|
|
Loading…
Reference in a new issue