open file dialog in folder of currently open file

This commit is contained in:
2021-10-29 14:27:45 +02:00
parent 029d60fc77
commit fbd378cbf4
3 changed files with 22 additions and 6 deletions

13
tabs.py
View File

@@ -1,5 +1,5 @@
import os
from typing import Mapping
from typing import Mapping, Optional
from PyQt6.QtWidgets import *
from PyQt6.QtCore import *
@@ -13,7 +13,6 @@ from settings import Settings
class Tabs(QWidget):
tabs_by_index = {}
tabs_by_filename = {}
def __init__(self, settings: Settings):
@@ -69,3 +68,13 @@ class Tabs(QWidget):
def destruct(self):
while self.tabs.count() > 0:
self._close_tab(0)
def _current_tab(self) -> int:
return self.tabs.currentIndex()
def current_file(self) -> Optional[str]:
if self.tabs.currentIndex() < 0:
return None
full_tab: FullTabWidget = self.tabs.widget(self.tabs.currentIndex())
return full_tab.get_file()